@smartmemory/compose 0.1.44-beta → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/bin/compose.js +71 -35
  2. package/dist/assets/App-VU2lfA8m.js +770 -0
  3. package/dist/assets/{arc-N74_SuiS.js → arc-CIeqpX37.js} +1 -1
  4. package/dist/assets/{architectureDiagram-3BPJPVTR-DHOb5xas.js → architectureDiagram-3BPJPVTR-itmOSZLE.js} +1 -1
  5. package/dist/assets/{blockDiagram-GPEHLZMM-DR9b_xXC.js → blockDiagram-GPEHLZMM-N7MotI_5.js} +8 -8
  6. package/dist/assets/{c4Diagram-AAUBKEIU-EXIx4J1v.js → c4Diagram-AAUBKEIU-DRKW39LH.js} +1 -1
  7. package/dist/assets/channel-DugSMLKi.js +1 -0
  8. package/dist/assets/{chunk-2J33WTMH-CyZqa6ub.js → chunk-2J33WTMH-CF6iSwEb.js} +1 -1
  9. package/dist/assets/{chunk-4BX2VUAB-SjPmvNaj.js → chunk-4BX2VUAB-BTe-QE0R.js} +1 -1
  10. package/dist/assets/{chunk-55IACEB6-Cnu3mdms.js → chunk-55IACEB6-E2hHEsl9.js} +1 -1
  11. package/dist/assets/{chunk-727SXJPM-DNj5i6fj.js → chunk-727SXJPM-CBRmkSvh.js} +1 -1
  12. package/dist/assets/{chunk-AQP2D5EJ-BIVskOlI.js → chunk-AQP2D5EJ-BdtQ63fN.js} +1 -1
  13. package/dist/assets/{chunk-FMBD7UC4-BWlLU-hh.js → chunk-FMBD7UC4-DfYQ2YmB.js} +1 -1
  14. package/dist/assets/{chunk-ND2GUHAM-DQEknadH.js → chunk-ND2GUHAM-CDrOVOW5.js} +1 -1
  15. package/dist/assets/{chunk-QZHKN3VN-CUYnhnAB.js → chunk-QZHKN3VN-DwjqJ9xB.js} +1 -1
  16. package/dist/assets/classDiagram-4FO5ZUOK-D2RRwp7J.js +1 -0
  17. package/dist/assets/classDiagram-v2-Q7XG4LA2-D2RRwp7J.js +1 -0
  18. package/dist/assets/{cose-bilkent-S5V4N54A-X3n23b12.js → cose-bilkent-S5V4N54A-MHpsrtBZ.js} +1 -1
  19. package/dist/assets/{dagre-BM42HDAG-C0SrhQ_X.js → dagre-BM42HDAG-DaPz_mPt.js} +1 -1
  20. package/dist/assets/{diagram-2AECGRRQ-Bc3qx6pJ.js → diagram-2AECGRRQ-DIdstuOm.js} +1 -1
  21. package/dist/assets/{diagram-5GNKFQAL-UiCrD06F.js → diagram-5GNKFQAL-DbkTGVES.js} +1 -1
  22. package/dist/assets/{diagram-KO2AKTUF-B9Vn5KyO.js → diagram-KO2AKTUF-BPalYJed.js} +1 -1
  23. package/dist/assets/{diagram-LMA3HP47-DLOYeLM3.js → diagram-LMA3HP47-vnySSoyd.js} +1 -1
  24. package/dist/assets/{diagram-OG6HWLK6-CXjh2miZ.js → diagram-OG6HWLK6-Dv3BUJft.js} +1 -1
  25. package/dist/assets/{erDiagram-TEJ5UH35-EmDzXNsM.js → erDiagram-TEJ5UH35-B3OLgtKK.js} +1 -1
  26. package/dist/assets/{flowDiagram-I6XJVG4X-vk6E_ebo.js → flowDiagram-I6XJVG4X-DdpxVf-5.js} +1 -1
  27. package/dist/assets/{ganttDiagram-6RSMTGT7-DYYSAjNx.js → ganttDiagram-6RSMTGT7-QALT_Lj9.js} +4 -4
  28. package/dist/assets/{gitGraphDiagram-PVQCEYII-CWPZVbhV.js → gitGraphDiagram-PVQCEYII-nITcPPED.js} +1 -1
  29. package/dist/assets/{graph-uO5hwVZK.js → graph-DnLKqSPg.js} +2 -2
  30. package/dist/assets/{index-BYYTTzUT.js → index-CLb8RFcn.js} +3 -3
  31. package/dist/assets/index-jqUffYBL.css +1 -0
  32. package/dist/assets/{infoDiagram-5YYISTIA-Dsu-eeJm.js → infoDiagram-5YYISTIA-CjlRce3x.js} +1 -1
  33. package/dist/assets/{ishikawaDiagram-YF4QCWOH-BP1SP8WA.js → ishikawaDiagram-YF4QCWOH-OyKVgxOz.js} +1 -1
  34. package/dist/assets/{journeyDiagram-JHISSGLW-DkE5By_R.js → journeyDiagram-JHISSGLW-3FaFyfLR.js} +1 -1
  35. package/dist/assets/{kanban-definition-UN3LZRKU-Cf_230xs.js → kanban-definition-UN3LZRKU-DUPnRo3q.js} +1 -1
  36. package/dist/assets/{linear-B-paxRBQ.js → linear-BeL8i3rv.js} +1 -1
  37. package/dist/assets/{mindmap-definition-RKZ34NQL-DAp6uJ_b.js → mindmap-definition-RKZ34NQL-C0CwWNdR.js} +1 -1
  38. package/dist/assets/mobile-qvdJ5p0m.js +17 -0
  39. package/dist/assets/{pieDiagram-4H26LBE5-CbYY5KL0.js → pieDiagram-4H26LBE5-DaU2jPjX.js} +1 -1
  40. package/dist/assets/{quadrantDiagram-W4KKPZXB-D5S4_ac5.js → quadrantDiagram-W4KKPZXB-HFtjZSAT.js} +1 -1
  41. package/dist/assets/{requirementDiagram-4Y6WPE33-BrPWCnHz.js → requirementDiagram-4Y6WPE33-CX_Mz3gv.js} +1 -1
  42. package/dist/assets/{sankeyDiagram-5OEKKPKP-CP8j1mcl.js → sankeyDiagram-5OEKKPKP-BR2_eTy9.js} +1 -1
  43. package/dist/assets/{sequenceDiagram-3UESZ5HK-c8DuhvUj.js → sequenceDiagram-3UESZ5HK-CtHp0Qnp.js} +1 -1
  44. package/dist/assets/{stateDiagram-AJRCARHV-KO9G1Jrm.js → stateDiagram-AJRCARHV-DmiEmD6G.js} +1 -1
  45. package/dist/assets/stateDiagram-v2-BHNVJYJU-7rdO1Tgp.js +1 -0
  46. package/dist/assets/{timeline-definition-PNZ67QCA-Cs2HLlbG.js → timeline-definition-PNZ67QCA-GSHqrJ3A.js} +1 -1
  47. package/dist/assets/{vennDiagram-CIIHVFJN-rcSRidqI.js → vennDiagram-CIIHVFJN-CNxhQnCU.js} +1 -1
  48. package/dist/assets/{wardley-L42UT6IY-BsajGfii.js → wardley-L42UT6IY-Bf-gQIFY.js} +1 -1
  49. package/dist/assets/{wardleyDiagram-YWT4CUSO-CSWALc_m.js → wardleyDiagram-YWT4CUSO-RGxoapr7.js} +1 -1
  50. package/dist/assets/{xychartDiagram-2RQKCTM6-jC4Q0GvG.js → xychartDiagram-2RQKCTM6-1_H1qVde.js} +1 -1
  51. package/dist/index.html +3 -3
  52. package/lib/build.js +3 -2
  53. package/lib/feature-code.js +14 -4
  54. package/lib/feature-json.js +33 -2
  55. package/lib/feature-validator.js +135 -11
  56. package/lib/feature-writer.js +83 -3
  57. package/lib/migrate-roadmap.js +16 -2
  58. package/lib/project-paths.js +16 -0
  59. package/lib/roadmap-config.js +50 -0
  60. package/lib/roadmap-gen.js +46 -31
  61. package/lib/roadmap-heading.js +85 -0
  62. package/lib/roadmap-parser.js +69 -18
  63. package/lib/roadmap-preservers.js +60 -19
  64. package/lib/roadmap-roundtrip.js +137 -0
  65. package/lib/vision-writer.js +42 -14
  66. package/lib/xref-sync.js +160 -0
  67. package/package.json +1 -1
  68. package/server/compose-mcp.js +2 -1
  69. package/server/vision-store.js +1 -1
  70. package/dist/assets/App-CdP799CF.js +0 -768
  71. package/dist/assets/channel-yPY0IE15.js +0 -1
  72. package/dist/assets/classDiagram-4FO5ZUOK-SGKYXTP4.js +0 -1
  73. package/dist/assets/classDiagram-v2-Q7XG4LA2-SGKYXTP4.js +0 -1
  74. package/dist/assets/index-Dh2rRpBR.css +0 -1
  75. package/dist/assets/mobile-BwduHUEq.js +0 -17
  76. package/dist/assets/stateDiagram-v2-BHNVJYJU-eVyb8_R4.js +0 -1
@@ -0,0 +1,770 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-BM42HDAG-DaPz_mPt.js","assets/graph-BEmEBUp_.js","assets/layout-Bw0msyOw.js","assets/mobile-qvdJ5p0m.js","assets/mobile-5PV1E6OC.css","assets/index-CLb8RFcn.js","assets/index-jqUffYBL.css","assets/graph-DnLKqSPg.js","assets/cose-bilkent-S5V4N54A-MHpsrtBZ.js","assets/c4Diagram-AAUBKEIU-DRKW39LH.js","assets/chunk-ND2GUHAM-CDrOVOW5.js","assets/flowDiagram-I6XJVG4X-DdpxVf-5.js","assets/chunk-FMBD7UC4-DfYQ2YmB.js","assets/chunk-55IACEB6-E2hHEsl9.js","assets/chunk-2J33WTMH-CF6iSwEb.js","assets/channel-DugSMLKi.js","assets/erDiagram-TEJ5UH35-B3OLgtKK.js","assets/gitGraphDiagram-PVQCEYII-nITcPPED.js","assets/chunk-4BX2VUAB-BTe-QE0R.js","assets/chunk-QZHKN3VN-DwjqJ9xB.js","assets/wardley-L42UT6IY-Bf-gQIFY.js","assets/ganttDiagram-6RSMTGT7-QALT_Lj9.js","assets/linear-BeL8i3rv.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-CrowFXzY.js","assets/infoDiagram-5YYISTIA-CjlRce3x.js","assets/pieDiagram-4H26LBE5-DaU2jPjX.js","assets/arc-CIeqpX37.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-W4KKPZXB-HFtjZSAT.js","assets/xychartDiagram-2RQKCTM6-1_H1qVde.js","assets/requirementDiagram-4Y6WPE33-CX_Mz3gv.js","assets/sequenceDiagram-3UESZ5HK-CtHp0Qnp.js","assets/classDiagram-4FO5ZUOK-D2RRwp7J.js","assets/chunk-727SXJPM-CBRmkSvh.js","assets/classDiagram-v2-Q7XG4LA2-D2RRwp7J.js","assets/stateDiagram-AJRCARHV-DmiEmD6G.js","assets/chunk-AQP2D5EJ-BdtQ63fN.js","assets/stateDiagram-v2-BHNVJYJU-7rdO1Tgp.js","assets/journeyDiagram-JHISSGLW-3FaFyfLR.js","assets/timeline-definition-PNZ67QCA-GSHqrJ3A.js","assets/mindmap-definition-RKZ34NQL-C0CwWNdR.js","assets/kanban-definition-UN3LZRKU-DUPnRo3q.js","assets/sankeyDiagram-5OEKKPKP-BR2_eTy9.js","assets/diagram-LMA3HP47-vnySSoyd.js","assets/diagram-2AECGRRQ-DIdstuOm.js","assets/blockDiagram-GPEHLZMM-N7MotI_5.js","assets/diagram-5GNKFQAL-DbkTGVES.js","assets/architectureDiagram-3BPJPVTR-itmOSZLE.js","assets/diagram-KO2AKTUF-BPalYJed.js","assets/ishikawaDiagram-YF4QCWOH-OyKVgxOz.js","assets/vennDiagram-CIIHVFJN-CNxhQnCU.js","assets/diagram-OG6HWLK6-Dv3BUJft.js","assets/wardleyDiagram-YWT4CUSO-RGxoapr7.js"])))=>i.map(i=>d[i]);
2
+ var f_=Object.defineProperty;var p_=(t,e,r)=>e in t?f_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ie=(t,e,r)=>p_(t,typeof e!="symbol"?e+"":e,r);import{r as C,j as h,R as Yt,b as m_,g as Ac,f as zt,d as g_,a as af,w as us}from"./mobile-qvdJ5p0m.js";import{r as x_,_ as Jt,u as y_}from"./index-CLb8RFcn.js";import{a as ma,b as ly,f as b_}from"./graph-DnLKqSPg.js";const gr={feature:"#3b82f6",bug:"#ef4444",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},Vn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b"},C_=["planned","ready","in_progress","review","complete","blocked","parked","killed"],cy=["vision","specification","planning","implementation","verification","release"],Fl={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},lf=["Untested","Low","Moderate","High","Crystallized"],Te={explore_design:"Design",prd:"PRD",architecture:"Architecture",blueprint:"Blueprint",verification:"Verification",plan:"Plan",execute:"Execute",report:"Report",docs:"Docs",ship:"Ship",complete:"Complete",killed:"Killed"},hy={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},uy=["claude","codex","gemini","human","unassigned"],Qp={building:"bg-blue-500/10 text-blue-400",debugging:"bg-rose-500/10 text-rose-400",testing:"bg-amber-500/10 text-amber-400",exploring:"bg-purple-500/10 text-purple-400",thinking:"bg-cyan-500/10 text-cyan-400",reviewing:"bg-emerald-500/10 text-emerald-400"},bh=[{id:"explore_design",name:"Explore Design",agent:"claude",phase:"design",hasGate:!1},{id:"design_review",name:"Design Review",agent:"codex",phase:"design",hasGate:!1},{id:"design_gate",name:"Design Gate",agent:"human",phase:"design",hasGate:!0},{id:"prd",name:"PRD",agent:"claude",phase:"design",hasGate:!1},{id:"prd_review",name:"PRD Review",agent:"codex",phase:"design",hasGate:!1},{id:"prd_gate",name:"PRD Gate",agent:"human",phase:"design",hasGate:!0},{id:"architecture",name:"Architecture",agent:"claude",phase:"design",hasGate:!1},{id:"architecture_review",name:"Arch Review",agent:"codex",phase:"design",hasGate:!1},{id:"architecture_gate",name:"Arch Gate",agent:"human",phase:"design",hasGate:!0},{id:"blueprint",name:"Blueprint",agent:"claude",phase:"blueprint",hasGate:!1},{id:"verification",name:"Verification",agent:"claude",phase:"blueprint",hasGate:!1},{id:"blueprint_review",name:"BP Review",agent:"codex",phase:"blueprint",hasGate:!1},{id:"plan",name:"Plan",agent:"claude",phase:"implementation",hasGate:!1},{id:"plan_review",name:"Plan Review",agent:"codex",phase:"implementation",hasGate:!1},{id:"plan_gate",name:"Plan Gate",agent:"human",phase:"implementation",hasGate:!0},{id:"execute",name:"Execute",agent:"claude",phase:"implementation",hasGate:!1},{id:"review",name:"Review Loop",agent:"codex",phase:"implementation",hasGate:!1},{id:"coverage",name:"Coverage Sweep",agent:"claude",phase:"implementation",hasGate:!1},{id:"report",name:"Report",agent:"claude",phase:"ship",hasGate:!1},{id:"report_review",name:"Report Review",agent:"codex",phase:"ship",hasGate:!1},{id:"report_gate",name:"Report Gate",agent:"human",phase:"ship",hasGate:!0},{id:"docs",name:"Docs",agent:"claude",phase:"ship",hasGate:!1},{id:"ship",name:"Ship",agent:"claude",phase:"ship",hasGate:!1},{id:"ship_gate",name:"Ship Gate",agent:"human",phase:"ship",hasGate:!0}],wn={design_gate:"Review Design",prd_gate:"Review PRD",architecture_gate:"Review Architecture",plan_gate:"Review Plan",report_gate:"Review Report",ship_gate:"Approve for Ship"};function Jo(t,e){const r=wn[t.stepId]??(t.fromPhase&&t.toPhase?`${Te[t.fromPhase]??t.fromPhase} → ${Te[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const Jp={design:{label:"Phase 1: Design",color:"border-blue-500/30 bg-blue-500/5"},blueprint:{label:"Phase 2: Blueprint",color:"border-violet-500/30 bg-violet-500/5"},implementation:{label:"Phase 3: Implement",color:"border-amber-500/30 bg-amber-500/5"},ship:{label:"Phase 4: Ship",color:"border-emerald-500/30 bg-emerald-500/5"}},k_={reading:"hsl(210 70% 60%)",writing:"hsl(142 60% 50%)",executing:"hsl(38 90% 60%)",searching:"hsl(270 60% 65%)",fetching:"hsl(190 70% 55%)",delegating:"hsl(330 60% 65%)",thinking:"hsl(240 30% 70%)"},tm={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},v_={development:"border-blue-500/30 bg-blue-500/5 text-blue-400",quality:"border-emerald-500/30 bg-emerald-500/5 text-emerald-400",maintenance:"border-amber-500/30 bg-amber-500/5 text-amber-400",documentation:"border-violet-500/30 bg-violet-500/5 text-violet-400",exploration:"border-cyan-500/30 bg-cyan-500/5 text-cyan-400"},w_={explore_design:{bg:"bg-blue-500/5",border:"border-blue-500/40",text:"text-blue-300"},prd:{bg:"bg-purple-500/5",border:"border-purple-500/40",text:"text-purple-300"},architecture:{bg:"bg-cyan-500/5",border:"border-cyan-500/40",text:"text-cyan-300"},blueprint:{bg:"bg-violet-500/5",border:"border-violet-500/40",text:"text-violet-300"},plan:{bg:"bg-amber-500/5",border:"border-amber-500/40",text:"text-amber-300"},report:{bg:"bg-emerald-500/5",border:"border-emerald-500/40",text:"text-emerald-300"},ship:{bg:"bg-green-500/5",border:"border-green-500/40",text:"text-green-300"}},S_={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},em=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],T_={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},__={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},E_={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},rm={reading:"var(--color-category-reading)",writing:"var(--color-category-writing)",executing:"var(--color-category-executing)",searching:"var(--color-category-searching)",fetching:"var(--color-category-fetching)",delegating:"var(--color-category-delegating)",thinking:"hsl(var(--muted-foreground))"},dy={branch:{label:"Branch",icon:"⑂",color:"text-purple-400"},phase_transition:{label:"Phase",icon:"→",color:"text-blue-400"},iteration:{label:"Iteration",icon:"↻",color:"text-cyan-400"},gate:{label:"Gate",icon:"◈",color:"text-amber-400"},drift_threshold:{label:"Drift",icon:"⚠",color:"text-rose-400"}};function N_(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function j_(t){return`violations (${Array.isArray(t)?t.length:0})`}function L_(t){return t?"▾":"▸"}function B_({violations:t=[],expanded:e,onToggle:r}){const[n,i]=C.useState(!1),s=e!==void 0,o=s?e:n,a=N_(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const c=L_(o),u=j_(t);return h.jsxs("div",{style:{background:"hsl(38 90% 50% / 0.06)",borderLeft:"2px solid hsl(38 90% 50% / 0.3)",borderRadius:"3px",marginTop:"4px"},children:[h.jsxs("div",{onClick:l,style:{display:"flex",alignItems:"center",gap:"4px",padding:"3px 8px",cursor:"pointer",color:"hsl(38 90% 70%)",fontSize:"10px",fontFamily:"monospace",userSelect:"none"},children:[h.jsx("span",{style:{opacity:.7},children:c}),h.jsx("span",{children:u})]}),a==="expanded"&&h.jsx("ul",{style:{listStyle:"none",margin:0,padding:"0 8px 6px 16px"},children:t.map((d,p)=>h.jsx("li",{style:{color:"hsl(38 50% 60%)",fontSize:"10px",fontFamily:"monospace",lineHeight:"1.5"},children:d},p))})]})}function A_({msg:t,mode:e="stream"}){const[r,n]=C.useState(!1),i=t.retries??0,s=t.violations??[],o=s.length>0;return e==="strip"?i===0?null:h.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:i}):h.jsxs("div",{className:"text-[10px] py-0.5",children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsxs("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.7},children:["step complete -- ",t.stepId]}),i>0&&h.jsxs("span",{onClick:()=>n(a=>!a),style:{background:"hsl(38 90% 50% / 0.15)",color:"hsl(38 90% 60%)",padding:"1px 6px",borderRadius:"9999px",fontSize:"10px",cursor:"pointer"},children:[i," ",i===1?"retry":"retries"]}),o?h.jsxs("span",{onClick:()=>n(a=>!a),style:{color:"hsl(38 90% 60%)",fontSize:"10px",cursor:"pointer"},children:[s.length," ",s.length===1?"violation":"violations"]}):h.jsx("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.4,fontSize:"10px"},children:"✓ checks passed"})]}),r&&o&&h.jsx(B_,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const M_=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,nm=20;function I_({summary:t,output:e}){const[r,n]=C.useState(!1),[i,s]=C.useState(!1),o=e?M_.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
3
+ `):[],c=l.length>nm,u=r&&!i&&c?l.slice(0,nm):l,d=o?"hsl(var(--destructive, 0 84% 60%))":"hsl(215 20% 20%)";return a?h.jsxs("div",{style:{marginLeft:8,borderLeft:`1px solid ${d}`,paddingLeft:8,marginTop:2},children:[h.jsxs("div",{onClick:()=>n(p=>!p),style:{opacity:.6,fontSize:"10px",cursor:"pointer",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace",userSelect:"none",display:"flex",alignItems:"center",gap:4},children:[h.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),t]}),r&&h.jsxs("pre",{style:{margin:"4px 0 0 0",padding:0,fontSize:"10px",fontFamily:"ui-monospace, monospace",color:o?"hsl(var(--destructive, 0 84% 60%))":"hsl(var(--muted-foreground))",opacity:o?.9:.7,whiteSpace:"pre-wrap",wordBreak:"break-word",lineHeight:1.5},children:[u.join(`
4
+ `),!i&&c&&h.jsxs(h.Fragment,{children:[`
5
+ `,h.jsxs("span",{onClick:p=>{p.stopPropagation(),s(!0)},style:{color:"hsl(var(--accent))",cursor:"pointer",textDecoration:"underline",fontSize:"10px"},children:["Show all (",l.length," lines)"]})]})]})]}):h.jsx("div",{style:{marginLeft:8,opacity:.6,fontSize:"10px",padding:"2px 0",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:t})}const F_={Read:"reading",Glob:"searching",Grep:"searching",Write:"writing",Edit:"writing",NotebookEdit:"writing",Bash:"executing",Task:"delegating",Skill:"delegating",WebFetch:"fetching",WebSearch:"searching",TodoRead:"reading",TodoWrite:"writing"};function P_(t){return k_[F_[t]||"thinking"]}function D_(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function O_(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function R_({input:t}){const[e,r]=C.useState(!1);if(!t||Object.keys(t).length===0)return null;const n=Object.keys(t)[0],i=String(t[n]??""),s=i.length>60?i.slice(0,57)+"…":i;return h.jsxs("div",{className:"mt-1",children:[h.jsxs("button",{onClick:()=>r(o=>!o),className:"text-[10px] font-mono flex items-center gap-1",style:{color:"hsl(var(--muted-foreground))",background:"none",border:"none",cursor:"pointer",padding:0},children:[h.jsx("span",{style:{opacity:.6},children:e?"▾":"▸"}),!e&&h.jsxs("span",{style:{opacity:.6},children:[n,": ",s]}),e&&h.jsx("span",{style:{opacity:.6},children:"collapse"})]}),e&&h.jsx("pre",{className:"mt-1 text-[10px] font-mono rounded p-2 overflow-x-auto",style:{background:"hsl(var(--muted) / 0.4)",color:"hsl(var(--muted-foreground))",maxHeight:"200px",overflowY:"auto"},children:JSON.stringify(t,null,2)})]})}function $_({block:t}){const e=P_(t.name);return h.jsxs("div",{className:"rounded px-2 py-1.5 my-1",style:{background:"hsl(var(--muted) / 0.3)",borderLeft:`2px solid ${e}`},children:[h.jsx("div",{className:"flex items-center gap-1.5",children:h.jsx("span",{className:"text-[11px] font-semibold font-mono",style:{color:e},children:t.name})}),h.jsx(R_,{input:t.input})]})}function z_({msg:t}){var r;const e=((r=t.message)==null?void 0:r.content)??[];return h.jsx("div",{className:"flex flex-col gap-1 py-1",children:e.map((n,i)=>{if(n.type==="text")return h.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",style:{color:"hsl(var(--foreground))"},children:n.text},i);if(n.type==="tool_use"){const s=!e.slice(i+1).some(o=>o.type==="tool_use");return h.jsxs(Yt.Fragment,{children:[h.jsx($_,{block:n}),s&&t._toolResult&&h.jsx(I_,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function W_({msg:t}){const e=t.subtype!=="success",r=e?"hsl(var(--destructive))":"hsl(var(--success, 142 60% 50%))";return h.jsxs("div",{className:"rounded px-3 py-2 text-xs font-mono flex items-center gap-3 flex-wrap",style:{background:"hsl(var(--muted) / 0.4)",borderLeft:`2px solid ${r}`,color:r},children:[h.jsx("span",{children:e?"✗ error":"✓ done"}),!e&&t.num_turns!=null&&h.jsxs("span",{style:{color:"hsl(var(--muted-foreground))"},children:[t.num_turns," turn",t.num_turns!==1?"s":""]}),t.duration_ms!=null&&h.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:D_(t.duration_ms)}),t.total_cost_usd!=null&&h.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:O_(t.total_cost_usd)}),e&&t.errors&&h.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function q_({msg:t}){var r,n,i,s;const e=typeof((r=t.message)==null?void 0:r.content)=="string"?t.message.content:((s=(i=(n=t.message)==null?void 0:n.content)==null?void 0:i[0])==null?void 0:s.text)??"";return!e||t.isSynthetic?null:h.jsx("div",{className:"flex justify-end py-1",children:h.jsx("div",{className:"rounded-lg px-3 py-2 text-sm max-w-[80%] whitespace-pre-wrap",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--accent) / 0.3)"},children:e})})}function H_({msg:t}){var e,r;if(t.type==="stream_event"||!t.verbose&&t.type==="tool_progress"||!t.verbose&&t.type==="tool_use_summary")return null;if(t.verbose){const n=t.type==="tool_progress"?`${t.tool||"tool"} · ${t.elapsed!=null?t.elapsed+"s":""}`:t.summary||"summary",i=t.type==="tool_progress"?"progress":"summary";return h.jsxs("div",{style:{opacity:.6,fontSize:"10px",padding:"2px 0",paddingLeft:4,borderLeft:"1px solid hsl(215 20% 20%)",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:[h.jsx("span",{style:{color:"hsl(210 40% 45%)",background:"hsl(210 40% 45% / 0.1)",padding:"0 4px",borderRadius:2,fontSize:"10px"},children:i})," ",n]})}if(t.type==="system"&&t.subtype==="init")return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-3 flex-wrap",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:[h.jsxs("span",{children:["session ",(e=t.session_id)==null?void 0:e.slice(0,8)]}),h.jsx("span",{children:t.model}),h.jsx("span",{children:t.permissionMode})]});if(t.type==="system"&&t.subtype==="connected")return h.jsxs("div",{className:"text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))",opacity:.5},children:["reconnected · session ",(r=t.sessionId)==null?void 0:r.slice(0,8)]});if(t.type==="system"&&(t.subtype==="build_start"||t.subtype==="build_resume")){const n=t.subtype==="build_resume"?"build resumed":"build started";return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:"hsl(var(--accent))",opacity:.8},children:[n," -- ",t.featureCode]})}if(t.type==="system"&&t.subtype==="build_step")return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-2",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsxs("span",{children:["step ",t.stepNum,"/",t.totalSteps]}),h.jsx("span",{className:"font-mono",children:t.stepId}),h.jsx("span",{style:{opacity:.5},children:t.agent})]});if(t.type==="system"&&t.subtype==="build_step_done")return h.jsx(A_,{msg:t,mode:"stream"});if(t.type==="system"&&t.subtype==="build_gate")return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:"hsl(38 90% 60%)"},children:["gate -- ",t.stepId]});if(t.type==="system"&&t.subtype==="build_gate_resolved"){const n=t.outcome==="approved"||t.outcome==="approve"?"hsl(var(--success, 142 60% 50%))":t.outcome==="revise"?"hsl(38 90% 60%)":"hsl(var(--destructive))";return h.jsxs("div",{className:"text-[10px] py-0.5",style:{color:n,opacity:.8},children:["gate ",t.outcome," -- ",t.stepId]})}if(t.type==="system"&&t.subtype==="build_end"){const n=t.status==="complete"?"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))";return h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:n},children:["build ",t.status," -- ",t.featureCode]})}return t.type==="assistant"?h.jsx(z_,{msg:t}):t.type==="user"?h.jsx(q_,{msg:t}):t.type==="result"?h.jsx(W_,{msg:t}):t.type==="error"?h.jsx("div",{className:"text-xs rounded px-2 py-1.5 font-mono",style:{background:"hsl(var(--destructive) / 0.1)",color:"hsl(var(--destructive))",borderLeft:"2px solid hsl(var(--destructive))"},children:t.message}):null}function U_({onSend:t,disabled:e=!1,placeholder:r="Message Claude…"}){const n=C.useRef(null);C.useEffect(()=>{!e&&n.current&&n.current.focus()},[e]);function i(){const a=n.current;a&&(a.style.height="auto",a.style.height=`${Math.min(a.scrollHeight,160)}px`)}function s(a){a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())}function o(){const a=n.current;if(!a)return;const l=a.value.trim();l&&(t(l),a.value="",i())}return h.jsxs("div",{className:"flex items-end gap-2 px-3 py-2",style:{borderTop:"1px solid hsl(var(--border))"},children:[h.jsx("textarea",{ref:n,rows:1,disabled:e,placeholder:r,onKeyDown:s,onInput:i,className:"flex-1 resize-none bg-transparent text-sm outline-none font-mono leading-relaxed",style:{color:"hsl(var(--foreground))",caretColor:"hsl(var(--accent))",maxHeight:"160px",overflowY:"auto",opacity:e?.4:1,transition:"opacity 0.15s"}}),h.jsx("button",{onClick:o,disabled:e,title:"Send (Enter)",className:"shrink-0 rounded px-2 py-1 text-xs font-mono",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))",border:"1px solid hsl(var(--accent) / 0.3)",cursor:e?"not-allowed":"pointer",opacity:e?.4:1,transition:"opacity 0.15s"},children:"↵"})]})}const fy="compose:verboseStream",Pl={verboseStream:!1};function py(){return Pl.verboseStream}function G_(t,e){Pl.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(fy,String(Pl.verboseStream))}catch{}}function V_(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(fy);r!==null&&(Pl.verboseStream=r==="true")}catch{}}function Y_(t,e){return t.type==="stream_event"?{include:!1,msg:t}:t.type==="tool_progress"||t.type==="tool_use_summary"?e?{include:!0,msg:{...t,verbose:!0}}:{include:!1,msg:t}:{include:!0,msg:t}}function X_(t){var r,n;const e=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i+1],a=s.type==="assistant"&&((n=(r=s.message)==null?void 0:r.content)==null?void 0:n.some(c=>c.type==="tool_use")),l=o&&(o.type==="tool_use_summary"||o.type==="assistant"&&o.subtype==="tool_use_summary");a&&l?(e.push({...s,_toolResult:o}),i++):e.push(s)}return e}const my=parseInt("4002",10),K_="compose-agent-session",im=500,Z_=8,Q_=2e3,gy=3e4,sm={Read:"reading",Glob:"searching",Grep:"searching",Write:"writing",Edit:"writing",NotebookEdit:"writing",Bash:"executing",Task:"delegating",Skill:"delegating",WebFetch:"fetching",WebSearch:"searching",TodoRead:"reading",TodoWrite:"writing"},J_={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};V_();const Z={es:null,connected:!1,connecting:!1,reconnectTimer:null,reconnectAttempts:0,sessionId:null,messages:[],agentStatus:"idle",agentTool:null,agentCategory:null,currentActivity:null,activityLog:[],_idleTimer:null,sourceStatus:{build:null,interactive:null},parallelTasks:null,streamError:null,retryInfo:null,stalled:!1,onConnectedChange:null,onMessagesChange:null,onAgentStatusChange:null,onStreamErrorChange:null};function tE(t){var e,r;if(t._source==="build"){if(t.type==="system"){if(t.subtype==="build_step"||t.subtype==="build_step_done"||t.subtype==="build_gate_resolved")return{status:"working",tool:null,category:"thinking",_source:"build"};if(t.subtype==="build_gate")return{status:"working",tool:null,category:"waiting",_source:"build"};if(t.subtype==="build_end")return{status:"idle",tool:null,category:null,_source:"build"}}if(t.type==="error"&&t.source==="build")return{status:"working",tool:null,category:"thinking",_source:"build"};if(t.type==="assistant"){const n=((e=t.message)==null?void 0:e.content)??[];for(const i of n)if(i.type==="tool_use"){const s=sm[i.name]||"thinking";return{status:"working",tool:i.name,category:s,_source:"build"}}if(n.some(i=>i.type==="text"))return{status:"working",tool:null,category:"thinking",_source:"build"}}return null}if(t.type==="assistant"){const n=((r=t.message)==null?void 0:r.content)??[];for(const i of n)if(i.type==="tool_use"){const s=sm[i.name]||"thinking";return{status:"working",tool:i.name,category:s}}if(n.some(i=>i.type==="text"))return{status:"working",tool:null,category:"thinking"}}return t.type==="result"?{status:"idle",tool:null,category:null}:null}function Ch(t,e,r){const n=Date.now(),i=Z.agentStatus,s=Z.agentTool;if(Z._idleTimer&&(clearTimeout(Z._idleTimer),Z._idleTimer=null),i==="working"&&(t==="idle"||e!==s)){const a=Z.currentActivity;a&&(a.endTime=n,a.duration=n-a.startTime,Z.activityLog.push(a),Z.activityLog.length>Z_&&Z.activityLog.shift())}t==="working"&&e!==s?Z.currentActivity={tool:e,category:r,startTime:n,endTime:null,duration:null}:t==="idle"&&(Z.currentActivity=null),Z.agentStatus=t,Z.agentTool=e,Z.agentCategory=r;const o={status:t,tool:e,category:r,activityLog:Z.activityLog,currentActivity:Z.currentActivity,parallelTasks:Z.parallelTasks};Z.onAgentStatusChange&&Z.onAgentStatusChange({...o}),window.dispatchEvent(new CustomEvent("compose:agent-status",{detail:o}))}function om(){const t=Z.sourceStatus.build,e=Z.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?Ch(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?Ch(t.status,t.tool,t.category):Z._idleTimer=setTimeout(()=>{Z._idleTimer=null,Ch("idle",null,null)},Q_)}function Fu(t){var i,s,o,a,l,c;t._source==="build"&&t.type==="system"&&t.parallel&&(t.subtype==="build_step"&&((i=t.stepNum)!=null&&i.toString().startsWith("∥"))?(Z.parallelTasks||(Z.parallelTasks={total:0,completed:0,failed:0,active:0,tasks:{}}),Z.parallelTasks.total++,Z.parallelTasks.active++,Z.parallelTasks.tasks[t.stepId]="working"):t.subtype==="build_step_done"&&((o=(s=Z.parallelTasks)==null?void 0:s.tasks)!=null&&o[t.stepId])?(Z.parallelTasks.active=Math.max(0,Z.parallelTasks.active-1),Z.parallelTasks.completed++,Z.parallelTasks.tasks[t.stepId]="complete"):t.subtype==="build_step_done"&&Z.parallelTasks&&!((a=t.stepNum)!=null&&a.toString().startsWith("∥"))&&(Z.parallelTasks=null)),t._source==="build"&&t.type==="error"&&((c=(l=Z.parallelTasks)==null?void 0:l.tasks)!=null&&c[t.stepId])&&(Z.parallelTasks.active=Math.max(0,Z.parallelTasks.active-1),Z.parallelTasks.failed++,Z.parallelTasks.tasks[t.stepId]="failed");const e=tE(t);if(e){const u=e._source==="build"?"build":"interactive";Z.sourceStatus[u]=e,e.status==="idle"?(Z.parallelTasks=null,om()):(Z._idleTimer&&(clearTimeout(Z._idleTimer),Z._idleTimer=null),om())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(Z.sessionId=t.session_id,sessionStorage.setItem(K_,t.session_id));const{include:r,msg:n}=Y_(t,py());r&&(Z.messages=[...Z.messages,n],Z.messages.length>im&&(Z.messages=Z.messages.slice(-im)),Z.onMessagesChange&&Z.onMessagesChange(Z.messages))}function kh(){if(Z.es)return;const t=`${window.location.protocol}//${window.location.hostname}:${my}/api/agent/stream`,e=m_({url:t,namedEvents:["hydrate"],onOpen:()=>{Z.connected=!0,Z.streamError=null,Z.retryInfo=null,Z.stalled=!1,Z.sourceStatus.build=null,Z.onConnectedChange&&Z.onConnectedChange(!0),Z.onStreamErrorChange&&Z.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})},onClose:()=>{Z.connected=!1,Z.onConnectedChange&&Z.onConnectedChange(!1)},onError:r=>{Z.streamError=(r==null?void 0:r.message)||"Connection error",Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:Z.retryInfo,stalled:Z.stalled})},onRetry:r=>{Z.retryInfo=r,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:r,stalled:Z.stalled})},onStall:()=>{Z.stalled=!0,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:Z.retryInfo,stalled:!0})},onExhausted:()=>{Z.es=null,Z.retryInfo=null,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:Z.streamError,retryInfo:null,stalled:Z.stalled})},onEvent:(r,n)=>{if((Z.stalled||Z.streamError)&&(Z.stalled=!1,Z.streamError=null,Z.retryInfo=null,Z.onStreamErrorChange&&Z.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})),n==="hydrate"){if(Array.isArray(r))for(const i of r)Fu(i);return}Fu(r)},maxBackoffMs:8e3,maxRetries:5,stallTimeoutMs:gy});Z.es=e}async function vh(t,e){const r=await fetch(`${window.location.protocol}//${window.location.hostname}:${my}${t}`,{method:"POST",headers:{"Content-Type":"application/json","x-compose-token":""},body:JSON.stringify(e)});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||r.statusText)}return r.json()}function am(t){if(!t)return"";if(t<1e3)return"<1s";const e=Math.floor(t/1e3);return e<60?`${e}s`:`${Math.floor(e/60)}m ${e%60}s`}function xy(){var L;const[t,e]=C.useState(Z.connected),[r,n]=C.useState(Z.messages),[i,s]=C.useState({status:Z.agentStatus,tool:Z.agentTool,category:Z.agentCategory,activityLog:Z.activityLog,currentActivity:Z.currentActivity}),[o,a]=C.useState(!1),[l,c]=C.useState(null),[u,d]=C.useState({error:Z.streamError,retryInfo:Z.retryInfo,stalled:Z.stalled}),p=C.useRef(null),f=C.useRef(null),m=C.useRef(!1),x=r.length===0||r.every(M=>M.type==="system"&&(M.subtype==="init"||M.subtype==="connected"));C.useEffect(()=>(Z.onConnectedChange=e,Z.onMessagesChange=n,Z.onAgentStatusChange=s,Z.onStreamErrorChange=d,()=>{Z.onConnectedChange=null,Z.onMessagesChange=null,Z.onAgentStatusChange=null,Z.onStreamErrorChange=null}),[]),C.useEffect(()=>{kh()},[]);const g=C.useCallback(()=>{const M=f.current;if(!M)return;const N=M.scrollHeight-M.scrollTop-M.clientHeight<48;m.current=!N},[]);C.useEffect(()=>{var M;m.current||(M=p.current)==null||M.scrollIntoView({behavior:"smooth"})},[r.length]),C.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){c(null);return}const M=i.currentActivity.startTime,N=()=>c(Date.now()-M);N();const P=setInterval(N,1e3);return()=>clearInterval(P)},[i.status,(L=i.currentActivity)==null?void 0:L.startTime]);const y=C.useCallback(async M=>{a(!0);const N=M.match(/[A-Z]+-\d+/);N&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:N[0]}}));try{x||!Z.sessionId?await vh("/api/agent/session",{prompt:M}):await vh("/api/agent/message",{prompt:M})}catch(P){Fu({type:"error",message:`Failed to send: ${P.message}`})}finally{a(!1)}},[x]),b=C.useCallback(async()=>{try{await vh("/api/agent/interrupt",{})}catch{}},[]),k=t&&(i.status==="working"||o),T=t?k?"#fbbf24":"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))",_=i.category?J_[i.category]:null,w=t?k?_||"working":"ready":"offline",E=i.activityLog||[];return h.jsxs("div",{className:"relative w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[h.jsxs("div",{className:"shrink-0 flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid hsl(var(--border) / 0.5)"},children:[h.jsx("div",{className:"flex items-center gap-0.5",children:t&&E.length>0&&E.slice(-5).map((M,N)=>h.jsx("div",{className:"h-1 rounded-full",title:`${M.tool||"thinking"} — ${am(M.duration)}`,style:{width:Math.max(6,Math.min(20,(M.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+N/5*.5}},N))}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[k&&h.jsx("button",{onClick:b,title:"Interrupt",className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))",border:"1px solid hsl(var(--destructive) / 0.3)",cursor:"pointer"},children:"stop"}),h.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:T,animation:k?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"text-[10px] uppercase tracking-wider",style:{color:k?"#fbbf24":"hsl(var(--muted-foreground))"},children:w}),k&&i.tool&&h.jsx("span",{className:"text-[10px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:i.tool}),k&&l!=null&&h.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:am(l)})]})]}),h.jsxs("div",{ref:f,onScroll:g,className:"flex-1 min-h-0 overflow-y-auto px-3 py-2",style:{scrollBehavior:"smooth"},children:[r.length===0&&h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 opacity-40",children:[h.jsx("span",{className:"text-2xl",children:"⬡"}),h.jsx("span",{className:"text-xs uppercase tracking-widest",style:{color:"hsl(var(--muted-foreground))"},children:t?"ready":"connecting…"})]}),X_(r).map((M,N)=>h.jsx(H_,{msg:M},M.uuid||N)),h.jsx("div",{ref:p})]}),!t&&h.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center pointer-events-none",style:{background:"hsl(var(--background) / 0.7)",backdropFilter:"blur(2px)"},children:h.jsxs("div",{className:"flex flex-col items-center gap-3",role:"status","aria-live":"polite",children:[h.jsx("div",{className:"w-5 h-5 rounded-full animate-spin",style:{border:"2px solid hsl(var(--accent) / 0.2)",borderTopColor:"hsl(var(--accent))"}}),h.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:u.retryInfo?`Retrying… ${u.retryInfo.attempt}/${u.retryInfo.maxRetries}`:"connecting to agent server…"}),u.error&&h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--destructive))"},children:u.error}),!Z.es&&u.error&&h.jsx("button",{onClick:()=>{Z.streamError=null,Z.retryInfo=null,Z.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),kh()},className:"pointer-events-auto px-3 py-1 rounded text-[11px] font-medium",style:{background:"hsl(var(--accent) / 0.15)",border:"1px solid hsl(var(--accent) / 0.3)",color:"hsl(var(--accent-foreground))",cursor:"pointer"},children:"Reconnect"})]})}),t&&(u.error||u.stalled)&&h.jsx("div",{role:"status","aria-live":"polite",className:"shrink-0 flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{background:u.stalled?"hsl(45 93% 47% / 0.1)":"hsl(var(--destructive) / 0.1)",borderBottom:`1px solid ${u.stalled?"hsl(45 93% 47% / 0.2)":"hsl(var(--destructive) / 0.2)"}`,color:u.stalled?"hsl(45 93% 47%)":"hsl(var(--destructive))"},children:u.stalled?h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:["No data received for ",gy/1e3,"s — connection may be stalled."]}),h.jsx("button",{onClick:()=>{Z.es&&(Z.es.close(),Z.es=null),Z.connected=!1,Z.onConnectedChange&&Z.onConnectedChange(!1),Z.streamError=null,Z.retryInfo=null,Z.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),kh()},className:"ml-auto px-2 py-0.5 rounded text-[10px] font-medium",style:{background:"hsl(45 93% 47% / 0.15)",border:"1px solid hsl(45 93% 47% / 0.3)",cursor:"pointer"},children:"Reconnect"})]}):h.jsx("span",{children:u.error})}),h.jsx(U_,{onSend:y,disabled:k||!t,placeholder:k?"Working…":"Message Claude…"})]})}function eE(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const rE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iE={};function lm(t,e){return(iE.jsx?nE:rE).test(t)}const sE=/[ \t\n\f\r]/g;function oE(t){return typeof t=="object"?t.type==="text"?cm(t.value):!1:cm(t)}function cm(t){return t.replace(sE,"")===""}class ga{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}ga.prototype.normal={};ga.prototype.property={};ga.prototype.space=void 0;function yy(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new ga(r,n,e)}function Pu(t){return t.toLowerCase()}class xr{constructor(e,r){this.attribute=r,this.property=e}}xr.prototype.attribute="";xr.prototype.booleanish=!1;xr.prototype.boolean=!1;xr.prototype.commaOrSpaceSeparated=!1;xr.prototype.commaSeparated=!1;xr.prototype.defined=!1;xr.prototype.mustUseProperty=!1;xr.prototype.number=!1;xr.prototype.overloadedBoolean=!1;xr.prototype.property="";xr.prototype.spaceSeparated=!1;xr.prototype.space=void 0;let aE=0;const Ut=Ai(),Ne=Ai(),Du=Ai(),ct=Ai(),de=Ai(),ds=Ai(),vr=Ai();function Ai(){return 2**++aE}const Ou=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ut,booleanish:Ne,commaOrSpaceSeparated:vr,commaSeparated:ds,number:ct,overloadedBoolean:Du,spaceSeparated:de},Symbol.toStringTag,{value:"Module"})),wh=Object.keys(Ou);class cf extends xr{constructor(e,r,n,i){let s=-1;if(super(e,r),hm(this,"space",i),typeof n=="number")for(;++s<wh.length;){const o=wh[s];hm(this,wh[s],(n&Ou[o])===Ou[o])}}}cf.prototype.defined=!0;function hm(t,e,r){r&&(t[e]=r)}function Gs(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new cf(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Pu(n)]=n,r[Pu(s.attribute)]=n}return new ga(e,r,t.space)}const by=Gs({properties:{ariaActiveDescendant:null,ariaAtomic:Ne,ariaAutoComplete:null,ariaBusy:Ne,ariaChecked:Ne,ariaColCount:ct,ariaColIndex:ct,ariaColSpan:ct,ariaControls:de,ariaCurrent:null,ariaDescribedBy:de,ariaDetails:null,ariaDisabled:Ne,ariaDropEffect:de,ariaErrorMessage:null,ariaExpanded:Ne,ariaFlowTo:de,ariaGrabbed:Ne,ariaHasPopup:null,ariaHidden:Ne,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:de,ariaLevel:ct,ariaLive:null,ariaModal:Ne,ariaMultiLine:Ne,ariaMultiSelectable:Ne,ariaOrientation:null,ariaOwns:de,ariaPlaceholder:null,ariaPosInSet:ct,ariaPressed:Ne,ariaReadOnly:Ne,ariaRelevant:null,ariaRequired:Ne,ariaRoleDescription:de,ariaRowCount:ct,ariaRowIndex:ct,ariaRowSpan:ct,ariaSelected:Ne,ariaSetSize:ct,ariaSort:null,ariaValueMax:ct,ariaValueMin:ct,ariaValueNow:ct,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Cy(t,e){return e in t?t[e]:e}function ky(t,e){return Cy(t,e.toLowerCase())}const lE=Gs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ds,acceptCharset:de,accessKey:de,action:null,allow:null,allowFullScreen:Ut,allowPaymentRequest:Ut,allowUserMedia:Ut,alt:null,as:null,async:Ut,autoCapitalize:null,autoComplete:de,autoFocus:Ut,autoPlay:Ut,blocking:de,capture:null,charSet:null,checked:Ut,cite:null,className:de,cols:ct,colSpan:null,content:null,contentEditable:Ne,controls:Ut,controlsList:de,coords:ct|ds,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ut,defer:Ut,dir:null,dirName:null,disabled:Ut,download:Du,draggable:Ne,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ut,formTarget:null,headers:de,height:ct,hidden:Du,high:ct,href:null,hrefLang:null,htmlFor:de,httpEquiv:de,id:null,imageSizes:null,imageSrcSet:null,inert:Ut,inputMode:null,integrity:null,is:null,isMap:Ut,itemId:null,itemProp:de,itemRef:de,itemScope:Ut,itemType:de,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ut,low:ct,manifest:null,max:null,maxLength:ct,media:null,method:null,min:null,minLength:ct,multiple:Ut,muted:Ut,name:null,nonce:null,noModule:Ut,noValidate:Ut,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ut,optimum:ct,pattern:null,ping:de,placeholder:null,playsInline:Ut,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ut,referrerPolicy:null,rel:de,required:Ut,reversed:Ut,rows:ct,rowSpan:ct,sandbox:de,scope:null,scoped:Ut,seamless:Ut,selected:Ut,shadowRootClonable:Ut,shadowRootDelegatesFocus:Ut,shadowRootMode:null,shape:null,size:ct,sizes:null,slot:null,span:ct,spellCheck:Ne,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ct,step:null,style:null,tabIndex:ct,target:null,title:null,translate:null,type:null,typeMustMatch:Ut,useMap:null,value:Ne,width:ct,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:de,axis:null,background:null,bgColor:null,border:ct,borderColor:null,bottomMargin:ct,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ut,declare:Ut,event:null,face:null,frame:null,frameBorder:null,hSpace:ct,leftMargin:ct,link:null,longDesc:null,lowSrc:null,marginHeight:ct,marginWidth:ct,noResize:Ut,noHref:Ut,noShade:Ut,noWrap:Ut,object:null,profile:null,prompt:null,rev:null,rightMargin:ct,rules:null,scheme:null,scrolling:Ne,standby:null,summary:null,text:null,topMargin:ct,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ct,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ut,disableRemotePlayback:Ut,prefix:null,property:null,results:ct,security:null,unselectable:null},space:"html",transform:ky}),cE=Gs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vr,accentHeight:ct,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ct,amplitude:ct,arabicForm:null,ascent:ct,attributeName:null,attributeType:null,azimuth:ct,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ct,by:null,calcMode:null,capHeight:ct,className:de,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ct,diffuseConstant:ct,direction:null,display:null,dur:null,divisor:ct,dominantBaseline:null,download:Ut,dx:null,dy:null,edgeMode:null,editable:null,elevation:ct,enableBackground:null,end:null,event:null,exponent:ct,externalResourcesRequired:null,fill:null,fillOpacity:ct,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ds,g2:ds,glyphName:ds,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ct,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ct,horizOriginX:ct,horizOriginY:ct,id:null,ideographic:ct,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ct,k:ct,k1:ct,k2:ct,k3:ct,k4:ct,kernelMatrix:vr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ct,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ct,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ct,overlineThickness:ct,paintOrder:null,panose1:null,path:null,pathLength:ct,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:de,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ct,pointsAtY:ct,pointsAtZ:ct,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ct,specularExponent:ct,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ct,strikethroughThickness:ct,string:null,stroke:null,strokeDashArray:vr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ct,strokeOpacity:ct,strokeWidth:null,style:null,surfaceScale:ct,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vr,tabIndex:ct,tableValues:null,target:null,targetX:ct,targetY:ct,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ct,underlineThickness:ct,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ct,values:null,vAlphabetic:ct,vMathematical:ct,vectorEffect:null,vHanging:ct,vIdeographic:ct,version:null,vertAdvY:ct,vertOriginX:ct,vertOriginY:ct,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ct,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Cy}),vy=Gs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),wy=Gs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ky}),Sy=Gs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),hE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uE=/[A-Z]/g,um=/-[a-z]/g,dE=/^data[-\w.:]+$/i;function fE(t,e){const r=Pu(e);let n=e,i=xr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&dE.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(um,mE);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!um.test(s)){let o=s.replace(uE,pE);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=cf}return new i(n,e)}function pE(t){return"-"+t.toLowerCase()}function mE(t){return t.charAt(1).toUpperCase()}const gE=yy([by,lE,vy,wy,Sy],"html"),hf=yy([by,cE,vy,wy,Sy],"svg");function xE(t){return t.join(" ").trim()}var Wi={},Sh,dm;function yE(){if(dm)return Sh;dm=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
6
+ `,c="/",u="*",d="",p="comment",f="declaration";function m(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var b=1,k=1;function T(O){var I=O.match(e);I&&(b+=I.length);var F=O.lastIndexOf(l);k=~F?O.length-F:k+O.length}function _(){var O={line:b,column:k};return function(I){return I.position=new w(O),M(),I}}function w(O){this.start=O,this.end={line:b,column:k},this.source=y.source}w.prototype.content=g;function E(O){var I=new Error(y.source+":"+b+":"+k+": "+O);if(I.reason=O,I.filename=y.source,I.line=b,I.column=k,I.source=g,!y.silent)throw I}function L(O){var I=O.exec(g);if(I){var F=I[0];return T(F),g=g.slice(F.length),I}}function M(){L(r)}function N(O){var I;for(O=O||[];I=P();)I!==!1&&O.push(I);return O}function P(){var O=_();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var I=2;d!=g.charAt(I)&&(u!=g.charAt(I)||c!=g.charAt(I+1));)++I;if(I+=2,d===g.charAt(I-1))return E("End of comment missing");var F=g.slice(2,I-2);return k+=2,T(F),g=g.slice(I),k+=2,O({type:p,comment:F})}}function $(){var O=_(),I=L(n);if(I){if(P(),!L(i))return E("property missing ':'");var F=L(s),D=O({type:f,property:x(I[0].replace(t,d)),value:F?x(F[0].replace(t,d)):d});return L(o),D}}function q(){var O=[];N(O);for(var I;I=$();)I!==!1&&(O.push(I),N(O));return O}return M(),q()}function x(g){return g?g.replace(a,d):d}return Sh=m,Sh}var fm;function bE(){if(fm)return Wi;fm=1;var t=Wi&&Wi.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.default=r;const e=t(yE());function r(n,i){let s=null;if(!n||typeof n!="string")return s;const o=(0,e.default)(n),a=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?i(c,u,l):u&&(s=s||{},s[c]=u)}),s}return Wi}var co={},pm;function CE(){if(pm)return co;pm=1,Object.defineProperty(co,"__esModule",{value:!0}),co.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||r.test(c)||t.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),s(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,a):c=c.replace(n,a),c.replace(e,o))};return co.camelCase=l,co}var ho,mm;function kE(){if(mm)return ho;mm=1;var t=ho&&ho.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(bE()),r=CE();function n(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,l){a&&l&&(o[(0,r.camelCase)(a,s)]=l)}),o}return n.default=n,ho=n,ho}var vE=kE();const wE=Ac(vE),Ty=_y("end"),uf=_y("start");function _y(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function SE(t){const e=uf(t),r=Ty(t);if(e&&r)return{start:e,end:r}}function zo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?gm(t.position):"start"in t||"end"in t?gm(t):"line"in t||"column"in t?Ru(t):""}function Ru(t){return xm(t&&t.line)+":"+xm(t&&t.column)}function gm(t){return Ru(t&&t.start)+"-"+Ru(t&&t.end)}function xm(t){return t&&typeof t=="number"?t:1}class Xe extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=zo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Xe.prototype.file="";Xe.prototype.name="";Xe.prototype.reason="";Xe.prototype.message="";Xe.prototype.stack="";Xe.prototype.column=void 0;Xe.prototype.line=void 0;Xe.prototype.ancestors=void 0;Xe.prototype.cause=void 0;Xe.prototype.fatal=void 0;Xe.prototype.place=void 0;Xe.prototype.ruleId=void 0;Xe.prototype.source=void 0;const df={}.hasOwnProperty,TE=new Map,_E=/[A-Z]/g,EE=new Set(["table","tbody","thead","tfoot","tr"]),NE=new Set(["td","th"]),Ey="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jE(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=DE(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=PE(r,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?hf:gE,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Ny(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function Ny(t,e,r){if(e.type==="element")return LE(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return BE(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return ME(t,e,r);if(e.type==="mdxjsEsm")return AE(t,e);if(e.type==="root")return IE(t,e,r);if(e.type==="text")return FE(t,e)}function LE(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=hf,t.schema=i),t.ancestors.push(e);const s=Ly(t,e.tagName,!1),o=OE(t,e);let a=pf(t,e);return EE.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!oE(l):!0})),jy(t,o,s,e),ff(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function BE(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}ta(t,e.position)}function AE(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ta(t,e.position)}function ME(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=hf,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:Ly(t,e.name,!0),o=RE(t,e),a=pf(t,e);return jy(t,o,s,e),ff(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function IE(t,e,r){const n={};return ff(n,pf(t,e)),t.create(e,t.Fragment,n,r)}function FE(t,e){return e.value}function jy(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function ff(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function PE(t,e,r){return n;function n(i,s,o,a){const c=Array.isArray(o.children)?r:e;return a?c(s,o,a):c(s,o)}}function DE(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=uf(n);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function OE(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&df.call(e.properties,i)){const s=$E(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&NE.has(e.tagName)?n=a:r[o]=a}}if(n){const s=r.style||(r.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function RE(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(r,t.evaluater.evaluateExpression(a.argument))}else ta(t,e.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const a=n.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else ta(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function pf(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:TE;for(;++n<e.children.length;){const s=e.children[n];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=Ny(t,s,o);a!==void 0&&r.push(a)}return r}function $E(t,e,r){const n=fE(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?eE(r):xE(r)),n.property==="style"){let i=typeof r=="object"?r:zE(t,String(r));return t.stylePropertyNameCase==="css"&&(i=WE(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?hE[n.property]||n.property:n.attribute,r]}}function zE(t,e){try{return wE(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Xe("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=Ey+"#cannot-parse-style-attribute",i}}function Ly(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=lm(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}n=o}else n=lm(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return df.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);ta(t)}function ta(t,e){const r=new Xe("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=Ey+"#cannot-handle-mdx-estrees-without-createevaluater",r}function WE(t){const e={};let r;for(r in t)df.call(t,r)&&(e[qE(r)]=t[r]);return e}function qE(t){let e=t.replace(_E,HE);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function HE(t){return"-"+t.toLowerCase()}const Th={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},UE={};function mf(t,e){const r=UE,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return By(t,n,i)}function By(t,e,r){if(GE(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return ym(t.children,e,r)}return Array.isArray(t)?ym(t,e,r):""}function ym(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=By(t[i],e,r);return n.join("")}function GE(t){return!!(t&&typeof t=="object")}const bm=document.createElement("i");function gf(t){const e="&"+t+";";bm.innerHTML=e;const r=bm.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function wr(t,e,r,n){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Lr(t,e){return t.length>0?(wr(t,t.length,0,e),t):e}const Cm={}.hasOwnProperty;function Ay(t){const e={};let r=-1;for(;++r<t.length;)VE(e,t[r]);return e}function VE(t,e){let r;for(r in e){const i=(Cm.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Cm.call(i,o)||(i[o]=[]);const a=s[o];YE(i[o],Array.isArray(a)?a:a?[a]:[])}}}function YE(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);wr(t,0,0,n)}function My(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function qr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const tr=ti(/[A-Za-z]/),Ve=ti(/[\dA-Za-z]/),XE=ti(/[#-'*+\--9=?A-Z^-~]/);function Dl(t){return t!==null&&(t<32||t===127)}const $u=ti(/\d/),KE=ti(/[\dA-Fa-f]/),ZE=ti(/[!-/:-@[-`{-~]/);function Lt(t){return t!==null&&t<-2}function he(t){return t!==null&&(t<0||t===32)}function Kt(t){return t===-2||t===-1||t===32}const Mc=ti(new RegExp("\\p{P}|\\p{S}","u")),vi=ti(/\s/);function ti(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Vs(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&Ve(t.charCodeAt(r+1))&&Ve(t.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(r+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function te(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Kt(l)?(t.enter(r),a(l)):e(l)}function a(l){return Kt(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const QE={tokenize:JE};function JE(t){const e=t.attempt(this.parser.constructs.contentInitial,n,i);let r;return e;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),te(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return Lt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const tN={tokenize:eN},km={tokenize:rN};function eN(t){const e=this,r=[];let n=0,i,s,o;return a;function a(k){if(n<r.length){const T=r[n];return e.containerState=T[1],t.attempt(T[0].continuation,l,c)(k)}return c(k)}function l(k){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();const T=e.events.length;let _=T,w;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){w=e.events[_][1].end;break}y(n);let E=T;for(;E<e.events.length;)e.events[E][1].end={...w},E++;return wr(e.events,_+1,0,e.events.slice(T)),e.events.length=E,c(k)}return a(k)}function c(k){if(n===r.length){if(!i)return p(k);if(i.currentConstruct&&i.currentConstruct.concrete)return m(k);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(km,u,d)(k)}function u(k){return i&&b(),y(n),p(k)}function d(k){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,m(k)}function p(k){return e.containerState={},t.attempt(km,f,m)(k)}function f(k){return n++,r.push([e.currentConstruct,e.containerState]),p(k)}function m(k){if(k===null){i&&b(),y(0),t.consume(k);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(k)}function x(k){if(k===null){g(t.exit("chunkFlow"),!0),y(0),t.consume(k);return}return Lt(k)?(t.consume(k),g(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(k),x)}function g(k,T){const _=e.sliceStream(k);if(T&&_.push(null),k.previous=s,s&&(s.next=k),s=k,i.defineSkip(k.start),i.write(_),e.parser.lazy[k.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<o&&(!i.events[w][1].end||i.events[w][1].end.offset>o))return;const E=e.events.length;let L=E,M,N;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(M){N=e.events[L][1].end;break}M=!0}for(y(n),w=E;w<e.events.length;)e.events[w][1].end={...N},w++;wr(e.events,L+1,0,e.events.slice(E)),e.events.length=w}}function y(k){let T=r.length;for(;T-- >k;){const _=r[T];e.containerState=_[1],_[0].exit.call(e,t)}r.length=k}function b(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function rN(t,e,r){return te(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ms(t){if(t===null||he(t)||vi(t))return 1;if(Mc(t))return 2}function Ic(t,e,r){const n=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!n.includes(s)&&(e=s(e,r),n.push(s))}return e}const zu={name:"attention",resolveAll:nN,tokenize:iN};function nN(t,e){let r=-1,n,i,s,o,a,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const d={...t[n][1].end},p={...t[r][1].start};vm(d,-l),vm(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[n][1].end={...o.start},t[r][1].start={...a.end},c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Lr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Lr(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Lr(c,Ic(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=Lr(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=Lr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,wr(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function iN(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Ms(n);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),u=Ms(l),d=!u||u===2&&i||r.includes(l),p=!i||i===2&&u||r.includes(n);return c._open=!!(s===42?d:d&&(i||!p)),c._close=!!(s===42?p:p&&(u||!d)),e(l)}}function vm(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const sN={name:"autolink",tokenize:oN};function oN(t,e,r){let n=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return tr(f)?(t.consume(f),o):f===64?r(f):c(f)}function o(f){return f===43||f===45||f===46||Ve(f)?(n=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),n=0,l):(f===43||f===45||f===46||Ve(f))&&n++<32?(t.consume(f),a):(n=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Dl(f)?r(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):XE(f)?(t.consume(f),c):r(f)}function u(f){return Ve(f)?d(f):r(f)}function d(f){return f===46?(t.consume(f),n=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):p(f)}function p(f){if((f===45||Ve(f))&&n++<63){const m=f===45?p:d;return t.consume(f),m}return r(f)}}const xa={partial:!0,tokenize:aN};function aN(t,e,r){return n;function n(s){return Kt(s)?te(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Lt(s)?e(s):r(s)}}const Iy={continuation:{tokenize:cN},exit:hN,name:"blockQuote",tokenize:lN};function lN(t,e,r){const n=this;return i;function i(o){if(o===62){const a=n.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return r(o)}function s(o){return Kt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function cN(t,e,r){const n=this;return i;function i(o){return Kt(o)?te(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(Iy,e,r)(o)}}function hN(t){t.exit("blockQuote")}const Fy={name:"characterEscape",tokenize:uN};function uN(t,e,r){return n;function n(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return ZE(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const Py={name:"characterReference",tokenize:dN};function dN(t,e,r){const n=this;let i=0,s,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=Ve,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=KE,u):(t.enter("characterReferenceValue"),s=7,o=$u,u(d))}function u(d){if(d===59&&i){const p=t.exit("characterReferenceValue");return o===Ve&&!gf(n.sliceSerialize(p))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<s?(t.consume(d),u):r(d)}}const wm={partial:!0,tokenize:pN},Sm={concrete:!0,name:"codeFenced",tokenize:fN};function fN(t,e,r){const n=this,i={partial:!0,tokenize:_};let s=0,o=0,a;return l;function l(w){return c(w)}function c(w){const E=n.events[n.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,a=w,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===a?(o++,t.consume(w),u):o<3?r(w):(t.exit("codeFencedFenceSequence"),Kt(w)?te(t,d,"whitespace")(w):d(w))}function d(w){return w===null||Lt(w)?(t.exit("codeFencedFence"),n.interrupt?e(w):t.check(wm,x,T)(w)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||Lt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(w)):Kt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),te(t,f,"whitespace")(w)):w===96&&w===a?r(w):(t.consume(w),p)}function f(w){return w===null||Lt(w)?d(w):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||Lt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(w)):w===96&&w===a?r(w):(t.consume(w),m)}function x(w){return t.attempt(i,T,g)(w)}function g(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),y}function y(w){return s>0&&Kt(w)?te(t,b,"linePrefix",s+1)(w):b(w)}function b(w){return w===null||Lt(w)?t.check(wm,x,T)(w):(t.enter("codeFlowValue"),k(w))}function k(w){return w===null||Lt(w)?(t.exit("codeFlowValue"),b(w)):(t.consume(w),k)}function T(w){return t.exit("codeFenced"),e(w)}function _(w,E,L){let M=0;return N;function N(I){return w.enter("lineEnding"),w.consume(I),w.exit("lineEnding"),P}function P(I){return w.enter("codeFencedFence"),Kt(I)?te(w,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):$(I)}function $(I){return I===a?(w.enter("codeFencedFenceSequence"),q(I)):L(I)}function q(I){return I===a?(M++,w.consume(I),q):M>=o?(w.exit("codeFencedFenceSequence"),Kt(I)?te(w,O,"whitespace")(I):O(I)):L(I)}function O(I){return I===null||Lt(I)?(w.exit("codeFencedFence"),E(I)):L(I)}}}function pN(t,e,r){const n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}const _h={name:"codeIndented",tokenize:gN},mN={partial:!0,tokenize:xN};function gN(t,e,r){const n=this;return i;function i(c){return t.enter("codeIndented"),te(t,s,"linePrefix",5)(c)}function s(c){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?l(c):Lt(c)?t.attempt(mN,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Lt(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function xN(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Lt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):te(t,s,"linePrefix",5)(o)}function s(o){const a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Lt(o)?i(o):r(o)}}const yN={name:"codeText",previous:CN,resolve:bN,tokenize:kN};function bN(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function CN(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function kN(t,e,r){let n=0,i,s;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),n++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?r(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,u(d)):Lt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Lt(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),i++,u):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",c(d))}}class vN{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const i=r||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&uo(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),uo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),uo(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);uo(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);uo(this.left,r.reverse())}}}function uo(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function Dy(t){const e={};let r=-1,n,i,s,o,a,l,c;const u=new vN(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,wN(u,r)),r=e[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...u.get(i)[1].start},a=u.slice(i,r),a.unshift(n),u.splice(i,r-i+1,a))}}return wr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function wN(t,e){const r=t.get(e)[1],n=t.get(e)[2];let i=e-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,p=-1,f=r,m=0,x=0;const g=[x];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=n.sliceStream(f),f.next||u.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=r;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(x=p+1,g.push(x),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),p=g.length;p--;){const y=a.slice(g[p],g[p+1]),b=s.pop();l.push([b,b+y.length-1]),t.splice(b,2,y)}for(l.reverse(),p=-1;++p<l.length;)c[m+l[p][0]]=m+l[p][1],m+=l[p][1]-l[p][0]-1;return c}const SN={resolve:_N,tokenize:EN},TN={partial:!0,tokenize:NN};function _N(t){return Dy(t),t}function EN(t,e){let r;return n;function n(a){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):Lt(a)?t.check(TN,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function NN(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),te(t,s,"linePrefix")}function s(o){if(o===null||Lt(o))return r(o);const a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function Oy(t,e,r,n,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(y){return y===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(y),t.exit(s),p):y===null||y===32||y===41||Dl(y)?r(y):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(t.enter(s),t.consume(y),t.exit(s),t.exit(i),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(t.exit("chunkString"),t.exit(a),p(y)):y===null||y===60||Lt(y)?r(y):(t.consume(y),y===92?m:f)}function m(y){return y===60||y===62||y===92?(t.consume(y),f):f(y)}function x(y){return!u&&(y===null||y===41||he(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(y)):u<c&&y===40?(t.consume(y),u++,x):y===41?(t.consume(y),u--,x):y===null||y===32||y===40||Dl(y)?r(y):(t.consume(y),y===92?g:x)}function g(y){return y===40||y===41||y===92?(t.consume(y),x):x(y)}}function Ry(t,e,r,n,i,s){const o=this;let a=0,l;return c;function c(f){return t.enter(n),t.enter(i),t.consume(f),t.exit(i),t.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):Lt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Lt(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!Kt(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function $y(t,e,r,n,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(t.enter(n),t.enter(i),t.consume(p),t.exit(i),o=p===40?41:p,l):r(p)}function l(p){return p===o?(t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):(t.enter(s),c(p))}function c(p){return p===o?(t.exit(s),l(o)):p===null?r(p):Lt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),te(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===o||p===null||Lt(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?d:u)}function d(p){return p===o||p===92?(t.consume(p),u):u(p)}}function Wo(t,e){let r;return n;function n(i){return Lt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Kt(i)?te(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const jN={name:"definition",tokenize:BN},LN={partial:!0,tokenize:AN};function BN(t,e,r){const n=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return Ry.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=qr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):r(f)}function l(f){return he(f)?Wo(t,c)(f):c(f)}function c(f){return Oy(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(LN,d,d)(f)}function d(f){return Kt(f)?te(t,p,"whitespace")(f):p(f)}function p(f){return f===null||Lt(f)?(t.exit("definition"),n.parser.defined.push(i),e(f)):r(f)}}function AN(t,e,r){return n;function n(a){return he(a)?Wo(t,i)(a):r(a)}function i(a){return $y(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Kt(a)?te(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Lt(a)?e(a):r(a)}}const MN={name:"hardBreakEscape",tokenize:IN};function IN(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Lt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const FN={name:"headingAtx",resolve:PN,tokenize:DN};function PN(t,e){let r=t.length-2,n=3,i,s;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},s={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},wr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function DN(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(t.consume(u),o):u===null||he(u)?(t.exit("atxHeadingSequence"),a(u)):r(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Lt(u)?(t.exit("atxHeading"),e(u)):Kt(u)?te(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||he(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const ON=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Tm=["pre","script","style","textarea"],RN={concrete:!0,name:"htmlFlow",resolveTo:WN,tokenize:qN},$N={partial:!0,tokenize:UN},zN={partial:!0,tokenize:HN};function WN(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function qN(t,e,r){const n=this;let i,s,o,a,l;return c;function c(A){return u(A)}function u(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),d}function d(A){return A===33?(t.consume(A),p):A===47?(t.consume(A),s=!0,x):A===63?(t.consume(A),i=3,n.interrupt?e:S):tr(A)?(t.consume(A),o=String.fromCharCode(A),g):r(A)}function p(A){return A===45?(t.consume(A),i=2,f):A===91?(t.consume(A),i=5,a=0,m):tr(A)?(t.consume(A),i=4,n.interrupt?e:S):r(A)}function f(A){return A===45?(t.consume(A),n.interrupt?e:S):r(A)}function m(A){const rt="CDATA[";return A===rt.charCodeAt(a++)?(t.consume(A),a===rt.length?n.interrupt?e:$:m):r(A)}function x(A){return tr(A)?(t.consume(A),o=String.fromCharCode(A),g):r(A)}function g(A){if(A===null||A===47||A===62||he(A)){const rt=A===47,ut=o.toLowerCase();return!rt&&!s&&Tm.includes(ut)?(i=1,n.interrupt?e(A):$(A)):ON.includes(o.toLowerCase())?(i=6,rt?(t.consume(A),y):n.interrupt?e(A):$(A)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):s?b(A):k(A))}return A===45||Ve(A)?(t.consume(A),o+=String.fromCharCode(A),g):r(A)}function y(A){return A===62?(t.consume(A),n.interrupt?e:$):r(A)}function b(A){return Kt(A)?(t.consume(A),b):N(A)}function k(A){return A===47?(t.consume(A),N):A===58||A===95||tr(A)?(t.consume(A),T):Kt(A)?(t.consume(A),k):N(A)}function T(A){return A===45||A===46||A===58||A===95||Ve(A)?(t.consume(A),T):_(A)}function _(A){return A===61?(t.consume(A),w):Kt(A)?(t.consume(A),_):k(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(t.consume(A),l=A,E):Kt(A)?(t.consume(A),w):L(A)}function E(A){return A===l?(t.consume(A),l=null,M):A===null||Lt(A)?r(A):(t.consume(A),E)}function L(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||he(A)?_(A):(t.consume(A),L)}function M(A){return A===47||A===62||Kt(A)?k(A):r(A)}function N(A){return A===62?(t.consume(A),P):r(A)}function P(A){return A===null||Lt(A)?$(A):Kt(A)?(t.consume(A),P):r(A)}function $(A){return A===45&&i===2?(t.consume(A),F):A===60&&i===1?(t.consume(A),D):A===62&&i===4?(t.consume(A),U):A===63&&i===3?(t.consume(A),S):A===93&&i===5?(t.consume(A),j):Lt(A)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check($N,Q,q)(A)):A===null||Lt(A)?(t.exit("htmlFlowData"),q(A)):(t.consume(A),$)}function q(A){return t.check(zN,O,Q)(A)}function O(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),I}function I(A){return A===null||Lt(A)?q(A):(t.enter("htmlFlowData"),$(A))}function F(A){return A===45?(t.consume(A),S):$(A)}function D(A){return A===47?(t.consume(A),o="",R):$(A)}function R(A){if(A===62){const rt=o.toLowerCase();return Tm.includes(rt)?(t.consume(A),U):$(A)}return tr(A)&&o.length<8?(t.consume(A),o+=String.fromCharCode(A),R):$(A)}function j(A){return A===93?(t.consume(A),S):$(A)}function S(A){return A===62?(t.consume(A),U):A===45&&i===2?(t.consume(A),S):$(A)}function U(A){return A===null||Lt(A)?(t.exit("htmlFlowData"),Q(A)):(t.consume(A),U)}function Q(A){return t.exit("htmlFlow"),e(A)}}function HN(t,e,r){const n=this;return i;function i(o){return Lt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function UN(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(xa,e,r)}}const GN={name:"htmlText",tokenize:VN};function VN(t,e,r){const n=this;let i,s,o;return a;function a(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),c):S===47?(t.consume(S),_):S===63?(t.consume(S),k):tr(S)?(t.consume(S),L):r(S)}function c(S){return S===45?(t.consume(S),u):S===91?(t.consume(S),s=0,m):tr(S)?(t.consume(S),b):r(S)}function u(S){return S===45?(t.consume(S),f):r(S)}function d(S){return S===null?r(S):S===45?(t.consume(S),p):Lt(S)?(o=d,D(S)):(t.consume(S),d)}function p(S){return S===45?(t.consume(S),f):d(S)}function f(S){return S===62?F(S):S===45?p(S):d(S)}function m(S){const U="CDATA[";return S===U.charCodeAt(s++)?(t.consume(S),s===U.length?x:m):r(S)}function x(S){return S===null?r(S):S===93?(t.consume(S),g):Lt(S)?(o=x,D(S)):(t.consume(S),x)}function g(S){return S===93?(t.consume(S),y):x(S)}function y(S){return S===62?F(S):S===93?(t.consume(S),y):x(S)}function b(S){return S===null||S===62?F(S):Lt(S)?(o=b,D(S)):(t.consume(S),b)}function k(S){return S===null?r(S):S===63?(t.consume(S),T):Lt(S)?(o=k,D(S)):(t.consume(S),k)}function T(S){return S===62?F(S):k(S)}function _(S){return tr(S)?(t.consume(S),w):r(S)}function w(S){return S===45||Ve(S)?(t.consume(S),w):E(S)}function E(S){return Lt(S)?(o=E,D(S)):Kt(S)?(t.consume(S),E):F(S)}function L(S){return S===45||Ve(S)?(t.consume(S),L):S===47||S===62||he(S)?M(S):r(S)}function M(S){return S===47?(t.consume(S),F):S===58||S===95||tr(S)?(t.consume(S),N):Lt(S)?(o=M,D(S)):Kt(S)?(t.consume(S),M):F(S)}function N(S){return S===45||S===46||S===58||S===95||Ve(S)?(t.consume(S),N):P(S)}function P(S){return S===61?(t.consume(S),$):Lt(S)?(o=P,D(S)):Kt(S)?(t.consume(S),P):M(S)}function $(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(t.consume(S),i=S,q):Lt(S)?(o=$,D(S)):Kt(S)?(t.consume(S),$):(t.consume(S),O)}function q(S){return S===i?(t.consume(S),i=void 0,I):S===null?r(S):Lt(S)?(o=q,D(S)):(t.consume(S),q)}function O(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||he(S)?M(S):(t.consume(S),O)}function I(S){return S===47||S===62||he(S)?M(S):r(S)}function F(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):r(S)}function D(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),R}function R(S){return Kt(S)?te(t,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):j(S)}function j(S){return t.enter("htmlTextData"),o(S)}}const xf={name:"labelEnd",resolveAll:ZN,resolveTo:QN,tokenize:JN},YN={tokenize:tj},XN={tokenize:ej},KN={tokenize:rj};function ZN(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",e+=i}}return t.length!==r.length&&wr(t,0,t.length,r),t}function QN(t,e){let r=t.length,n=0,i,s,o,a;for(;r--;)if(i=t[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+n+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=Lr(a,t.slice(s+1,s+n+3)),a=Lr(a,[["enter",u,e]]),a=Lr(a,Ic(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Lr(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=Lr(a,t.slice(o+1)),a=Lr(a,[["exit",l,e]]),wr(t,s,t.length,a),t}function JN(t,e,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return a;function a(p){return s?s._inactive?d(p):(o=n.parser.defined.includes(qr(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),l):r(p)}function l(p){return p===40?t.attempt(YN,u,o?u:d)(p):p===91?t.attempt(XN,u,o?c:d)(p):o?u(p):d(p)}function c(p){return t.attempt(KN,u,d)(p)}function u(p){return e(p)}function d(p){return s._balanced=!0,r(p)}}function tj(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return he(d)?Wo(t,s)(d):s(d)}function s(d){return d===41?u(d):Oy(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return he(d)?Wo(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?$y(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return he(d)?Wo(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function ej(t,e,r){const n=this;return i;function i(a){return Ry.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(qr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function rj(t,e,r){return n;function n(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):r(s)}}const nj={name:"labelStartImage",resolveAll:xf.resolveAll,tokenize:ij};function ij(t,e,r){const n=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):r(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):e(a)}}const sj={name:"labelStartLink",resolveAll:xf.resolveAll,tokenize:oj};function oj(t,e,r){const n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const Eh={name:"lineEnding",tokenize:aj};function aj(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),te(t,e,"linePrefix")}}const xl={name:"thematicBreak",tokenize:lj};function lj(t,e,r){let n=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||Lt(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),Kt(c)?te(t,a,"whitespace")(c):a(c))}}const ur={continuation:{tokenize:dj},exit:pj,name:"list",tokenize:uj},cj={partial:!0,tokenize:mj},hj={partial:!0,tokenize:fj};function uj(t,e,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const m=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:$u(f)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(xl,r,c)(f):c(f);if(!n.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return r(f)}function l(f){return $u(f)&&++o<10?(t.consume(f),l):(!n.interrupt||o<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):r(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,t.check(xa,n.interrupt?r:u,t.attempt(cj,p,d))}function u(f){return n.containerState.initialBlankLine=!0,s++,p(f)}function d(f){return Kt(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),p):r(f)}function p(f){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function dj(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(xa,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,te(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Kt(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(hj,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,te(t,t.attempt(ur,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function fj(t,e,r){const n=this;return te(t,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(s):r(s)}}function pj(t){t.exit(this.containerState.type)}function mj(t,e,r){const n=this;return te(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!Kt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const _m={name:"setextUnderline",resolveTo:gj,tokenize:xj};function gj(t,e){let r=t.length,n,i,s;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!s&&t[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[n][1],e]),t[n][1].end={...t[s][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function xj(t,e,r){const n=this;let i;return s;function s(c){let u=n.events.length,d;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){d=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Kt(c)?te(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Lt(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}const yj={tokenize:bj};function bj(t){const e=this,r=t.attempt(xa,n,t.attempt(this.parser.constructs.flowInitial,i,te(t,t.attempt(this.parser.constructs.flow,i,t.attempt(SN,i)),"linePrefix")));return r;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const Cj={resolveAll:Wy()},kj=zy("string"),vj=zy("text");function zy(t){return{resolveAll:Wy(t==="text"?wj:void 0),tokenize:e};function e(r){const n=this,i=this.parser.constructs[t],s=r.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),s(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function Wy(t){return e;function e(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(r,n):r}}function wj(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],i=e.sliceStream(n);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const c={type:r===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-a,offset:n.end.offset-a},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}const Sj={42:ur,43:ur,45:ur,48:ur,49:ur,50:ur,51:ur,52:ur,53:ur,54:ur,55:ur,56:ur,57:ur,62:Iy},Tj={91:jN},_j={[-2]:_h,[-1]:_h,32:_h},Ej={35:FN,42:xl,45:[_m,xl],60:RN,61:_m,95:xl,96:Sm,126:Sm},Nj={38:Py,92:Fy},jj={[-5]:Eh,[-4]:Eh,[-3]:Eh,33:nj,38:Py,42:zu,60:[sN,GN],91:sj,92:[MN,Fy],93:xf,95:zu,96:yN},Lj={null:[zu,Cj]},Bj={null:[42,95]},Aj={null:[]},Mj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Bj,contentInitial:Tj,disable:Aj,document:Sj,flow:Ej,flowInitial:_j,insideSpan:Lj,string:Nj,text:jj},Symbol.toStringTag,{value:"Module"}));function Ij(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:E(_),check:E(w),consume:b,enter:k,exit:T,interrupt:E(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:t,previous:null,sliceSerialize:p,sliceStream:f,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function d(P){return o=Lr(o,P),g(),o[o.length-1]!==null?[]:(L(e,0),c.events=Ic(s,c.events,c),c.events)}function p(P,$){return Pj(f(P),$)}function f(P){return Fj(o,P)}function m(){const{_bufferIndex:P,_index:$,line:q,column:O,offset:I}=n;return{_bufferIndex:P,_index:$,line:q,column:O,offset:I}}function x(P){i[P.line]=P.column,N()}function g(){let P;for(;n._index<o.length;){const $=o[n._index];if(typeof $=="string")for(P=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===P&&n._bufferIndex<$.length;)y($.charCodeAt(n._bufferIndex));else y($)}}function y(P){u=u(P)}function b(P){Lt(P)?(n.line++,n.column=1,n.offset+=P===-3?2:1,N()):P!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=P}function k(P,$){const q=$||{};return q.type=P,q.start=m(),c.events.push(["enter",q,c]),a.push(q),q}function T(P){const $=a.pop();return $.end=m(),c.events.push(["exit",$,c]),$}function _(P,$){L(P,$.from)}function w(P,$){$.restore()}function E(P,$){return q;function q(O,I,F){let D,R,j,S;return Array.isArray(O)?Q(O):"tokenize"in O?Q([O]):U(O);function U(ot){return It;function It(ht){const at=ht!==null&&ot[ht],K=ht!==null&&ot.null,lt=[...Array.isArray(at)?at:at?[at]:[],...Array.isArray(K)?K:K?[K]:[]];return Q(lt)(ht)}}function Q(ot){return D=ot,R=0,ot.length===0?F:A(ot[R])}function A(ot){return It;function It(ht){return S=M(),j=ot,ot.partial||(c.currentConstruct=ot),ot.name&&c.parser.constructs.disable.null.includes(ot.name)?ut():ot.tokenize.call($?Object.assign(Object.create(c),$):c,l,rt,ut)(ht)}}function rt(ot){return P(j,S),I}function ut(ot){return S.restore(),++R<D.length?A(D[R]):F}}}function L(P,$){P.resolveAll&&!s.includes(P)&&s.push(P),P.resolve&&wr(c.events,$,c.events.length-$,P.resolve(c.events.slice($),c)),P.resolveTo&&(c.events=P.resolveTo(c.events,c))}function M(){const P=m(),$=c.previous,q=c.currentConstruct,O=c.events.length,I=Array.from(a);return{from:O,restore:F};function F(){n=P,c.previous=$,c.currentConstruct=q,c.events.length=O,a=I,N()}}function N(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function Fj(t,e){const r=e.start._index,n=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(r===i)o=[t[r].slice(n,s)];else{if(o=t.slice(r,i),n>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(n):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function Pj(t,e){let r=-1;const n=[];let i;for(;++r<t.length;){const s=t[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
7
+ `;break}case-3:{o=`\r
8
+ `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function Dj(t){const n={constructs:Ay([Mj,...(t||{}).extensions||[]]),content:i(QE),defined:[],document:i(tN),flow:i(yj),lazy:{},string:i(kj),text:i(vj)};return n;function i(s){return o;function o(a){return Ij(n,s,a)}}}function Oj(t){for(;!Dy(t););return t}const Em=/[\0\t\n\r]/g;function Rj(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let c,u,d,p,f;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,e="",r&&(s.charCodeAt(0)===65279&&d++,r=void 0);d<s.length;){if(Em.lastIndex=d,c=Em.exec(s),p=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(p),!c){e=s.slice(d);break}if(f===10&&d===p&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<p&&(l.push(s.slice(d,p)),t+=p-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=p+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const $j=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zj(t){return t.replace($j,Wj)}function Wj(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return My(r.slice(s?2:1),s?16:10)}return gf(r)||t}const qy={}.hasOwnProperty;function qj(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),Hj(r)(Oj(Dj(r).document().write(Rj()(t,e,!0))))}function Hj(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Be),autolinkProtocol:M,autolinkEmail:M,atxHeading:s(ue),blockQuote:s(K),characterEscape:M,characterReference:M,codeFenced:s(lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(lt,o),codeText:s(yt,o),codeTextData:M,data:M,codeFlowValue:M,definition:s(At),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Dt),hardBreakEscape:s(ae),hardBreakTrailing:s(ae),htmlFlow:s(Pe,o),htmlFlowData:M,htmlText:s(Pe,o),htmlTextData:M,image:s(Zt),label:o,link:s(Be),listItem:s(it),listItemValue:p,listOrdered:s(V,d),listUnordered:s(V),paragraph:s(dt),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(ue),strong:s(Nt),thematicBreak:s(kt)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:at,autolinkProtocol:ht,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:ut,characterReferenceMarkerNumeric:ut,characterReferenceValue:ot,characterReference:It,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:N,codeIndented:l(y),codeText:l(I),codeTextData:N,data:N,definition:l(),definitionDestinationString:T,definitionLabelString:b,definitionTitleString:k,emphasis:l(),hardBreakEscape:l($),hardBreakTrailing:l($),htmlFlow:l(q),htmlFlowData:N,htmlText:l(O),htmlTextData:N,image:l(D),label:j,labelText:R,lineEnding:P,link:l(F),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:rt,resourceDestinationString:S,resourceTitleString:U,resource:Q,setextHeading:l(L),setextHeadingLineSequence:E,setextHeadingText:w,strong:l(),thematicBreak:l()}};Hy(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(G){let st={type:"root",children:[]};const St={stack:[st],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:r},Ot=[];let $t=-1;for(;++$t<G.length;)if(G[$t][1].type==="listOrdered"||G[$t][1].type==="listUnordered")if(G[$t][0]==="enter")Ot.push($t);else{const Se=Ot.pop();$t=i(G,Se,$t)}for($t=-1;++$t<G.length;){const Se=e[G[$t][0]];qy.call(Se,G[$t][1].type)&&Se[G[$t][1].type].call(Object.assign({sliceSerialize:G[$t][2].sliceSerialize},St),G[$t][1])}if(St.tokenStack.length>0){const Se=St.tokenStack[St.tokenStack.length-1];(Se[1]||Nm).call(St,void 0,Se[0])}for(st.position={start:In(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:In(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},$t=-1;++$t<e.transforms.length;)st=e.transforms[$t](st)||st;return st}function i(G,st,St){let Ot=st-1,$t=-1,Se=!1,ar,fe,Er,Oe;for(;++Ot<=St;){const Ce=G[Ot];switch(Ce[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ce[0]==="enter"?$t++:$t--,Oe=void 0;break}case"lineEndingBlank":{Ce[0]==="enter"&&(ar&&!Oe&&!$t&&!Er&&(Er=Ot),Oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Oe=void 0}if(!$t&&Ce[0]==="enter"&&Ce[1].type==="listItemPrefix"||$t===-1&&Ce[0]==="exit"&&(Ce[1].type==="listUnordered"||Ce[1].type==="listOrdered")){if(ar){let lr=Ot;for(fe=void 0;lr--;){const ke=G[lr];if(ke[1].type==="lineEnding"||ke[1].type==="lineEndingBlank"){if(ke[0]==="exit")continue;fe&&(G[fe][1].type="lineEndingBlank",Se=!0),ke[1].type="lineEnding",fe=lr}else if(!(ke[1].type==="linePrefix"||ke[1].type==="blockQuotePrefix"||ke[1].type==="blockQuotePrefixWhitespace"||ke[1].type==="blockQuoteMarker"||ke[1].type==="listItemIndent"))break}Er&&(!fe||Er<fe)&&(ar._spread=!0),ar.end=Object.assign({},fe?G[fe][1].start:Ce[1].end),G.splice(fe||Ot,0,["exit",ar,Ce[2]]),Ot++,St++}if(Ce[1].type==="listItemPrefix"){const lr={type:"listItem",_spread:!1,start:Object.assign({},Ce[1].start),end:void 0};ar=lr,G.splice(Ot,0,["enter",lr,Ce[2]]),Ot++,St++,Er=void 0,Oe=!0}}}return G[st][1]._spread=Se,St}function s(G,st){return St;function St(Ot){a.call(this,G(Ot),Ot),st&&st.call(this,Ot)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(G,st,St){this.stack[this.stack.length-1].children.push(G),this.stack.push(G),this.tokenStack.push([st,St||void 0]),G.position={start:In(st.start),end:void 0}}function l(G){return st;function st(St){G&&G.call(this,St),c.call(this,St)}}function c(G,st){const St=this.stack.pop(),Ot=this.tokenStack.pop();if(Ot)Ot[0].type!==G.type&&(st?st.call(this,G,Ot[0]):(Ot[1]||Nm).call(this,G,Ot[0]));else throw new Error("Cannot close `"+G.type+"` ("+zo({start:G.start,end:G.end})+"): it’s not open");St.position.end=In(G.end)}function u(){return mf(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(G){if(this.data.expectingFirstListItemValue){const st=this.stack[this.stack.length-2];st.start=Number.parseInt(this.sliceSerialize(G),10),this.data.expectingFirstListItemValue=void 0}}function f(){const G=this.resume(),st=this.stack[this.stack.length-1];st.lang=G}function m(){const G=this.resume(),st=this.stack[this.stack.length-1];st.meta=G}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const G=this.resume(),st=this.stack[this.stack.length-1];st.value=G.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const G=this.resume(),st=this.stack[this.stack.length-1];st.value=G.replace(/(\r?\n|\r)$/g,"")}function b(G){const st=this.resume(),St=this.stack[this.stack.length-1];St.label=st,St.identifier=qr(this.sliceSerialize(G)).toLowerCase()}function k(){const G=this.resume(),st=this.stack[this.stack.length-1];st.title=G}function T(){const G=this.resume(),st=this.stack[this.stack.length-1];st.url=G}function _(G){const st=this.stack[this.stack.length-1];if(!st.depth){const St=this.sliceSerialize(G).length;st.depth=St}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function E(G){const st=this.stack[this.stack.length-1];st.depth=this.sliceSerialize(G).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function M(G){const St=this.stack[this.stack.length-1].children;let Ot=St[St.length-1];(!Ot||Ot.type!=="text")&&(Ot=et(),Ot.position={start:In(G.start),end:void 0},St.push(Ot)),this.stack.push(Ot)}function N(G){const st=this.stack.pop();st.value+=this.sliceSerialize(G),st.position.end=In(G.end)}function P(G){const st=this.stack[this.stack.length-1];if(this.data.atHardBreak){const St=st.children[st.children.length-1];St.position.end=In(G.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(st.type)&&(M.call(this,G),N.call(this,G))}function $(){this.data.atHardBreak=!0}function q(){const G=this.resume(),st=this.stack[this.stack.length-1];st.value=G}function O(){const G=this.resume(),st=this.stack[this.stack.length-1];st.value=G}function I(){const G=this.resume(),st=this.stack[this.stack.length-1];st.value=G}function F(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const st=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=st,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function D(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const st=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=st,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function R(G){const st=this.sliceSerialize(G),St=this.stack[this.stack.length-2];St.label=zj(st),St.identifier=qr(st).toLowerCase()}function j(){const G=this.stack[this.stack.length-1],st=this.resume(),St=this.stack[this.stack.length-1];if(this.data.inReference=!0,St.type==="link"){const Ot=G.children;St.children=Ot}else St.alt=st}function S(){const G=this.resume(),st=this.stack[this.stack.length-1];st.url=G}function U(){const G=this.resume(),st=this.stack[this.stack.length-1];st.title=G}function Q(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function rt(G){const st=this.resume(),St=this.stack[this.stack.length-1];St.label=st,St.identifier=qr(this.sliceSerialize(G)).toLowerCase(),this.data.referenceType="full"}function ut(G){this.data.characterReferenceType=G.type}function ot(G){const st=this.sliceSerialize(G),St=this.data.characterReferenceType;let Ot;St?(Ot=My(st,St==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ot=gf(st);const $t=this.stack[this.stack.length-1];$t.value+=Ot}function It(G){const st=this.stack.pop();st.position.end=In(G.end)}function ht(G){N.call(this,G);const st=this.stack[this.stack.length-1];st.url=this.sliceSerialize(G)}function at(G){N.call(this,G);const st=this.stack[this.stack.length-1];st.url="mailto:"+this.sliceSerialize(G)}function K(){return{type:"blockquote",children:[]}}function lt(){return{type:"code",lang:null,meta:null,value:""}}function yt(){return{type:"inlineCode",value:""}}function At(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Dt(){return{type:"emphasis",children:[]}}function ue(){return{type:"heading",depth:0,children:[]}}function ae(){return{type:"break"}}function Pe(){return{type:"html",value:""}}function Zt(){return{type:"image",title:null,url:"",alt:null}}function Be(){return{type:"link",title:null,url:"",children:[]}}function V(G){return{type:"list",ordered:G.type==="listOrdered",start:null,spread:G._spread,children:[]}}function it(G){return{type:"listItem",spread:G._spread,checked:null,children:[]}}function dt(){return{type:"paragraph",children:[]}}function Nt(){return{type:"strong",children:[]}}function et(){return{type:"text",value:""}}function kt(){return{type:"thematicBreak"}}}function In(t){return{line:t.line,column:t.column,offset:t.offset}}function Hy(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?Hy(t,n):Uj(t,n)}}function Uj(t,e){let r;for(r in e)if(qy.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function Nm(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+zo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+zo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+zo({start:e.start,end:e.end})+") is still open")}function Gj(t){const e=this;e.parser=r;function r(n){return qj(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Vj(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function Yj(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
9
+ `}]}function Xj(t,e){const r=e.value?e.value+`
10
+ `:"",n={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Kj(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Zj(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Qj(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Vs(n.toLowerCase()),s=t.footnoteOrder.indexOf(n);let o,a=t.footnoteCounts.get(n);a===void 0?(a=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(n,a);const l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function Jj(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function t5(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function Uy(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function e5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Uy(t,e);const i={src:Vs(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function r5(t,e){const r={src:Vs(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function n5(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function i5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Uy(t,e);const i={href:Vs(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function s5(t,e){const r={href:Vs(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function o5(t,e,r){const n=t.all(e),i=r?a5(r):Gy(e),s={},o=[];if(typeof e.checked=="boolean"){const u=n[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<n.length;){const u=n[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
11
+ `}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
12
+ `});const c={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,c),t.applyData(e,c)}function a5(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=Gy(r[n])}return e}function Gy(t){const e=t.spread;return e??t.children.length>1}function l5(t,e){const r={},n=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,s),t.applyData(e,s)}function c5(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function h5(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function u5(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function d5(t,e){const r=t.all(e),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},a=uf(e.children[1]),l=Ty(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function f5(t,e,r){const n=r?r.children:void 0,s=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const d=e.children[l],p={},f=o?o[l]:void 0;f&&(p.align=f);let m={type:"element",tagName:s,properties:p,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function p5(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const jm=9,Lm=32;function m5(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Bm(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Bm(e.slice(i),i>0,!1)),s.join("")}function Bm(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===jm||s===Lm;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===jm||s===Lm;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function g5(t,e){const r={type:"text",value:m5(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function x5(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const y5={blockquote:Vj,break:Yj,code:Xj,delete:Kj,emphasis:Zj,footnoteReference:Qj,heading:Jj,html:t5,imageReference:e5,image:r5,inlineCode:n5,linkReference:i5,link:s5,listItem:o5,list:l5,paragraph:c5,root:h5,strong:u5,table:d5,tableCell:p5,tableRow:f5,text:g5,thematicBreak:x5,toml:Oa,yaml:Oa,definition:Oa,footnoteDefinition:Oa};function Oa(){}const Vy=-1,Fc=0,qo=1,Ol=2,yf=3,bf=4,Cf=5,kf=6,Yy=7,Xy=8,b5=typeof self=="object"?self:globalThis,Am=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new b5[t](e)},C5=(t,e)=>{const r=(i,s)=>(t.set(s,i),i),n=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Fc:case Vy:return r(o,i);case qo:{const a=r([],i);for(const l of o)a.push(n(l));return a}case Ol:{const a=r({},i);for(const[l,c]of o)a[n(l)]=n(c);return a}case yf:return r(new Date(o),i);case bf:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case Cf:{const a=r(new Map,i);for(const[l,c]of o)a.set(n(l),n(c));return a}case kf:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case Yy:{const{name:a,message:l}=o;return r(Am(a,l),i)}case Xy:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return r(new DataView(a),o)}}return r(Am(s,o),i)};return n},Mm=t=>C5(new Map,t)(0),qi="",{toString:k5}={},{keys:v5}=Object,fo=t=>{const e=typeof t;if(e!=="object"||!t)return[Fc,e];const r=k5.call(t).slice(8,-1);switch(r){case"Array":return[qo,qi];case"Object":return[Ol,qi];case"Date":return[yf,qi];case"RegExp":return[bf,qi];case"Map":return[Cf,qi];case"Set":return[kf,qi];case"DataView":return[qo,r]}return r.includes("Array")?[qo,r]:r.includes("Error")?[Yy,r]:[Ol,r]},Ra=([t,e])=>t===Fc&&(e==="function"||e==="symbol"),w5=(t,e,r,n)=>{const i=(o,a)=>{const l=n.push(o)-1;return r.set(a,l),l},s=o=>{if(r.has(o))return r.get(o);let[a,l]=fo(o);switch(a){case Fc:{let u=o;switch(l){case"bigint":a=Xy,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([Vy],o)}return i([a,u],o)}case qo:{if(l){let p=o;return l==="DataView"?p=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(o)),i([l,[...p]],o)}const u=[],d=i([a,u],o);for(const p of o)u.push(s(p));return d}case Ol:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const u=[],d=i([a,u],o);for(const p of v5(o))(t||!Ra(fo(o[p])))&&u.push([s(p),s(o[p])]);return d}case yf:return i([a,o.toISOString()],o);case bf:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case Cf:{const u=[],d=i([a,u],o);for(const[p,f]of o)(t||!(Ra(fo(p))||Ra(fo(f))))&&u.push([s(p),s(f)]);return d}case kf:{const u=[],d=i([a,u],o);for(const p of o)(t||!Ra(fo(p)))&&u.push(s(p));return d}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},Im=(t,{json:e,lossy:r}={})=>{const n=[];return w5(!(e||r),!!e,new Map,n)(t),n},Rl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Mm(Im(t,e)):structuredClone(t):(t,e)=>Mm(Im(t,e));function S5(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function T5(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function _5(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||S5,n=t.options.footnoteBackLabel||T5,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const u=t.all(c),d=String(c.identifier).toUpperCase(),p=Vs(d.toLowerCase());let f=0;const m=[],x=t.footnoteCounts.get(d);for(;x!==void 0&&++f<=x;){m.length>0&&m.push({type:"text",value:" "});let b=typeof r=="string"?r:r(l,f);typeof b=="string"&&(b={type:"text",value:b}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const b=g.children[g.children.length-1];b&&b.type==="text"?b.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...m)}else u.push(...m);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(u,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Rl(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
13
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
14
+ `}]}}const Pc=(function(t){if(t==null)return L5;if(typeof t=="function")return Dc(t);if(typeof t=="object")return Array.isArray(t)?E5(t):N5(t);if(typeof t=="string")return j5(t);throw new Error("Expected function, string, or object as test")});function E5(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=Pc(t[r]);return Dc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function N5(t){const e=t;return Dc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function j5(t){return Dc(e);function e(r){return r&&r.type===t}}function Dc(t){return e;function e(r,n,i){return!!(B5(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function L5(){return!0}function B5(t){return t!==null&&typeof t=="object"&&"type"in t}const Ky=[],A5=!0,Wu=!1,M5="skip";function Zy(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=Pc(i),o=n?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Ky,m,x,g;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=I5(r(l,u)),f[0]===Wu))return f;if("children"in l&&l.children){const y=l;if(y.children&&f[0]!==M5)for(x=(n?y.children.length:-1)+o,g=u.concat(y);x>-1&&x<y.children.length;){const b=y.children[x];if(m=a(b,x,g)(),m[0]===Wu)return m;x=typeof m[1]=="number"?m[1]:x+o}}return f}}}function I5(t){return Array.isArray(t)?t:typeof t=="number"?[A5,t]:t==null?Ky:[t]}function vf(t,e,r,n){let i,s,o;typeof e=="function"&&typeof r!="function"?(s=void 0,o=e,i=r):(s=e,o=r,i=n),Zy(t,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const qu={}.hasOwnProperty,F5={};function P5(t,e){const r=e||F5,n=new Map,i=new Map,s=new Map,o={...y5,...r.handlers},a={all:c,applyData:O5,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:D5,wrap:$5};return vf(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?n:i,p=String(u.identifier).toUpperCase();d.has(p)||d.set(p,u)}}),a;function l(u,d){const p=u.type,f=a.handlers[p];if(qu.call(a.handlers,p)&&f)return f(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in u){const{children:x,...g}=u,y=Rl(g);return y.children=a.all(u),y}return Rl(u)}return(a.options.unknownHandler||R5)(a,u,d)}function c(u){const d=[];if("children"in u){const p=u.children;let f=-1;for(;++f<p.length;){const m=a.one(p[f],u);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Fm(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=Fm(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function D5(t,e){t.position&&(e.position=SE(t))}function O5(t,e){let r=e;if(t&&t.data){const n=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,Rl(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function R5(t,e){const r=e.data||{},n="value"in e&&!(qu.call(r,"hProperties")||qu.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function $5(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
15
+ `});++n<t.length;)n&&r.push({type:"text",value:`
16
+ `}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
17
+ `}),r}function Fm(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Pm(t,e){const r=P5(t,e),n=r.one(t,void 0),i=_5(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
18
+ `},i),s}function z5(t,e){return t&&"run"in t?async function(r,n){const i=Pm(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Pm(r,{file:n,...t||e})}}function Dm(t){if(t)throw t}var Nh,Om;function W5(){if(Om)return Nh;Om=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var p;for(p in c);return typeof p>"u"||t.call(c,p)},o=function(c,u){r&&u.name==="__proto__"?r(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(n)return n(c,u).value}else return;return c[u]};return Nh=function l(){var c,u,d,p,f,m,x=arguments[0],g=1,y=arguments.length,b=!1;for(typeof x=="boolean"&&(b=x,x=arguments[1]||{},g=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});g<y;++g)if(c=arguments[g],c!=null)for(u in c)d=a(x,u),p=a(c,u),x!==p&&(b&&p&&(s(p)||(f=i(p)))?(f?(f=!1,m=d&&i(d)?d:[]):m=d&&s(d)?d:{},o(x,{name:u,newValue:l(b,m,p)})):typeof p<"u"&&o(x,{name:u,newValue:p}));return x},Nh}var q5=W5();const jh=Ac(q5);function Hu(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function H5(){const t=[],e={run:r,use:n};return e;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const u=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?U5(u,a)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function U5(t,e){let r;return n;function n(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&r)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){r||(r=!0,e(o,...a))}function s(o){i(null,o)}}const rn={basename:G5,dirname:V5,extname:Y5,join:X5,sep:"/"};function G5(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ya(t);let r=0,n=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function V5(t){if(ya(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Y5(t){ya(t);let e=t.length,r=-1,n=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function X5(...t){let e=-1,r;for(;++e<t.length;)ya(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":K5(r)}function K5(t){ya(t);const e=t.codePointAt(0)===47;let r=Z5(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function Z5(t,e){let r="",n=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return r}function ya(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Q5={cwd:J5};function J5(){return"/"}function Uu(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function tL(t){if(typeof t=="string")t=new URL(t);else if(!Uu(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return eL(t)}function eL(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const Lh=["history","path","basename","stem","extname","dirname"];class Qy{constructor(e){let r;e?Uu(e)?r={path:e}:typeof e=="string"||rL(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":Q5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Lh.length;){const s=Lh[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)Lh.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?rn.basename(this.path):void 0}set basename(e){Ah(e,"basename"),Bh(e,"basename"),this.path=rn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?rn.dirname(this.path):void 0}set dirname(e){Rm(this.basename,"dirname"),this.path=rn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?rn.extname(this.path):void 0}set extname(e){if(Bh(e,"extname"),Rm(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=rn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Uu(e)&&(e=tL(e)),Ah(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?rn.basename(this.path,this.extname):void 0}set stem(e){Ah(e,"stem"),Bh(e,"stem"),this.path=rn.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){const i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){const i=new Xe(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Bh(t,e){if(t&&t.includes(rn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+rn.sep+"`")}function Ah(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Rm(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function rL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const nL=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),iL={}.hasOwnProperty;class wf extends nL{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=H5()}copy(){const e=new wf;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(jh(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Fh("data",this.frozen),this.namespace[e]=r,this):iL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Fh("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=$a(e),n=this.parser||this.Parser;return Mh("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Mh("process",this.parser||this.Parser),Ih("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=$a(e),l=n.parse(a);n.run(l,a,function(u,d,p){if(u||!d||!p)return c(u);const f=d,m=n.stringify(f,p);aL(m)?p.value=m:p.result=m,c(u,p)});function c(u,d){u||!d?o(u):s?s(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),Mh("processSync",this.parser||this.Parser),Ih("processSync",this.compiler||this.Compiler),this.process(e,i),zm("processSync","process",r),n;function i(s,o){r=!0,Dm(s),n=o}}run(e,r,n){$m(e),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,a){const l=$a(r);i.run(e,l,c);function c(u,d,p){const f=d||e;u?a(u):o?o(f):n(void 0,f,p)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),zm("runSync","run",n),i;function s(o,a){Dm(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=$a(r),i=this.compiler||this.Compiler;return Ih("stringify",i),$m(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(Fh("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=jh(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===c){p=d;break}if(p===-1)n.push([c,...u]);else if(u.length>0){let[f,...m]=u;const x=n[p][1];Hu(x)&&Hu(f)&&(f=jh(!0,x,f)),n[p]=[c,f,...m]}}}}const sL=new wf().freeze();function Mh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ih(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Fh(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $m(t){if(!Hu(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function zm(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function $a(t){return oL(t)?t:new Qy(t)}function oL(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function aL(t){return typeof t=="string"||lL(t)}function lL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const cL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Wm=[],qm={allowDangerousHtml:!0},hL=/^(https?|ircs?|mailto|xmpp)$/i,uL=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Sf(t){const e=dL(t),r=fL(t);return pL(e.runSync(e.parse(r),r),t)}function dL(t){const e=t.rehypePlugins||Wm,r=t.remarkPlugins||Wm,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...qm}:qm;return sL().use(Gj).use(r).use(z5,n).use(e)}function fL(t){const e=t.children||"",r=new Qy;return typeof e=="string"&&(r.value=e),r}function pL(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||mL;for(const u of uL)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+cL+u.id,void 0);return vf(t,c),jE(t,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,p){if(u.type==="raw"&&p&&typeof d=="number")return o?p.children.splice(d,1):p.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let f;for(f in Th)if(Object.hasOwn(Th,f)&&Object.hasOwn(u.properties,f)){const m=u.properties[f],x=Th[f];(x===null||x.includes(u.tagName))&&(u.properties[f]=l(String(m||""),f,u))}}if(u.type==="element"){let f=r?!r.includes(u.tagName):s?s.includes(u.tagName):!1;if(!f&&n&&typeof d=="number"&&(f=!n(u,d,p)),f&&p&&typeof d=="number")return a&&u.children?p.children.splice(d,1,...u.children):p.children.splice(d,1),d}}}function mL(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||r!==-1&&e>r||n!==-1&&e>n||hL.test(t.slice(0,e))?t:""}function Hm(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function gL(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xL(t,e,r){const i=Pc((r||{}).ignore||[]),s=yL(e);let o=-1;for(;++o<s.length;)Zy(t,"text",a);function a(c,u){let d=-1,p;for(;++d<u.length;){const f=u[d],m=p?p.children:void 0;if(i(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return l(c,u)}function l(c,u){const d=u[u.length-1],p=s[o][0],f=s[o][1];let m=0;const g=d.children.indexOf(c);let y=!1,b=[];p.lastIndex=0;let k=p.exec(c.value);for(;k;){const T=k.index,_={index:k.index,input:k.input,stack:[...u,c]};let w=f(...k,_);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=T+1:(m!==T&&b.push({type:"text",value:c.value.slice(m,T)}),Array.isArray(w)?b.push(...w):w&&b.push(w),m=T+k[0].length,y=!0),!p.global)break;k=p.exec(c.value)}return y?(m<c.value.length&&b.push({type:"text",value:c.value.slice(m)}),d.children.splice(g,1,...b)):b=[c],g+b.length}}function yL(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let n=-1;for(;++n<r.length;){const i=r[n];e.push([bL(i[0]),CL(i[1])])}return e}function bL(t){return typeof t=="string"?new RegExp(gL(t),"g"):t}function CL(t){return typeof t=="function"?t:function(){return t}}const Ph="phrasing",Dh=["autolink","link","image","label"];function kL(){return{transforms:[NL],enter:{literalAutolink:wL,literalAutolinkEmail:Oh,literalAutolinkHttp:Oh,literalAutolinkWww:Oh},exit:{literalAutolink:EL,literalAutolinkEmail:_L,literalAutolinkHttp:SL,literalAutolinkWww:TL}}}function vL(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ph,notInConstruct:Dh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ph,notInConstruct:Dh},{character:":",before:"[ps]",after:"\\/",inConstruct:Ph,notInConstruct:Dh}]}}function wL(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Oh(t){this.config.enter.autolinkProtocol.call(this,t)}function SL(t){this.config.exit.autolinkProtocol.call(this,t)}function TL(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function _L(t){this.config.exit.autolinkEmail.call(this,t)}function EL(t){this.exit(t)}function NL(t){xL(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jL],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),LL]],{ignore:["link","linkReference"]})}function jL(t,e,r,n,i){let s="";if(!Jy(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!BL(r)))return!1;const o=AL(r+n);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function LL(t,e,r,n){return!Jy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function BL(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function AL(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],n=r.indexOf(")");const i=Hm(t,"(");let s=Hm(t,")");for(;n!==-1&&i>s;)t+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[t,r]}function Jy(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||vi(r)||Mc(r))&&(!e||r!==47)}tb.peek=zL;function ML(){this.buffer()}function IL(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function FL(){this.buffer()}function PL(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function DL(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=qr(this.sliceSerialize(t)).toLowerCase(),r.label=e}function OL(t){this.exit(t)}function RL(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=qr(this.sliceSerialize(t)).toLowerCase(),r.label=e}function $L(t){this.exit(t)}function zL(){return"["}function tb(t,e,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),a=r.enter("reference");return s+=i.move(r.safe(r.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function WL(){return{enter:{gfmFootnoteCallString:ML,gfmFootnoteCall:IL,gfmFootnoteDefinitionLabelString:FL,gfmFootnoteDefinition:PL},exit:{gfmFootnoteCallString:DL,gfmFootnoteCall:OL,gfmFootnoteDefinitionLabelString:RL,gfmFootnoteDefinition:$L}}}function qL(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:tb},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return l+=a.move(s.safe(s.associationId(n),{before:l,after:"]"})),u(),l+=a.move("]:"),n.children&&n.children.length>0&&(a.shift(4),l+=a.move((e?`
19
+ `:" ")+s.indentLines(s.containerFlow(n,a.current()),e?eb:HL))),c(),l}}function HL(t,e,r){return e===0?t:eb(t,e,r)}function eb(t,e,r){return(r?"":" ")+t}const UL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];rb.peek=KL;function GL(){return{canContainEols:["delete"],enter:{strikethrough:YL},exit:{strikethrough:XL}}}function VL(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:UL}],handlers:{delete:rb}}}function YL(t){this.enter({type:"delete",children:[]},t)}function XL(t){this.exit(t)}function rb(t,e,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function KL(){return"~"}function ZL(t){return t.length}function QL(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||ZL,s=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const x=[],g=[];let y=-1;for(t[u].length>c&&(c=t[u].length);++y<t[u].length;){const b=JL(t[u][y]);if(r.alignDelimiters!==!1){const k=i(b);g[y]=k,(l[y]===void 0||k>l[y])&&(l[y]=k)}x.push(b)}o[u]=x,a[u]=g}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<c;)s[d]=Um(n[d]);else{const x=Um(n);for(;++d<c;)s[d]=x}d=-1;const p=[],f=[];for(;++d<c;){const x=s[d];let g="",y="";x===99?(g=":",y=":"):x===108?g=":":x===114&&(y=":");let b=r.alignDelimiters===!1?1:Math.max(1,l[d]-g.length-y.length);const k=g+"-".repeat(b)+y;r.alignDelimiters!==!1&&(b=g.length+b+y.length,b>l[d]&&(l[d]=b),f[d]=b),p[d]=k}o.splice(1,0,p),a.splice(1,0,f),u=-1;const m=[];for(;++u<o.length;){const x=o[u],g=a[u];d=-1;const y=[];for(;++d<c;){const b=x[d]||"";let k="",T="";if(r.alignDelimiters!==!1){const _=l[d]-(g[d]||0),w=s[d];w===114?k=" ".repeat(_):w===99?_%2?(k=" ".repeat(_/2+.5),T=" ".repeat(_/2-.5)):(k=" ".repeat(_/2),T=k):T=" ".repeat(_)}r.delimiterStart!==!1&&!d&&y.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&b==="")&&(r.delimiterStart!==!1||d)&&y.push(" "),r.alignDelimiters!==!1&&y.push(k),y.push(b),r.alignDelimiters!==!1&&y.push(T),r.padding!==!1&&y.push(" "),(r.delimiterEnd!==!1||d!==c-1)&&y.push("|")}m.push(r.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
20
+ `)}function JL(t){return t==null?"":String(t)}function Um(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function tB(t,e,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(t,s.current()),eB);return i(),o}function eB(t,e,r){return">"+(r?"":" ")+t}function rB(t,e){return Gm(t,e.inConstruct,!0)&&!Gm(t,e.notInConstruct,!1)}function Gm(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let n=-1;for(;++n<e.length;)if(t.includes(e[n]))return!0;return!1}function Vm(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
21
+ `&&rB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
22
+ `}function nB(t,e){const r=String(t);let n=r.indexOf(e),i=n,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+e.length,n=r.indexOf(e,i);return o}function iB(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function sB(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function oB(t,e,r,n){const i=sB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(iB(t,r)){const d=r.enter("codeIndented"),p=r.indentLines(s,aB);return d(),p}const a=r.createTracker(n),l=i.repeat(Math.max(nB(s,i)+1,3)),c=r.enter("codeFenced");let u=a.move(l);if(t.lang){const d=r.enter(`codeFencedLang${o}`);u+=a.move(r.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=r.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(r.safe(t.meta,{before:u,after:`
23
+ `,encode:["`"],...a.current()})),d()}return u+=a.move(`
24
+ `),s&&(u+=a.move(s+`
25
+ `)),u+=a.move(l),c(),u}function aB(t,e,r){return(r?"":" ")+t}function Tf(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function lB(t,e,r,n){const i=Tf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("[");return c+=l.move(r.safe(r.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":`
26
+ `,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}function cB(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function ea(t){return"&#x"+t.toString(16).toUpperCase()+";"}function $l(t,e,r){const n=Ms(t),i=Ms(e);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}nb.peek=hB;function nb(t,e,r,n){const i=cB(r),s=r.enter("emphasis"),o=r.createTracker(n),a=o.move(i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=$l(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=ea(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=$l(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+ea(d));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function hB(t,e,r){return r.options.emphasis||"*"}function uB(t,e){let r=!1;return vf(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Wu}),!!((!t.depth||t.depth<3)&&mf(t)&&(e.options.setext||r))}function dB(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(uB(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),p=r.containerPhrasing(t,{...s.current(),before:`
27
+ `,after:`
28
+ `});return d(),u(),p+`
29
+ `+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
30
+ `))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let c=r.containerPhrasing(t,{before:"# ",after:`
31
+ `,...s.current()});return/^[\t ]/.test(c)&&(c=ea(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),l(),a(),c}ib.peek=fB;function ib(t){return t.value||""}function fB(){return"<"}sb.peek=pB;function sb(t,e,r,n){const i=Tf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("![");return c+=l.move(r.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function pB(){return"!"}ob.peek=mB;function ob(t,e,r,n){const i=t.referenceType,s=r.enter("imageReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("![");const c=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function mB(){return"!"}ab.peek=gB;function ab(t,e,r){let n=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],a=r.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(n);){let c=l.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(l.index+1)}}return i+n+i}function gB(){return"`"}function lb(t,e){const r=mf(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}cb.peek=xB;function cb(t,e,r,n){const i=Tf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(lb(t,r)){const u=r.stack;r.stack=[],a=r.enter("autolink");let d=o.move("<");return d+=o.move(r.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),r.stack=u,d}a=r.enter("link"),l=r.enter("label");let c=o.move("[");return c+=o.move(r.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=r.enter("destinationRaw"),c+=o.move(r.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(t.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function xB(t,e,r){return lb(t,r)?"<":"["}hb.peek=yB;function hb(t,e,r,n){const i=t.referenceType,s=r.enter("linkReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("[");const c=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function yB(){return"["}function _f(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function bB(t){const e=_f(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}function CB(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function ub(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function kB(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?CB(r):_f(r);const a=t.ordered?o==="."?")":".":bB(r);let l=e&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),ub(r)===o&&u){let d=-1;for(;++d<t.children.length;){const p=t.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),r.bulletCurrent=o;const c=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),c}function vB(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function wB(t,e,r,n){const i=vB(r);let s=r.bulletCurrent||_f(r);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=r.createTracker(n);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=r.enter("listItem"),c=r.indentLines(r.containerFlow(t,a.current()),u);return l(),c;function u(d,p,f){return p?(f?"":" ".repeat(o))+d:(f?s:s+" ".repeat(o-s.length))+d}}function SB(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const TB=Pc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _B(t,e,r,n){return(t.children.some(function(o){return TB(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function EB(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}db.peek=NB;function db(t,e,r,n){const i=EB(r),s=r.enter("strong"),o=r.createTracker(n),a=o.move(i+i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=$l(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=ea(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=$l(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+ea(d));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function NB(t,e,r){return r.options.strong||"*"}function jB(t,e,r,n){return r.safe(t.value,n)}function LB(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function BB(t,e,r){const n=(ub(r)+(r.options.ruleSpaces?" ":"")).repeat(LB(r));return r.options.ruleSpaces?n.slice(0,-1):n}const fb={blockquote:tB,break:Vm,code:oB,definition:lB,emphasis:nb,hardBreak:Vm,heading:dB,html:ib,image:sb,imageReference:ob,inlineCode:ab,link:cb,linkReference:hb,list:kB,listItem:wB,paragraph:SB,root:_B,strong:db,text:jB,thematicBreak:BB};function AB(){return{enter:{table:MB,tableData:Ym,tableHeader:Ym,tableRow:FB},exit:{codeText:PB,table:IB,tableData:Rh,tableHeader:Rh,tableRow:Rh}}}function MB(t){const e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function IB(t){this.exit(t),this.data.inTable=void 0}function FB(t){this.enter({type:"tableRow",children:[]},t)}function Rh(t){this.exit(t)}function Ym(t){this.enter({type:"tableCell",children:[]},t)}function PB(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,DB));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function DB(t,e){return e==="|"?e:t}function OB(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
32
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:l,tableRow:a}};function o(f,m,x,g){return c(u(f,x,g),f.align)}function a(f,m,x,g){const y=d(f,x,g),b=c([y]);return b.slice(0,b.indexOf(`
33
+ `))}function l(f,m,x,g){const y=x.enter("tableCell"),b=x.enter("phrasing"),k=x.containerPhrasing(f,{...g,before:s,after:s});return b(),y(),k}function c(f,m){return QL(f,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function u(f,m,x){const g=f.children;let y=-1;const b=[],k=m.enter("table");for(;++y<g.length;)b[y]=d(g[y],m,x);return k(),b}function d(f,m,x){const g=f.children;let y=-1;const b=[],k=m.enter("tableRow");for(;++y<g.length;)b[y]=l(g[y],f,m,x);return k(),b}function p(f,m,x){let g=fb.inlineCode(f,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function RB(){return{exit:{taskListCheckValueChecked:Xm,taskListCheckValueUnchecked:Xm,paragraph:zB}}}function $B(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:WB}}}function Xm(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function zB(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(t)}function WB(t,e,r,n){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=r.createTracker(n);s&&a.move(o);let l=fb.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function qB(){return[kL(),WL(),GL(),AB(),RB()]}function HB(t){return{extensions:[vL(),qL(t),VL(),OB(t),$B()]}}const UB={tokenize:ZB,partial:!0},pb={tokenize:QB,partial:!0},mb={tokenize:JB,partial:!0},gb={tokenize:tA,partial:!0},GB={tokenize:eA,partial:!0},xb={name:"wwwAutolink",tokenize:XB,previous:bb},yb={name:"protocolAutolink",tokenize:KB,previous:Cb},_n={name:"emailAutolink",tokenize:YB,previous:kb},cn={};function VB(){return{text:cn}}let ci=48;for(;ci<123;)cn[ci]=_n,ci++,ci===58?ci=65:ci===91&&(ci=97);cn[43]=_n;cn[45]=_n;cn[46]=_n;cn[95]=_n;cn[72]=[_n,yb];cn[104]=[_n,yb];cn[87]=[_n,xb];cn[119]=[_n,xb];function YB(t,e,r){const n=this;let i,s;return o;function o(d){return!Gu(d)||!kb.call(n,n.previous)||Ef(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return Gu(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(GB,u,c)(d):d===45||d===95||Ve(d)?(s=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return s&&i&&tr(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function XB(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!bb.call(n,n.previous)||Ef(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(UB,t.attempt(pb,t.attempt(mb,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function KB(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&Cb.call(n,n.previous)&&!Ef(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(tr(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),s?c:(s=!0,l)):r(d)}function c(d){return d===null||Dl(d)||he(d)||vi(d)||Mc(d)?r(d):t.attempt(pb,t.attempt(mb,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function ZB(t,e,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,t.consume(o),i):o===46&&n===3?(t.consume(o),s):r(o)}function s(o){return o===null?r(o):e(o)}}function QB(t,e,r){let n,i,s;return o;function o(c){return c===46||c===95?t.check(gb,l,a)(c):c===null||he(c)||vi(c)||c!==45&&Mc(c)?l(c):(s=!0,t.consume(c),o)}function a(c){return c===95?n=!0:(i=n,n=void 0),t.consume(c),o}function l(c){return i||n||!s?r(c):e(c)}}function JB(t,e){let r=0,n=0;return i;function i(o){return o===40?(r++,t.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(gb,e,s)(o):o===null||he(o)||vi(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function tA(t,e,r){return n;function n(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),n):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||he(a)||vi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||he(a)||vi(a)?e(a):n(a)}function s(a){return tr(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):tr(a)?(t.consume(a),o):r(a)}}function eA(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ve(s)?r(s):e(s)}}function bb(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||he(t)}function Cb(t){return!tr(t)}function kb(t){return!(t===47||Gu(t))}function Gu(t){return t===43||t===45||t===46||t===95||Ve(t)}function Ef(t){let e=t.length,r=!1;for(;e--;){const n=t[e][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const rA={tokenize:hA,partial:!0};function nA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aA,continuation:{tokenize:lA},exit:cA}},text:{91:{name:"gfmFootnoteCall",tokenize:oA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iA,resolveTo:sA}}}}function iA(t,e,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const l=n.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return r(l);const c=qr(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function sA(t,e){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...a),t}function oA(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||he(d))return r(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(qr(n.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return he(d)||(o=!0),s++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,c):c(d)}}function aA(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||he(m))return r(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return s=qr(n.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return he(m)||(a=!0),o++,t.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(s)||i.push(s),te(t,f,"gfmFootnoteDefinitionWhitespace")):r(m)}function f(m){return e(m)}}function lA(t,e,r){return t.check(xa,e,t.attempt(rA,e,r))}function cA(t){t.exit("gfmFootnoteDefinition")}function hA(t,e,r){const n=this;return te(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):r(s)}}function uA(t){let r=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},p=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&wr(p,p.length,0,Ic(f,o.slice(c+1,l),a)),wr(p,p.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),wr(o,c-1,l-c+3,p),l=c+p.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let d=0;return p;function p(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const x=Ms(c);if(m===126)return d>1?l(m):(o.consume(m),d++,f);if(d<2&&!r)return l(m);const g=o.exit("strikethroughSequenceTemporary"),y=Ms(m);return g._open=!y||y===2&&!!x,g._close=!x||x===2&&!!y,a(m)}}}class dA{constructor(){this.map=[]}add(e,r,n){fA(this,e,r,n)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];n.push(e.slice()),e.length=0;let i=n.pop();for(;i;){for(const s of i)e.push(s);i=n.pop()}this.map.length=0}}function fA(t,e,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=r,t.map[i][2].push(...n);return}i+=1}t.map.push([e,r,n])}}function pA(t,e){let r=!1;const n=[];for(;e<t.length;){const i=t[e];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return n}function mA(){return{flow:{null:{name:"table",tokenize:gA,resolveAll:xA}}}}function gA(t,e,r){const n=this;let i=0,s=0,o;return a;function a(N){let P=n.events.length-1;for(;P>-1;){const O=n.events[P][1].type;if(O==="lineEnding"||O==="linePrefix")P--;else break}const $=P>-1?n.events[P][1].type:null,q=$==="tableHead"||$==="tableRow"?w:l;return q===w&&n.parser.lazy[n.now().line]?r(N):q(N)}function l(N){return t.enter("tableHead"),t.enter("tableRow"),c(N)}function c(N){return N===124||(o=!0,s+=1),u(N)}function u(N){return N===null?r(N):Lt(N)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),f):r(N):Kt(N)?te(t,u,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(N)))}function d(N){return N===null||N===124||he(N)?(t.exit("data"),u(N)):(t.consume(N),N===92?p:d)}function p(N){return N===92||N===124?(t.consume(N),d):d(N)}function f(N){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(N):(t.enter("tableDelimiterRow"),o=!1,Kt(N)?te(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?g(N):N===124?(o=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),x):_(N)}function x(N){return Kt(N)?te(t,g,"whitespace")(N):g(N)}function g(N){return N===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),y):N===45?(s+=1,y(N)):N===null||Lt(N)?T(N):_(N)}function y(N){return N===45?(t.enter("tableDelimiterFiller"),b(N)):_(N)}function b(N){return N===45?(t.consume(N),b):N===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),k):(t.exit("tableDelimiterFiller"),k(N))}function k(N){return Kt(N)?te(t,T,"whitespace")(N):T(N)}function T(N){return N===124?m(N):N===null||Lt(N)?!o||i!==s?_(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):_(N)}function _(N){return r(N)}function w(N){return t.enter("tableRow"),E(N)}function E(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),E):N===null||Lt(N)?(t.exit("tableRow"),e(N)):Kt(N)?te(t,E,"whitespace")(N):(t.enter("data"),L(N))}function L(N){return N===null||N===124||he(N)?(t.exit("data"),E(N)):(t.consume(N),N===92?M:L)}function M(N){return N===92||N===124?(t.consume(N),L):L(N)}}function xA(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const p=new dA;for(;++r<t.length;){const f=t[r],m=f[1];f[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(Km(p,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(r,0,[["enter",c,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,d=void 0,s=[0,0,0,0],o=[0,r+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(r,0,[["enter",u,e]])),i=m.type==="tableDelimiterRow"?2:u?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=za(p,e,s,i,void 0,d),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],d=za(p,e,s,i,void 0,d)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(a=!0,l=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=r,s[1]!==0?(o[0]=o[1],d=za(p,e,s,i,r,d)):o[1]!==0&&(d=za(p,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&Km(p,e,l,c,u),p.consume(e.events),r=-1;++r<e.events.length;){const f=e.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=pA(e.events,r))}return t}function za(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},ns(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=ns(e.events,r[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",s,e]]),r[2]!==0){const c=ns(e.events,r[2]),u=ns(e.events,r[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){const p=e.events[r[2]],f=e.events[r[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,x=r[3]-r[2]-1;t.add(m,x,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},ns(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function Km(t,e,r,n,i){const s=[],o=ns(e.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),n.end=Object.assign({},o),s.push(["exit",n,e]),t.add(r+1,0,s)}function ns(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const yA={name:"tasklistCheck",tokenize:CA};function bA(){return{text:{91:yA}}}function CA(t,e,r){const n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return he(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):r(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):r(l)}function a(l){return Lt(l)?e(l):Kt(l)?t.check({tokenize:kA},e,r)(l):r(l)}}function kA(t,e,r){return te(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function vA(t){return Ay([VB(),nA(),uA(t),mA(),bA()])}const wA={};function Nf(t){const e=this,r=t||wA,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(vA(r)),s.push(qB()),o.push(HB(r))}/**
34
+ * @license lucide-react v0.563.0 - ISC
35
+ *
36
+ * This source code is licensed under the ISC license.
37
+ * See the LICENSE file in the root directory of this source tree.
38
+ */const vb=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
39
+ * @license lucide-react v0.563.0 - ISC
40
+ *
41
+ * This source code is licensed under the ISC license.
42
+ * See the LICENSE file in the root directory of this source tree.
43
+ */const SA=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
44
+ * @license lucide-react v0.563.0 - ISC
45
+ *
46
+ * This source code is licensed under the ISC license.
47
+ * See the LICENSE file in the root directory of this source tree.
48
+ */const TA=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());/**
49
+ * @license lucide-react v0.563.0 - ISC
50
+ *
51
+ * This source code is licensed under the ISC license.
52
+ * See the LICENSE file in the root directory of this source tree.
53
+ */const Zm=t=>{const e=TA(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
54
+ * @license lucide-react v0.563.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ */var _A={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
59
+ * @license lucide-react v0.563.0 - ISC
60
+ *
61
+ * This source code is licensed under the ISC license.
62
+ * See the LICENSE file in the root directory of this source tree.
63
+ */const EA=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
64
+ * @license lucide-react v0.563.0 - ISC
65
+ *
66
+ * This source code is licensed under the ISC license.
67
+ * See the LICENSE file in the root directory of this source tree.
68
+ */const NA=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},l)=>C.createElement("svg",{ref:l,..._A,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:vb("lucide",i),...!s&&!EA(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,u])=>C.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
69
+ * @license lucide-react v0.563.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const jt=(t,e)=>{const r=C.forwardRef(({className:n,...i},s)=>C.createElement(NA,{ref:s,iconNode:e,className:vb(`lucide-${SA(Zm(t))}`,`lucide-${t}`,n),...i}));return r.displayName=Zm(t),r};/**
74
+ * @license lucide-react v0.563.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */const jA=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],jf=jt("activity",jA);/**
79
+ * @license lucide-react v0.563.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const LA=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],BA=jt("arrow-down-to-line",LA);/**
84
+ * @license lucide-react v0.563.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const AA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],MA=jt("arrow-left",AA);/**
89
+ * @license lucide-react v0.563.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const IA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],wb=jt("arrow-right",IA);/**
94
+ * @license lucide-react v0.563.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const FA=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],PA=jt("bell",FA);/**
99
+ * @license lucide-react v0.563.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const DA=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],fs=jt("bot",DA);/**
104
+ * @license lucide-react v0.563.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const OA=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],RA=jt("chart-no-axes-column",OA);/**
109
+ * @license lucide-react v0.563.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const $A=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ba=jt("check",$A);/**
114
+ * @license lucide-react v0.563.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const zA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ca=jt("chevron-down",zA);/**
119
+ * @license lucide-react v0.563.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const WA=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Sb=jt("chevron-left",WA);/**
124
+ * @license lucide-react v0.563.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const qA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Is=jt("chevron-right",qA);/**
129
+ * @license lucide-react v0.563.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const HA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Tb=jt("chevron-up",HA);/**
134
+ * @license lucide-react v0.563.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const UA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],GA=jt("circle-check-big",UA);/**
139
+ * @license lucide-react v0.563.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const VA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_b=jt("circle-check",VA);/**
144
+ * @license lucide-react v0.563.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const YA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],XA=jt("circle-x",YA);/**
149
+ * @license lucide-react v0.563.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const KA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ZA=jt("circle",KA);/**
154
+ * @license lucide-react v0.563.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const QA=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Eb=jt("clock",QA);/**
159
+ * @license lucide-react v0.563.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const JA=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Lf=jt("cpu",JA);/**
164
+ * @license lucide-react v0.563.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const tM=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nb=jt("eye",tM);/**
169
+ * @license lucide-react v0.563.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const eM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Mi=jt("file-text",eM);/**
174
+ * @license lucide-react v0.563.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const rM=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],nM=jt("folder-open",rM);/**
179
+ * @license lucide-react v0.563.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const iM=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Bf=jt("folder",iM);/**
184
+ * @license lucide-react v0.563.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const sM=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],oM=jt("funnel",sM);/**
189
+ * @license lucide-react v0.563.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const aM=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],jb=jt("git-branch",aM);/**
194
+ * @license lucide-react v0.563.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const lM=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],cM=jt("inbox",lM);/**
199
+ * @license lucide-react v0.563.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const hM=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],uM=jt("layers",hM);/**
204
+ * @license lucide-react v0.563.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const dM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],fM=jt("layout-dashboard",dM);/**
209
+ * @license lucide-react v0.563.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const pM=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],wi=jt("lightbulb",pM);/**
214
+ * @license lucide-react v0.563.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const mM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],gM=jt("link-2",mM);/**
219
+ * @license lucide-react v0.563.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const xM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],yM=jt("list",xM);/**
224
+ * @license lucide-react v0.563.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const bM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Lb=jt("loader-circle",bM);/**
229
+ * @license lucide-react v0.563.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const CM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Oc=jt("message-square",CM);/**
234
+ * @license lucide-react v0.563.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const kM=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],vM=jt("moon",kM);/**
239
+ * @license lucide-react v0.563.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const wM=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],SM=jt("network",wM);/**
244
+ * @license lucide-react v0.563.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const TM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Bb=jt("pencil",TM);/**
249
+ * @license lucide-react v0.563.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const _M=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],EM=jt("play",_M);/**
254
+ * @license lucide-react v0.563.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ */const NM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ab=jt("plus",NM);/**
259
+ * @license lucide-react v0.563.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */const jM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],zl=jt("refresh-cw",jM);/**
264
+ * @license lucide-react v0.563.0 - ISC
265
+ *
266
+ * This source code is licensed under the ISC license.
267
+ * See the LICENSE file in the root directory of this source tree.
268
+ */const LM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],BM=jt("save",LM);/**
269
+ * @license lucide-react v0.563.0 - ISC
270
+ *
271
+ * This source code is licensed under the ISC license.
272
+ * See the LICENSE file in the root directory of this source tree.
273
+ */const AM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ei=jt("search",AM);/**
274
+ * @license lucide-react v0.563.0 - ISC
275
+ *
276
+ * This source code is licensed under the ISC license.
277
+ * See the LICENSE file in the root directory of this source tree.
278
+ */const MM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Af=jt("send",MM);/**
279
+ * @license lucide-react v0.563.0 - ISC
280
+ *
281
+ * This source code is licensed under the ISC license.
282
+ * See the LICENSE file in the root directory of this source tree.
283
+ */const IM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ys=jt("shield-check",IM);/**
284
+ * @license lucide-react v0.563.0 - ISC
285
+ *
286
+ * This source code is licensed under the ISC license.
287
+ * See the LICENSE file in the root directory of this source tree.
288
+ */const FM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],PM=jt("shield",FM);/**
289
+ * @license lucide-react v0.563.0 - ISC
290
+ *
291
+ * This source code is licensed under the ISC license.
292
+ * See the LICENSE file in the root directory of this source tree.
293
+ */const DM=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Mb=jt("skip-forward",DM);/**
294
+ * @license lucide-react v0.563.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ */const OM=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Qm=jt("sparkles",OM);/**
299
+ * @license lucide-react v0.563.0 - ISC
300
+ *
301
+ * This source code is licensed under the ISC license.
302
+ * See the LICENSE file in the root directory of this source tree.
303
+ */const RM=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],$M=jt("star",RM);/**
304
+ * @license lucide-react v0.563.0 - ISC
305
+ *
306
+ * This source code is licensed under the ISC license.
307
+ * See the LICENSE file in the root directory of this source tree.
308
+ */const zM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],WM=jt("sun",zM);/**
309
+ * @license lucide-react v0.563.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */const qM=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],HM=jt("terminal",qM);/**
314
+ * @license lucide-react v0.563.0 - ISC
315
+ *
316
+ * This source code is licensed under the ISC license.
317
+ * See the LICENSE file in the root directory of this source tree.
318
+ */const UM=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Jm=jt("trash-2",UM);/**
319
+ * @license lucide-react v0.563.0 - ISC
320
+ *
321
+ * This source code is licensed under the ISC license.
322
+ * See the LICENSE file in the root directory of this source tree.
323
+ */const GM=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Rc=jt("triangle-alert",GM);/**
324
+ * @license lucide-react v0.563.0 - ISC
325
+ *
326
+ * This source code is licensed under the ISC license.
327
+ * See the LICENSE file in the root directory of this source tree.
328
+ */const VM=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Mf=jt("user",VM);/**
329
+ * @license lucide-react v0.563.0 - ISC
330
+ *
331
+ * This source code is licensed under the ISC license.
332
+ * See the LICENSE file in the root directory of this source tree.
333
+ */const YM=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],XM=jt("workflow",YM);/**
334
+ * @license lucide-react v0.563.0 - ISC
335
+ *
336
+ * This source code is licensed under the ISC license.
337
+ * See the LICENSE file in the root directory of this source tree.
338
+ */const KM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],hn=jt("x",KM);/**
339
+ * @license lucide-react v0.563.0 - ISC
340
+ *
341
+ * This source code is licensed under the ISC license.
342
+ * See the LICENSE file in the root directory of this source tree.
343
+ */const ZM=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Wl=jt("zap",ZM),$c=C.createContext({newIds:new Set,changedIds:new Set}),tg=t=>{let e;const r=new Set,n=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const p=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(f=>f(e,p))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c))},l=e=t(n,i,a);return a},QM=(t=>t?tg(t):tg),JM=t=>t;function tI(t,e=JM){const r=Yt.useSyncExternalStore(t.subscribe,Yt.useCallback(()=>e(t.getState()),[t,e]),Yt.useCallback(()=>e(t.getInitialState()),[t,e]));return Yt.useDebugValue(r),r}const eg=t=>{const e=QM(t),r=n=>tI(e,n);return Object.assign(r,e),r},If=(t=>t?eg(t):eg),po=new Map;function eI(t,e,r){var D,R;const{prevItemMapRef:n,snapshotProviderRef:i,gatesRef:s,pendingResolveIdsRef:o,changeTimerRef:a,sessionEndTimerRef:l,wsRef:c}=e,{setItems:u,setConnections:d,setGates:p,setGateEvent:f,setRecentChanges:m,setUICommand:x,setAgentActivity:g,setAgentErrors:y,setSessionState:b,setSpawnedAgents:k,setAgentRelays:T,setSettings:_,setPipelineDraft:w,setActiveBuild:E,setSessions:L,setIterationStates:M,setFeatureTimeline:N,EMPTY_CHANGES:P,appendDecisionEvent:$,setDecisionEventsSnapshot:q,setStatusSnapshot:O,clearStatusSnapshots:I}=r,F=N?j=>{N(S=>S.some(U=>U.id===j.id)?S:[...S,j])}:null;if(t.type==="visionState"||t.type==="hydrate"){const j=t.items||[];if(n.current){const S=n.current,U=new Set,Q=new Set;for(const A of j){const rt=S.get(A.id);rt?(rt.status!==A.status||rt.confidence!==A.confidence||rt.title!==A.title)&&Q.add(A.id):U.add(A.id)}(U.size>0||Q.size>0)&&(m({newIds:U,changedIds:Q}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(P),800))}n.current=new Map(j.map(S=>[S.id,S])),u(j),d(t.connections||[]),p(t.gates||[]),L&&L(t.sessions||[]),q&&Array.isArray(t.decisionEventsSnapshot)&&q(t.decisionEventsSnapshot),I&&I()}else if(t.type==="decisionEvent")$&&t.event&&$(t.event);else if(t.type==="decisionEventsSnapshot")q&&Array.isArray(t.events)&&q(t.events);else if(t.type==="statusSnapshot")O&&t.featureCode&&t.snapshot&&O(t.featureCode,t.snapshot);else if(t.type==="visionUI")x(t);else if(t.type==="agentActivity")g(j=>{const S=[...j,{tool:t.tool,category:t.category||null,detail:t.detail,items:t.items||[],error:t.error||null,timestamp:t.timestamp}];return S.length>20?S.slice(-20):S}),b(j=>j!=null&&j.active?{...j,toolCount:(j.toolCount||0)+1}:j);else if(t.type==="agentSpawned")k(j=>[...j,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")k(j=>j.map(S=>S.agentId===t.agentId?{...S,silent:!0,silentSinceMs:t.silentSinceMs}:S));else if(t.type==="agentKilled")k(j=>j.map(S=>S.agentId===t.agentId?{...S,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:S));else if(t.type==="agentGC")((D=t.removed)==null?void 0:D.length)>0&&g(j=>{const S=[...j,{tool:"gc",category:"executing",detail:`Cleaned ${t.removed.length} orphan worktree(s)`,items:[],timestamp:t.timestamp}];return S.length>20?S.slice(-20):S});else if(t.type==="agentComplete")k(j=>j.map(S=>S.agentId===t.agentId?S.status==="killed"?S:{...S,status:t.status,completedAt:new Date().toISOString()}:S));else if(t.type==="agentRelay")T(j=>[...j,t].slice(-50));else if(t.type==="sessionStart")l.current&&(clearTimeout(l.current),l.current=null),k(()=>[]),T(()=>[]),b(j=>j&&j.id===t.sessionId?{...j,active:!0}:{id:t.sessionId,active:!0,startedAt:t.timestamp,source:t.source,toolCount:0,errorCount:0,summaries:[],featureCode:null,featureItemId:null,phaseAtBind:null,boundAt:null}),F&&F({id:`session-start-${t.sessionId}`,timestamp:t.timestamp,category:"session",title:"Session started",detail:t.source?`Source: ${t.source}`:null,severity:"info",sessionId:t.sessionId,meta:{source:t.source}});else if(t.type==="sessionEnd")l.current&&(clearTimeout(l.current),l.current=null),b(j=>j?{...j,active:!1,endedAt:t.timestamp,toolCount:t.toolCount,duration:t.duration,journalSpawned:t.journalSpawned,featureCode:t.featureCode||(j==null?void 0:j.featureCode)||null,phaseAtEnd:t.phaseAtEnd||null}:null),l.current=setTimeout(()=>{b(null),l.current=null},3e3),F&&F({id:`session-end-${t.sessionId||Date.now()}`,timestamp:t.timestamp,category:"session",title:`Session ended (${t.toolCount??0} tools)`,detail:null,severity:"info",sessionId:t.sessionId||null,meta:{toolCount:t.toolCount,duration:t.duration}});else if(t.type==="sessionSummary")b(j=>j&&{...j,summaries:[...j.summaries||[],{summary:t.summary,intent:t.intent,component:t.component,timestamp:t.timestamp}].slice(-5)});else if(t.type==="sessionBound")b(j=>j&&{...j,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(j=>{const S=[...j,{errorType:t.errorType,severity:t.severity,message:t.message,tool:t.tool,detail:t.detail,items:t.items||[],timestamp:t.timestamp||new Date().toISOString()}];return S.length>10?S.slice(-10):S}),b(j=>j!=null&&j.active?{...j,errorCount:(j.errorCount||0)+1}:j),F&&F({id:`error-${t.timestamp}-${Math.random().toString(36).slice(2,6)}`,timestamp:t.timestamp||new Date().toISOString(),category:"error",title:t.message||`${t.errorType} error`,detail:t.tool?`Tool: ${t.tool}`:null,severity:t.severity==="error"?"error":"warning",sessionId:null,meta:{type:t.errorType,tool:t.tool}});else if(t.type==="gateCreated"||t.type==="gatePending")f({type:"pending",gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}),F&&F({id:`gate-created-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:t.fromPhase&&t.toPhase?`Gate: ${t.fromPhase} → ${t.toPhase}`:"Gate created",detail:null,severity:"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}});else if(t.type==="gateResolved"){if(p(U=>U.map(Q=>Q.id===t.gateId?{...Q,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:Q)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const U=t.itemId??((R=s.current.find(Q=>Q.id===t.gateId))==null?void 0:R.itemId)??t.gateId;f({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:U})}const j=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,S={approve:"success",revise:"warning",kill:"error"};F&&F({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${j}`,detail:null,severity:S[t.outcome]||"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,outcome:t.outcome}})}else if(t.type==="iterationStarted"||t.type==="iterationUpdate"||t.type==="iterationComplete"){if(g(j=>{let S;t.type==="iterationStarted"?S=`${t.loopType} loop started (0/${t.maxIterations})`:t.type==="iterationComplete"?S=`${t.loopType??"loop"} loop complete (${t.outcome} after ${t.finalCount} iterations)`:S=`${t.loopType??"loop"} iteration ${t.count}/${t.maxIterations}`;const U=[...j,{tool:"iteration",category:t.loopType||"iteration",detail:S,items:[],timestamp:t.timestamp}];return U.length>20?U.slice(-20):U}),t.type==="iterationStarted")po.has(t.loopId)&&(clearTimeout(po.get(t.loopId)),po.delete(t.loopId)),M(j=>{const S=new Map(j);return S.set(t.loopId,{loopId:t.loopId,itemId:t.itemId,loopType:t.loopType,count:0,maxIterations:t.maxIterations,status:"running",outcome:null,startedAt:t.startedAt??t.timestamp,wallClockTimeout:t.wallClockTimeout??null,maxActions:t.maxActions??null}),S});else if(t.type==="iterationUpdate")M(j=>{const S=j.get(t.loopId);if(!S)return j;const U=new Map(j);return U.set(t.loopId,{...S,count:t.count,maxIterations:t.maxIterations}),U});else if(t.type==="iterationComplete"){M(S=>{const U=S.get(t.loopId);if(!U)return S;const Q=new Map(S);return Q.set(t.loopId,{...U,status:"complete",outcome:t.outcome,count:t.finalCount??U.count}),Q});const j=setTimeout(()=>{M(S=>{const U=new Map(S);return U.delete(t.loopId),U}),po.delete(t.loopId)},5e3);po.set(t.loopId,j)}if(t.type==="iterationComplete"&&(t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit")){const j={max_reached:`${t.loopType??"Loop"} hit max iterations (${t.finalCount}) — problem may be in the spec`,timeout:`${t.loopType??"Loop"} timed out after ${t.elapsedMinutes??"?"} minutes (${t.finalCount} iterations)`,action_limit:`${t.loopType??"Loop"} hit action count ceiling (${t.finalCount} iterations)`};y(S=>{const U=[...S,{errorType:"iteration_limit",severity:"warning",message:j[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return U.length>10?U.slice(-10):U}),b(S=>S!=null&&S.active?{...S,errorCount:(S.errorCount||0)+1}:S)}if(F&&(t.type==="iterationStarted"||t.type==="iterationComplete")){const j=t.type==="iterationStarted"?`${t.loopType} loop started (0/${t.maxIterations})`:`${t.loopType??"loop"} loop ${t.outcome} (${t.finalCount} iterations)`;F({id:`iteration-${t.loopId}-${t.type}`,timestamp:t.timestamp,category:"iteration",title:j,detail:null,severity:t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit"?"warning":t.type==="iterationComplete"?"success":"info",sessionId:null,meta:{loopId:t.loopId,loopType:t.loopType}})}}else if(t.type==="lifecycleStarted")F&&F({id:`lifecycle-started-${t.itemId}`,timestamp:t.timestamp,category:"phase",title:`Lifecycle started: ${t.phase}`,detail:t.featureCode?`Feature: ${t.featureCode}`:null,severity:"success",sessionId:null,meta:{itemId:t.itemId,phase:t.phase,featureCode:t.featureCode}});else if(t.type==="lifecycleTransition"){const j=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",S=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";F&&F({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${j}`,detail:null,severity:S,sessionId:null,meta:{itemId:t.itemId,from:t.from,to:t.to,outcome:t.outcome}})}else if(t.type==="openLoopsUpdate")u&&t.itemId&&Array.isArray(t.loops)&&u(j=>j.map(S=>{if(S.id!==t.itemId)return S;const U=S.lifecycle?{...S.lifecycle}:{};return U.lifecycle_ext={...U.lifecycle_ext||{},open_loops:t.loops},{...S,lifecycle:U}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(j=>j.map(S=>{if(S.id!==t.itemId)return S;const U=S.lifecycle?{...S.lifecycle}:{};return U.lifecycle_ext={...U.lifecycle_ext||{},drift_axes:t.drift_axes},{...S,lifecycle:U}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:j,itemId:S,...U}=t;u(Q=>Q.map(A=>{if(A.id!==S)return A;const rt=A.lifecycle?{...A.lifecycle}:{};return rt.lifecycle_ext={...rt.lifecycle_ext||{},branch_lineage:U},{...A,lifecycle:rt}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")_&&_(t.settings||null);else if(t.type==="buildState")E&&E(j=>{const S=(j==null?void 0:j.flowId)&&t.flowId&&j.flowId===t.flowId;return{...t,tierEvents:S?j.tierEvents??[]:[],capabilityEvents:S?j.capabilityEvents??[]:[],...S&&(j==null?void 0:j.health_score)!=null?{health_score:j.health_score,health_breakdown:j.health_breakdown,health_missing:j.health_missing}:{}}});else if(t.type==="pipelineDraft")w&&w(t);else if(t.type==="pipelineDraftResolved")w&&w(null);else if(t.type==="system"&&t.subtype==="health_score")E&&E(j=>j&&{...j,health_score:t.score,health_breakdown:t.breakdown,health_missing:t.missing});else if(t.type==="system"&&(t.subtype==="gate_tier_result"||t.subtype==="gate_tier_failed"||t.subtype==="gate_tier_summary"))E&&E(j=>j&&{...j,tierEvents:[...j.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")E&&E(j=>j&&{...j,capabilityEvents:[...j.capabilityEvents||[],t].slice(-200)});else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:j}=e,S=i.current?i.current():{},U=j?j():{},Q=c.current;Q&&Q.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...S,dom:U,timestamp:new Date().toISOString()}}))}}function rI(){const t=new Set(["SCRIPT","STYLE","LINK","META","NOSCRIPT"]),e=12,r=120;function n(s,o){if(!s||o>e)return null;if(s.nodeType===Node.TEXT_NODE){const p=s.textContent.trim();return p?p.slice(0,r):null}if(s.nodeType!==Node.ELEMENT_NODE||t.has(s.tagName))return null;const a=window.getComputedStyle(s);if(a.display==="none"||a.visibility==="hidden")return null;const l={},c=s.getAttribute("role")||s.getAttribute("aria-label"),u=s.tagName.toLowerCase();if(c?l.role=c:l.tag=u,s.className&&typeof s.className=="string"){const p=s.className.trim();p.length<80&&(l.class=p)}const d=[];for(const p of s.childNodes){const f=n(p,o+1);f&&d.push(f)}return d.length===1&&typeof d[0]=="string"?l.text=d[0]:d.length>0&&(l.children=d),!c&&(u==="div"||u==="span")&&!l.text&&d.length===1&&typeof d[0]=="object"?d[0]:l}const i=document.querySelector("[data-snapshot-root]")||document.body;return n(i,0)}const ye={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},rg={newIds:new Set,changedIds:new Set},mr=If((t,e)=>{async function r(o,a){const l=await zt(o,a),c=await l.json();return l.ok?c:(console.error(`[vision] API error ${l.status}:`,c.error||c),{error:c.error||`HTTP ${l.status}`})}function n(){t({connected:!0}),zt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),zt("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),zt("/api/agents/tree").then(o=>o.json()).then(o=>{e().spawnedAgents.length===0&&t({spawnedAgents:(o.agents||[]).map(l=>({agentId:l.agentId,parentSessionId:l.parentSessionId,agentType:l.agentType,status:l.status||"running",startedAt:l.startedAt,prompt:l.prompt}))})}).catch(()=>{})}function i(o){try{const a=JSON.parse(o.data);eI(a,{prevItemMapRef:{get current(){return ye.prevItemMap},set current(l){ye.prevItemMap=l}},snapshotProviderRef:{get current(){return ye.snapshotProvider},set current(l){ye.snapshotProvider=l}},gatesRef:{get current(){return ye.gates},set current(l){ye.gates=l}},pendingResolveIdsRef:{get current(){return ye.pendingResolveIds},set current(l){ye.pendingResolveIds=l}},changeTimerRef:{get current(){return ye.changeTimer},set current(l){ye.changeTimer=l}},sessionEndTimerRef:{get current(){return ye.sessionEndTimer},set current(l){ye.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=ye.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:rI},{setItems:l=>t(c=>({items:typeof l=="function"?l(c.items):l})),setConnections:l=>t(c=>({connections:typeof l=="function"?l(c.connections):l})),setGates:l=>{t(c=>{const u=typeof l=="function"?l(c.gates):l;return ye.gates=u,{gates:u}})},setGateEvent:l=>t({gateEvent:l}),setRecentChanges:l=>t(c=>({recentChanges:typeof l=="function"?l(c.recentChanges):l})),setUICommand:l=>t({uiCommand:l}),setAgentActivity:l=>t(c=>({agentActivity:typeof l=="function"?l(c.agentActivity):l})),setAgentErrors:l=>{t(c=>{const u=typeof l=="function"?l(c.agentErrors):l,d=Date.now()-6e4,p=u.filter(f=>new Date(f.timestamp).getTime()>d).slice(-5);return{agentErrors:u,recentErrors:p}})},setSessionState:l=>t(c=>({sessionState:typeof l=="function"?l(c.sessionState):l})),setSpawnedAgents:l=>t(c=>({spawnedAgents:typeof l=="function"?l(c.spawnedAgents):l})),setAgentRelays:l=>t(c=>({agentRelays:typeof l=="function"?l(c.agentRelays):l})),setSettings:l=>t({settings:l}),setPipelineDraft:l=>t({pipelineDraft:l}),setActiveBuild:l=>t(c=>({activeBuild:typeof l=="function"?l(c.activeBuild):l})),setSessions:l=>t(c=>({sessions:typeof l=="function"?l(c.sessions):l})),setFeatureTimeline:l=>t(c=>({featureTimeline:typeof l=="function"?l(c.featureTimeline):l})),setIterationStates:l=>t(c=>({iterationStates:typeof l=="function"?l(c.iterationStates):l})),appendDecisionEvent:l=>t(c=>!(l!=null&&l.id)||c.decisionEvents.some(u=>u.id===l.id)?c:{decisionEvents:[...c.decisionEvents,l]}),setDecisionEventsSnapshot:l=>t({decisionEvents:Array.isArray(l)?l:[]}),setStatusSnapshot:(l,c)=>t(u=>({statusSnapshots:{...u.statusSnapshots,[l]:c}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),EMPTY_CHANGES:rg})}catch{}}function s(){if(ye.disposed||ye.ws)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/vision`;ye.ws=g_({url:a,onOpen:n,onMessage:i,onClose:()=>t({connected:!1})})}return zt("/api/session/current").then(o=>o.json()).then(o=>{o.session&&t(a=>a.sessionState?{}:{sessionState:{id:o.session.id,active:!0,startedAt:o.session.startedAt,source:o.session.source||"hydrated",toolCount:o.session.toolCount||0,errorCount:o.session.errorCount||0,summaries:o.session.summaries||[],featureCode:o.session.featureCode||null,featureItemId:o.session.featureItemId||null,phaseAtBind:o.session.phaseAtBind||null,boundAt:o.session.boundAt||null}})}).catch(()=>console.warn("[vision] Failed to hydrate session state")),ye.buildPollInterval=setInterval(()=>{zt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),ye.recentErrorsInterval=setInterval(()=>{const{agentErrors:o}=e(),a=Date.now()-6e4,l=o.filter(c=>new Date(c.timestamp).getTime()>a).slice(-5);t({recentErrors:l})},1e4),s(),{items:[],connections:[],connected:!1,uiCommand:null,recentChanges:rg,agentActivity:[],agentErrors:[],recentErrors:[],spawnedAgents:[],agentRelays:[],sessionState:null,gates:[],gateEvent:null,settings:null,pipelineDraft:null,activeBuild:null,iterationStates:new Map,sessions:[],featureTimeline:[],selectedPhase:(()=>{try{return localStorage.getItem("compose:selectedPhase")||null}catch{return null}})(),selectedBranches:{},decisionEvents:[],statusSnapshots:{},clearUICommand:()=>t({uiCommand:null}),setSelectedBranches:(o,a)=>t(l=>({selectedBranches:{...l.selectedBranches,[o]:a}})),setStatusSnapshot:(o,a)=>t(l=>({statusSnapshots:{...l.statusSnapshots,[o]:a}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),setDecisionEventsSnapshot:o=>t({decisionEvents:Array.isArray(o)?o:[]}),appendDecisionEvent:o=>t(a=>!(o!=null&&o.id)||a.decisionEvents.some(l=>l.id===o.id)?a:{decisionEvents:[...a.decisionEvents,o]}),registerSnapshotProvider:o=>{ye.snapshotProvider=o},setActiveBuild:o=>t({activeBuild:o}),setPipelineDraft:o=>t({pipelineDraft:o}),setFeatureTimeline:o=>t(a=>({featureTimeline:typeof o=="function"?o(a.featureTimeline):o})),setSelectedPhase:o=>{t({selectedPhase:o});try{o?localStorage.setItem("compose:selectedPhase",o):localStorage.removeItem("compose:selectedPhase")}catch{}},updateItemPosition:(o,a)=>{t(l=>({items:l.items.map(c=>c.id===o?{...c,position:a}:c)}))},createItem:o=>r("/api/vision/items",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),updateItem:(o,a)=>r(`/api/vision/items/${o}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),deleteItem:o=>r(`/api/vision/items/${o}`,{method:"DELETE"}),createConnection:o=>r("/api/vision/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),deleteConnection:o=>r(`/api/vision/connections/${o}`,{method:"DELETE"}),resolveGate:async(o,a,l)=>{ye.pendingResolveIds.add(o);try{const c=await r(`/api/vision/gates/${o}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({outcome:a,comment:l})});return c.error&&ye.pendingResolveIds.delete(o),c}catch{return ye.pendingResolveIds.delete(o),{error:"Network error"}}},updateSettings:o=>r("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),resetSettings:o=>r("/api/settings/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o?{section:o}:{})})}});function Ib(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=Ib(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Fb(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=Ib(t))&&(n&&(n+=" "),n+=e);return n}const ng=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ig=Fb,Pb=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return ig(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const u=r==null?void 0:r[c],d=s==null?void 0:s[c];if(u===null)return null;const p=ng(u)||ng(d);return i[c][p]}),a=r&&Object.entries(r).reduce((c,u)=>{let[d,p]=u;return p===void 0||(c[d]=p),c},{}),l=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:d,className:p,...f}=u;return Object.entries(f).every(m=>{let[x,g]=m;return Array.isArray(g)?g.includes({...s,...a}[x]):{...s,...a}[x]===g})?[...c,d,p]:c},[]);return ig(t,o,l,r==null?void 0:r.class,r==null?void 0:r.className)},nI=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},iI=(t,e)=>({classGroupId:t,validator:e}),Db=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),ql="-",sg=[],sI="arbitrary..",oI=t=>{const e=lI(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return aI(o);const a=o.split(ql),l=a[0]===""&&a.length>1?1:0;return Ob(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=r[o];return l?c?nI(c,l):l:c||sg}return r[o]||sg}}},Ob=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],s=r.nextPart.get(i);if(s){const c=Ob(t,e+1,s);if(c)return c}const o=r.validators;if(o===null)return;const a=e===0?t.join(ql):t.slice(e).join(ql),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},aI=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?sI+n:void 0})(),lI=t=>{const{theme:e,classGroups:r}=t;return cI(r,e)},cI=(t,e)=>{const r=Db();for(const n in t){const i=t[n];Ff(i,r,n,e)}return r},Ff=(t,e,r,n)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];hI(o,e,r,n)}},hI=(t,e,r,n)=>{if(typeof t=="string"){uI(t,e,r);return}if(typeof t=="function"){dI(t,e,r,n);return}fI(t,e,r,n)},uI=(t,e,r)=>{const n=t===""?e:Rb(e,t);n.classGroupId=r},dI=(t,e,r,n)=>{if(pI(t)){Ff(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(iI(r,t))},fI=(t,e,r,n)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];Ff(l,Rb(e,a),r,n)}},Rb=(t,e)=>{let r=t;const n=e.split(ql),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=r.nextPart.get(o);a||(a=Db(),r.nextPart.set(o,a)),r=a}return r},pI=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,mI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},Vu="!",og=":",gI=[],ag=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),xI=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let x=0;x<u;x++){const g=i[x];if(o===0&&a===0){if(g===og){s.push(i.slice(l,x)),l=x+1;continue}if(g==="/"){c=x;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.slice(l);let p=d,f=!1;d.endsWith(Vu)?(p=d.slice(0,-1),f=!0):d.startsWith(Vu)&&(p=d.slice(1),f=!0);const m=c&&c>l?c-l:void 0;return ag(s,f,p,m)};if(e){const i=e+og,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):ag(gI,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},yI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},bI=t=>({cache:mI(t.cacheSize),parseClassName:xI(t),sortModifiers:yI(t),postfixLookupClassGroupIds:CI(t),...oI(t)}),CI=t=>{const e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)e[r[n]]=!0;return e},kI=/\s+/,vI=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s,postfixLookupClassGroupIds:o}=e,a=[],l=t.trim().split(kI);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let y=!!g,b;if(y){const E=x.substring(0,g);b=n(E);const L=b&&o[b]?n(x):void 0;L&&L!==b&&(b=L,y=!1)}else b=n(x);if(!b){if(!y){c=d+(c.length>0?" "+c:c);continue}if(b=n(x),!b){c=d+(c.length>0?" "+c:c);continue}y=!1}const k=f.length===0?"":f.length===1?f[0]:s(f).join(":"),T=m?k+Vu:k,_=T+b;if(a.indexOf(_)>-1)continue;a.push(_);const w=i(b,y);for(let E=0;E<w.length;++E){const L=w[E];a.push(T+L)}c=d+(c.length>0?" "+c:c)}return c},wI=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=$b(r))&&(i&&(i+=" "),i+=n);return i},$b=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=$b(t[n]))&&(r&&(r+=" "),r+=e);return r},SI=(t,...e)=>{let r,n,i,s;const o=l=>{const c=e.reduce((u,d)=>d(u),t());return r=bI(c),n=r.cache.get,i=r.cache.set,s=a,a(l)},a=l=>{const c=n(l);if(c)return c;const u=vI(l,r);return i(l,u),u};return s=o,(...l)=>s(wI(...l))},TI=[],Ae=t=>{const e=r=>r[t]||TI;return e.isThemeGetter=!0,e},zb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Wb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_I=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,EI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,LI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,BI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fn=t=>_I.test(t),Vt=t=>!!t&&!Number.isNaN(Number(t)),Zr=t=>!!t&&Number.isInteger(Number(t)),$h=t=>t.endsWith("%")&&Vt(t.slice(0,-1)),gn=t=>EI.test(t),qb=()=>!0,AI=t=>NI.test(t)&&!jI.test(t),Pf=()=>!1,MI=t=>LI.test(t),II=t=>BI.test(t),FI=t=>!mt(t)&&!gt(t),PI=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),DI=t=>ri(t,Gb,Pf),mt=t=>zb.test(t),hi=t=>ri(t,Vb,AI),lg=t=>ri(t,UI,Vt),OI=t=>ri(t,Xb,qb),RI=t=>ri(t,Yb,Pf),cg=t=>ri(t,Hb,Pf),$I=t=>ri(t,Ub,II),Wa=t=>ri(t,Kb,MI),gt=t=>Wb.test(t),mo=t=>Ii(t,Vb),zI=t=>Ii(t,Yb),hg=t=>Ii(t,Hb),WI=t=>Ii(t,Gb),qI=t=>Ii(t,Ub),qa=t=>Ii(t,Kb,!0),HI=t=>Ii(t,Xb,!0),ri=(t,e,r)=>{const n=zb.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},Ii=(t,e,r=!1)=>{const n=Wb.exec(t);return n?n[1]?e(n[1]):r:!1},Hb=t=>t==="position"||t==="percentage",Ub=t=>t==="image"||t==="url",Gb=t=>t==="length"||t==="size"||t==="bg-size",Vb=t=>t==="length",UI=t=>t==="number",Yb=t=>t==="family-name",Xb=t=>t==="number"||t==="weight",Kb=t=>t==="shadow",GI=()=>{const t=Ae("color"),e=Ae("font"),r=Ae("text"),n=Ae("font-weight"),i=Ae("tracking"),s=Ae("leading"),o=Ae("breakpoint"),a=Ae("container"),l=Ae("spacing"),c=Ae("radius"),u=Ae("shadow"),d=Ae("inset-shadow"),p=Ae("text-shadow"),f=Ae("drop-shadow"),m=Ae("blur"),x=Ae("perspective"),g=Ae("aspect"),y=Ae("ease"),b=Ae("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...T(),gt,mt],w=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],L=()=>[gt,mt,l],M=()=>[Fn,"full","auto",...L()],N=()=>[Zr,"none","subgrid",gt,mt],P=()=>["auto",{span:["full",Zr,gt,mt]},Zr,gt,mt],$=()=>[Zr,"auto",gt,mt],q=()=>["auto","min","max","fr",gt,mt],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...L()],D=()=>[Fn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],R=()=>[Fn,"screen","full","dvw","lvw","svw","min","max","fit",...L()],j=()=>[Fn,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],S=()=>[t,gt,mt],U=()=>[...T(),hg,cg,{position:[gt,mt]}],Q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",WI,DI,{size:[gt,mt]}],rt=()=>[$h,mo,hi],ut=()=>["","none","full",c,gt,mt],ot=()=>["",Vt,mo,hi],It=()=>["solid","dashed","dotted","double"],ht=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],at=()=>[Vt,$h,hg,cg],K=()=>["","none",m,gt,mt],lt=()=>["none",Vt,gt,mt],yt=()=>["none",Vt,gt,mt],At=()=>[Vt,gt,mt],Dt=()=>[Fn,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[gn],breakpoint:[gn],color:[qb],container:[gn],"drop-shadow":[gn],ease:["in","out","in-out"],font:[FI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[gn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[gn],shadow:[gn],spacing:["px",Vt],text:[gn],"text-shadow":[gn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Fn,mt,gt,g]}],container:["container"],"container-type":[{"@container":["","normal","size",gt,mt]}],"container-named":[PI],columns:[{columns:[Vt,mt,gt,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",gt,mt]}],basis:[{basis:[Fn,"full","auto",a,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Vt,Fn,"auto","initial","none",mt]}],grow:[{grow:["",Vt,gt,mt]}],shrink:[{shrink:["",Vt,gt,mt]}],order:[{order:[Zr,"first","last","none",gt,mt]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mbs:[{mbs:F()}],mbe:[{mbe:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...j()]}],"min-block-size":[{"min-block":["auto",...j()]}],"max-block-size":[{"max-block":["none",...j()]}],w:[{w:[a,"screen",...D()]}],"min-w":[{"min-w":[a,"screen","none",...D()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",r,mo,hi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,HI,OI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$h,mt]}],"font-family":[{font:[zI,RI,e]}],"font-features":[{"font-features":[mt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,gt,mt]}],"line-clamp":[{"line-clamp":[Vt,"none",gt,lg]}],leading:[{leading:[s,...L()]}],"list-image":[{"list-image":["none",gt,mt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",gt,mt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...It(),"wavy"]}],"text-decoration-thickness":[{decoration:[Vt,"from-font","auto",gt,hi]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Vt,"auto",gt,mt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"tab-size":[{tab:[Zr,gt,mt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt,mt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gt,mt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:Q()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,gt,mt],radial:["",gt,mt],conic:[Zr,gt,mt]},qI,$I]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:rt()}],"gradient-via-pos":[{via:rt()}],"gradient-to-pos":[{to:rt()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:ut()}],"rounded-s":[{"rounded-s":ut()}],"rounded-e":[{"rounded-e":ut()}],"rounded-t":[{"rounded-t":ut()}],"rounded-r":[{"rounded-r":ut()}],"rounded-b":[{"rounded-b":ut()}],"rounded-l":[{"rounded-l":ut()}],"rounded-ss":[{"rounded-ss":ut()}],"rounded-se":[{"rounded-se":ut()}],"rounded-ee":[{"rounded-ee":ut()}],"rounded-es":[{"rounded-es":ut()}],"rounded-tl":[{"rounded-tl":ut()}],"rounded-tr":[{"rounded-tr":ut()}],"rounded-br":[{"rounded-br":ut()}],"rounded-bl":[{"rounded-bl":ut()}],"border-w":[{border:ot()}],"border-w-x":[{"border-x":ot()}],"border-w-y":[{"border-y":ot()}],"border-w-s":[{"border-s":ot()}],"border-w-e":[{"border-e":ot()}],"border-w-bs":[{"border-bs":ot()}],"border-w-be":[{"border-be":ot()}],"border-w-t":[{"border-t":ot()}],"border-w-r":[{"border-r":ot()}],"border-w-b":[{"border-b":ot()}],"border-w-l":[{"border-l":ot()}],"divide-x":[{"divide-x":ot()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ot()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...It(),"hidden","none"]}],"divide-style":[{divide:[...It(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-bs":[{"border-bs":S()}],"border-color-be":[{"border-be":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...It(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Vt,gt,mt]}],"outline-w":[{outline:["",Vt,mo,hi]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",u,qa,Wa]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",d,qa,Wa]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:ot()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Vt,hi]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":ot()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",p,qa,Wa]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Vt,gt,mt]}],"mix-blend":[{"mix-blend":[...ht(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ht()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Vt]}],"mask-image-linear-from-pos":[{"mask-linear-from":at()}],"mask-image-linear-to-pos":[{"mask-linear-to":at()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":at()}],"mask-image-t-to-pos":[{"mask-t-to":at()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":at()}],"mask-image-r-to-pos":[{"mask-r-to":at()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":at()}],"mask-image-b-to-pos":[{"mask-b-to":at()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":at()}],"mask-image-l-to-pos":[{"mask-l-to":at()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":at()}],"mask-image-x-to-pos":[{"mask-x-to":at()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":at()}],"mask-image-y-to-pos":[{"mask-y-to":at()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[gt,mt]}],"mask-image-radial-from-pos":[{"mask-radial-from":at()}],"mask-image-radial-to-pos":[{"mask-radial-to":at()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Vt]}],"mask-image-conic-from-pos":[{"mask-conic-from":at()}],"mask-image-conic-to-pos":[{"mask-conic-to":at()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:Q()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",gt,mt]}],filter:[{filter:["","none",gt,mt]}],blur:[{blur:K()}],brightness:[{brightness:[Vt,gt,mt]}],contrast:[{contrast:[Vt,gt,mt]}],"drop-shadow":[{"drop-shadow":["","none",f,qa,Wa]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Vt,gt,mt]}],"hue-rotate":[{"hue-rotate":[Vt,gt,mt]}],invert:[{invert:["",Vt,gt,mt]}],saturate:[{saturate:[Vt,gt,mt]}],sepia:[{sepia:["",Vt,gt,mt]}],"backdrop-filter":[{"backdrop-filter":["","none",gt,mt]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[Vt,gt,mt]}],"backdrop-contrast":[{"backdrop-contrast":[Vt,gt,mt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Vt,gt,mt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vt,gt,mt]}],"backdrop-invert":[{"backdrop-invert":["",Vt,gt,mt]}],"backdrop-opacity":[{"backdrop-opacity":[Vt,gt,mt]}],"backdrop-saturate":[{"backdrop-saturate":[Vt,gt,mt]}],"backdrop-sepia":[{"backdrop-sepia":["",Vt,gt,mt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",gt,mt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Vt,"initial",gt,mt]}],ease:[{ease:["linear","initial",y,gt,mt]}],delay:[{delay:[Vt,gt,mt]}],animate:[{animate:["none",b,gt,mt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,gt,mt]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:lt()}],"rotate-x":[{"rotate-x":lt()}],"rotate-y":[{"rotate-y":lt()}],"rotate-z":[{"rotate-z":lt()}],scale:[{scale:yt()}],"scale-x":[{"scale-x":yt()}],"scale-y":[{"scale-y":yt()}],"scale-z":[{"scale-z":yt()}],"scale-3d":["scale-3d"],skew:[{skew:At()}],"skew-x":[{"skew-x":At()}],"skew-y":[{"skew-y":At()}],transform:[{transform:[gt,mt,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Dt()}],"translate-x":[{"translate-x":Dt()}],"translate-y":[{"translate-y":Dt()}],"translate-z":[{"translate-z":Dt()}],"translate-none":["translate-none"],zoom:[{zoom:[Zr,gt,mt]}],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gt,mt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":S()}],"scrollbar-track-color":[{"scrollbar-track":S()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gt,mt]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Vt,mo,hi,lg]}],stroke:[{stroke:["none",...S()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},VI=SI(GI);function nt(...t){return VI(Fb(t))}const YI=Pb("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function nr({className:t,variant:e,...r}){return h.jsx("div",{className:nt(YI({variant:e}),t),...r})}const zc=C.forwardRef(({className:t,type:e,...r},n)=>h.jsx("input",{type:e,className:nt("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));zc.displayName="Input";var Df=x_();const XI=Ac(Df);function ug(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Wc(...t){return e=>{let r=!1;const n=t.map(i=>{const s=ug(i,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let i=0;i<n.length;i++){const s=n[i];typeof s=="function"?s():ug(t[i],null)}}}}function _r(...t){return C.useCallback(Wc(...t),t)}function KI(t){const e=ZI(t),r=C.forwardRef((n,i)=>{const{children:s,...o}=n,a=C.Children.toArray(s),l=a.find(JI);if(l){const c=l.props.children,u=a.map(d=>d===l?C.Children.count(c)>1?C.Children.only(null):C.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:i,children:C.isValidElement(c)?C.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function ZI(t){const e=C.forwardRef((r,n)=>{const{children:i,...s}=r;if(C.isValidElement(i)){const o=e3(i),a=t3(s,i.props);return i.type!==C.Fragment&&(a.ref=n?Wc(n,o):o),C.cloneElement(i,a)}return C.Children.count(i)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var QI=Symbol("radix.slottable");function JI(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===QI}function t3(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function e3(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var r3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yr=r3.reduce((t,e)=>{const r=KI(`Primitive.${e}`),n=C.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function n3(t,e){t&&Df.flushSync(()=>t.dispatchEvent(e))}var Fs=globalThis!=null&&globalThis.document?C.useLayoutEffect:()=>{};function i3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var ni=t=>{const{present:e,children:r}=t,n=s3(e),i=typeof r=="function"?r({present:n.isPresent}):C.Children.only(r),s=_r(n.ref,o3(i));return typeof r=="function"||n.isPresent?C.cloneElement(i,{ref:s}):null};ni.displayName="Presence";function s3(t){const[e,r]=C.useState(),n=C.useRef(null),i=C.useRef(t),s=C.useRef("none"),o=t?"mounted":"unmounted",[a,l]=i3(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{const c=Ha(n.current);s.current=a==="mounted"?c:"none"},[a]),Fs(()=>{const c=n.current,u=i.current;if(u!==t){const p=s.current,f=Ha(c);t?l("MOUNT"):f==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Fs(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const x=Ha(n.current).includes(CSS.escape(f.animationName));if(f.target===e&&x&&(l("ANIMATION_END"),!i.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},p=f=>{f.target===e&&(s.current=Ha(n.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:C.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function Ha(t){return(t==null?void 0:t.animationName)||"none"}function o3(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function a3(t,e){const r=C.createContext(e),n=s=>{const{children:o,...a}=s,l=C.useMemo(()=>a,Object.values(a));return h.jsx(r.Provider,{value:l,children:o})};n.displayName=t+"Provider";function i(s){const o=C.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[n,i]}function Zb(t,e=[]){let r=[];function n(s,o){const a=C.createContext(o),l=r.length;r=[...r,o];const c=d=>{var y;const{scope:p,children:f,...m}=d,x=((y=p==null?void 0:p[t])==null?void 0:y[l])||a,g=C.useMemo(()=>m,Object.values(m));return h.jsx(x.Provider,{value:g,children:f})};c.displayName=s+"Provider";function u(d,p){var x;const f=((x=p==null?void 0:p[t])==null?void 0:x[l])||a,m=C.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=r.map(o=>C.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return C.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[n,l3(i,...e)]}function l3(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Br(t){const e=C.useRef(t);return C.useEffect(()=>{e.current=t}),C.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}var c3=C.createContext(void 0);function h3(t){const e=C.useContext(c3);return t||e||"ltr"}function u3(t,[e,r]){return Math.min(r,Math.max(e,t))}function ir(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function d3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var Of="ScrollArea",[Qb]=Zb(Of),[f3,Ir]=Qb(Of),Jb=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=C.useState(null),[c,u]=C.useState(null),[d,p]=C.useState(null),[f,m]=C.useState(null),[x,g]=C.useState(null),[y,b]=C.useState(0),[k,T]=C.useState(0),[_,w]=C.useState(!1),[E,L]=C.useState(!1),M=_r(e,P=>l(P)),N=h3(i);return h.jsx(f3,{scope:r,type:n,dir:N,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:p,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:w,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:E,onScrollbarYEnabledChange:L,onCornerWidthChange:b,onCornerHeightChange:T,children:h.jsx(yr.div,{dir:N,...o,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...t.style}})})});Jb.displayName=Of;var t1="ScrollAreaViewport",e1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Ir(t1,r),a=C.useRef(null),l=_r(e,a,o.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),h.jsx(yr.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:h.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});e1.displayName=t1;var un="ScrollAreaScrollbar",Rf=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ir(un,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return C.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?h.jsx(p3,{...n,ref:e,forceMount:r}):i.type==="scroll"?h.jsx(m3,{...n,ref:e,forceMount:r}):i.type==="auto"?h.jsx(r1,{...n,ref:e,forceMount:r}):i.type==="always"?h.jsx($f,{...n,ref:e}):null});Rf.displayName=un;var p3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ir(un,t.__scopeScrollArea),[s,o]=C.useState(!1);return C.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),h.jsx(ni,{present:r||s,children:h.jsx(r1,{"data-state":s?"visible":"hidden",...n,ref:e})})}),m3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ir(un,t.__scopeScrollArea),s=t.orientation==="horizontal",o=Hc(()=>l("SCROLL_END"),100),[a,l]=d3("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),C.useEffect(()=>{const c=i.viewport,u=s?"scrollLeft":"scrollTop";if(c){let d=c[u];const p=()=>{const f=c[u];d!==f&&(l("SCROLL"),o()),d=f};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[i.viewport,s,l,o]),h.jsx(ni,{present:r||a!=="hidden",children:h.jsx($f,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:ir(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:ir(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),r1=C.forwardRef((t,e)=>{const r=Ir(un,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=C.useState(!1),a=t.orientation==="horizontal",l=Hc(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?c:u)}},10);return Ps(r.viewport,l),Ps(r.content,l),h.jsx(ni,{present:n||s,children:h.jsx($f,{"data-state":s?"visible":"hidden",...i,ref:e})})}),$f=C.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Ir(un,t.__scopeScrollArea),s=C.useRef(null),o=C.useRef(0),[a,l]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=a1(a.viewport,a.content),u={...n,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function d(p,f){return k3(p,o.current,a,f)}return r==="horizontal"?h.jsx(g3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,f=dg(p,a,i.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=d(p,i.dir))}}):r==="vertical"?h.jsx(x3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,f=dg(p,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=d(p))}}):null}),g3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ir(un,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=_r(e,l,s.onScrollbarXChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(i1,{"data-orientation":"horizontal",...i,ref:c,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(p),c1(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Ul(o.paddingLeft),paddingEnd:Ul(o.paddingRight)}})}})}),x3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ir(un,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=_r(e,l,s.onScrollbarYChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(i1,{"data-orientation":"vertical",...i,ref:c,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(p),c1(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Ul(o.paddingTop),paddingEnd:Ul(o.paddingBottom)}})}})}),[y3,n1]=Qb(un),i1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...p}=t,f=Ir(un,r),[m,x]=C.useState(null),g=_r(e,M=>x(M)),y=C.useRef(null),b=C.useRef(""),k=f.viewport,T=n.content-n.viewport,_=Br(u),w=Br(l),E=Hc(d,10);function L(M){if(y.current){const N=M.clientX-y.current.left,P=M.clientY-y.current.top;c({x:N,y:P})}}return C.useEffect(()=>{const M=N=>{const P=N.target;(m==null?void 0:m.contains(P))&&_(N,T)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[k,m,T,_]),C.useEffect(w,[n,w]),Ps(m,E),Ps(f.content,E),h.jsx(y3,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:Br(s),onThumbPointerUp:Br(o),onThumbPositionChange:w,onThumbPointerDown:Br(a),children:h.jsx(yr.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:ir(t.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),y.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),L(M))}),onPointerMove:ir(t.onPointerMove,L),onPointerUp:ir(t.onPointerUp,M=>{const N=M.target;N.hasPointerCapture(M.pointerId)&&N.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),Hl="ScrollAreaThumb",s1=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=n1(Hl,t.__scopeScrollArea);return h.jsx(ni,{present:r||i.hasThumb,children:h.jsx(b3,{ref:e,...n})})}),b3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Ir(Hl,r),o=n1(Hl,r),{onThumbPositionChange:a}=o,l=_r(e,d=>o.onThumbChange(d)),c=C.useRef(void 0),u=Hc(()=>{c.current&&(c.current(),c.current=void 0)},100);return C.useEffect(()=>{const d=s.viewport;if(d){const p=()=>{if(u(),!c.current){const f=v3(d,a);c.current=f,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[s.viewport,u,a]),h.jsx(yr.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ir(t.onPointerDownCapture,d=>{const f=d.target.getBoundingClientRect(),m=d.clientX-f.left,x=d.clientY-f.top;o.onThumbPointerDown({x:m,y:x})}),onPointerUp:ir(t.onPointerUp,o.onThumbPointerUp)})});s1.displayName=Hl;var zf="ScrollAreaCorner",o1=C.forwardRef((t,e)=>{const r=Ir(zf,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?h.jsx(C3,{...t,ref:e}):null});o1.displayName=zf;var C3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Ir(zf,r),[s,o]=C.useState(0),[a,l]=C.useState(0),c=!!(s&&a);return Ps(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),l(u)}),Ps(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),c?h.jsx(yr.div,{...n,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Ul(t){return t?parseInt(t,10):0}function a1(t,e){const r=t/e;return isNaN(r)?0:r}function qc(t){const e=a1(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function k3(t,e,r,n="ltr"){const i=qc(r),s=i/2,o=e||s,a=i-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-a,u=r.content-r.viewport,d=n==="ltr"?[0,u]:[u*-1,0];return l1([l,c],d)(t)}function dg(t,e,r="ltr"){const n=qc(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-n,l=r==="ltr"?[0,o]:[o*-1,0],c=u3(t,l);return l1([0,o],[0,a])(c)}function l1(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function c1(t,e){return t>0&&t<e}var v3=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&e(),r=s,n=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(n)};function Hc(t,e){const r=Br(t),n=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(n.current),[]),C.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Ps(t,e){const r=Br(e);Fs(()=>{let n=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(n),i.unobserve(t)}}},[t,r])}var h1=Jb,w3=e1,S3=o1;const Yn=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(h1,{ref:n,className:nt("relative overflow-hidden",t),...r,children:[h.jsx(w3,{className:"h-full w-full rounded-[inherit]",children:e}),h.jsx(u1,{}),h.jsx(S3,{})]}));Yn.displayName=h1.displayName;const u1=C.forwardRef(({className:t,orientation:e="vertical",...r},n)=>h.jsx(Rf,{ref:n,orientation:e,className:nt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:h.jsx(s1,{className:"relative flex-1 rounded-full bg-border"})}));u1.displayName=Rf.displayName;var T3=Symbol.for("react.lazy"),Gl=af[" use ".trim().toString()];function _3(t){return typeof t=="object"&&t!==null&&"then"in t}function d1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===T3&&"_payload"in t&&_3(t._payload)}function f1(t){const e=N3(t),r=C.forwardRef((n,i)=>{let{children:s,...o}=n;d1(s)&&typeof Gl=="function"&&(s=Gl(s._payload));const a=C.Children.toArray(s),l=a.find(L3);if(l){const c=l.props.children,u=a.map(d=>d===l?C.Children.count(c)>1?C.Children.only(null):C.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:i,children:C.isValidElement(c)?C.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}var E3=f1("Slot");function N3(t){const e=C.forwardRef((r,n)=>{let{children:i,...s}=r;if(d1(i)&&typeof Gl=="function"&&(i=Gl(i._payload)),C.isValidElement(i)){const o=A3(i),a=B3(s,i.props);return i.type!==C.Fragment&&(a.ref=n?Wc(n,o):o),C.cloneElement(i,a)}return C.Children.count(i)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var j3=Symbol("radix.slottable");function L3(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===j3}function B3(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function A3(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var M3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],I3=M3.reduce((t,e)=>{const r=f1(`Primitive.${e}`),n=C.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),F3="Separator",fg="horizontal",P3=["horizontal","vertical"],p1=C.forwardRef((t,e)=>{const{decorative:r,orientation:n=fg,...i}=t,s=D3(n)?n:fg,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return h.jsx(I3.div,{"data-orientation":s,...a,...i,ref:e})});p1.displayName=F3;function D3(t){return P3.includes(t)}var m1=p1;const Vl=C.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>h.jsx(m1,{ref:i,decorative:r,orientation:e,className:nt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Vl.displayName=m1.displayName;function O3({agentId:t,status:e}){const[r,n]=C.useState(""),[i,s]=C.useState(""),o=C.useRef(null),a=C.useRef(!1),l=C.useCallback(()=>{const d=o.current;d&&(a.current=d.scrollTop+d.clientHeight<d.scrollHeight-20)},[]);C.useEffect(()=>{const d=o.current;d&&!a.current&&(d.scrollTop=d.scrollHeight)},[r,i]),C.useEffect(()=>{if(!t)return;const d=async()=>{try{const p=await zt(`/api/agent/${t}`);if(!p.ok)return;const f=await p.json();f.output!=null&&n(f.output),f.stderr!=null&&s(f.stderr)}catch{}};if(d(),e==="running"){const p=setInterval(d,2e3);return()=>clearInterval(p)}},[t,e]);const c=!r&&!i,u=e==="running";return h.jsx("div",{children:h.jsx("div",{ref:o,onScroll:l,className:"overflow-auto max-h-[300px] rounded bg-muted/30 p-2",children:c?h.jsx("p",{className:"text-[10px] font-mono text-muted-foreground italic",children:u?"Waiting for output...":"No output"}):h.jsxs(h.Fragment,{children:[r&&h.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground whitespace-pre-wrap break-all m-0",children:r}),i&&h.jsxs("div",{className:"mt-2",children:[h.jsx("span",{className:"text-[10px] font-mono font-medium text-destructive",children:"stderr"}),h.jsx("pre",{className:"text-[10px] font-mono text-destructive whitespace-pre-wrap break-all m-0 mt-0.5",children:i})]})]})})})}const R3=Yt.memo(O3);function $3(t){if(!t)return"";const e=Math.floor((Date.now()-new Date(t).getTime())/1e3);return e<5?"now":e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:`${Math.floor(e/3600)}h ago`}function z3({agentId:t,relays:e}){const r=C.useMemo(()=>!e||!t?[]:e.filter(n=>n.fromAgentId===t||n.toAgentId===t),[e,t]);return r.length===0?null:h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Relays"}),h.jsx("div",{className:"space-y-0.5",children:r.map((n,i)=>{const s=n.direction==="result";return h.jsxs("div",{className:"flex items-start gap-1 text-[10px] font-mono",children:[h.jsx("span",{className:s?"text-foreground shrink-0":"text-muted-foreground shrink-0",children:s?"→":"←"}),h.jsx("span",{className:s?"text-foreground truncate":"text-muted-foreground truncate",title:n.messagePreview,children:n.messagePreview}),h.jsx("span",{className:"text-muted-foreground opacity-50 ml-auto shrink-0 tabular-nums",children:$3(n.timestamp)})]},n.id||i)})})]})}const W3=Yt.memo(z3),q3={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},pg={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function zh(t){if(!t||t<1e3)return"<1s";const e=Math.floor(t/1e3);return e<60?`${e}s`:`${Math.floor(e/60)}m ${e%60}s`}const H3=Yt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Yt.useState(0);Yt.useEffect(()=>{if(!r)return;const l=setInterval(()=>i(c=>c+1),1e3);return()=>clearInterval(l)},[r]);const s=r?Math.floor((Date.now()-new Date(e).getTime())/1e3):n||0,o=Math.floor(s/60),a=s%60;return h.jsxs("span",{className:"tabular-nums",children:[o,"m ",String(a).padStart(2,"0"),"s"]})});function U3({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,b;const[a,l]=Yt.useState(null),[c,u]=Yt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Yt.useState(0),[p,f]=Yt.useState([]),m=Yt.useRef(null);return Yt.useEffect(()=>{const k=T=>u(T.detail);return window.addEventListener("compose:agent-status",k),()=>window.removeEventListener("compose:agent-status",k)},[]),Yt.useEffect(()=>{if(c.status!=="working")return;const k=setInterval(()=>d(T=>T+1),1e3);return()=>clearInterval(k)},[c.status]),Yt.useEffect(()=>{if(!t||t.length===0)return;const k=t[t.length-1];Array.isArray(k.items)&&k.items.length>0&&(f(k.items),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>f([]),3e4))},[t]),Yt.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),h.jsxs(h.Fragment,{children:[i&&i.length>0&&h.jsxs("div",{className:"flex items-center gap-0.5 mb-1.5 overflow-x-auto px-3",children:[h.jsx("button",{onClick:()=>l(null),className:nt("text-[10px] px-2 py-0.5 rounded cursor-pointer transition-colors border shrink-0",a?"bg-transparent text-muted-foreground border-border hover:text-foreground":"bg-primary text-primary-foreground border-primary"),children:"Session"}),i.map(k=>h.jsxs("span",{className:"flex items-center gap-0 shrink-0",children:[h.jsxs("button",{onClick:()=>l(k.agentId),className:nt("text-[10px] px-2 py-0.5 rounded-l cursor-pointer transition-colors border flex items-center gap-1 shrink-0",a===k.agentId?"bg-primary text-primary-foreground border-primary":"bg-transparent text-muted-foreground border-border hover:text-foreground"),children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:k.status==="killed"?"hsl(var(--destructive))":k.silent?"hsl(45 93% 47%)":k.status==="running"?"hsl(var(--success))":k.status==="complete"?"hsl(142 71% 45%)":"hsl(var(--destructive))",animation:k.status==="running"&&!k.silent?"phase-active-pulse 2s ease-in-out infinite":"none"}}),k.agentType,k.silent&&h.jsx("span",{className:"text-[8px] text-yellow-500 ml-0.5",title:"Agent silent",children:"!"})]}),k.status==="running"&&o&&h.jsx("button",{onClick:T=>{T.stopPropagation(),o(k.agentId)},className:"text-[10px] px-1 py-0.5 rounded-r border border-l-0 border-border hover:bg-destructive/20 hover:text-destructive cursor-pointer transition-colors",title:"Stop agent",children:"x"})]},k.agentId))]}),a?h.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[h.jsx(R3,{agentId:a,status:(x=i.find(k=>k.agentId===a))==null?void 0:x.status}),h.jsx(W3,{agentId:a,relays:s})]}):h.jsxs(h.Fragment,{children:[(r==null?void 0:r.featureCode)&&h.jsxs("div",{className:"px-3 py-1.5 mb-1 rounded bg-muted/50",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:"Working on"}),h.jsx("button",{className:"font-medium text-foreground hover:underline",onClick:()=>r.featureItemId&&(n==null?void 0:n(r.featureItemId)),children:r.featureCode})]}),r.phaseAtBind&&h.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Phase: ",r.phaseAtBind.replace(/_/g," ")]})]}),r&&h.jsxs("div",{className:"px-3 pb-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:r.active?"hsl(var(--primary))":"hsl(var(--success))"}}),h.jsx(H3,{startedAt:r.startedAt,active:r.active,duration:r.duration}),h.jsxs("span",{className:"tabular-nums",children:[r.toolCount||0," tools"]}),r.errorCount>0&&h.jsxs("span",{style:{color:"hsl(var(--destructive))"},children:[r.errorCount," err"]}),!r.active&&r.journalSpawned&&h.jsx("span",{style:{color:"hsl(var(--primary))"},children:"journal"})]}),((g=r.summaries)==null?void 0:g.length)>0&&h.jsx("p",{className:"text-[10px] mt-0.5 truncate",style:{color:"hsl(var(--muted-foreground))",opacity:.7},title:(y=r.summaries[r.summaries.length-1])==null?void 0:y.summary,children:(b=r.summaries[r.summaries.length-1])==null?void 0:b.summary})]}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("div",{className:"rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:c.status==="working"?"var(--color-category-writing)":"hsl(var(--success))",animation:c.status==="working"?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider",style:{color:c.status==="working"?"var(--color-category-writing)":"hsl(var(--muted-foreground))"},children:c.status==="working"?q3[c.category]||"Working":"Idle"}),c.status==="working"&&c.tool&&h.jsx("span",{className:"text-[10px] tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:c.tool}),c.status==="working"&&c.currentActivity&&h.jsx("span",{className:"text-[10px] tabular-nums ml-auto",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:zh(Date.now()-c.currentActivity.startTime)})]}),c.activityLog&&c.activityLog.length>0&&h.jsx("div",{className:"flex items-center gap-0.5 mt-1",children:c.activityLog.slice(-6).map((k,T,_)=>h.jsx("div",{className:"h-1 rounded-full",title:`${k.tool||"thinking"} — ${zh(k.duration)}`,style:{width:Math.max(4,Math.min(16,(k.duration||0)/1e3*2)),background:rm[k.category]||(c.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+T/_.length*.6}},T))}),t&&t.length>0&&h.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((k,T)=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px]",style:{color:k.error?"hsl(var(--destructive))":"hsl(var(--muted-foreground))"},children:[k.error&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"font-medium shrink-0",children:k.tool}),k.category&&!k.error&&h.jsx("span",{className:"shrink-0 opacity-50",style:{color:rm[k.category]},children:k.category}),k.error?h.jsx("span",{className:"truncate",title:k.error.type,children:pg[k.error.type]||k.error.type}):k.detail?h.jsx("span",{className:"truncate opacity-60",title:k.detail,children:k.detail.split("/").pop()}):null]},T))}),p.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Working on"}),p.slice(0,3).map(k=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{children:k.status==="in_progress"?"◆":"◇"}),h.jsx("span",{className:"truncate",children:k.title})]},k.id))]}),e&&e.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--destructive))"},children:"Errors"}),e.slice(-3).map((k,T)=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--destructive))"},children:[h.jsx("span",{className:"font-medium shrink-0",children:pg[k.errorType]||k.errorType}),h.jsx("span",{className:"truncate opacity-70",title:k.message,children:k.message})]},T))]}),i&&i.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Subagents"}),i.map(k=>h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:k.status==="running"?"var(--color-category-executing)":k.status==="complete"?"hsl(var(--success))":"hsl(var(--destructive))",animation:k.status==="running"?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"font-medium shrink-0",children:k.agentType}),h.jsx("span",{className:"truncate opacity-60",children:k.status}),h.jsx("span",{className:"tabular-nums ml-auto opacity-50",children:zh(Date.now()-new Date(k.startedAt).getTime())})]},k.agentId))]})]})})]})]})}const G3=Yt.memo(U3),Ho={DECISION:1,PENDING_GATE:2,BLOCKED:3};function g1(t,e){const r=new Set((e||[]).filter(s=>s.status==="pending").map(s=>s.itemId)),n=new Map,i=(s,o,a)=>{const l=n.get(s.id);(!l||o>l.priority)&&n.set(s.id,{item:s,priority:o,reason:a})};for(const s of t||[])s.status==="blocked"&&i(s,Ho.BLOCKED,"Blocked"),r.has(s.id)&&i(s,Ho.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,Ho.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function V3(t){if(!t)return{isRunning:!1,pct:0,stepLabel:"",featureCode:"",stepNum:0,totalSteps:0,status:""};const{currentStepId:e,stepNum:r,totalSteps:n,status:i,featureCode:s}=t,o=i==="running",a=n>0?r/n*100:0,l=Math.min(100,Math.max(0,Math.round(a))),c=e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," "):"";return{isRunning:o,pct:l,stepLabel:c,featureCode:s||"",stepNum:r??0,totalSteps:n??0,status:i||""}}function x1(t,e){const r=t||[],n=e||[];let i=0,s=0,o=0;for(const l of r)l.status==="in_progress"&&i++,l.status==="blocked"&&s++;const a=n.filter(l=>l.status==="pending"||l.status==="awaiting").length;return o=g1(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function Y3(t,e){return t&&t===e?null:e}const X3={planned:{bg:"bg-slate-500/15",text:"text-slate-400",dot:"bg-slate-400"},ready:{bg:"bg-sky-500/15",text:"text-sky-400",dot:"bg-sky-400"},in_progress:{bg:"bg-blue-500/15",text:"text-blue-400",dot:"bg-blue-400"},review:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"},complete:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},blocked:{bg:"bg-rose-500/15",text:"text-rose-400",dot:"bg-rose-400"},parked:{bg:"bg-slate-500/15",text:"text-slate-500",dot:"bg-slate-500"},killed:{bg:"bg-slate-500/15",text:"text-slate-600",dot:"bg-slate-600"},pending:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"},resolved:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},active:{bg:"bg-blue-500/15",text:"text-blue-400",dot:"bg-blue-400"},completed:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},failed:{bg:"bg-rose-500/15",text:"text-rose-400",dot:"bg-rose-400"},paused:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"}},K3={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function Wf({status:t,className:e}){const r=X3[t]||K3,n=t?t.replace(/_/g," "):"—";return h.jsxs("span",{className:nt("inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",r.bg,r.text,e),children:[h.jsx("span",{className:nt("w-1 h-1 rounded-full shrink-0",r.dot)}),n]})}const Z3={vision:"text-violet-400 bg-violet-500/10 border-violet-500/20",specification:"text-purple-400 bg-purple-500/10 border-purple-500/20",planning:"text-cyan-400 bg-cyan-500/10 border-cyan-500/20",implementation:"text-amber-400 bg-amber-500/10 border-amber-500/20",verification:"text-emerald-400 bg-emerald-500/10 border-emerald-500/20",release:"text-green-400 bg-green-500/10 border-green-500/20"},Q3="text-slate-400 bg-slate-500/10 border-slate-500/20";function J3({phase:t,className:e}){const r=Z3[t]||Q3;return h.jsx("span",{className:nt("inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-mono",r,e),children:t||"—"})}async function Pn(t,e={}){const r=await zt(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let Wh=null;function y1(t){if(Wh)return;const e=window.location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${e}//${window.location.host}/ws/vision`);Wh=r,r.onmessage=n=>{try{const i=JSON.parse(n.data);i.type==="ideaboxUpdated"&&t(i)}catch{}},r.onclose=()=>{Wh=null,setTimeout(()=>{y1(t)},3e3)},r.onerror=()=>{}}const Ds=If((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{y1(()=>{e().hydrate()})},500),{ideas:[],killed:[],loading:!1,error:null,selectedIdeaId:null,filters:{tag:"",status:"",priority:"",search:""},hydrate:async()=>{t({loading:!0,error:null});try{const r=await Pn("/api/ideabox");t({ideas:r.ideas||[],killed:r.killed||[],loading:!1})}catch(r){t({error:r.message,loading:!1})}},addIdea:async r=>{const n=await Pn("/api/ideabox/ideas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return await e().hydrate(),n},promoteIdea:async(r,n="")=>{const i=await Pn(`/api/ideabox/ideas/${r}/promote`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({featureCode:n})});return await e().hydrate(),i},killIdea:async(r,n="")=>{const i=await Pn(`/api/ideabox/ideas/${r}/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})});return await e().hydrate(),i},setPriority:async(r,n)=>{const i=await Pn(`/api/ideabox/ideas/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:n})});return t(s=>({ideas:s.ideas.map(o=>o.id===r?{...o,priority:n}:o)})),i},resurrectIdea:async r=>{const n=await Pn(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await Pn(`/api/ideabox/ideas/${encodeURIComponent(r)}/discuss`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:n,text:i})});return await e().hydrate(),s},updateIdea:async(r,n)=>{const i=await Pn(`/api/ideabox/ideas/${encodeURIComponent(r)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e().hydrate(),i},setSelectedIdea:r=>t({selectedIdeaId:r}),updateFilters:r=>t(n=>({filters:{...n.filters,...r}})),clearFilters:()=>t({filters:{tag:"",status:"",priority:"",search:""}})}));function tF({activeBuild:t}){const e=V3(t);if(!t)return null;const r=e.isRunning?"hsl(var(--primary))":e.status==="complete"?"hsl(var(--success))":e.status==="failed"||e.status==="killed"?"hsl(var(--destructive))":"hsl(var(--muted-foreground))";return h.jsxs("div",{className:"mx-3 mb-2 rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Wl,{className:"h-3 w-3 shrink-0",style:{color:r}}),h.jsx("span",{className:"text-[10px] font-medium truncate max-w-[100px]",style:{color:"hsl(var(--foreground))"},children:e.featureCode||"Build"})]}),h.jsxs("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))"},children:[e.stepNum,"/",e.totalSteps]})]}),h.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${e.pct}%`,background:r}})}),h.jsxs("div",{className:"flex items-center justify-between mt-1",children:[h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:e.stepLabel}),e.isRunning&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--primary))",animation:"pulse 1.5s ease-in-out infinite"}})]})]})}function eF({items:t,gates:e,onSelectItem:r,onViewChange:n}){const i=Yt.useMemo(()=>g1(t,e),[t,e]);if(i.length===0)return null;const s=i.slice(0,5),o=i.length-s.length,a=l=>l===Ho.BLOCKED?h.jsx(Rc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):l===Ho.PENDING_GATE?h.jsx(PM,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):h.jsx(PA,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--muted-foreground))"}});return h.jsxs("div",{className:"px-2 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Needs Attention"}),s.map(({item:l,priority:c,reason:u})=>h.jsxs("button",{onClick:()=>r==null?void 0:r(l.id),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:u,children:[a(c),h.jsx("span",{className:"truncate flex-1 text-left",children:l.title}),l.phase&&h.jsx(J3,{phase:l.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),h.jsx(Wf,{status:l.status,className:"shrink-0"})]},l.id)),o>0&&h.jsxs("button",{onClick:()=>n==null?void 0:n("attention"),className:"flex w-full items-center px-2 py-0.5 text-[10px] rounded-md hover:bg-sidebar-accent/50 transition-colors",style:{color:"hsl(var(--muted-foreground))"},children:["+",o," more"]})]})}function rF({items:t,gates:e}){const r=Yt.useMemo(()=>x1(t,e),[t,e]);return r.total===0?null:h.jsxs("div",{className:"flex items-center gap-2 flex-wrap px-3 pb-1",children:[h.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.total," items"]}),r.inProgress>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--primary))"},children:[r.inProgress," active"]}),r.blocked>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--destructive))"},children:[r.blocked," blocked"]}),r.pendingGates>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--warning))"},children:[r.pendingGates," ",r.pendingGates===1?"gate":"gates"]})]})}const nF=new Set(["planned","ready","in_progress","review","blocked","parked"]);function iF({items:t,hiddenGroups:e,onToggleGroup:r}){const n=Yt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!nF.has(o.status))continue;const l=o.group||"other";i[l]=(i[l]||0)+1,["in_progress","review","ready"].includes(o.status)&&(s[l]=(s[l]||0)+1)}return Object.entries(i).sort((o,a)=>(s[a[0]]||0)-(s[o[0]]||0)||a[1]-o[1]||o[0].localeCompare(a[0])).map(([o,a])=>({group:o,count:a,active:s[o]||0}))},[t]);return n.length<=1?null:h.jsx(h.Fragment,{children:n.map(({group:i,count:s,active:o})=>{const a=e==null?void 0:e.has(i);return h.jsxs("button",{onClick:()=>r==null?void 0:r(i),className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))",opacity:a?.4:1,fontWeight:o>0?500:400},children:[h.jsx("span",{className:"truncate flex-1 text-left",children:i}),o>0&&h.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--primary))"},children:o}),h.jsx("span",{className:"text-[10px] tabular-nums shrink-0",style:{color:"hsl(var(--muted-foreground))"},children:s})]},i)})})}function sF({onViewChange:t}){const e=Ds(n=>n.ideas),r=Yt.useMemo(()=>e.filter(n=>!n.priority||n.priority==="—").length,[e]);return r===0?null:h.jsxs("div",{className:"px-2 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Ideas"}),h.jsxs("button",{onClick:()=>t==null?void 0:t("ideabox"),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:"View untriaged ideas",children:[h.jsx(wi,{className:"h-3 w-3 shrink-0 text-amber-400"}),h.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function b1({items:t,gates:e,activeBuild:r,onViewChange:n,selectedPhase:i,onPhaseSelect:s,selectedTrack:o,onTrackSelect:a,visibleTracks:l,onToggleVisibleTrack:c,onShowAllTracks:u,hiddenGroups:d,onToggleGroup:p,searchQuery:f,onSearchChange:m,connected:x,agentActivity:g,agentErrors:y,spawnedAgents:b,agentRelays:k,sessionState:T,onSelectItem:_,onStopAgent:w,onThemeChange:E,onNewItem:L,widthPx:M}){const N=t||[],P=e||[],$=Yt.useMemo(()=>x1(N,P),[N,P]),[q,O]=Yt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Yt.useEffect(()=>{if(typeof document>"u")return;const F=new MutationObserver(()=>{O(document.documentElement.classList.contains("dark"))});return F.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>F.disconnect()},[]);const I=Yt.useCallback(()=>{const F=!q,D=F?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",F);try{localStorage.setItem("compose:theme",D)}catch{}E&&E({ui:{theme:D}})},[q,E]);return Yt.useCallback(F=>{s&&s(Y3(i,F))},[s,i]),h.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:M??208},children:[h.jsxs("div",{className:"p-3 pb-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"Compose"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[!x&&h.jsx("span",{className:"text-[10px] text-destructive",children:"disconnected"}),L&&h.jsxs("button",{onClick:L,className:"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-xs text-muted-foreground hover:text-foreground bg-sidebar-accent/50 hover:bg-sidebar-accent transition-colors",title:"New item (⌘N)",children:[h.jsx(Ab,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"New"})]}),h.jsx("button",{onClick:I,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:q?"Switch to light mode":"Switch to dark mode",children:q?h.jsx(WM,{className:"h-3.5 w-3.5"}):h.jsx(vM,{className:"h-3.5 w-3.5"})})]})]}),h.jsx(rF,{items:N,gates:P})]}),h.jsx(tF,{activeBuild:r}),h.jsx(G3,{agentActivity:g,agentErrors:y,sessionState:T,onSelectItem:_,onStopAgent:w,spawnedAgents:b,agentRelays:k}),$.attentionCount>0&&h.jsxs(h.Fragment,{children:[h.jsx(Vl,{className:"bg-sidebar-border"}),h.jsx(eF,{items:N,gates:P,onSelectItem:_,onViewChange:n})]}),h.jsx(sF,{onViewChange:n}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("div",{className:"relative",children:[h.jsx(ei,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(zc,{placeholder:"Search...",value:f,onChange:F=>m(F.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),h.jsx(Vl,{className:"bg-sidebar-border"}),h.jsx(Yn,{className:"flex-1",children:h.jsxs("div",{className:"p-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Groups"}),h.jsx(iF,{items:N,hiddenGroups:d,onToggleGroup:p})]})})]})}function oF({level:t,size:e=4}){return h.jsx("div",{className:"flex items-center gap-px",children:[0,1,2,3].map(r=>h.jsx("div",{className:"rounded-full",style:{width:e,height:e,background:r<t?t>=3?"hsl(var(--success))":t>=2?"hsl(var(--accent))":"hsl(var(--destructive))":"transparent",border:`1px solid ${r<t?t>=3?"hsl(var(--success))":t>=2?"hsl(var(--accent))":"hsl(var(--destructive))":"hsl(var(--border))"}`}},r))})}function ka({featureCode:t,active:e,onToggle:r}){return t?h.jsxs("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${e?"#f59e0b":"#334155"}`,background:e?"#f59e0b20":"#1e293b",color:e?"#f59e0b":"#94a3b8"},children:["Focus: ",t]}):null}const mg=[{key:"all",label:"All",statuses:null},{key:"active",label:"Active",statuses:["planned","ready","in_progress","review"]},{key:"done",label:"Done",statuses:["complete"]},{key:"blocked",label:"Blocked",statuses:["blocked","parked"]}],aF=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function gg({active:t,onClick:e,children:r}){return h.jsx("button",{onClick:e,style:{fontSize:11,padding:"2px 7px",borderRadius:4,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function C1({item:t,children:e,depth:r,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o}){const a=e.length>0,l=o.has(t.id),c=n===t.id,u=gr[t.type]||gr.task,d=Vn[t.status]||Vn.planned,{newIds:p,changedIds:f}=C.useContext($c),m=p.has(t.id),x=f.has(t.id);return h.jsxs("div",{children:[h.jsxs("div",{"data-item-id":t.id,onClick:()=>i(t.id),className:nt("flex items-center gap-1.5 py-1 px-2 cursor-pointer transition-colors rounded-md","hover:bg-accent/5",c&&"bg-accent/10",m&&"bg-green-500/5 border-l-2 border-l-green-500",x&&!m&&"bg-amber-500/5 border-l-2 border-l-amber-500"),style:{paddingLeft:`${r*20+8}px`},children:[h.jsx("button",{onClick:g=>{g.stopPropagation(),a&&s(t.id)},className:nt("shrink-0 w-4 h-4 flex items-center justify-center rounded",a?"text-muted-foreground hover:text-foreground":"invisible"),children:a&&(l?h.jsx(Ca,{className:"h-3.5 w-3.5"}):h.jsx(Is,{className:"h-3.5 w-3.5"}))}),h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:d}}),h.jsx("span",{className:"text-[9px] uppercase tracking-wider shrink-0 w-12",style:{color:u},children:t.type}),h.jsx("span",{className:nt("text-sm text-foreground truncate flex-1",t.status==="killed"&&"line-through opacity-50"),children:t.title}),h.jsx(oF,{level:t.confidence||0}),t.phase&&h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-3.5 shrink-0",children:t.phase})]}),a&&l&&h.jsx("div",{children:e.map(g=>h.jsx(C1,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function k1({items:t,connections:e,selectedItemId:r,onSelect:n,onCreate:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,c]=C.useState(()=>new Set),[u,d]=C.useState(""),[p,f]=C.useState("all"),[m,x]=C.useState("all"),g=C.useCallback(_=>{c(w=>{const E=new Set(w);return E.has(_)?E.delete(_):E.add(_),E})},[]),y=C.useMemo(()=>{let _=t;const w=mg.find(E=>E.key===p);if(w!=null&&w.statuses&&(_=_.filter(E=>w.statuses.includes(E.status||"planned"))),m!=="all"&&(_=_.filter(E=>E.type===m)),u){const E=u.toLowerCase();_=_.filter(L=>(L.title||"").toLowerCase().includes(E)||(L.description||"").toLowerCase().includes(E)||(L.type||"").toLowerCase().includes(E)||(L.phase||"").toLowerCase().includes(E))}return o&&s&&(_=_.filter(E=>{var L;return E.featureCode===s||((L=E.lifecycle)==null?void 0:L.featureCode)===s||(E.title||"").includes(s)})),_},[t,u,p,m,o,s]),b=C.useMemo(()=>{const _=new Set(y.map(N=>N.id)),w=new Map;for(const N of y)w.set(N.id,{...N,_children:[]});const E=new Map;for(const N of e)!_.has(N.fromId)||!_.has(N.toId)||(N.type==="informs"?E.has(N.toId)||E.set(N.toId,N.fromId):(N.type==="supports"||N.type==="blocks")&&(E.has(N.fromId)||E.set(N.fromId,N.toId)));for(const N of t)N.parentId&&w.has(N.parentId)&&E.set(N.id,N.parentId);for(const[N]of E){const P=new Set;let $=N;for(;$&&E.has($);){if(P.has($)){E.delete($);break}P.add($),$=E.get($)}}const L=[];for(const N of w.values()){const P=E.get(N.id);P&&w.has(P)?w.get(P)._children.push(N):L.push(N)}const M=N=>{N.sort((P,$)=>(P.confidence||0)-($.confidence||0));for(const P of N)P._children.length>0&&M(P._children)};return M(L),L},[y,e]);Yt.useEffect(()=>{if(u){const _=new Set,w=E=>{for(const L of E)L._children.length>0&&(_.add(L.id),w(L._children))};w(b),c(_)}else l.size===0&&b.length>0&&c(new Set(b.map(_=>_.id)))},[b,u]),Yt.useEffect(()=>{if(!r||b.length===0)return;const _=[],w=(E,L)=>{for(const M of E){if(M.id===L)return!0;if(M._children.length>0&&w(M._children,L))return _.push(M.id),!0}return!1};w(b,r),_.length>0&&c(E=>{const L=new Set(E);for(const M of _)L.add(M);return L}),requestAnimationFrame(()=>{const E=document.querySelector(`[data-item-id="${r}"]`);E&&E.scrollIntoView({block:"center",behavior:"smooth"})})},[r,b]);const k=C.useCallback(()=>{const _=new Set,w=E=>{for(const L of E)L._children.length>0&&(_.add(L.id),w(L._children))};w(b),c(_)},[b]),T=C.useCallback(()=>{c(new Set)},[]);return b.filter(_=>_._children.length>0).length,h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[h.jsx(ka,{featureCode:s,active:o,onToggle:a}),h.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[h.jsx(ei,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(zc,{placeholder:"Search items...",value:u,onChange:_=>d(_.target.value),className:"h-7 pl-7 pr-7 text-xs"}),u&&h.jsx("button",{onClick:()=>d(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h.jsx(hn,{className:"h-3 w-3"})})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Status:"}),mg.map(_=>h.jsx(gg,{active:p===_.key,onClick:()=>f(_.key),children:_.label},_.key))]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Type:"}),aF.map(_=>h.jsx(gg,{active:m===_.key,onClick:()=>x(_.key),children:_.label},_.key))]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[y.length,u||p!=="all"||m!=="all"?`/${t.length}`:""]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:k,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Expand"}),h.jsx("button",{onClick:T,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Collapse"}),i&&h.jsx("button",{onClick:i,title:"Create item",style:{width:24,height:24,borderRadius:4,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},className:"hover:border-blue-500 hover:text-white",children:h.jsx(Ab,{className:"h-3.5 w-3.5"})})]}),h.jsx(Yn,{className:"flex-1",children:h.jsx("div",{className:"py-1",children:b.length===0?h.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No items to display"}):b.map(_=>h.jsx(C1,{item:_,children:_._children,depth:0,selectedItemId:r,onSelect:n,onToggle:g,expandedIds:l},_.id))})})]})}try{ma.use(ly)}catch{}try{ma.use(b_)}catch{}const Yl={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},lF=Object.fromEntries(Object.entries(gr).map(([t,e])=>{const r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16),s=[15,23,42],o=.15,a=[Math.round(s[0]*(1-o)+r*o),Math.round(s[1]*(1-o)+n*o),Math.round(s[2]*(1-o)+i*o)];return[t,`#${a.map(l=>l.toString(16).padStart(2,"0")).join("")}`]})),cF=[1,1.5,2,2.5,3],Yu={informs:{color:"#64748b",style:"solid"},supports:{color:"#22c55e",style:"solid"},blocks:{color:"#ef4444",style:"solid"},contradicts:{color:"#f472b6",style:"dashed"},implements:{color:"#a78bfa",style:"solid"}},xg=[{key:"all",label:"All",statuses:null},{key:"active",label:"Active",statuses:["planned","ready","in_progress","review"]},{key:"complete",label:"Done",statuses:["complete"]},{key:"blocked",label:"Blocked",statuses:["blocked","parked"]}];function Bo(t){return t.group||"other"}const yg=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,qh=24;function hF(t){if(!t||t.length<=qh)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>qh-1)break;r=i}return(r||t.slice(0,qh-1))+"…"}function uF(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&yg.test(e))return e;if(t.id&&yg.test(t.id)&&t.id.length<=32)return t.id;const n=(t.title||"").replace(/`/g,"").trim().match(/^([A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?)\b/);return n&&n[1].length>=3?n[1]:t.slug?hF(t.slug):t.id?t.id.slice(0,12):"item"}function bg(t,e=18){const r=t.split("-"),n=[];let i="";for(const s of r){const o=i?i+"-"+s:s;o.length>e&&i?(n.push(i),i=s):i=o}return i&&n.push(i),n.join(`
344
+ `)}function dF(t,e,r,n,i){var c;const s=[],o=new Set(t.map(u=>u.id));let a=null;if(n&&i){a=new Set(t.filter(u=>{var d;return u.featureCode===i||((d=u.lifecycle)==null?void 0:d.featureCode)===i||(u.title||"").startsWith(i)}).map(u=>u.id));for(const u of e)a.has(u.fromId)&&o.has(u.toId)&&a.add(u.toId),a.has(u.toId)&&o.has(u.fromId)&&a.add(u.fromId)}const l=new Set;if(r){const d=[...new Set(t.map(p=>Bo(p)).filter(Boolean))].map(p=>{const f=t.filter(y=>Bo(y)===p),m=f.filter(y=>["blocked","parked"].includes(y.status)).length,x=f.filter(y=>["in_progress","review","ready"].includes(y.status)).length,g=f.filter(y=>y.status==="planned").length;return{group:p,blocked:m,active:x,planned:g,total:f.length}});d.sort((p,f)=>f.active-p.active||f.blocked-p.blocked||f.planned-p.planned||p.group.localeCompare(f.group));for(const{group:p,active:f,total:m}of d){if(m<2)continue;l.add(p);const x=a&&t.some(g=>Bo(g)===p&&a.has(g.id));s.push({data:{id:`group-${p}`,label:`${bg(p)}
345
+ (${f} active, ${m} total)`,isGroup:!0,groupType:p},...a&&!x?{classes:"focus-dimmed"}:{}})}}for(const u of t){const d=u.slug||u.id.slice(0,8),p=bg(uF(u),14),f=Bo(u),m=a&&!a.has(u.id);s.push({data:{id:u.id,label:p,itemType:u.type||"task",status:u.status||"planned",phase:u.phase||"vision",confidence:u.confidence??0,title:u.title,description:u.description,slug:d,featureCode:((c=u.lifecycle)==null?void 0:c.featureCode)||u.featureCode||null,group:f||null,...r&&f&&l.has(f)?{parent:`group-${f}`}:{}},...m?{classes:"focus-dimmed"}:{}})}for(const u of e){if(!o.has(u.fromId)||!o.has(u.toId))continue;let d,p;u.type==="supports"||u.type==="blocks"?(d=u.toId,p=u.fromId):(d=u.fromId,p=u.toId);const f=Yu[u.type]||Yu.informs;s.push({data:{id:u.id||`${u.fromId}-${u.toId}`,source:d,target:p,edgeType:u.type,edgeColor:f.color,edgeStyle:f.style}})}return s}function fF(){return[{selector:"[?isGroup]",style:{label:"data(label)","text-valign":"top","text-halign":"center","font-size":"10px","font-weight":600,color:"#64748b","text-transform":"uppercase","letter-spacing":"0.08em","text-wrap":"wrap","text-max-width":"160px","background-color":"#1a2537","border-width":1,"border-color":"#283548","border-style":"solid",padding:"24px","text-margin-y":-4}},{selector:"node[status]",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"9px","font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", monospace',"font-weight":500,color:"#e2e8f0","text-wrap":"wrap","text-max-width":"130px",width:"150px",height:"60px",shape:"round-rectangle","background-color":"#1e293b","border-style":"solid","border-width":2,"border-color":"#3b82f6"}},...Object.entries(Yl).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(lF).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...cF.map((t,e)=>({selector:`node[confidence=${e}]`,style:{"border-width":t}})),{selector:"node:selected",style:{"background-color":"#1e3a5f","border-width":3,"border-color":"#60a5fa"}},{selector:"edge",style:{width:1.5,"line-color":"data(edgeColor)","target-arrow-color":"data(edgeColor)","target-arrow-shape":"triangle","arrow-scale":.8,"curve-style":"bezier",opacity:.6}},{selector:'edge[edgeStyle="dashed"]',style:{"line-style":"dashed","line-dash-pattern":[6,3],"target-arrow-shape":"diamond"}},{selector:'edge[edgeType="blocks"]',style:{"target-arrow-shape":"tee"}},{selector:".dimmed",style:{opacity:.35}},{selector:".focus-dimmed",style:{opacity:.15,events:"no"}},{selector:".highlighted",style:{"border-width":3,"border-color":"#60a5fa"}},{selector:".build-building",style:{"border-color":"#3b82f6","border-width":3,"shadow-color":"#3b82f6","shadow-opacity":.6,"shadow-blur":12}},{selector:".build-gate-pending",style:{"border-color":"#f59e0b","border-width":3,"shadow-color":"#f59e0b","shadow-opacity":.5,"shadow-blur":8}},{selector:".build-blocked-downstream",style:{opacity:.35,"border-color":"#94a3b8"}},{selector:".build-error",style:{"border-color":"#ef4444","border-width":3,"shadow-color":"#ef4444","shadow-opacity":.5,"shadow-blur":8}},{selector:"[?isAgentGroup]",style:{label:"data(label)","text-valign":"top","text-halign":"center","font-size":"9px",color:"#64748b","text-transform":"uppercase","background-color":"#0f1a2b","border-width":1,"border-color":"#1e3050","border-style":"dashed",padding:"14px"}},{selector:"[?isAgentNode]",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"8px","font-family":"monospace",color:"#e2e8f0","text-wrap":"wrap","text-max-width":"70px",width:"80px",height:"40px",shape:"diamond","background-color":"#1e293b","border-style":"solid","border-width":2,"border-color":"data(agentColor)"}},{selector:'[agentStatus="complete"]',style:{"border-style":"dashed",opacity:.6}},{selector:'[agentStatus="failed"]',style:{"border-color":"#ef4444","border-style":"dashed",opacity:.6}},{selector:"[?isRelayEdge]",style:{width:1,"line-color":"#475569","line-style":"dashed","line-dash-pattern":[8,4],"target-arrow-color":"#475569","target-arrow-shape":"triangle","arrow-scale":.6,"curve-style":"bezier",opacity:.4}},{selector:".relay-active",style:{width:2,"line-color":"#3b82f6",opacity:.8,"target-arrow-color":"#3b82f6"}},{selector:".relay-result",style:{width:2,"line-color":"#10b981",opacity:.8,"target-arrow-color":"#10b981"}},{selector:".idea-node",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"8px","font-family":"monospace",color:"#fbbf24","text-wrap":"wrap","text-max-width":"70px",width:"70px",height:"70px",shape:"ellipse","background-color":"#451a0310","border-style":"dashed","border-width":1.5,"border-color":"#f59e0b",opacity:.85}},{selector:'edge[edgeType="idea"]',style:{width:1,"line-color":"#f59e0b","line-style":"dashed","line-dash-pattern":[6,3],"target-arrow-color":"#f59e0b","target-arrow-shape":"triangle","arrow-scale":.7,"curve-style":"bezier",opacity:.5}}]}function pF({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=Yl[n.status]||Yl.planned,s=gr[n.itemType]||"#94a3b8",o=e+300>window.innerWidth?e-294:e+14,a=Math.min(r-10,window.innerHeight-200);return h.jsxs("div",{style:{position:"fixed",left:o,top:a,zIndex:9999,pointerEvents:"none",maxWidth:280,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 13px",fontSize:12,boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[h.jsx("div",{style:{fontWeight:700,fontSize:13,color:"#f8fafc",marginBottom:3},children:n.slug}),h.jsx("div",{style:{color:"#94a3b8",marginBottom:6,lineHeight:1.4},children:n.title}),h.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[h.jsx(Hh,{color:i,children:(n.status||"planned").replace("_"," ")}),h.jsx(Hh,{color:s,children:n.itemType}),n.phase&&h.jsx(Hh,{color:"#94a3b8",children:Fl[n.phase]||n.phase})]}),n.description&&h.jsx("div",{style:{marginTop:8,color:"#94a3b8",fontSize:11,lineHeight:1.4},children:n.description.length>140?n.description.slice(0,140)+"…":n.description}),h.jsxs("div",{style:{marginTop:6,color:"#64748b",fontSize:10},children:[lf[n.confidence||0]," confidence"]})]})}function mF({data:t,onApply:e,onClose:r}){const{x:n,y:i,currentGroup:s}=t,[o,a]=C.useState(s||""),l=C.useRef(null);C.useEffect(()=>{var p,f;(p=l.current)==null||p.focus(),(f=l.current)==null||f.select()},[]),C.useEffect(()=>{const p=f=>{f.key==="Escape"&&r()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),C.useEffect(()=>{const p=m=>{const x=document.getElementById("group-change-popover-root");x&&!x.contains(m.target)&&r()},f=setTimeout(()=>window.addEventListener("mousedown",p),0);return()=>{clearTimeout(f),window.removeEventListener("mousedown",p)}},[r]);const c=n+240>window.innerWidth?n-234:n+14,u=Math.min(i-10,window.innerHeight-120),d=()=>e(o.trim());return h.jsxs("div",{id:"group-change-popover-root","data-testid":"group-change-popover",style:{position:"fixed",left:c,top:u,zIndex:1e4,width:220,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 12px",boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[h.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Change group"}),h.jsx("input",{ref:l,type:"text",value:o,onChange:p=>a(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),d())},placeholder:"(no group)",style:{width:"100%",boxSizing:"border-box",fontSize:12,padding:"5px 7px",background:"#0f172a",color:"#f8fafc",border:"1px solid #334155",borderRadius:4,outline:"none"}}),h.jsxs("div",{style:{display:"flex",gap:6,marginTop:8,justifyContent:"flex-end"},children:[h.jsx("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"transparent",color:"#94a3b8",border:"1px solid #334155"},children:"Cancel"}),h.jsx("button",{onClick:d,"data-testid":"group-change-apply",style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"#2563eb",color:"#f8fafc",border:"1px solid #2563eb"},children:"Apply"})]})]})}function Hh({color:t,children:e}){return h.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,fontWeight:600,background:`${t}20`,color:t,border:`1px solid ${t}40`,textTransform:"uppercase",letterSpacing:"0.03em"},children:e})}const v1={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function go({active:t,onClick:e,children:r}){return h.jsx("button",{onClick:e,style:{...v1,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function Uh({onClick:t,children:e,title:r}){return h.jsx("button",{onClick:t,title:r,style:{...v1,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function Ua(){return h.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const gF=["build-building","build-gate-pending","build-blocked-downstream","build-error"],xF={building:{bg:"#3b82f620",border:"#3b82f6",color:"#3b82f6",label:"⚙"},gate_pending:{bg:"#f59e0b20",border:"#f59e0b",color:"#f59e0b",label:"⚠"},error:{bg:"#ef444420",border:"#ef4444",color:"#ef4444",label:"✖"}};function yF({badge:t,onClick:e}){const r=xF[t.state];return r?h.jsx("div",{onClick:e,style:{position:"absolute",left:t.x,top:t.y,width:16,height:16,borderRadius:"50%",background:r.bg,border:`1.5px solid ${r.border}`,color:r.color,fontSize:9,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",cursor:e?"pointer":"default",zIndex:100,pointerEvents:e?"auto":"none"},title:t.state.replace(/_/g," "),children:r.label}):null}function bF({featureCode:t,gates:e,items:r,badgePositions:n,onResolve:i,onClose:s}){const o=n.find(u=>u.featureCode===t);if(!o)return null;const a=r.find(u=>{var d;return((d=u.lifecycle)==null?void 0:d.featureCode)===t||u.featureCode===t||u.title===t}),l=a&&(e==null?void 0:e.find(u=>u.itemId===a.id&&!u.resolvedAt));if(!l)return null;const c=l.stepId?l.stepId.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):"Gate";return h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{position:"fixed",inset:0,zIndex:199},onClick:s}),h.jsxs("div",{style:{position:"absolute",left:o.x-80,top:o.y+22,zIndex:200,width:200,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 12px",boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[h.jsx("div",{style:{fontSize:10,color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:4},children:c}),h.jsx("div",{style:{fontSize:12,color:"#f8fafc",fontWeight:600,marginBottom:8},children:t}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{onClick:()=>i(l.id,"approve"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#22c55e20",color:"#22c55e",border:"1px solid #22c55e40",cursor:"pointer"},children:"Approve"}),h.jsx("button",{onClick:()=>i(l.id,"revise"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#f59e0b20",color:"#f59e0b",border:"1px solid #f59e0b40",cursor:"pointer"},children:"Revise"}),h.jsx("button",{onClick:()=>i(l.id,"kill"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#ef444420",color:"#ef4444",border:"1px solid #ef444440",cursor:"pointer"},children:"Kill"})]})]})]})}function w1({items:t,connections:e,selectedItemId:r,onSelect:n,visibleTracks:i,hiddenGroups:s,buildStateMap:o,resolveGate:a,gates:l,spawnedAgents:c,agentRelays:u,agentOverlay:d,featureCode:p,focusActive:f,onToggleFocus:m}){const x=C.useRef(null),g=C.useRef(null),y=C.useRef({}),b=C.useRef(!1),k=C.useRef({}),T=C.useRef(null),[_,w]=C.useState(null),[E,L]=C.useState("active"),[M,N]=C.useState(!0),[P,$]=C.useState(!1),[q,O]=C.useState(null),[I,F]=C.useState(null),[D,R]=C.useState([]),[j,S]=C.useState(!1),[U,Q]=C.useState(!1),A=Ds(V=>V.ideas);C.useEffect(()=>{let V=!1;return zt("/api/graph/layout").then(it=>it.ok?it.json():{positions:{}}).then(it=>{if(V)return;y.current=it.positions||{},b.current=!0;const dt=g.current;dt&&ot(dt)}).catch(()=>{b.current=!0}),()=>{V=!0}},[]);const rt=C.useCallback(()=>{const V=k.current;k.current={},T.current=null,Object.keys(V).length&&zt("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:V})}).catch(it=>console.warn("[graph-layout] save failed:",it))},[]),ut=C.useCallback(V=>{Object.assign(k.current,V),Object.assign(y.current,V),T.current&&clearTimeout(T.current),T.current=setTimeout(rt,500)},[rt]),ot=C.useCallback(V=>{const it=y.current,dt={};V.nodes("node[status]").forEach(Nt=>{const et=Nt.data();if(et.isAgentNode||et.isIdeaNode)return;const kt=Nt.id(),G=it[kt];if(G&&Number.isFinite(G.x)&&Number.isFinite(G.y))Nt.position({x:G.x,y:G.y});else{const st=Nt.position();Number.isFinite(st.x)&&Number.isFinite(st.y)&&(dt[kt]={x:st.x,y:st.y})}}),Object.keys(dt).length&&ut(dt)},[ut]),It=C.useRef(!1);C.useEffect(()=>{const V=c==null?void 0:c.some(it=>it.status==="running");V&&!It.current?S(!0):!V&&It.current&&(c==null?void 0:c.length)>0&&S(!1),It.current=!!V},[c]);const ht=C.useMemo(()=>t.filter(V=>{const it=V.title||"";return!it.startsWith("`docs/")&&!it.startsWith("docs/")}),[t]),at=C.useMemo(()=>{let V=ht;const it=xg.find(dt=>dt.key===E);if(it!=null&&it.statuses&&(V=V.filter(dt=>it.statuses.includes(dt.status||"planned"))),i){const dt=Nt=>{const et=(Nt.description||"").match(/Track:\s*(\w+)/i);return et?et[1].toLowerCase():Nt.type||"other"};V=V.filter(Nt=>i.has(dt(Nt)))}return(s==null?void 0:s.size)>0&&(V=V.filter(dt=>!s.has(Bo(dt)))),V},[ht,E,i,s]),K=C.useMemo(()=>{const V=new Set(at.map(it=>it.id));return e.filter(it=>V.has(it.fromId)&&V.has(it.toId))},[e,at]),lt=C.useMemo(()=>!d||!d.nodes.length?[]:[...d.nodes,...d.edges],[c]),yt=C.useMemo(()=>{if(!U)return[];new Set(at.map(it=>it.id));const V=[];for(const it of A){if(!it.mapsTo)continue;const dt=`idea-${it.id}`;V.push({data:{id:dt,label:`${it.id}
346
+ ${it.title.slice(0,20)}${it.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:it.id},classes:"idea-node"});const Nt=it.mapsTo.split(",").map(et=>et.trim()).filter(Boolean);for(const et of Nt){const kt=at.find(G=>{var st;return((st=G.lifecycle)==null?void 0:st.featureCode)===et||G.featureCode===et||(G.title||"").startsWith(et)});kt&&V.push({data:{id:`idea-edge-${it.id}-${kt.id}`,source:dt,target:kt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return V},[U,A,at]),At=C.useMemo(()=>{let it=dF(at,K,M,f,p);return j&&lt.length>0&&(it=[...it,...lt]),U&&yt.length>0&&(it=[...it,...yt]),it},[at,K,M,j,lt,U,yt,f,p]),Dt=C.useMemo(()=>fF(),[]);C.useEffect(()=>{if(!x.current)return;g.current&&(g.current.destroy(),g.current=null);const V=ma({container:x.current,elements:At,style:Dt,layout:{name:"fcose",quality:"proof",animate:!1,fit:!1,padding:20,nodeSeparation:80,idealEdgeLength:120,nodeRepulsion:6e3,gravity:.3,gravityRange:1.5,tilingPaddingVertical:12,tilingPaddingHorizontal:12},minZoom:.1,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});if(g.current=V,V.one("layoutstop",()=>{b.current&&ot(V),V.fit(void 0,30)}),V.fit(void 0,30),V.on("dragfree","node[status]",it=>{const dt=it.target,Nt=dt.data();if(Nt.isAgentNode||Nt.isIdeaNode)return;const et=dt.position();!Number.isFinite(et.x)||!Number.isFinite(et.y)||ut({[dt.id()]:{x:et.x,y:et.y}})}),r){const it=V.$id(r);it.length&&Gh(V,it)}return V.on("mouseover","node[status]",it=>{const dt=it.renderedPosition||it.position,Nt=V.container().getBoundingClientRect();w({x:Nt.left+dt.x,y:Nt.top+dt.y,item:it.target.data()})}),V.on("mousemove","node[status]",it=>{const dt=it.renderedPosition||it.position,Nt=V.container().getBoundingClientRect();w(et=>et?{x:Nt.left+dt.x,y:Nt.top+dt.y,item:et.item}:null)}),V.on("mouseout","node[status]",()=>w(null)),V.on("tap","node[status]",it=>{ue.current=!0,Gh(V,it.target),n(it.target.id())}),V.on("tap",it=>{it.target===V&&V.elements().removeClass("dimmed highlighted")}),V.on("cxttap","node[status]",it=>{var kt;const dt=it.target.data();if(dt.isAgentNode||dt.isIdeaNode||dt.isGroup)return;try{(kt=it.originalEvent)==null||kt.preventDefault()}catch{}const Nt=it.renderedPosition||it.position,et=V.container().getBoundingClientRect();F({x:et.left+Nt.x,y:et.top+Nt.y,itemId:it.target.id(),currentGroup:dt.group||""}),w(null)}),V.container().addEventListener("contextmenu",it=>it.preventDefault()),()=>{T.current&&(clearTimeout(T.current),rt()),V.destroy(),g.current=null}},[At,Dt]);const ue=C.useRef(!1);C.useEffect(()=>{const V=g.current;if(!V||!r)return;const it=V.$id(r);it.length&&(V.elements().removeClass("dimmed highlighted"),Gh(V,it),ue.current||V.animate({center:{eles:it},duration:200}),ue.current=!1)},[r]),C.useEffect(()=>{const V=g.current;if(V&&(V.nodes().removeClass(gF.join(" ")),!(!o||Object.keys(o).length===0)))for(const[it,dt]of Object.entries(o)){const Nt=`build-${dt.replace(/_/g,"-")}`,et=V.nodes().filter(kt=>{const G=kt.data();return G.slug===it||G.title===it||G.featureCode===it});et.length&&et.addClass(Nt)}},[o]),C.useEffect(()=>{const V=g.current;if(!V||!o||!Object.values(o).includes("building"))return;let dt=!0;const Nt=setInterval(()=>{const et=V.nodes(".build-building");et.length&&(dt=!dt,et.style("shadow-blur",dt?12:4),et.style("shadow-opacity",dt?.6:.2))},800);return()=>clearInterval(Nt)},[o]),C.useEffect(()=>{var et;const V=g.current;if(!V||(V.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!j||!((et=d==null?void 0:d.activeEdgeIds)!=null&&et.size)))return;const it=new Set((c||[]).map(kt=>kt.agentId)),dt=kt=>kt==="session"?"agent-session":it.has(kt)?`agent-${kt}`:"agent-session";for(const kt of d.activeEdgeIds){const G=V.getElementById(kt);if(G.length){const st=u==null?void 0:u.findLast(St=>{const Ot=dt(St.fromAgentId),$t=dt(St.toAgentId);return(St.direction==="dispatch"?`relay-${Ot}-${$t}`:`relay-${$t}-${Ot}`)===kt});G.addClass((st==null?void 0:st.direction)==="result"?"relay-result":"relay-active")}}const Nt=setInterval(()=>{const kt=V.edges(".relay-active, .relay-result");if(!kt.length)return;const G=Date.now()/20%100;kt.style("line-dash-offset",-G)},50);return()=>clearInterval(Nt)},[j,d==null?void 0:d.activeEdgeIds,u]);const ae=C.useCallback(()=>{const V=g.current;if(!V||!o||Object.keys(o).length===0){R([]);return}const it=[];for(const[dt,Nt]of Object.entries(o)){if(Nt!=="gate_pending"&&Nt!=="error"&&Nt!=="building")continue;const et=V.nodes().filter(st=>{const St=st.data();return St.slug===dt||St.title===dt||St.featureCode===dt});if(!et.length)continue;const kt=et.renderedPosition(),G=et.renderedOuterWidth();it.push({featureCode:dt,state:Nt,x:kt.x+G/2-6,y:kt.y-et.renderedOuterHeight()/2-6,nodeId:et.id()})}R(it)},[o]);C.useEffect(()=>{const V=g.current;if(V)return V.on("render pan zoom",ae),ae(),()=>{V.removeListener("render pan zoom",ae)}},[ae]);const Pe=C.useCallback(()=>{var V;return(V=g.current)==null?void 0:V.fit(void 0,40)},[]),Zt=C.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()*1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]),Be=C.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()/1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]);return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",style:{background:"#0f172a"},children:[h.jsx("div",{className:"shrink-0",style:{background:"#1e293b",borderBottom:"1px solid #334155"},children:h.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ka,{featureCode:p,active:f,onToggle:m}),p&&h.jsx(Ua,{}),h.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),xg.map(V=>h.jsx(go,{active:E===V.key,onClick:()=>L(V.key),children:V.label},V.key)),h.jsx(Ua,{}),h.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[at.length," items · ",K.length," edges"]})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(go,{active:M,onClick:()=>N(!M),children:"Group"}),h.jsx(go,{active:j,onClick:()=>S(V=>!V),title:"Show/hide agent topology",children:"Agents"}),h.jsx(go,{active:U,onClick:()=>Q(V=>!V),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),h.jsx(Ua,{}),h.jsx(Uh,{onClick:Be,title:"Zoom out",children:"−"}),h.jsx(Uh,{onClick:Pe,title:"Fit to view",children:"Fit"}),h.jsx(Uh,{onClick:Zt,title:"Zoom in",children:"+"}),h.jsx(Ua,{}),h.jsx(go,{active:P,onClick:()=>$(!P),children:"Legend"})]})]})}),at.length===0&&!j?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsxs("div",{style:{textAlign:"center"},children:[h.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items match the current filters"}),h.jsx("div",{style:{fontSize:11,color:"#475569"},children:"Try adjusting the status or group filters"})]})}):h.jsxs("div",{className:"flex-1 relative min-h-0",children:[h.jsx("div",{ref:x,className:"w-full h-full"}),P&&h.jsxs("div",{style:{position:"absolute",bottom:16,left:16,zIndex:10,background:"#1e293b",border:"1px solid #334155",borderRadius:8,padding:"10px 13px",fontSize:11,maxHeight:"calc(100% - 32px)",overflowY:"auto"},children:[h.jsx(Vh,{title:"Types",children:Object.entries(gr).map(([V,it])=>h.jsxs(Xh,{children:[h.jsx(Cg,{color:it}),V]},V))}),h.jsx(Yh,{}),h.jsx(Vh,{title:"Status",children:Object.entries(Yl).map(([V,it])=>h.jsxs(Xh,{children:[h.jsx(Cg,{color:it}),V.replace("_"," ")]},V))}),h.jsx(Yh,{}),h.jsx(Vh,{title:"Edges",children:Object.entries(Yu).map(([V,it])=>h.jsxs(Xh,{children:[h.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:h.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:it.color,strokeWidth:"1.5",strokeDasharray:it.style==="dashed"?"6,3":"none"})}),V]},V))}),h.jsx(Yh,{}),h.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",h.jsx("br",{}),"Click node to trace deps"]})]}),h.jsx(pF,{data:_}),I&&h.jsx(mF,{data:I,onClose:()=>F(null),onApply:V=>{const it=I.itemId;F(null),zt(`/api/vision/items/${it}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:V||null})}).catch(dt=>console.warn("[graph] group update failed:",dt))}}),D.map(V=>h.jsx(yF,{badge:V,onClick:V.state==="gate_pending"?()=>O(q===V.featureCode?null:V.featureCode):V.state==="error"?()=>n(V.nodeId):void 0},V.featureCode)),q&&h.jsx(bF,{featureCode:q,gates:l,items:t,badgePositions:D,onResolve:(V,it)=>{a&&a(V,it),O(null)},onClose:()=>O(null)})]})]})}function Gh(t,e){t.elements().removeClass("dimmed highlighted");const r=e.union(e.predecessors("node[status]")).union(e.successors("node[status]")),n=r.edgesWith(r);t.nodes("[status]").not(r).addClass("dimmed"),t.edges().not(n).addClass("dimmed"),e.addClass("highlighted")}function Vh({title:t,children:e}){return h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:5,fontWeight:700},children:t}),e]})}function Yh(){return h.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function Xh({children:t}){return h.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function Cg({color:t}){return h.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var yl={exports:{}},CF=yl.exports,kg;function kF(){return kg||(kg=1,(function(t,e){(function(r,n){t.exports=n()})(CF,(function(){var r=1e3,n=6e4,i=36e5,s="millisecond",o="second",a="minute",l="hour",c="day",u="week",d="month",p="quarter",f="year",m="date",x="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(O){var I=["th","st","nd","rd"],F=O%100;return"["+O+(I[(F-20)%10]||I[F]||I[0])+"]"}},k=function(O,I,F){var D=String(O);return!D||D.length>=I?O:""+Array(I+1-D.length).join(F)+O},T={s:k,z:function(O){var I=-O.utcOffset(),F=Math.abs(I),D=Math.floor(F/60),R=F%60;return(I<=0?"+":"-")+k(D,2,"0")+":"+k(R,2,"0")},m:function O(I,F){if(I.date()<F.date())return-O(F,I);var D=12*(F.year()-I.year())+(F.month()-I.month()),R=I.clone().add(D,d),j=F-R<0,S=I.clone().add(D+(j?-1:1),d);return+(-(D+(F-R)/(j?R-S:S-R))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:d,y:f,w:u,d:c,D:m,h:l,m:a,s:o,ms:s,Q:p}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},_="en",w={};w[_]=b;var E="$isDayjsObject",L=function(O){return O instanceof $||!(!O||!O[E])},M=function O(I,F,D){var R;if(!I)return _;if(typeof I=="string"){var j=I.toLowerCase();w[j]&&(R=j),F&&(w[j]=F,R=j);var S=I.split("-");if(!R&&S.length>1)return O(S[0])}else{var U=I.name;w[U]=I,R=U}return!D&&R&&(_=R),R||!D&&_},N=function(O,I){if(L(O))return O.clone();var F=typeof I=="object"?I:{};return F.date=O,F.args=arguments,new $(F)},P=T;P.l=M,P.i=L,P.w=function(O,I){return N(O,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var $=(function(){function O(F){this.$L=M(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[E]=!0}var I=O.prototype;return I.parse=function(F){this.$d=(function(D){var R=D.date,j=D.utc;if(R===null)return new Date(NaN);if(P.u(R))return new Date;if(R instanceof Date)return new Date(R);if(typeof R=="string"&&!/Z$/i.test(R)){var S=R.match(g);if(S){var U=S[2]-1||0,Q=(S[7]||"0").substring(0,3);return j?new Date(Date.UTC(S[1],U,S[3]||1,S[4]||0,S[5]||0,S[6]||0,Q)):new Date(S[1],U,S[3]||1,S[4]||0,S[5]||0,S[6]||0,Q)}}return new Date(R)})(F),this.init()},I.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},I.$utils=function(){return P},I.isValid=function(){return this.$d.toString()!==x},I.isSame=function(F,D){var R=N(F);return this.startOf(D)<=R&&R<=this.endOf(D)},I.isAfter=function(F,D){return N(F)<this.startOf(D)},I.isBefore=function(F,D){return this.endOf(D)<N(F)},I.$g=function(F,D,R){return P.u(F)?this[D]:this.set(R,F)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(F,D){var R=this,j=!!P.u(D)||D,S=P.p(F),U=function(at,K){var lt=P.w(R.$u?Date.UTC(R.$y,K,at):new Date(R.$y,K,at),R);return j?lt:lt.endOf(c)},Q=function(at,K){return P.w(R.toDate()[at].apply(R.toDate("s"),(j?[0,0,0,0]:[23,59,59,999]).slice(K)),R)},A=this.$W,rt=this.$M,ut=this.$D,ot="set"+(this.$u?"UTC":"");switch(S){case f:return j?U(1,0):U(31,11);case d:return j?U(1,rt):U(0,rt+1);case u:var It=this.$locale().weekStart||0,ht=(A<It?A+7:A)-It;return U(j?ut-ht:ut+(6-ht),rt);case c:case m:return Q(ot+"Hours",0);case l:return Q(ot+"Minutes",1);case a:return Q(ot+"Seconds",2);case o:return Q(ot+"Milliseconds",3);default:return this.clone()}},I.endOf=function(F){return this.startOf(F,!1)},I.$set=function(F,D){var R,j=P.p(F),S="set"+(this.$u?"UTC":""),U=(R={},R[c]=S+"Date",R[m]=S+"Date",R[d]=S+"Month",R[f]=S+"FullYear",R[l]=S+"Hours",R[a]=S+"Minutes",R[o]=S+"Seconds",R[s]=S+"Milliseconds",R)[j],Q=j===c?this.$D+(D-this.$W):D;if(j===d||j===f){var A=this.clone().set(m,1);A.$d[U](Q),A.init(),this.$d=A.set(m,Math.min(this.$D,A.daysInMonth())).$d}else U&&this.$d[U](Q);return this.init(),this},I.set=function(F,D){return this.clone().$set(F,D)},I.get=function(F){return this[P.p(F)]()},I.add=function(F,D){var R,j=this;F=Number(F);var S=P.p(D),U=function(rt){var ut=N(j);return P.w(ut.date(ut.date()+Math.round(rt*F)),j)};if(S===d)return this.set(d,this.$M+F);if(S===f)return this.set(f,this.$y+F);if(S===c)return U(1);if(S===u)return U(7);var Q=(R={},R[a]=n,R[l]=i,R[o]=r,R)[S]||1,A=this.$d.getTime()+F*Q;return P.w(A,this)},I.subtract=function(F,D){return this.add(-1*F,D)},I.format=function(F){var D=this,R=this.$locale();if(!this.isValid())return R.invalidDate||x;var j=F||"YYYY-MM-DDTHH:mm:ssZ",S=P.z(this),U=this.$H,Q=this.$m,A=this.$M,rt=R.weekdays,ut=R.months,ot=R.meridiem,It=function(K,lt,yt,At){return K&&(K[lt]||K(D,j))||yt[lt].slice(0,At)},ht=function(K){return P.s(U%12||12,K,"0")},at=ot||function(K,lt,yt){var At=K<12?"AM":"PM";return yt?At.toLowerCase():At};return j.replace(y,(function(K,lt){return lt||(function(yt){switch(yt){case"YY":return String(D.$y).slice(-2);case"YYYY":return P.s(D.$y,4,"0");case"M":return A+1;case"MM":return P.s(A+1,2,"0");case"MMM":return It(R.monthsShort,A,ut,3);case"MMMM":return It(ut,A);case"D":return D.$D;case"DD":return P.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return It(R.weekdaysMin,D.$W,rt,2);case"ddd":return It(R.weekdaysShort,D.$W,rt,3);case"dddd":return rt[D.$W];case"H":return String(U);case"HH":return P.s(U,2,"0");case"h":return ht(1);case"hh":return ht(2);case"a":return at(U,Q,!0);case"A":return at(U,Q,!1);case"m":return String(Q);case"mm":return P.s(Q,2,"0");case"s":return String(D.$s);case"ss":return P.s(D.$s,2,"0");case"SSS":return P.s(D.$ms,3,"0");case"Z":return S}return null})(K)||S.replace(":","")}))},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(F,D,R){var j,S=this,U=P.p(D),Q=N(F),A=(Q.utcOffset()-this.utcOffset())*n,rt=this-Q,ut=function(){return P.m(S,Q)};switch(U){case f:j=ut()/12;break;case d:j=ut();break;case p:j=ut()/3;break;case u:j=(rt-A)/6048e5;break;case c:j=(rt-A)/864e5;break;case l:j=rt/i;break;case a:j=rt/n;break;case o:j=rt/r;break;default:j=rt}return R?j:P.a(j)},I.daysInMonth=function(){return this.endOf(d).$D},I.$locale=function(){return w[this.$L]},I.locale=function(F,D){if(!F)return this.$L;var R=this.clone(),j=M(F,D,!0);return j&&(R.$L=j),R},I.clone=function(){return P.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},O})(),q=$.prototype;return N.prototype=q,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",c],["$M",d],["$y",f],["$D",m]].forEach((function(O){q[O[1]]=function(I){return this.$g(I,O[0],O[1])}})),N.extend=function(O,I){return O.$i||(O(I,$,N),O.$i=!0),N},N.locale=M,N.isDayjs=L,N.unix=function(O){return N(1e3*O)},N.en=w[_],N.Ls=w,N.p={},N}))})(yl)),yl.exports}var vF=kF();const wF=Ac(vF);var S1=Object.defineProperty,v=(t,e)=>S1(t,"name",{value:e,configurable:!0}),SF=(t,e)=>{for(var r in e)S1(t,r,{get:e[r],enumerable:!0})},xn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},tt={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},qf=v(function(t="fatal"){let e=xn.fatal;typeof t=="string"?t.toLowerCase()in xn&&(e=xn[t]):typeof t=="number"&&(e=t),tt.trace=()=>{},tt.debug=()=>{},tt.info=()=>{},tt.warn=()=>{},tt.error=()=>{},tt.fatal=()=>{},e<=xn.fatal&&(tt.fatal=console.error?console.error.bind(console,jr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",jr("FATAL"))),e<=xn.error&&(tt.error=console.error?console.error.bind(console,jr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",jr("ERROR"))),e<=xn.warn&&(tt.warn=console.warn?console.warn.bind(console,jr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",jr("WARN"))),e<=xn.info&&(tt.info=console.info?console.info.bind(console,jr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",jr("INFO"))),e<=xn.debug&&(tt.debug=console.debug?console.debug.bind(console,jr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",jr("DEBUG"))),e<=xn.trace&&(tt.trace=console.debug?console.debug.bind(console,jr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",jr("TRACE")))},"setLogLevel"),jr=v(t=>`%c${wF().format("ss.SSS")} : ${t} : `,"format");const bl={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t),hsl2rgb:({h:t,s:e,l:r},n)=>{if(!e)return r*2.55;t/=360,e/=100,r/=100;const i=r<.5?r*(1+e):r+e-r*e,s=2*r-i;switch(n){case"r":return bl.hue2rgb(s,i,t+1/3)*255;case"g":return bl.hue2rgb(s,i,t)*255;case"b":return bl.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:r},n)=>{t/=255,e/=255,r/=255;const i=Math.max(t,e,r),s=Math.min(t,e,r),o=(i+s)/2;if(n==="l")return o*100;if(i===s)return 0;const a=i-s,l=o>.5?a/(2-i-s):a/(i+s);if(n==="s")return l*100;switch(i){case t:return((e-r)/a+(e<r?6:0))*60;case e:return((r-t)/a+2)*60;case r:return((t-e)/a+4)*60;default:return-1}}},TF={clamp:(t,e,r)=>e>r?Math.min(e,Math.max(r,t)):Math.min(r,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},_F={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Rt={channel:bl,lang:TF,unit:_F},Rn={};for(let t=0;t<=255;t++)Rn[t]=Rt.unit.dec2hex(t);const He={ALL:0,RGB:1,HSL:2};class EF{constructor(){this.type=He.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=He.ALL}is(e){return this.type===e}}class NF{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new EF}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=He.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Rt.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Rt.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Rt.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Rt.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Rt.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Rt.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(He.HSL)&&r!==void 0?r:(this._ensureHSL(),Rt.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(He.HSL)&&r!==void 0?r:(this._ensureHSL(),Rt.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(He.HSL)&&r!==void 0?r:(this._ensureHSL(),Rt.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(He.RGB)&&r!==void 0?r:(this._ensureRGB(),Rt.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(He.RGB)&&r!==void 0?r:(this._ensureRGB(),Rt.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(He.RGB)&&r!==void 0?r:(this._ensureRGB(),Rt.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(He.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(He.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(He.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(He.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(He.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(He.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const Uc=new NF({r:0,g:0,b:0,a:0},"transparent"),ps={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(ps.re);if(!e)return;const r=e[1],n=parseInt(r,16),i=r.length,s=i%4===0,o=i>4,a=o?1:17,l=o?8:4,c=s?0:-1,u=o?255:15;return Uc.set({r:(n>>l*(c+3)&u)*a,g:(n>>l*(c+2)&u)*a,b:(n>>l*(c+1)&u)*a,a:s?(n&u)*a/255:1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`#${Rn[Math.round(e)]}${Rn[Math.round(r)]}${Rn[Math.round(n)]}${Rn[Math.round(i*255)]}`:`#${Rn[Math.round(e)]}${Rn[Math.round(r)]}${Rn[Math.round(n)]}`}},gi={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(gi.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Rt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Rt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Rt.channel.clamp.h(parseFloat(r)*360)}}return Rt.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(gi.re);if(!r)return;const[,n,i,s,o,a]=r;return Uc.set({h:gi._hue2deg(n),s:Rt.channel.clamp.s(parseFloat(i)),l:Rt.channel.clamp.l(parseFloat(s)),a:o?Rt.channel.clamp.a(a?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:r,l:n,a:i}=t;return i<1?`hsla(${Rt.lang.round(e)}, ${Rt.lang.round(r)}%, ${Rt.lang.round(n)}%, ${i})`:`hsl(${Rt.lang.round(e)}, ${Rt.lang.round(r)}%, ${Rt.lang.round(n)}%)`}},Uo={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=Uo.colors[t];if(e)return ps.parse(e)},stringify:t=>{const e=ps.stringify(t);for(const r in Uo.colors)if(Uo.colors[r]===e)return r}},Ao={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const r=t.match(Ao.re);if(!r)return;const[,n,i,s,o,a,l,c,u]=r;return Uc.set({r:Rt.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Rt.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:Rt.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:c?Rt.channel.clamp.a(u?parseFloat(c)/100:parseFloat(c)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${Rt.lang.round(e)}, ${Rt.lang.round(r)}, ${Rt.lang.round(n)}, ${Rt.lang.round(i)})`:`rgb(${Rt.lang.round(e)}, ${Rt.lang.round(r)}, ${Rt.lang.round(n)})`}},an={format:{keyword:Uo,hex:ps,rgb:Ao,rgba:Ao,hsl:gi,hsla:gi},parse:t=>{if(typeof t!="string")return t;const e=ps.parse(t)||Ao.parse(t)||gi.parse(t)||Uo.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(He.HSL)||t.data.r===void 0?gi.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?Ao.stringify(t):ps.stringify(t)},T1=(t,e)=>{const r=an.parse(t);for(const n in e)r[n]=Rt.channel.clamp[n](e[n]);return an.stringify(r)},Hn=(t,e,r=0,n=1)=>{if(typeof t!="number")return T1(t,{a:e});const i=Uc.set({r:Rt.channel.clamp.r(t),g:Rt.channel.clamp.g(e),b:Rt.channel.clamp.b(r),a:Rt.channel.clamp.a(n)});return an.stringify(i)},jF=t=>{const{r:e,g:r,b:n}=an.parse(t),i=.2126*Rt.channel.toLinear(e)+.7152*Rt.channel.toLinear(r)+.0722*Rt.channel.toLinear(n);return Rt.lang.round(i)},LF=t=>jF(t)>=.5,Vr=t=>!LF(t),_1=(t,e,r)=>{const n=an.parse(t),i=n[e],s=Rt.channel.clamp[e](i+r);return i!==s&&(n[e]=s),an.stringify(n)},Y=(t,e)=>_1(t,"l",e),X=(t,e)=>_1(t,"l",-e),B=(t,e)=>{const r=an.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return T1(t,n)},BF=(t,e,r=50)=>{const{r:n,g:i,b:s,a:o}=an.parse(t),{r:a,g:l,b:c,a:u}=an.parse(e),d=r/100,p=d*2-1,f=o-u,x=((p*f===-1?p:(p+f)/(1+p*f))+1)/2,g=1-x,y=n*x+a*g,b=i*x+l*g,k=s*x+c*g,T=o*d+u*(1-d);return Hn(y,b,k,T)},H=(t,e=100)=>{const r=an.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,BF(r,t,e)};/*! @license DOMPurify 3.4.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.7/LICENSE */function vg(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function AF(t){if(Array.isArray(t))return t}function MF(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function IF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
347
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FF(t,e){return AF(t)||MF(t,e)||PF(t,e)||IF()}function PF(t,e){if(t){if(typeof t=="string")return vg(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vg(t,e):void 0}}const E1=Object.entries,wg=Object.setPrototypeOf,DF=Object.isFrozen,OF=Object.getPrototypeOf,RF=Object.getOwnPropertyDescriptor;let sr=Object.freeze,Ar=Object.seal,is=Object.create,N1=typeof Reflect<"u"&&Reflect,Xu=N1.apply,Ku=N1.construct;sr||(sr=function(e){return e});Ar||(Ar=function(e){return e});Xu||(Xu=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(r,i)});Ku||(Ku=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return new e(...n)});const Hi=Le(Array.prototype.forEach),$F=Le(Array.prototype.lastIndexOf),Sg=Le(Array.prototype.pop),Ui=Le(Array.prototype.push),zF=Le(Array.prototype.splice),Je=Array.isArray,Mo=Le(String.prototype.toLowerCase),Kh=Le(String.prototype.toString),Tg=Le(String.prototype.match),Gi=Le(String.prototype.replace),_g=Le(String.prototype.indexOf),WF=Le(String.prototype.trim),qF=Le(Number.prototype.toString),HF=Le(Boolean.prototype.toString),Eg=typeof BigInt>"u"?null:Le(BigInt.prototype.toString),Ng=typeof Symbol>"u"?null:Le(Symbol.prototype.toString),we=Le(Object.prototype.hasOwnProperty),xo=Le(Object.prototype.toString),Re=Le(RegExp.prototype.test),yo=UF(TypeError);function Le(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return Xu(t,e,n)}}function UF(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Ku(t,r)}}function Ht(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mo;if(wg&&wg(t,null),!Je(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(DF(e)||(e[n]=s),i=s)}t[i]=!0}return t}function GF(t){for(let e=0;e<t.length;e++)we(t,e)||(t[e]=null);return t}function qe(t){const e=is(null);for(const n of E1(t)){var r=FF(n,2);const i=r[0],s=r[1];we(t,i)&&(Je(s)?e[i]=GF(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=qe(s):e[i]=s)}return e}function VF(t){switch(typeof t){case"string":return t;case"number":return qF(t);case"boolean":return HF(t);case"bigint":return Eg?Eg(t):"0";case"symbol":return Ng?Ng(t):"Symbol()";case"undefined":return xo(t);case"function":case"object":{if(t===null)return xo(t);const e=t,r=Jr(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:xo(n)}return xo(t)}default:return xo(t)}}function Jr(t,e){for(;t!==null;){const n=RF(t,e);if(n){if(n.get)return Le(n.get);if(typeof n.value=="function")return Le(n.value)}t=OF(t)}function r(){return null}return r}function YF(t){try{return Re(t,""),!0}catch{return!1}}const jg=sr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zh=sr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Qh=sr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),XF=sr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Jh=sr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),KF=sr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Lg=sr(["#text"]),Bg=sr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),tu=sr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ag=sr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ga=sr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ZF=Ar(/{{[\w\W]*|^[\w\W]*}}/g),QF=Ar(/<%[\w\W]*|^[\w\W]*%>/g),JF=Ar(/\${[\w\W]*/g),t4=Ar(/^data-[\-\w.\u00B7-\uFFFF]+$/),e4=Ar(/^aria-[\-\w]+$/),Mg=Ar(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),r4=Ar(/^(?:\w+script|data):/i),n4=Ar(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),i4=Ar(/^html$/i),s4=Ar(/^[a-z][.\w]*(-[.\w]+)+$/i),Qr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},o4=function(){return typeof window>"u"?null:window},a4=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(n=r.getAttribute(i));const s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Ig=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function j1(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:o4();const e=vt=>j1(vt);if(e.version="3.4.7",e.removed=[],!t||!t.document||t.document.nodeType!==Qr.document||!t.Element)return e.isSupported=!1,e;let r=t.document;const n=r,i=n.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,d=t.trustedTypes,p=a.prototype,f=Jr(p,"cloneNode"),m=Jr(p,"remove"),x=Jr(p,"nextSibling"),g=Jr(p,"childNodes"),y=Jr(p,"parentNode"),b=Jr(p,"shadowRoot"),k=Jr(p,"attributes"),T=o&&o.prototype?Jr(o.prototype,"nodeType"):null,_=o&&o.prototype?Jr(o.prototype,"nodeName"):null;if(typeof s=="function"){const vt=r.createElement("template");vt.content&&vt.content.ownerDocument&&(r=vt.content.ownerDocument)}let w,E="";const L=r,M=L.implementation,N=L.createNodeIterator,P=L.createDocumentFragment,$=L.getElementsByTagName,q=n.importNode;let O=Ig();e.isSupported=typeof E1=="function"&&typeof y=="function"&&M&&M.createHTMLDocument!==void 0;const I=ZF,F=QF,D=JF,R=t4,j=e4,S=r4,U=n4,Q=s4;let A=Mg,rt=null;const ut=Ht({},[...jg,...Zh,...Qh,...Jh,...Lg]);let ot=null;const It=Ht({},[...Bg,...tu,...Ag,...Ga]);let ht=Object.seal(is(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),at=null,K=null;const lt=Object.seal(is(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let yt=!0,At=!0,Dt=!1,ue=!0,ae=!1,Pe=!0,Zt=!1,Be=!1,V=!1,it=!1,dt=!1,Nt=!1,et=!0,kt=!1;const G="user-content-";let st=!0,St=!1,Ot={},$t=null;const Se=Ht({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ar=null;const fe=Ht({},["audio","video","img","source","image","track"]);let Er=null;const Oe=Ht({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ce="http://www.w3.org/1998/Math/MathML",lr="http://www.w3.org/2000/svg",ke="http://www.w3.org/1999/xhtml";let Ln=ke,Js=!1,to=null;const Aa=Ht({},[Ce,lr,ke],Kh);let eo=Ht({},["mi","mo","mn","ms","mtext"]),ro=Ht({},["annotation-xml"]);const si=Ht({},["title","style","font","a","script"]);let oi=null;const no=["application/xhtml+xml","text/html"],gh="text/html";let pe=null,Bn=null;const Ma=r.createElement("form"),io=function(z){return z instanceof RegExp||z instanceof Function},Di=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Bn&&Bn===z)return;(!z||typeof z!="object")&&(z={}),z=qe(z),oi=no.indexOf(z.PARSER_MEDIA_TYPE)===-1?gh:z.PARSER_MEDIA_TYPE,pe=oi==="application/xhtml+xml"?Kh:Mo,rt=we(z,"ALLOWED_TAGS")&&Je(z.ALLOWED_TAGS)?Ht({},z.ALLOWED_TAGS,pe):ut,ot=we(z,"ALLOWED_ATTR")&&Je(z.ALLOWED_ATTR)?Ht({},z.ALLOWED_ATTR,pe):It,to=we(z,"ALLOWED_NAMESPACES")&&Je(z.ALLOWED_NAMESPACES)?Ht({},z.ALLOWED_NAMESPACES,Kh):Aa,Er=we(z,"ADD_URI_SAFE_ATTR")&&Je(z.ADD_URI_SAFE_ATTR)?Ht(qe(Oe),z.ADD_URI_SAFE_ATTR,pe):Oe,ar=we(z,"ADD_DATA_URI_TAGS")&&Je(z.ADD_DATA_URI_TAGS)?Ht(qe(fe),z.ADD_DATA_URI_TAGS,pe):fe,$t=we(z,"FORBID_CONTENTS")&&Je(z.FORBID_CONTENTS)?Ht({},z.FORBID_CONTENTS,pe):Se,at=we(z,"FORBID_TAGS")&&Je(z.FORBID_TAGS)?Ht({},z.FORBID_TAGS,pe):qe({}),K=we(z,"FORBID_ATTR")&&Je(z.FORBID_ATTR)?Ht({},z.FORBID_ATTR,pe):qe({}),Ot=we(z,"USE_PROFILES")?z.USE_PROFILES&&typeof z.USE_PROFILES=="object"?qe(z.USE_PROFILES):z.USE_PROFILES:!1,yt=z.ALLOW_ARIA_ATTR!==!1,At=z.ALLOW_DATA_ATTR!==!1,Dt=z.ALLOW_UNKNOWN_PROTOCOLS||!1,ue=z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ae=z.SAFE_FOR_TEMPLATES||!1,Pe=z.SAFE_FOR_XML!==!1,Zt=z.WHOLE_DOCUMENT||!1,it=z.RETURN_DOM||!1,dt=z.RETURN_DOM_FRAGMENT||!1,Nt=z.RETURN_TRUSTED_TYPE||!1,V=z.FORCE_BODY||!1,et=z.SANITIZE_DOM!==!1,kt=z.SANITIZE_NAMED_PROPS||!1,st=z.KEEP_CONTENT!==!1,St=z.IN_PLACE||!1,A=YF(z.ALLOWED_URI_REGEXP)?z.ALLOWED_URI_REGEXP:Mg,Ln=typeof z.NAMESPACE=="string"?z.NAMESPACE:ke,eo=we(z,"MATHML_TEXT_INTEGRATION_POINTS")&&z.MATHML_TEXT_INTEGRATION_POINTS&&typeof z.MATHML_TEXT_INTEGRATION_POINTS=="object"?qe(z.MATHML_TEXT_INTEGRATION_POINTS):Ht({},["mi","mo","mn","ms","mtext"]),ro=we(z,"HTML_INTEGRATION_POINTS")&&z.HTML_INTEGRATION_POINTS&&typeof z.HTML_INTEGRATION_POINTS=="object"?qe(z.HTML_INTEGRATION_POINTS):Ht({},["annotation-xml"]);const J=we(z,"CUSTOM_ELEMENT_HANDLING")&&z.CUSTOM_ELEMENT_HANDLING&&typeof z.CUSTOM_ELEMENT_HANDLING=="object"?qe(z.CUSTOM_ELEMENT_HANDLING):is(null);if(ht=is(null),we(J,"tagNameCheck")&&io(J.tagNameCheck)&&(ht.tagNameCheck=J.tagNameCheck),we(J,"attributeNameCheck")&&io(J.attributeNameCheck)&&(ht.attributeNameCheck=J.attributeNameCheck),we(J,"allowCustomizedBuiltInElements")&&typeof J.allowCustomizedBuiltInElements=="boolean"&&(ht.allowCustomizedBuiltInElements=J.allowCustomizedBuiltInElements),ae&&(At=!1),dt&&(it=!0),Ot&&(rt=Ht({},Lg),ot=is(null),Ot.html===!0&&(Ht(rt,jg),Ht(ot,Bg)),Ot.svg===!0&&(Ht(rt,Zh),Ht(ot,tu),Ht(ot,Ga)),Ot.svgFilters===!0&&(Ht(rt,Qh),Ht(ot,tu),Ht(ot,Ga)),Ot.mathMl===!0&&(Ht(rt,Jh),Ht(ot,Ag),Ht(ot,Ga))),lt.tagCheck=null,lt.attributeCheck=null,we(z,"ADD_TAGS")&&(typeof z.ADD_TAGS=="function"?lt.tagCheck=z.ADD_TAGS:Je(z.ADD_TAGS)&&(rt===ut&&(rt=qe(rt)),Ht(rt,z.ADD_TAGS,pe))),we(z,"ADD_ATTR")&&(typeof z.ADD_ATTR=="function"?lt.attributeCheck=z.ADD_ATTR:Je(z.ADD_ATTR)&&(ot===It&&(ot=qe(ot)),Ht(ot,z.ADD_ATTR,pe))),we(z,"ADD_URI_SAFE_ATTR")&&Je(z.ADD_URI_SAFE_ATTR)&&Ht(Er,z.ADD_URI_SAFE_ATTR,pe),we(z,"FORBID_CONTENTS")&&Je(z.FORBID_CONTENTS)&&($t===Se&&($t=qe($t)),Ht($t,z.FORBID_CONTENTS,pe)),we(z,"ADD_FORBID_CONTENTS")&&Je(z.ADD_FORBID_CONTENTS)&&($t===Se&&($t=qe($t)),Ht($t,z.ADD_FORBID_CONTENTS,pe)),st&&(rt["#text"]=!0),Zt&&Ht(rt,["html","head","body"]),rt.table&&(Ht(rt,["tbody"]),delete at.tbody),z.TRUSTED_TYPES_POLICY){if(typeof z.TRUSTED_TYPES_POLICY.createHTML!="function")throw yo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw yo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=z.TRUSTED_TYPES_POLICY,E=w.createHTML("")}else w===void 0&&(w=a4(d,i)),w!==null&&typeof E=="string"&&(E=w.createHTML(""));(O.uponSanitizeElement.length>0||O.uponSanitizeAttribute.length>0)&&rt===ut&&(rt=qe(rt)),O.uponSanitizeAttribute.length>0&&ot===It&&(ot=qe(ot)),sr&&sr(z),Bn=z},Ia=Ht({},[...Zh,...Qh,...XF]),so=Ht({},[...Jh,...KF]),xh=function(z){let J=y(z);(!J||!J.tagName)&&(J={namespaceURI:Ln,tagName:"template"});const ft=Mo(z.tagName),ee=Mo(J.tagName);return to[z.namespaceURI]?z.namespaceURI===lr?J.namespaceURI===ke?ft==="svg":J.namespaceURI===Ce?ft==="svg"&&(ee==="annotation-xml"||eo[ee]):!!Ia[ft]:z.namespaceURI===Ce?J.namespaceURI===ke?ft==="math":J.namespaceURI===lr?ft==="math"&&ro[ee]:!!so[ft]:z.namespaceURI===ke?J.namespaceURI===lr&&!ro[ee]||J.namespaceURI===Ce&&!eo[ee]?!1:!so[ft]&&(si[ft]||!Ia[ft]):!!(oi==="application/xhtml+xml"&&to[z.namespaceURI]):!1},me=function(z){Ui(e.removed,{element:z});try{y(z).removeChild(z)}catch{m(z)}},Kr=function(z,J){try{Ui(e.removed,{attribute:J.getAttributeNode(z),from:J})}catch{Ui(e.removed,{attribute:null,from:J})}if(J.removeAttribute(z),z==="is")if(it||dt)try{me(J)}catch{}else try{J.setAttribute(z,"")}catch{}},An=function(z){let J=null,ft=null;if(V)z="<remove></remove>"+z;else{const le=Tg(z,/^[\r\n\t ]+/);ft=le&&le[0]}oi==="application/xhtml+xml"&&Ln===ke&&(z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+z+"</body></html>");const ee=w?w.createHTML(z):z;if(Ln===ke)try{J=new u().parseFromString(ee,oi)}catch{}if(!J||!J.documentElement){J=M.createDocument(Ln,"template",null);try{J.documentElement.innerHTML=Js?E:ee}catch{}}const Xt=J.body||J.documentElement;return z&&ft&&Xt.insertBefore(r.createTextNode(ft),Xt.childNodes[0]||null),Ln===ke?$.call(J,Zt?"html":"body")[0]:Zt?J.documentElement:Xt},Oi=function(z){return N.call(z.ownerDocument||z,z,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},oo=function(z){z.normalize();const J=N.call(z.ownerDocument||z,z,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let ft=J.nextNode();for(;ft;){let ee=ft.data;Hi([I,F,D],Xt=>{ee=Gi(ee,Xt," ")}),ft.data=ee,ft=J.nextNode()}},Ri=function(z){const J=_?_(z):null;return typeof J!="string"||pe(J)!=="form"?!1:typeof z.nodeName!="string"||typeof z.textContent!="string"||typeof z.removeChild!="function"||z.attributes!==k(z)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function"||z.nodeType!==T(z)||z.childNodes!==g(z)},ai=function(z){if(!T||typeof z!="object"||z===null)return!1;try{return T(z)===Qr.documentFragment}catch{return!1}},$i=function(z){if(!T||typeof z!="object"||z===null)return!1;try{return typeof T(z)=="number"}catch{return!1}};function Fr(vt,z,J){Hi(vt,ft=>{ft.call(e,z,J,Bn)})}const We=function(z){let J=null;if(Fr(O.beforeSanitizeElements,z,null),Ri(z))return me(z),!0;const ft=pe(z.nodeName);if(Fr(O.uponSanitizeElement,z,{tagName:ft,allowedTags:rt}),Pe&&z.hasChildNodes()&&!$i(z.firstElementChild)&&Re(/<[/\w!]/g,z.innerHTML)&&Re(/<[/\w!]/g,z.textContent)||Pe&&z.namespaceURI===ke&&ft==="style"&&$i(z.firstElementChild)||z.nodeType===Qr.progressingInstruction||Pe&&z.nodeType===Qr.comment&&Re(/<[/\w]/g,z.data))return me(z),!0;if(at[ft]||!(lt.tagCheck instanceof Function&&lt.tagCheck(ft))&&!rt[ft]){if(!at[ft]&&ao(ft)&&(ht.tagNameCheck instanceof RegExp&&Re(ht.tagNameCheck,ft)||ht.tagNameCheck instanceof Function&&ht.tagNameCheck(ft)))return!1;if(st&&!$t[ft]){const Xt=y(z),le=g(z);if(le&&Xt){const Ze=le.length;for(let Nr=Ze-1;Nr>=0;--Nr){const br=f(le[Nr],!0);Xt.insertBefore(br,x(z))}}}return me(z),!0}return(T?T(z):z.nodeType)===Qr.element&&!xh(z)||(ft==="noscript"||ft==="noembed"||ft==="noframes")&&Re(/<\/no(script|embed|frames)/i,z.innerHTML)?(me(z),!0):(ae&&z.nodeType===Qr.text&&(J=z.textContent,Hi([I,F,D],Xt=>{J=Gi(J,Xt," ")}),z.textContent!==J&&(Ui(e.removed,{element:z.cloneNode()}),z.textContent=J)),Fr(O.afterSanitizeElements,z,null),!1)},Pr=function(z,J,ft){if(K[J]||et&&(J==="id"||J==="name")&&(ft in r||ft in Ma))return!1;const ee=ot[J]||lt.attributeCheck instanceof Function&&lt.attributeCheck(J,z);if(!(At&&!K[J]&&Re(R,J))){if(!(yt&&Re(j,J))){if(!ee||K[J]){if(!(ao(z)&&(ht.tagNameCheck instanceof RegExp&&Re(ht.tagNameCheck,z)||ht.tagNameCheck instanceof Function&&ht.tagNameCheck(z))&&(ht.attributeNameCheck instanceof RegExp&&Re(ht.attributeNameCheck,J)||ht.attributeNameCheck instanceof Function&&ht.attributeNameCheck(J,z))||J==="is"&&ht.allowCustomizedBuiltInElements&&(ht.tagNameCheck instanceof RegExp&&Re(ht.tagNameCheck,ft)||ht.tagNameCheck instanceof Function&&ht.tagNameCheck(ft))))return!1}else if(!Er[J]){if(!Re(A,Gi(ft,U,""))){if(!((J==="src"||J==="xlink:href"||J==="href")&&z!=="script"&&_g(ft,"data:")===0&&ar[z])){if(!(Dt&&!Re(S,Gi(ft,U,"")))){if(ft)return!1}}}}}}return!0},yh=Ht({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ao=function(z){return!yh[Mo(z)]&&Re(Q,z)},zi=function(z){Fr(O.beforeSanitizeAttributes,z,null);const J=z.attributes;if(!J||Ri(z))return;const ft={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ot,forceKeepAttr:void 0};let ee=J.length;for(;ee--;){const Xt=J[ee],le=Xt.name,Ze=Xt.namespaceURI,Nr=Xt.value,br=pe(le),li=Nr;let Ee=le==="value"?li:WF(li);if(ft.attrName=br,ft.attrValue=Ee,ft.keepAttr=!0,ft.forceKeepAttr=void 0,Fr(O.uponSanitizeAttribute,z,ft),Ee=ft.attrValue,kt&&(br==="id"||br==="name")&&_g(Ee,G)!==0&&(Kr(le,z),Ee=G+Ee),Pe&&Re(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ee)){Kr(le,z);continue}if(br==="attributename"&&Tg(Ee,"href")){Kr(le,z);continue}if(ft.forceKeepAttr)continue;if(!ft.keepAttr){Kr(le,z);continue}if(!ue&&Re(/\/>/i,Ee)){Kr(le,z);continue}ae&&Hi([I,F,D],Pa=>{Ee=Gi(Ee,Pa," ")});const Fa=pe(z.nodeName);if(!Pr(Fa,br,Ee)){Kr(le,z);continue}if(w&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Ze)switch(d.getAttributeType(Fa,br)){case"TrustedHTML":{Ee=w.createHTML(Ee);break}case"TrustedScriptURL":{Ee=w.createScriptURL(Ee);break}}if(Ee!==li)try{Ze?z.setAttributeNS(Ze,le,Ee):z.setAttribute(le,Ee),Ri(z)?me(z):Sg(e.removed)}catch{Kr(le,z)}}Fr(O.afterSanitizeAttributes,z,null)},mn=function(z){let J=null;const ft=Oi(z);for(Fr(O.beforeSanitizeShadowDOM,z,null);J=ft.nextNode();)if(Fr(O.uponSanitizeShadowNode,J,null),We(J),zi(J),ai(J.content)&&mn(J.content),(T?T(J):J.nodeType)===Qr.element){const Xt=b?b(J):J.shadowRoot;ai(Xt)&&(Mn(Xt),mn(Xt))}Fr(O.afterSanitizeShadowDOM,z,null)},Mn=function(z){const J=T?T(z):z.nodeType;if(J===Qr.element){const Xt=b?b(z):z.shadowRoot;ai(Xt)&&(Mn(Xt),mn(Xt))}const ft=g?g(z):z.childNodes;if(!ft)return;const ee=[];Hi(ft,Xt=>{Ui(ee,Xt)});for(const Xt of ee)Mn(Xt);if(J===Qr.element){const Xt=_?_(z):null;if(typeof Xt=="string"&&pe(Xt)==="template"){const le=z.content;ai(le)&&Mn(le)}}};return e.sanitize=function(vt){let z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=null,ft=null,ee=null,Xt=null;if(Js=!vt,Js&&(vt="<!-->"),typeof vt!="string"&&!$i(vt)&&(vt=VF(vt),typeof vt!="string"))throw yo("dirty is not a string, aborting");if(!e.isSupported)return vt;if(Be||Di(z),e.removed=[],typeof vt=="string"&&(St=!1),St){const Nr=_?_(vt):vt.nodeName;if(typeof Nr=="string"){const br=pe(Nr);if(!rt[br]||at[br])throw yo("root node is forbidden and cannot be sanitized in-place")}if(Ri(vt))throw yo("root node is clobbered and cannot be sanitized in-place");Mn(vt)}else if($i(vt))J=An("<!---->"),ft=J.ownerDocument.importNode(vt,!0),ft.nodeType===Qr.element&&ft.nodeName==="BODY"||ft.nodeName==="HTML"?J=ft:J.appendChild(ft),Mn(ft);else{if(!it&&!ae&&!Zt&&vt.indexOf("<")===-1)return w&&Nt?w.createHTML(vt):vt;if(J=An(vt),!J)return it?null:Nt?E:""}J&&V&&me(J.firstChild);const le=Oi(St?vt:J);for(;ee=le.nextNode();)We(ee),zi(ee),ai(ee.content)&&mn(ee.content);if(St)return ae&&oo(vt),vt;if(it){if(ae&&oo(J),dt)for(Xt=P.call(J.ownerDocument);J.firstChild;)Xt.appendChild(J.firstChild);else Xt=J;return(ot.shadowroot||ot.shadowrootmode)&&(Xt=q.call(n,Xt,!0)),Xt}let Ze=Zt?J.outerHTML:J.innerHTML;return Zt&&rt["!doctype"]&&J.ownerDocument&&J.ownerDocument.doctype&&J.ownerDocument.doctype.name&&Re(i4,J.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+J.ownerDocument.doctype.name+`>
348
+ `+Ze),ae&&Hi([I,F,D],Nr=>{Ze=Gi(Ze,Nr," ")}),w&&Nt?w.createHTML(Ze):Ze},e.setConfig=function(){let vt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Di(vt),Be=!0},e.clearConfig=function(){Bn=null,Be=!1},e.isValidAttribute=function(vt,z,J){Bn||Di({});const ft=pe(vt),ee=pe(z);return Pr(ft,ee,J)},e.addHook=function(vt,z){typeof z=="function"&&Ui(O[vt],z)},e.removeHook=function(vt,z){if(z!==void 0){const J=$F(O[vt],z);return J===-1?void 0:zF(O[vt],J,1)[0]}return Sg(O[vt])},e.removeHooks=function(vt){O[vt]=[]},e.removeAllHooks=function(){O=Ig()},e}var Os=j1(),L1=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Go=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,l4=/\s*%%.*\n/gm,bs,B1=(bs=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(bs,"UnknownDiagramError"),bs),Si={},Hf=v(function(t,e){t=t.replace(L1,"").replace(Go,"").replace(l4,`
349
+ `);for(const[r,{detector:n}]of Object.entries(Si))if(n(t,e))return r;throw new B1(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),Zu=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)A1(e,r,n)},"registerLazyLoadedDiagrams"),A1=v((t,e,r)=>{Si[t]&&tt.warn(`Detector with key ${t} already exists. Overwriting.`),Si[t]={detector:e,loader:r},tt.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),c4=v(t=>Si[t].loader,"getDiagramLoader"),Qu=v((t,e,{depth:r=2,clobber:n=!1}={})=>{const i={depth:r,clobber:n};return Array.isArray(e)&&!Array.isArray(t)?(e.forEach(s=>Qu(t,s,i)),t):Array.isArray(e)&&Array.isArray(t)?(e.forEach(s=>{t.includes(s)||t.push(s)}),t):t===void 0||r<=0?t!=null&&typeof t=="object"&&typeof e=="object"?Object.assign(t,e):e:(e!==void 0&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(s=>{typeof e[s]=="object"&&e[s]!==null&&(t[s]===void 0||typeof t[s]=="object")?(t[s]===void 0&&(t[s]=Array.isArray(e[s])?[]:{}),t[s]=Qu(t[s],e[s],{depth:r-1,clobber:n})):(n||typeof t[s]!="object"&&typeof e[s]!="object")&&(t[s]=e[s])}),t)},"assignWithDepth"),Ie=Qu,dn="#ffffff",fn="#f2f2f2",Pt=v((t,e)=>e?B(t,{s:-40,l:10}):B(t,{s:-40,l:-10}),"mkBorder"),Cs,h4=(Cs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,E,L,M,N,P,$,q,O,I,F,D,R,j;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||B(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||B(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Y(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||X(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||X(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Y(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Y(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||B(this.primaryColor,{h:30}),this.cScale4=this.cScale4||B(this.primaryColor,{h:60}),this.cScale5=this.cScale5||B(this.primaryColor,{h:90}),this.cScale6=this.cScale6||B(this.primaryColor,{h:120}),this.cScale7=this.cScale7||B(this.primaryColor,{h:150}),this.cScale8=this.cScale8||B(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||B(this.primaryColor,{h:270}),this.cScale10=this.cScale10||B(this.primaryColor,{h:300}),this.cScale11=this.cScale11||B(this.primaryColor,{h:330}),this.darkMode)for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=X(this["cScale"+S],75);else for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=X(this["cScale"+S],25);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleInv"+S]=this["cScaleInv"+S]||H(this["cScale"+S]);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this.darkMode?this["cScalePeer"+S]=this["cScalePeer"+S]||Y(this["cScale"+S],10):this["cScalePeer"+S]=this["cScalePeer"+S]||X(this["cScale"+S],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleLabel"+S]=this["cScaleLabel"+S]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let S=0;S<5;S++)this["surface"+S]=this["surface"+S]||B(this.mainBkg,{h:180,s:-15,l:e*(5+S*3)}),this["surfacePeer"+S]=this["surfacePeer"+S]||B(this.mainBkg,{h:180,s:-15,l:e*(8+S*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||B(this.primaryColor,{h:64}),this.fillType3=this.fillType3||B(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||B(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||B(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||B(this.primaryColor,{h:128}),this.fillType7=this.fillType7||B(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||B(this.primaryColor,{l:-10}),this.pie5=this.pie5||B(this.secondaryColor,{l:-10}),this.pie6=this.pie6||B(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||B(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||B(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||B(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||B(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||B(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||B(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??B(this.primaryColor,{l:-30}),this.venn2=this.venn2??B(this.secondaryColor,{l:-30}),this.venn3=this.venn3??B(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??B(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??B(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??B(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??B(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??B(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.radar={axisColor:((r=this.radar)==null?void 0:r.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((i=this.radar)==null?void 0:i.axisLabelFontSize)||12,curveOpacity:((s=this.radar)==null?void 0:s.curveOpacity)||.5,curveStrokeWidth:((o=this.radar)==null?void 0:o.curveStrokeWidth)||2,graticuleColor:((a=this.radar)==null?void 0:a.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((l=this.radar)==null?void 0:l.graticuleStrokeWidth)||1,graticuleOpacity:((c=this.radar)==null?void 0:c.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((p=this.wardley)==null?void 0:p.backgroundColor)||this.background,axisColor:((f=this.wardley)==null?void 0:f.axisColor)||this.lineColor,axisTextColor:((m=this.wardley)==null?void 0:m.axisTextColor)||this.primaryTextColor,gridColor:((x=this.wardley)==null?void 0:x.gridColor)||this.gridColor,componentFill:((g=this.wardley)==null?void 0:g.componentFill)||this.background,componentStroke:((y=this.wardley)==null?void 0:y.componentStroke)||this.lineColor,componentLabelColor:((b=this.wardley)==null?void 0:b.componentLabelColor)||this.primaryTextColor,linkStroke:((k=this.wardley)==null?void 0:k.linkStroke)||this.lineColor,evolutionStroke:((T=this.wardley)==null?void 0:T.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((_=this.wardley)==null?void 0:_.annotationStroke)||this.lineColor,annotationTextColor:((w=this.wardley)==null?void 0:w.annotationTextColor)||this.primaryTextColor,annotationFill:((E=this.wardley)==null?void 0:E.annotationFill)||this.background},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((L=this.xyChart)==null?void 0:L.backgroundColor)||this.background,titleColor:((M=this.xyChart)==null?void 0:M.titleColor)||this.primaryTextColor,dataLabelColor:((N=this.xyChart)==null?void 0:N.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((P=this.xyChart)==null?void 0:P.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:(($=this.xyChart)==null?void 0:$.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((q=this.xyChart)==null?void 0:q.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((O=this.xyChart)==null?void 0:O.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((I=this.xyChart)==null?void 0:I.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((F=this.xyChart)==null?void 0:F.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((D=this.xyChart)==null?void 0:D.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((R=this.xyChart)==null?void 0:R.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((j=this.xyChart)==null?void 0:j.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||B(this.primaryColor,{h:-30}),this.git4=this.git4||B(this.primaryColor,{h:-60}),this.git5=this.git5||B(this.primaryColor,{h:-90}),this.git6=this.git6||B(this.primaryColor,{h:60}),this.git7=this.git7||B(this.primaryColor,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Cs,"Theme"),Cs),u4=v(t=>{const e=new h4;return e.calculate(t),e},"getThemeVariables"),ks,d4=(ks=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=B(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Y(H("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Hn(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=X("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=X(this.sectionBkgColor,10),this.taskBorderColor=Hn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Hn(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Y(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||X(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,E,L,M,N,P,$,q,O,I,F,D,R;this.secondBkg=Y(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=Y(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=Y(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=H(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=B(this.primaryColor,{h:64}),this.fillType3=B(this.secondaryColor,{h:64}),this.fillType4=B(this.primaryColor,{h:-64}),this.fillType5=B(this.secondaryColor,{h:-64}),this.fillType6=B(this.primaryColor,{h:128}),this.fillType7=B(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||B(this.primaryColor,{h:30}),this.cScale4=this.cScale4||B(this.primaryColor,{h:60}),this.cScale5=this.cScale5||B(this.primaryColor,{h:90}),this.cScale6=this.cScale6||B(this.primaryColor,{h:120}),this.cScale7=this.cScale7||B(this.primaryColor,{h:150}),this.cScale8=this.cScale8||B(this.primaryColor,{h:210}),this.cScale9=this.cScale9||B(this.primaryColor,{h:270}),this.cScale10=this.cScale10||B(this.primaryColor,{h:300}),this.cScale11=this.cScale11||B(this.primaryColor,{h:330});for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||H(this["cScale"+j]);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScalePeer"+j]=this["cScalePeer"+j]||Y(this["cScale"+j],10);for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||B(this.mainBkg,{h:30,s:-30,l:-(-10+j*4)}),this["surfacePeer"+j]=this["surfacePeer"+j]||B(this.mainBkg,{h:30,s:-30,l:-(-7+j*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["pie"+j]=this["cScale"+j];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.mainContrastColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.mainContrastColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7";for(let j=0;j<8;j++)this["venn"+(j+1)]=this["venn"+(j+1)]??Y(this["cScale"+j],30);this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,dataLabelColor:((n=this.xyChart)==null?void 0:n.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((m=this.radar)==null?void 0:m.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((g=this.radar)==null?void 0:g.curveOpacity)||.5,curveStrokeWidth:((y=this.radar)==null?void 0:y.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((k=this.radar)==null?void 0:k.graticuleStrokeWidth)||1,graticuleOpacity:((T=this.radar)==null?void 0:T.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#ff6b6b",this.wardley={backgroundColor:((E=this.wardley)==null?void 0:E.backgroundColor)||this.background,axisColor:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((M=this.wardley)==null?void 0:M.axisTextColor)||this.primaryTextColor,gridColor:((N=this.wardley)==null?void 0:N.gridColor)||this.gridColor,componentFill:((P=this.wardley)==null?void 0:P.componentFill)||this.mainBkg,componentStroke:(($=this.wardley)==null?void 0:$.componentStroke)||this.lineColor,componentLabelColor:((q=this.wardley)==null?void 0:q.componentLabelColor)||this.primaryTextColor,linkStroke:((O=this.wardley)==null?void 0:O.linkStroke)||this.lineColor,evolutionStroke:((I=this.wardley)==null?void 0:I.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((F=this.wardley)==null?void 0:F.annotationStroke)||this.lineColor,annotationTextColor:((D=this.wardley)==null?void 0:D.annotationTextColor)||this.primaryTextColor,annotationFill:((R=this.wardley)==null?void 0:R.annotationFill)||this.mainBkg},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Y(this.secondaryColor,20),this.git1=Y(this.pie2||this.secondaryColor,20),this.git2=Y(this.pie3||this.tertiaryColor,20),this.git3=Y(this.pie4||B(this.primaryColor,{h:-30}),20),this.git4=Y(this.pie5||B(this.primaryColor,{h:-60}),20),this.git5=Y(this.pie6||B(this.primaryColor,{h:-90}),10),this.git6=Y(this.pie7||B(this.primaryColor,{h:60}),10),this.git7=Y(this.pie8||B(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"#2d2d2d",this.emUiStroke=this.emUiStroke||"#555",this.emProcessorFill=this.emProcessorFill||Y("#5a3d5c",10),this.emProcessorStroke=this.emProcessorStroke||"#8a6d8c",this.emReadModelFill=this.emReadModelFill||Y("#3d5a2d",10),this.emReadModelStroke=this.emReadModelStroke||"#6d8c5c",this.emCommandFill=this.emCommandFill||Y("#2d3d5a",10),this.emCommandStroke=this.emCommandStroke||"#5c6d8c",this.emEventFill=this.emEventFill||Y("#5a452d",10),this.emEventStroke=this.emEventStroke||"#8c755c",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||Y(this.background,5),this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||Y(this.background,12),this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Y(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ks,"Theme"),ks),f4=v(t=>{const e=new d4;return e.calculate(t),e},"getThemeVariables"),vs,p4=(vs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=B(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=B(this.primaryColor,{h:-160}),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=Hn(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,E,L,M,N,P,$,q,O,I,F,D,R;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||B(this.primaryColor,{h:30}),this.cScale4=this.cScale4||B(this.primaryColor,{h:60}),this.cScale5=this.cScale5||B(this.primaryColor,{h:90}),this.cScale6=this.cScale6||B(this.primaryColor,{h:120}),this.cScale7=this.cScale7||B(this.primaryColor,{h:150}),this.cScale8=this.cScale8||B(this.primaryColor,{h:210}),this.cScale9=this.cScale9||B(this.primaryColor,{h:270}),this.cScale10=this.cScale10||B(this.primaryColor,{h:300}),this.cScale11=this.cScale11||B(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||X(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||X(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=X(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||B(this["cScale"+j],{h:180});for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||B(this.mainBkg,{h:30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||B(this.mainBkg,{h:30,l:-(7+j*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||H(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||H(this.labelTextColor);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Y(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Y(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=B(this.primaryColor,{h:64}),this.fillType3=B(this.secondaryColor,{h:64}),this.fillType4=B(this.primaryColor,{h:-64}),this.fillType5=B(this.secondaryColor,{h:-64}),this.fillType6=B(this.primaryColor,{h:128}),this.fillType7=B(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||B(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||B(this.primaryColor,{l:-10}),this.pie5=this.pie5||B(this.secondaryColor,{l:-30}),this.pie6=this.pie6||B(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||B(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||B(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||B(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||B(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||B(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||B(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??B(this.primaryColor,{l:-30}),this.venn2=this.venn2??B(this.secondaryColor,{l:-30}),this.venn3=this.venn3??B(this.tertiaryColor,{l:-40}),this.venn4=this.venn4??B(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??B(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??B(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??B(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??B(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((n=this.radar)==null?void 0:n.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((a=this.radar)==null?void 0:a.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.axisColor)||this.lineColor,axisTextColor:((f=this.wardley)==null?void 0:f.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((k=this.wardley)==null?void 0:k.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((T=this.wardley)==null?void 0:T.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((w=this.wardley)==null?void 0:w.annotationFill)||this.background},this.xyChart={backgroundColor:((E=this.xyChart)==null?void 0:E.backgroundColor)||this.background,titleColor:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((M=this.xyChart)==null?void 0:M.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((N=this.xyChart)==null?void 0:N.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((P=this.xyChart)==null?void 0:P.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:(($=this.xyChart)==null?void 0:$.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((q=this.xyChart)==null?void 0:q.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((O=this.xyChart)==null?void 0:O.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((I=this.xyChart)==null?void 0:I.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((F=this.xyChart)==null?void 0:F.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((D=this.xyChart)==null?void 0:D.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((R=this.xyChart)==null?void 0:R.plotColorPalette)||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||B(this.primaryColor,{h:-30}),this.git4=this.git4||B(this.primaryColor,{h:-60}),this.git5=this.git5||B(this.primaryColor,{h:-90}),this.git6=this.git6||B(this.primaryColor,{h:60}),this.git7=this.git7||B(this.primaryColor,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||X(H(this.git0),25),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(Object.keys(this).forEach(n=>{this[n]==="calculated"&&(this[n]=void 0)}),typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(vs,"Theme"),vs),m4=v(t=>{const e=new p4;return e.calculate(t),e},"getThemeVariables"),ws,g4=(ws=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=Y("#cde498",10),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.primaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,E,L,M,N,P,$,q,O,I,F,D,R;this.actorBorder=X(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||B(this.primaryColor,{h:30}),this.cScale4=this.cScale4||B(this.primaryColor,{h:60}),this.cScale5=this.cScale5||B(this.primaryColor,{h:90}),this.cScale6=this.cScale6||B(this.primaryColor,{h:120}),this.cScale7=this.cScale7||B(this.primaryColor,{h:150}),this.cScale8=this.cScale8||B(this.primaryColor,{h:210}),this.cScale9=this.cScale9||B(this.primaryColor,{h:270}),this.cScale10=this.cScale10||B(this.primaryColor,{h:300}),this.cScale11=this.cScale11||B(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||X(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||X(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=X(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||B(this["cScale"+j],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||B(this.mainBkg,{h:30,s:-30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||B(this.mainBkg,{h:30,s:-30,l:-(8+j*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Y(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Y(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=B(this.primaryColor,{h:64}),this.fillType3=B(this.secondaryColor,{h:64}),this.fillType4=B(this.primaryColor,{h:-64}),this.fillType5=B(this.secondaryColor,{h:-64}),this.fillType6=B(this.primaryColor,{h:128}),this.fillType7=B(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||B(this.primaryColor,{l:-30}),this.pie5=this.pie5||B(this.secondaryColor,{l:-30}),this.pie6=this.pie6||B(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||B(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||B(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||B(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||B(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||B(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||B(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??B(this.primaryColor,{l:-30}),this.venn2=this.venn2??B(this.secondaryColor,{l:-30}),this.venn3=this.venn3??B(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??B(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??B(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??B(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??B(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??B(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((n=this.radar)==null?void 0:n.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((a=this.radar)==null?void 0:a.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.axisColor)||this.lineColor,axisTextColor:((f=this.wardley)==null?void 0:f.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((k=this.wardley)==null?void 0:k.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((T=this.wardley)==null?void 0:T.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((w=this.wardley)==null?void 0:w.annotationFill)||this.background},this.xyChart={backgroundColor:((E=this.xyChart)==null?void 0:E.backgroundColor)||this.background,titleColor:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((M=this.xyChart)==null?void 0:M.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((N=this.xyChart)==null?void 0:N.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((P=this.xyChart)==null?void 0:P.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:(($=this.xyChart)==null?void 0:$.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((q=this.xyChart)==null?void 0:q.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((O=this.xyChart)==null?void 0:O.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((I=this.xyChart)==null?void 0:I.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((F=this.xyChart)==null?void 0:F.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((D=this.xyChart)==null?void 0:D.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((R=this.xyChart)==null?void 0:R.plotColorPalette)||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||B(this.primaryColor,{h:-30}),this.git4=this.git4||B(this.primaryColor,{h:-60}),this.git5=this.git5||B(this.primaryColor,{h:-90}),this.git6=this.git6||B(this.primaryColor,{h:60}),this.git7=this.git7||B(this.primaryColor,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ws,"Theme"),ws),x4=v(t=>{const e=new g4;return e.calculate(t),e},"getThemeVariables"),Ss,y4=(Ss=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Y(this.contrast,55),this.background="#ffffff",this.tertiaryColor=B(this.primaryColor,{h:-160}),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||Y(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var e,r,n,i,s,o,a,l,c,u,d,p,f,m,x,g,y,b,k,T,_,w,E,L,M,N,P,$,q,O,I,F,D,R;this.secondBkg=Y(this.contrast,55),this.border2=this.contrast,this.actorBorder=Y(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||H(this["cScale"+j]);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this.darkMode?this["cScalePeer"+j]=this["cScalePeer"+j]||Y(this["cScale"+j],10):this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||B(this.mainBkg,{l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||B(this.mainBkg,{l:-(8+j*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=Y(this.contrast,30),this.sectionBkgColor2=Y(this.contrast,30),this.taskBorderColor=X(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=Y(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=X(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=B(this.primaryColor,{h:64}),this.fillType3=B(this.secondaryColor,{h:64}),this.fillType4=B(this.primaryColor,{h:-64}),this.fillType5=B(this.secondaryColor,{h:-64}),this.fillType6=B(this.primaryColor,{h:128}),this.fillType7=B(this.secondaryColor,{h:128});for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["pie"+j]=this["cScale"+j];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7";for(let j=0;j<8;j++)this["venn"+(j+1)]=this["venn"+(j+1)]??this["cScale"+j];this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,dataLabelColor:((n=this.xyChart)==null?void 0:n.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((f=this.radar)==null?void 0:f.axisColor)||this.lineColor,axisStrokeWidth:((m=this.radar)==null?void 0:m.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((g=this.radar)==null?void 0:g.curveOpacity)||.5,curveStrokeWidth:((y=this.radar)==null?void 0:y.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((k=this.radar)==null?void 0:k.graticuleStrokeWidth)||1,graticuleOpacity:((T=this.radar)==null?void 0:T.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((E=this.wardley)==null?void 0:E.backgroundColor)||this.background,axisColor:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((M=this.wardley)==null?void 0:M.axisTextColor)||this.primaryTextColor,gridColor:((N=this.wardley)==null?void 0:N.gridColor)||this.gridColor,componentFill:((P=this.wardley)==null?void 0:P.componentFill)||this.background,componentStroke:(($=this.wardley)==null?void 0:$.componentStroke)||this.lineColor,componentLabelColor:((q=this.wardley)==null?void 0:q.componentLabelColor)||this.primaryTextColor,linkStroke:((O=this.wardley)==null?void 0:O.linkStroke)||this.lineColor,evolutionStroke:((I=this.wardley)==null?void 0:I.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((F=this.wardley)==null?void 0:F.annotationStroke)||this.lineColor,annotationTextColor:((D=this.wardley)==null?void 0:D.annotationTextColor)||this.primaryTextColor,annotationFill:((R=this.wardley)==null?void 0:R.annotationFill)||this.background},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=X(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||B(this.primaryColor,{h:-30}),this.git4=this.pie5||B(this.primaryColor,{h:-60}),this.git5=this.pie6||B(this.primaryColor,{h:-90}),this.git6=this.pie7||B(this.primaryColor,{h:60}),this.git7=this.pie8||B(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ss,"Theme"),Ss),b4=v(t=>{const e=new y4;return e.calculate(t),e},"getThemeVariables"),Ts,C4=(Ts=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var s,o,a,l,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||B(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||B(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=B(e,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||Y(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||e,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||n,this.cScale3=this.cScale3||B(e,{h:30}),this.cScale4=this.cScale4||B(e,{h:60}),this.cScale5=this.cScale5||B(e,{h:90}),this.cScale6=this.cScale6||B(e,{h:120}),this.cScale7=this.cScale7||B(e,{h:150}),this.cScale8=this.cScale8||B(e,{h:210,l:150}),this.cScale9=this.cScale9||B(e,{h:270}),this.cScale10=this.cScale10||B(e,{h:300}),this.cScale11=this.cScale11||B(e,{h:330}),this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=X(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=X(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Y(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||X(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||B(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||B(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||B(e,{h:64}),this.fillType3=this.fillType3||B(r,{h:64}),this.fillType4=this.fillType4||B(e,{h:-64}),this.fillType5=this.fillType5||B(r,{h:-64}),this.fillType6=this.fillType6||B(e,{h:128}),this.fillType7=this.fillType7||B(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||B(e,{l:-10}),this.pie5=this.pie5||B(r,{l:-10}),this.pie6=this.pie6||B(n,{l:-10}),this.pie7=this.pie7||B(e,{h:60,l:-10}),this.pie8=this.pie8||B(e,{h:-60,l:-10}),this.pie9=this.pie9||B(e,{h:120,l:0}),this.pie10=this.pie10||B(e,{h:60,l:-20}),this.pie11=this.pie11||B(e,{h:-60,l:-20}),this.pie12=this.pie12||B(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||B(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((l=this.xyChart)==null?void 0:l.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((c=this.xyChart)==null?void 0:c.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||B(e,{h:-30}),this.git4=this.git4||B(e,{h:-60}),this.git5=this.git5||B(e,{h:-90}),this.git6=this.git6||B(e,{h:60}),this.git7=this.git7||B(e,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ts,"Theme"),Ts),k4=v(t=>{const e=new C4;return e.calculate(t),e},"getThemeVariables"),_s,v4=(_s=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=B(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Y(H("#323D47"),10),this.border1="#ccc",this.border2=Hn(255,255,255,.25),this.arrowheadColor=H(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||B(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||B(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Y(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||B(this.primaryColor,{h:30}),this.cScale4=this.cScale4||B(this.primaryColor,{h:60}),this.cScale5=this.cScale5||B(this.primaryColor,{h:90}),this.cScale6=this.cScale6||B(this.primaryColor,{h:120}),this.cScale7=this.cScale7||B(this.primaryColor,{h:150}),this.cScale8=this.cScale8||B(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||B(this.primaryColor,{h:270}),this.cScale10=this.cScale10||B(this.primaryColor,{h:300}),this.cScale11=this.cScale11||B(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(this["cScale"+f],25);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||Y(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||X(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=this["cScaleLabel"+f]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||B(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||B(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||B(this.primaryColor,{h:64}),this.fillType3=this.fillType3||B(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||B(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||B(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||B(this.primaryColor,{h:128}),this.fillType7=this.fillType7||B(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||B(this.primaryColor,{l:-10}),this.pie5=this.pie5||B(this.secondaryColor,{l:-10}),this.pie6=this.pie6||B(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||B(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||B(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||B(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||B(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||B(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||B(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||"#0b0000",this.git1=this.git1||"#4d1037",this.git2=this.git2||"#3f5258",this.git3=this.git3||"#4f2f1b",this.git4=this.git4||"#6e0a0a",this.git5=this.git5||"#3b0048",this.git6=this.git6||"#995a01",this.git7=this.git7||"#154706",this.gitDarkMode=!0,this.gitDarkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(_s,"Theme"),_s),w4=v(t=>{const e=new v4;return e.calculate(t),e},"getThemeVariables"),Es,S4=(Es=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Pt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var s,o,a,l,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||B(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||B(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=B(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||Y(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=this.mainBkg;if(this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=X(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=X(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Y(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||X(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||B(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||B(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||B(e,{h:64}),this.fillType3=this.fillType3||B(r,{h:64}),this.fillType4=this.fillType4||B(e,{h:-64}),this.fillType5=this.fillType5||B(r,{h:-64}),this.fillType6=this.fillType6||B(e,{h:128}),this.fillType7=this.fillType7||B(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||B(e,{l:-10}),this.pie5=this.pie5||B(r,{l:-10}),this.pie6=this.pie6||B(n,{l:-10}),this.pie7=this.pie7||B(e,{h:60,l:-10}),this.pie8=this.pie8||B(e,{h:-60,l:-10}),this.pie9=this.pie9||B(e,{h:120,l:0}),this.pie10=this.pie10||B(e,{h:60,l:-20}),this.pie11=this.pie11||B(e,{h:-60,l:-20}),this.pie12=this.pie12||B(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||B(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((l=this.xyChart)==null?void 0:l.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((c=this.xyChart)==null?void 0:c.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.requirementEdgeLabelBackground="#FFFFFF",this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||B(e,{h:-30}),this.git4=this.git4||B(e,{h:-60}),this.git5=this.git5||B(e,{h:-90}),this.git6=this.git6||B(e,{h:60}),this.git7=this.git7||B(e,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.erEdgeLabelBackground="#FFFFFF",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Es,"Theme"),Es),T4=v(t=>{const e=new S4;return e.calculate(t),e},"getThemeVariables"),Ns,_4=(Ns=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=B(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Y(H("#323D47"),10),this.border1="#ccc",this.border2=Hn(255,255,255,.25),this.arrowheadColor=H(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||B(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||B(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Y(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||B(this.primaryColor,{h:30}),this.cScale4=this.cScale4||B(this.primaryColor,{h:60}),this.cScale5=this.cScale5||B(this.primaryColor,{h:90}),this.cScale6=this.cScale6||B(this.primaryColor,{h:120}),this.cScale7=this.cScale7||B(this.primaryColor,{h:150}),this.cScale8=this.cScale8||B(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||B(this.primaryColor,{h:270}),this.cScale10=this.cScale10||B(this.primaryColor,{h:300}),this.cScale11=this.cScale11||B(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(this["cScale"+f],25);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||Y(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||X(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=this["cScaleLabel"+f]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||B(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||B(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||B(this.primaryColor,{h:64}),this.fillType3=this.fillType3||B(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||B(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||B(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||B(this.primaryColor,{h:128}),this.fillType7=this.fillType7||B(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||B(this.primaryColor,{l:-10}),this.pie5=this.pie5||B(this.secondaryColor,{l:-10}),this.pie6=this.pie6||B(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||B(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||B(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||B(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||B(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||B(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||B(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.requirementEdgeLabelBackground="#16141F",this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||B(this.primaryColor,{h:-30}),this.git4=this.git4||B(this.primaryColor,{h:-60}),this.git5=this.git5||B(this.primaryColor,{h:-90}),this.git6=this.git6||B(this.primaryColor,{h:60}),this.git7=this.git7||B(this.primaryColor,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.erEdgeLabelBackground="#16141F",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ns,"Theme"),Ns),E4=v(t=>{const e=new _4;return e.calculate(t),e},"getThemeVariables"),js,N4=(js=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var s,o,a,l,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||B(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||B(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=B(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||Y(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Y(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||X(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||B(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||B(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||B(e,{h:64}),this.fillType3=this.fillType3||B(r,{h:64}),this.fillType4=this.fillType4||B(e,{h:-64}),this.fillType5=this.fillType5||B(r,{h:-64}),this.fillType6=this.fillType6||B(e,{h:128}),this.fillType7=this.fillType7||B(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||B(e,{l:-10}),this.pie5=this.pie5||B(r,{l:-10}),this.pie6=this.pie6||B(n,{l:-10}),this.pie7=this.pie7||B(e,{h:60,l:-10}),this.pie8=this.pie8||B(e,{h:-60,l:-10}),this.pie9=this.pie9||B(e,{h:120,l:0}),this.pie10=this.pie10||B(e,{h:60,l:-20}),this.pie11=this.pie11||B(e,{h:-60,l:-20}),this.pie12=this.pie12||B(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||B(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((l=this.xyChart)==null?void 0:l.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((c=this.xyChart)==null?void 0:c.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||B(e,{h:-30}),this.git4=this.git4||B(e,{h:-60}),this.git5=this.git5||B(e,{h:-90}),this.git6=this.git6||B(e,{h:60}),this.git7=this.git7||B(e,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLineColor=this.commitLineColor??"#BDBCCC",this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.fontWeight=600,this.erEdgeLabelBackground="#FFFFFF",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(js,"Theme"),js),j4=v(t=>{const e=new N4;return e.calculate(t),e},"getThemeVariables"),Ls,L4=(Ls=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=B(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Y(H("#323D47"),10),this.border1="#ccc",this.border2=Hn(255,255,255,.25),this.arrowheadColor=H(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,n,i,s,o,a,l,c,u,d,p;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||B(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||B(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor),this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Y(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||Y(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||X(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=X(this["cScale"+f],75);const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||B(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||B(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||B(this.primaryColor,{h:64}),this.fillType3=this.fillType3||B(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||B(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||B(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||B(this.primaryColor,{h:128}),this.fillType7=this.fillType7||B(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||B(this.primaryColor,{l:-10}),this.pie5=this.pie5||B(this.secondaryColor,{l:-10}),this.pie6=this.pie6||B(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||B(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||B(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||B(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||B(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||B(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||B(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||B(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||B(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||B(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||B(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||B(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||B(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((l=this.xyChart)==null?void 0:l.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((c=this.xyChart)==null?void 0:c.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||B(this.primaryColor,{h:-30}),this.git4=this.git4||B(this.primaryColor,{h:-60}),this.git5=this.git5||B(this.primaryColor,{h:-90}),this.git6=this.git6||B(this.primaryColor,{h:60}),this.git7=this.git7||B(this.primaryColor,{h:120}),this.darkMode?(this.git0=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)):(this.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.fontWeight=600,this.erEdgeLabelBackground="#16141F",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||dn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||fn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ls,"Theme"),Ls),B4=v(t=>{const e=new L4;return e.calculate(t),e},"getThemeVariables"),kn={base:{getThemeVariables:u4},dark:{getThemeVariables:f4},default:{getThemeVariables:m4},forest:{getThemeVariables:x4},neutral:{getThemeVariables:b4},neo:{getThemeVariables:k4},"neo-dark":{getThemeVariables:w4},redux:{getThemeVariables:T4},"redux-dark":{getThemeVariables:E4},"redux-color":{getThemeVariables:j4},"redux-dark-color":{getThemeVariables:B4}},Qe={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},M1={...Qe,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:kn.default.getThemeVariables(),sequence:{...Qe.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Qe.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Qe.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Qe.flowchart,inheritDir:!1},external_personFont:v(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:v(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:v(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:v(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:v(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:v(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:v(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:v(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:v(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:v(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:v(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:v(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:v(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:v(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:v(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:v(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:v(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:v(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:v(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:v(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Qe.pie,useWidth:984},xyChart:{...Qe.xyChart,useWidth:void 0},requirement:{...Qe.requirement,useWidth:void 0},packet:{...Qe.packet},eventmodeling:{...Qe.eventmodeling},treeView:{...Qe.treeView,useWidth:void 0},radar:{...Qe.radar},ishikawa:{...Qe.ishikawa},sankey:{...Qe.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Qe.venn}},I1=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...I1(t[n],"")]:[...r,e+n],[]),"keyify"),A4=new Set(I1(M1,"")),F1=M1,Xl=v(t=>{if(tt.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>Xl(e));return}for(const e of Object.keys(t)){if(tt.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!A4.has(e)||t[e]==null){tt.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){if(e==="nodeColors"){const n=/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i;for(const i of Object.keys(t[e]))(typeof t[e][i]!="string"||!n.test(t[e][i]))&&(tt.debug("sanitize deleting invalid color:",i,t[e][i]),delete t[e][i])}else tt.debug("sanitizing object",e),Xl(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(tt.debug("sanitizing css option",e),t[e]=P1(t[e]))}if(t.themeVariables)for(const e of Object.keys(t.themeVariables)){const r=t.themeVariables[e];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[e]="")}tt.debug("After sanitization",t)}},"sanitizeDirective"),P1=v(t=>{let e=0,r=0;for(const n of t){if(e<r)return"{ /* ERROR: Unbalanced CSS */ }";n==="{"?e++:n==="}"&&r++}return e!==r?"{ /* ERROR: Unbalanced CSS */ }":t},"sanitizeCss"),Rs=Object.freeze(F1),En=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),dr=Ie({},Rs),Kl,Ti=[],Vo=Ie({},Rs),Gc=v((t,e)=>{let r=Ie({},t),n={};for(const i of e)R1(i),n=Ie(n,i);if(r=Ie(r,n),n.theme&&n.theme in kn){const i=Ie({},Kl),s=Ie(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in kn&&(r.themeVariables=kn[r.theme].getThemeVariables(s))}return Vo=r,z1(Vo),Vo},"updateCurrentConfig"),M4=v(t=>(dr=Ie({},Rs),dr=Ie(dr,t),t.theme&&kn[t.theme]&&(dr.themeVariables=kn[t.theme].getThemeVariables(t.themeVariables)),Gc(dr,Ti),dr),"setSiteConfig"),I4=v(t=>{Kl=Ie({},t)},"saveConfigFromInitialize"),F4=v(t=>(dr=Ie(dr,t),Gc(dr,Ti),dr),"updateSiteConfig"),D1=v(()=>Ie({},dr),"getSiteConfig"),O1=v(t=>(z1(t),Ie(Vo,t),be()),"setConfig"),be=v(()=>Ie({},Vo),"getConfig"),R1=v(t=>{t&&(["secure",...dr.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(tt.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])}),Object.keys(t).forEach(e=>{e.startsWith("__")&&delete t[e]}),Object.keys(t).forEach(e=>{typeof t[e]=="string"&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],typeof t[e]=="object"&&R1(t[e])}))},"sanitize"),P4=v(t=>{var e;Xl(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),Ti.push(t),Gc(dr,Ti)},"addDirective"),Zl=v((t=dr)=>{Ti=[],Gc(t,Ti)},"reset"),D4={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},Fg={},$1=v(t=>{Fg[t]||(tt.warn(D4[t]),Fg[t]=!0)},"issueWarning"),z1=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&$1("LAZY_LOAD_DEPRECATED")},"checkConfig"),xZ=v(()=>{let t={};Kl&&(t=Ie(t,Kl));for(const e of Ti)t=Ie(t,e);return t},"getUserDefinedConfig"),or=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&$1("FLOWCHART_HTML_LABELS_DEPRECATED"),En(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),va=/<br\s*\/?>/gi,O4=v(t=>t?H1(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),R4=(()=>{let t=!1;return()=>{t||(W1(),t=!0)}})();function W1(){const t="data-temp-href-target";Os.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),Os.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute(t)&&(e.setAttribute("target",e.getAttribute(t)??""),e.removeAttribute(t),e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener"))})}v(W1,"setupDompurifyHooks");var q1=v(t=>(R4(),Os.sanitize(t)),"removeScript"),Pg=v((t,e)=>{if(or(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=q1(t):r!=="loose"&&(t=H1(t),t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=t.replace(/=/g,"&equals;"),t=q4(t))}return t},"sanitizeMore"),Gr=v((t,e)=>t&&(e.dompurifyConfig?t=Os.sanitize(Pg(t,e),e.dompurifyConfig).toString():t=Os.sanitize(Pg(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),$4=v((t,e)=>typeof t=="string"?Gr(t,e):t.flat().map(r=>Gr(r,e)),"sanitizeTextOrArray"),z4=v(t=>va.test(t),"hasBreaks"),W4=v(t=>t.split(va),"splitBreaks"),q4=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),H1=v(t=>t.replace(va,"#br#"),"breakToPlaceholder"),H4=v(t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=CSS.escape(e)),e},"getUrl"),U4=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),G4=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),Dg=v(function(t){const e=t.split(/(,)/),r=[];for(let n=0;n<e.length;n++){let i=e[n];if(i===","&&n>0&&n+1<e.length){const s=e[n-1],o=e[n+1];V4(s,o)&&(i=s+","+o,n++,r.pop())}r.push(Y4(i))}return r.join("")},"parseGenericTypes"),Ju=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),V4=v((t,e)=>{const r=Ju(t,"~"),n=Ju(e,"~");return r===1&&n===1},"shouldCombineSets"),Y4=v(t=>{const e=Ju(t,"~");let r=!1;if(e<=1)return t;e%2!==0&&t.startsWith("~")&&(t=t.substring(1),r=!0);const n=[...t];let i=n.indexOf("~"),s=n.lastIndexOf("~");for(;i!==-1&&s!==-1&&i!==s;)n[i]="<",n[s]=">",i=n.indexOf("~"),s=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),Og=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),td=/\$\$(.*)\$\$/g,ra=v(t=>{var e;return(((e=t.match(td))==null?void 0:e.length)??0)>0},"hasKatex"),yZ=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await U1(t,e),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0";const n=document.querySelector("body");n==null||n.insertAdjacentElement("beforeend",r);const i={width:r.clientWidth,height:r.clientHeight};return r.remove(),i},"calculateMathMLDimensions"),X4=v(async(t,e)=>{if(!ra(t))return t;if(!(Og()||e.legacyMathML||e.forceLegacyMathML))return t.replace(td,"MathML is unsupported in this environment.");{const{default:r}=await Jt(async()=>{const{default:i}=await import("./katex-C5jXJg4s.js");return{default:i}},[]),n=e.forceLegacyMathML||!Og()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(va).map(i=>ra(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(td,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),U1=v(async(t,e)=>Gr(await X4(t,e),e),"renderKatexSanitized"),wa={getRows:O4,sanitizeText:Gr,sanitizeTextOrArray:$4,hasBreaks:z4,splitBreaks:W4,lineBreakRegex:va,removeScript:q1,getUrl:H4,evaluate:En,getMax:U4,getMin:G4},K4=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),Z4=v(function(t,e,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${e}px;`)):(n.set("height",t),n.set("width",e)),n},"calculateSvgSizeAttrs"),G1=v(function(t,e,r,n){const i=Z4(e,r,n);K4(t,i)},"configureSvgSize"),Q4=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;tt.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;tt.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,tt.info(`Calculated bounds: ${a}x${l}`),G1(e,l,a,n);const c=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;e.attr("viewBox",c)},"setupGraphViewbox"),Cl={};function ed(t){return[...t.cssRules].map(e=>e.cssText).join(`
350
+ `)}v(ed,"cssStyleSheetToString");var J4=v((t,e,r,n)=>{let i="";return t in Cl&&Cl[t]?i=Cl[t]({...r,svgId:n}):tt.warn(`No theme found for ${t}`),` & {
351
+ font-family: ${r.fontFamily};
352
+ font-size: ${r.fontSize};
353
+ fill: ${r.textColor}
354
+ }
355
+ @keyframes edge-animation-frame {
356
+ from {
357
+ stroke-dashoffset: 0;
358
+ }
359
+ }
360
+ @keyframes dash {
361
+ to {
362
+ stroke-dashoffset: 0;
363
+ }
364
+ }
365
+ & .edge-animation-slow {
366
+ stroke-dasharray: 9,5 !important;
367
+ stroke-dashoffset: 900;
368
+ animation: dash 50s linear infinite;
369
+ stroke-linecap: round;
370
+ }
371
+ & .edge-animation-fast {
372
+ stroke-dasharray: 9,5 !important;
373
+ stroke-dashoffset: 900;
374
+ animation: dash 20s linear infinite;
375
+ stroke-linecap: round;
376
+ }
377
+ /* Classes common for multiple diagrams */
378
+
379
+ & .error-icon {
380
+ fill: ${r.errorBkgColor};
381
+ }
382
+ & .error-text {
383
+ fill: ${r.errorTextColor};
384
+ stroke: ${r.errorTextColor};
385
+ }
386
+
387
+ & .edge-thickness-normal {
388
+ stroke-width: ${r.strokeWidth??1}px;
389
+ }
390
+ & .edge-thickness-thick {
391
+ stroke-width: 3.5px
392
+ }
393
+ & .edge-pattern-solid {
394
+ stroke-dasharray: 0;
395
+ }
396
+ & .edge-thickness-invisible {
397
+ stroke-width: 0;
398
+ fill: none;
399
+ }
400
+ & .edge-pattern-dashed{
401
+ stroke-dasharray: 3;
402
+ }
403
+ .edge-pattern-dotted {
404
+ stroke-dasharray: 2;
405
+ }
406
+
407
+ & .marker {
408
+ fill: ${r.lineColor};
409
+ stroke: ${r.lineColor};
410
+ }
411
+ & .marker.cross {
412
+ stroke: ${r.lineColor};
413
+ }
414
+
415
+ & svg {
416
+ font-family: ${r.fontFamily};
417
+ font-size: ${r.fontSize};
418
+ }
419
+ & p {
420
+ margin: 0
421
+ }
422
+
423
+ ${i}
424
+ .node .neo-node {
425
+ stroke: ${r.nodeBorder};
426
+ }
427
+
428
+ [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
429
+ stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
430
+ filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
431
+ }
432
+
433
+
434
+ [data-look="neo"].node path {
435
+ stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
436
+ stroke-width: ${r.strokeWidth??1}px;
437
+ }
438
+
439
+ [data-look="neo"].node .outer-path {
440
+ filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
441
+ }
442
+
443
+ [data-look="neo"].node .neo-line path {
444
+ stroke: ${r.nodeBorder};
445
+ filter: none;
446
+ }
447
+
448
+ [data-look="neo"].node circle{
449
+ stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
450
+ filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
451
+ }
452
+
453
+ [data-look="neo"].node circle .state-start{
454
+ fill: #000000;
455
+ }
456
+
457
+ [data-look="neo"].icon-shape .icon {
458
+ fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
459
+ filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
460
+ }
461
+
462
+ [data-look="neo"].icon-shape .icon-neo path {
463
+ stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
464
+ filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
465
+ }
466
+
467
+ ${e}
468
+ `},"getStyles"),tP=v((t,e)=>{e!==void 0&&(Cl[t]=e)},"addStylesForDiagram"),eP=J4,V1={};SF(V1,{clear:()=>rP,getAccDescription:()=>oP,getAccTitle:()=>iP,getDiagramTitle:()=>lP,setAccDescription:()=>sP,setAccTitle:()=>nP,setDiagramTitle:()=>aP});var Uf="",Gf="",Vf="",Yf=v(t=>Gr(t,be()),"sanitizeText"),rP=v(()=>{Uf="",Vf="",Gf=""},"clear"),nP=v(t=>{Uf=Yf(t).replace(/^\s+/g,"")},"setAccTitle"),iP=v(()=>Uf,"getAccTitle"),sP=v(t=>{Vf=Yf(t).replace(/\n\s+/g,`
469
+ `)},"setAccDescription"),oP=v(()=>Vf,"getAccDescription"),aP=v(t=>{Gf=Yf(t)},"setDiagramTitle"),lP=v(()=>Gf,"getDiagramTitle"),Rg=tt,cP=qf,re=be,bZ=O1,CZ=Rs,Xf=v(t=>Gr(t,re()),"sanitizeText"),hP=Q4,uP=v(()=>V1,"getCommonDb"),Ql={},Jl=v((t,e,r)=>{var n;Ql[t]&&Rg.warn(`Diagram with id ${t} already registered. Overwriting.`),Ql[t]=e,r&&A1(t,r),tP(t,e.styles),(n=e.injectUtils)==null||n.call(e,Rg,cP,re,Xf,hP,uP(),()=>{})},"registerDiagram"),rd=v(t=>{if(t in Ql)return Ql[t];throw new dP(t)},"getDiagram"),Bs,dP=(Bs=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(Bs,"DiagramNotFoundError"),Bs),fP={value:()=>{}};function Y1(){for(var t=0,e=arguments.length,r={},n;t<e;++t){if(!(n=arguments[t]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new kl(r)}function kl(t){this._=t}function pP(t,e){return t.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}kl.prototype=Y1.prototype={constructor:kl,on:function(t,e){var r=this._,n=pP(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=mP(r[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=n[s]).type)r[i]=$g(r[i],t.name,e);else if(e==null)for(i in r)r[i]=$g(r[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new kl(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,s;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],n=0,i=s.length;n<i;++n)s[n].value.apply(e,r)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};function mP(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function $g(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=fP,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var nd="http://www.w3.org/1999/xhtml";const zg={svg:"http://www.w3.org/2000/svg",xhtml:nd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),zg.hasOwnProperty(e)?{space:zg[e],local:t}:t}function gP(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===nd&&e.documentElement.namespaceURI===nd?e.createElement(t):e.createElementNS(r,t)}}function xP(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function X1(t){var e=Vc(t);return(e.local?xP:gP)(e)}function yP(){}function Kf(t){return t==null?yP:function(){return this.querySelector(t)}}function bP(t){typeof t!="function"&&(t=Kf(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=t.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new Tr(n,this._parents)}function CP(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function kP(){return[]}function K1(t){return t==null?kP:function(){return this.querySelectorAll(t)}}function vP(t){return function(){return CP(t.apply(this,arguments))}}function wP(t){typeof t=="function"?t=vP(t):t=K1(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(t.call(l,l.__data__,c,o)),i.push(l));return new Tr(n,i)}function Z1(t){return function(){return this.matches(t)}}function Q1(t){return function(e){return e.matches(t)}}var SP=Array.prototype.find;function TP(t){return function(){return SP.call(this.children,t)}}function _P(){return this.firstElementChild}function EP(t){return this.select(t==null?_P:TP(typeof t=="function"?t:Q1(t)))}var NP=Array.prototype.filter;function jP(){return Array.from(this.children)}function LP(t){return function(){return NP.call(this.children,t)}}function BP(t){return this.selectAll(t==null?jP:LP(typeof t=="function"?t:Q1(t)))}function AP(t){typeof t!="function"&&(t=Z1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new Tr(n,this._parents)}function J1(t){return new Array(t.length)}function MP(){return new Tr(this._enter||this._groups.map(J1),this._parents)}function tc(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}tc.prototype={constructor:tc,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function IP(t){return function(){return t}}function FP(t,e,r,n,i,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new tc(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function PP(t,e,r,n,i,s,o){var a,l,c=new Map,u=e.length,d=s.length,p=new Array(u),f;for(a=0;a<u;++a)(l=e[a])&&(p[a]=f=o.call(l,l.__data__,a,e)+"",c.has(f)?i[a]=l:c.set(f,l));for(a=0;a<d;++a)f=o.call(t,s[a],a,s)+"",(l=c.get(f))?(n[a]=l,l.__data__=s[a],c.delete(f)):r[a]=new tc(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(i[a]=l)}function DP(t){return t.__data__}function OP(t,e){if(!arguments.length)return Array.from(this,DP);var r=e?PP:FP,n=this._parents,i=this._groups;typeof t!="function"&&(t=IP(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],d=i[c],p=d.length,f=RP(t.call(u,u&&u.__data__,c,n)),m=f.length,x=a[c]=new Array(m),g=o[c]=new Array(m),y=l[c]=new Array(p);r(u,d,x,g,y,f,e);for(var b=0,k=0,T,_;b<m;++b)if(T=x[b]){for(b>=k&&(k=b+1);!(_=g[k])&&++k<m;);T._next=_||null}}return o=new Tr(o,n),o._enter=a,o._exit=l,o}function RP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $P(){return new Tr(this._exit||this._groups.map(J1),this._parents)}function zP(t,e,r){var n=this.enter(),i=this,s=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),r==null?s.remove():r(s),n&&i?n.merge(i).order():i}function WP(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,o=Math.min(i,s),a=new Array(i),l=0;l<o;++l)for(var c=r[l],u=n[l],d=c.length,p=a[l]=new Array(d),f,m=0;m<d;++m)(f=c[m]||u[m])&&(p[m]=f);for(;l<i;++l)a[l]=r[l];return new Tr(a,this._parents)}function qP(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n=t[e],i=n.length-1,s=n[i],o;--i>=0;)(o=n[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function HP(t){t||(t=UP);function e(d,p){return d&&p?t(d.__data__,p.__data__):!d-!p}for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var o=r[s],a=o.length,l=i[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new Tr(i,this._parents).order()}function UP(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function GP(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function VP(){return Array.from(this)}function YP(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var o=n[i];if(o)return o}return null}function XP(){let t=0;for(const e of this)++t;return t}function KP(){return!this.node()}function ZP(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i=e[r],s=0,o=i.length,a;s<o;++s)(a=i[s])&&t.call(a,a.__data__,s,i);return this}function QP(t){return function(){this.removeAttribute(t)}}function JP(t){return function(){this.removeAttributeNS(t.space,t.local)}}function tD(t,e){return function(){this.setAttribute(t,e)}}function eD(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function rD(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function nD(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function iD(t,e){var r=Vc(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((e==null?r.local?JP:QP:typeof e=="function"?r.local?nD:rD:r.local?eD:tD)(r,e))}function tC(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function sD(t){return function(){this.style.removeProperty(t)}}function oD(t,e,r){return function(){this.style.setProperty(t,e,r)}}function aD(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function lD(t,e,r){return arguments.length>1?this.each((e==null?sD:typeof e=="function"?aD:oD)(t,e,r??"")):$s(this.node(),t)}function $s(t,e){return t.style.getPropertyValue(e)||tC(t).getComputedStyle(t,null).getPropertyValue(e)}function cD(t){return function(){delete this[t]}}function hD(t,e){return function(){this[t]=e}}function uD(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function dD(t,e){return arguments.length>1?this.each((e==null?cD:typeof e=="function"?uD:hD)(t,e)):this.node()[t]}function eC(t){return t.trim().split(/^|\s+/)}function Zf(t){return t.classList||new rC(t)}function rC(t){this._node=t,this._names=eC(t.getAttribute("class")||"")}rC.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function nC(t,e){for(var r=Zf(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function iC(t,e){for(var r=Zf(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function fD(t){return function(){nC(this,t)}}function pD(t){return function(){iC(this,t)}}function mD(t,e){return function(){(e.apply(this,arguments)?nC:iC)(this,t)}}function gD(t,e){var r=eC(t+"");if(arguments.length<2){for(var n=Zf(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?mD:e?fD:pD)(r,e))}function xD(){this.textContent=""}function yD(t){return function(){this.textContent=t}}function bD(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function CD(t){return arguments.length?this.each(t==null?xD:(typeof t=="function"?bD:yD)(t)):this.node().textContent}function kD(){this.innerHTML=""}function vD(t){return function(){this.innerHTML=t}}function wD(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function SD(t){return arguments.length?this.each(t==null?kD:(typeof t=="function"?wD:vD)(t)):this.node().innerHTML}function TD(){this.nextSibling&&this.parentNode.appendChild(this)}function _D(){return this.each(TD)}function ED(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ND(){return this.each(ED)}function jD(t){var e=typeof t=="function"?t:X1(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function LD(){return null}function BD(t,e){var r=typeof t=="function"?t:X1(t),n=e==null?LD:typeof e=="function"?e:Kf(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function AD(){var t=this.parentNode;t&&t.removeChild(this)}function MD(){return this.each(AD)}function ID(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function FD(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function PD(t){return this.select(t?FD:ID)}function DD(t){return arguments.length?this.property("__data__",t):this.node().__data__}function OD(t){return function(e){t.call(this,e,this.__data__)}}function RD(t){return t.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");return n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function $D(t){return function(){var e=this.__on;if(e){for(var r=0,n=-1,i=e.length,s;r<i;++r)s=e[r],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function zD(t,e,r){return function(){var n=this.__on,i,s=OD(e);if(n){for(var o=0,a=n.length;o<a;++o)if((i=n[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=r),i.value=e;return}}this.addEventListener(t.type,s,r),i={type:t.type,name:t.name,value:e,listener:s,options:r},n?n.push(i):this.__on=[i]}}function WD(t,e,r){var n=RD(t+""),i,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(i=0,u=a[l];i<s;++i)if((o=n[i]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?zD:$D,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function sC(t,e,r){var n=tC(t),i=n.CustomEvent;typeof i=="function"?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function qD(t,e){return function(){return sC(this,t,e)}}function HD(t,e){return function(){return sC(this,t,e.apply(this,arguments))}}function UD(t,e){return this.each((typeof e=="function"?HD:qD)(t,e))}function*GD(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length,o;i<s;++i)(o=n[i])&&(yield o)}var oC=[null];function Tr(t,e){this._groups=t,this._parents=e}function Sa(){return new Tr([[document.documentElement]],oC)}function VD(){return this}Tr.prototype=Sa.prototype={constructor:Tr,select:bP,selectAll:wP,selectChild:EP,selectChildren:BP,filter:AP,data:OP,enter:MP,exit:$P,join:zP,merge:WP,selection:VD,order:qP,sort:HP,call:GP,nodes:VP,node:YP,size:XP,empty:KP,each:ZP,attr:iD,style:lD,property:dD,classed:gD,text:CD,html:SD,raise:_D,lower:ND,append:jD,insert:BD,remove:MD,clone:PD,datum:DD,on:WD,dispatch:UD,[Symbol.iterator]:GD};function Gt(t){return typeof t=="string"?new Tr([[document.querySelector(t)]],[document.documentElement]):new Tr([[t]],oC)}function Qf(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function aC(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Ta(){}var na=.7,ec=1/na,ms="\\s*([+-]?\\d+)\\s*",ia="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",on="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",YD=/^#([0-9a-f]{3,8})$/,XD=new RegExp(`^rgb\\(${ms},${ms},${ms}\\)$`),KD=new RegExp(`^rgb\\(${on},${on},${on}\\)$`),ZD=new RegExp(`^rgba\\(${ms},${ms},${ms},${ia}\\)$`),QD=new RegExp(`^rgba\\(${on},${on},${on},${ia}\\)$`),JD=new RegExp(`^hsl\\(${ia},${on},${on}\\)$`),tO=new RegExp(`^hsla\\(${ia},${on},${on},${ia}\\)$`),Wg={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Qf(Ta,sa,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:qg,formatHex:qg,formatHex8:eO,formatHsl:rO,formatRgb:Hg,toString:Hg});function qg(){return this.rgb().formatHex()}function eO(){return this.rgb().formatHex8()}function rO(){return lC(this).formatHsl()}function Hg(){return this.rgb().formatRgb()}function sa(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=YD.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?Ug(e):r===3?new pr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Va(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Va(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=XD.exec(t))?new pr(e[1],e[2],e[3],1):(e=KD.exec(t))?new pr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ZD.exec(t))?Va(e[1],e[2],e[3],e[4]):(e=QD.exec(t))?Va(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=JD.exec(t))?Yg(e[1],e[2]/100,e[3]/100,1):(e=tO.exec(t))?Yg(e[1],e[2]/100,e[3]/100,e[4]):Wg.hasOwnProperty(t)?Ug(Wg[t]):t==="transparent"?new pr(NaN,NaN,NaN,0):null}function Ug(t){return new pr(t>>16&255,t>>8&255,t&255,1)}function Va(t,e,r,n){return n<=0&&(t=e=r=NaN),new pr(t,e,r,n)}function nO(t){return t instanceof Ta||(t=sa(t)),t?(t=t.rgb(),new pr(t.r,t.g,t.b,t.opacity)):new pr}function id(t,e,r,n){return arguments.length===1?nO(t):new pr(t,e,r,n??1)}function pr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Qf(pr,id,aC(Ta,{brighter(t){return t=t==null?ec:Math.pow(ec,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?na:Math.pow(na,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new pr(Ci(this.r),Ci(this.g),Ci(this.b),rc(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Gg,formatHex:Gg,formatHex8:iO,formatRgb:Vg,toString:Vg}));function Gg(){return`#${xi(this.r)}${xi(this.g)}${xi(this.b)}`}function iO(){return`#${xi(this.r)}${xi(this.g)}${xi(this.b)}${xi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vg(){const t=rc(this.opacity);return`${t===1?"rgb(":"rgba("}${Ci(this.r)}, ${Ci(this.g)}, ${Ci(this.b)}${t===1?")":`, ${t})`}`}function rc(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ci(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function xi(t){return t=Ci(t),(t<16?"0":"")+t.toString(16)}function Yg(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new zr(t,e,r,n)}function lC(t){if(t instanceof zr)return new zr(t.h,t.s,t.l,t.opacity);if(t instanceof Ta||(t=sa(t)),!t)return new zr;if(t instanceof zr)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(r-n)/a+(r<n)*6:r===s?o=(n-e)/a+2:o=(e-r)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new zr(o,a,l,t.opacity)}function sO(t,e,r,n){return arguments.length===1?lC(t):new zr(t,e,r,n??1)}function zr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Qf(zr,sO,aC(Ta,{brighter(t){return t=t==null?ec:Math.pow(ec,t),new zr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?na:Math.pow(na,t),new zr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new pr(eu(t>=240?t-240:t+120,i,n),eu(t,i,n),eu(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new zr(Xg(this.h),Ya(this.s),Ya(this.l),rc(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=rc(this.opacity);return`${t===1?"hsl(":"hsla("}${Xg(this.h)}, ${Ya(this.s)*100}%, ${Ya(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Xg(t){return t=(t||0)%360,t<0?t+360:t}function Ya(t){return Math.max(0,Math.min(1,t||0))}function eu(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const Jf=t=>()=>t;function cC(t,e){return function(r){return t+r*e}}function oO(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function kZ(t,e){var r=e-t;return r?cC(t,r>180||r<-180?r-360*Math.round(r/360):r):Jf(isNaN(t)?e:t)}function aO(t){return(t=+t)==1?hC:function(e,r){return r-e?oO(e,r,t):Jf(isNaN(e)?r:e)}}function hC(t,e){var r=e-t;return r?cC(t,r):Jf(isNaN(t)?e:t)}const Kg=(function t(e){var r=aO(e);function n(i,s){var o=r((i=id(i)).r,(s=id(s)).r),a=r(i.g,s.g),l=r(i.b,s.b),c=hC(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return n.gamma=t,n})(1);function zn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var sd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ru=new RegExp(sd.source,"g");function lO(t){return function(){return t}}function cO(t){return function(e){return t(e)+""}}function hO(t,e){var r=sd.lastIndex=ru.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=sd.exec(t))&&(i=ru.exec(e));)(s=i.index)>r&&(s=e.slice(r,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:zn(n,i)})),r=ru.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?cO(l[0].x):lO(e):(e=l.length,function(c){for(var u=0,d;u<e;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}var Zg=180/Math.PI,od={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function uC(t,e,r,n,i,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,l/=a),t*n<e*r&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Zg,skewX:Math.atan(l)*Zg,scaleX:o,scaleY:a}}var Xa;function uO(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?od:uC(e.a,e.b,e.c,e.d,e.e,e.f)}function dO(t){return t==null||(Xa||(Xa=document.createElementNS("http://www.w3.org/2000/svg","g")),Xa.setAttribute("transform",t),!(t=Xa.transform.baseVal.consolidate()))?od:(t=t.matrix,uC(t.a,t.b,t.c,t.d,t.e,t.f))}function dC(t,e,r,n){function i(c){return c.length?c.pop()+" ":""}function s(c,u,d,p,f,m){if(c!==d||u!==p){var x=f.push("translate(",null,e,null,r);m.push({i:x-4,x:zn(c,d)},{i:x-2,x:zn(u,p)})}else(d||p)&&f.push("translate("+d+e+p+r)}function o(c,u,d,p){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),p.push({i:d.push(i(d)+"rotate(",null,n)-2,x:zn(c,u)})):u&&d.push(i(d)+"rotate("+u+n)}function a(c,u,d,p){c!==u?p.push({i:d.push(i(d)+"skewX(",null,n)-2,x:zn(c,u)}):u&&d.push(i(d)+"skewX("+u+n)}function l(c,u,d,p,f,m){if(c!==d||u!==p){var x=f.push(i(f)+"scale(",null,",",null,")");m.push({i:x-4,x:zn(c,d)},{i:x-2,x:zn(u,p)})}else(d!==1||p!==1)&&f.push(i(f)+"scale("+d+","+p+")")}return function(c,u){var d=[],p=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,p),o(c.rotate,u.rotate,d,p),a(c.skewX,u.skewX,d,p),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,p),c=u=null,function(f){for(var m=-1,x=p.length,g;++m<x;)d[(g=p[m]).i]=g.x(f);return d.join("")}}}var fO=dC(uO,"px, ","px)","deg)"),pO=dC(dO,", ",")",")"),zs=0,Io=0,bo=0,fC=1e3,nc,Fo,ic=0,_i=0,Yc=0,oa=typeof performance=="object"&&performance.now?performance:Date,pC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function tp(){return _i||(pC(mO),_i=oa.now()+Yc)}function mO(){_i=0}function sc(){this._call=this._time=this._next=null}sc.prototype=mC.prototype={constructor:sc,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?tp():+r)+(e==null?0:+e),!this._next&&Fo!==this&&(Fo?Fo._next=this:nc=this,Fo=this),this._call=t,this._time=r,ad()},stop:function(){this._call&&(this._call=null,this._time=1/0,ad())}};function mC(t,e,r){var n=new sc;return n.restart(t,e,r),n}function gO(){tp(),++zs;for(var t=nc,e;t;)(e=_i-t._time)>=0&&t._call.call(void 0,e),t=t._next;--zs}function Qg(){_i=(ic=oa.now())+Yc,zs=Io=0;try{gO()}finally{zs=0,yO(),_i=0}}function xO(){var t=oa.now(),e=t-ic;e>fC&&(Yc-=e,ic=t)}function yO(){for(var t,e=nc,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:nc=r);Fo=t,ad(n)}function ad(t){if(!zs){Io&&(Io=clearTimeout(Io));var e=t-_i;e>24?(t<1/0&&(Io=setTimeout(Qg,t-oa.now()-Yc)),bo&&(bo=clearInterval(bo))):(bo||(ic=oa.now(),bo=setInterval(xO,fC)),zs=1,pC(Qg))}}function Jg(t,e,r){var n=new sc;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var bO=Y1("start","end","cancel","interrupt"),CO=[],gC=0,tx=1,ld=2,vl=3,ex=4,cd=5,wl=6;function Xc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;kO(t,r,{name:e,index:n,group:i,on:bO,tween:CO,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:gC})}function ep(t,e){var r=Yr(t,e);if(r.state>gC)throw new Error("too late; already scheduled");return r}function pn(t,e){var r=Yr(t,e);if(r.state>vl)throw new Error("too late; already running");return r}function Yr(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function kO(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=mC(s,0,r.time);function s(c){r.state=tx,r.timer.restart(o,r.delay,r.time),r.delay<=c&&o(c-r.delay)}function o(c){var u,d,p,f;if(r.state!==tx)return l();for(u in n)if(f=n[u],f.name===r.name){if(f.state===vl)return Jg(o);f.state===ex?(f.state=wl,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete n[u]):+u<e&&(f.state=wl,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete n[u])}if(Jg(function(){r.state===vl&&(r.state=ex,r.timer.restart(a,r.delay,r.time),a(c))}),r.state=ld,r.on.call("start",t,t.__data__,r.index,r.group),r.state===ld){for(r.state=vl,i=new Array(p=r.tween.length),u=0,d=-1;u<p;++u)(f=r.tween[u].value.call(t,t.__data__,r.index,r.group))&&(i[++d]=f);i.length=d+1}}function a(c){for(var u=c<r.duration?r.ease.call(null,c/r.duration):(r.timer.restart(l),r.state=cd,1),d=-1,p=i.length;++d<p;)i[d].call(t,u);r.state===cd&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=wl,r.timer.stop(),delete n[e];for(var c in n)return;delete t.__transition}}function vO(t,e){var r=t.__transition,n,i,s=!0,o;if(r){e=e==null?null:e+"";for(o in r){if((n=r[o]).name!==e){s=!1;continue}i=n.state>ld&&n.state<cd,n.state=wl,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function wO(t){return this.each(function(){vO(this,t)})}function SO(t,e){var r,n;return function(){var i=pn(this,t),s=i.tween;if(s!==r){n=r=s;for(var o=0,a=n.length;o<a;++o)if(n[o].name===e){n=n.slice(),n.splice(o,1);break}}i.tween=n}}function TO(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var s=pn(this,t),o=s.tween;if(o!==n){i=(n=o).slice();for(var a={name:e,value:r},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function _O(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=Yr(this.node(),r).tween,i=0,s=n.length,o;i<s;++i)if((o=n[i]).name===t)return o.value;return null}return this.each((e==null?SO:TO)(r,t,e))}function rp(t,e,r){var n=t._id;return t.each(function(){var i=pn(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return Yr(i,n).value[e]}}function xC(t,e){var r;return(typeof e=="number"?zn:e instanceof sa?Kg:(r=sa(e))?(e=r,Kg):hO)(t,e)}function EO(t){return function(){this.removeAttribute(t)}}function NO(t){return function(){this.removeAttributeNS(t.space,t.local)}}function jO(t,e,r){var n,i=r+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===n?s:s=e(n=o,r)}}function LO(t,e,r){var n,i=r+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===n?s:s=e(n=o,r)}}function BO(t,e,r){var n,i,s;return function(){var o,a=r(this),l;return a==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=a+"",o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a)))}}function AO(t,e,r){var n,i,s;return function(){var o,a=r(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=a+"",o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a)))}}function MO(t,e){var r=Vc(t),n=r==="transform"?pO:xC;return this.attrTween(t,typeof e=="function"?(r.local?AO:BO)(r,n,rp(this,"attr."+t,e)):e==null?(r.local?NO:EO)(r):(r.local?LO:jO)(r,n,e))}function IO(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function FO(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function PO(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&FO(t,s)),r}return i._value=e,i}function DO(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&IO(t,s)),r}return i._value=e,i}function OO(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;var n=Vc(t);return this.tween(r,(n.local?PO:DO)(n,e))}function RO(t,e){return function(){ep(this,t).delay=+e.apply(this,arguments)}}function $O(t,e){return e=+e,function(){ep(this,t).delay=e}}function zO(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?RO:$O)(e,t)):Yr(this.node(),e).delay}function WO(t,e){return function(){pn(this,t).duration=+e.apply(this,arguments)}}function qO(t,e){return e=+e,function(){pn(this,t).duration=e}}function HO(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?WO:qO)(e,t)):Yr(this.node(),e).duration}function UO(t,e){if(typeof e!="function")throw new Error;return function(){pn(this,t).ease=e}}function GO(t){var e=this._id;return arguments.length?this.each(UO(e,t)):Yr(this.node(),e).ease}function VO(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;pn(this,t).ease=r}}function YO(t){if(typeof t!="function")throw new Error;return this.each(VO(this._id,t))}function XO(t){typeof t!="function"&&(t=Z1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=[],l,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new Sn(n,this._parents,this._name,this._id)}function KO(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),o=new Array(n),a=0;a<s;++a)for(var l=e[a],c=r[a],u=l.length,d=o[a]=new Array(u),p,f=0;f<u;++f)(p=l[f]||c[f])&&(d[f]=p);for(;a<n;++a)o[a]=e[a];return new Sn(o,this._parents,this._name,this._id)}function ZO(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function QO(t,e,r){var n,i,s=ZO(e)?ep:pn;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function JO(t,e){var r=this._id;return arguments.length<2?Yr(this.node(),r).on.on(t):this.each(QO(r,t,e))}function tR(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function eR(){return this.on("end.remove",tR(this._id))}function rR(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Kf(t));for(var n=this._groups,i=n.length,s=new Array(i),o=0;o<i;++o)for(var a=n[o],l=a.length,c=s[o]=new Array(l),u,d,p=0;p<l;++p)(u=a[p])&&(d=t.call(u,u.__data__,p,a))&&("__data__"in u&&(d.__data__=u.__data__),c[p]=d,Xc(c[p],e,r,p,c,Yr(u,r)));return new Sn(s,this._parents,e,r)}function nR(t){var e=this._name,r=this._id;typeof t!="function"&&(t=K1(t));for(var n=this._groups,i=n.length,s=[],o=[],a=0;a<i;++a)for(var l=n[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var p=t.call(u,u.__data__,d,l),f,m=Yr(u,r),x=0,g=p.length;x<g;++x)(f=p[x])&&Xc(f,e,r,x,p,m);s.push(p),o.push(u)}return new Sn(s,o,e,r)}var iR=Sa.prototype.constructor;function sR(){return new iR(this._groups,this._parents)}function oR(t,e){var r,n,i;return function(){var s=$s(this,t),o=(this.style.removeProperty(t),$s(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function yC(t){return function(){this.style.removeProperty(t)}}function aR(t,e,r){var n,i=r+"",s;return function(){var o=$s(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function lR(t,e,r){var n,i,s;return function(){var o=$s(this,t),a=r(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),$s(this,t))),o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a))}}function cR(t,e){var r,n,i,s="style."+e,o="end."+s,a;return function(){var l=pn(this,t),c=l.on,u=l.value[s]==null?a||(a=yC(e)):void 0;(c!==r||i!==u)&&(n=(r=c).copy()).on(o,i=u),l.on=n}}function hR(t,e,r){var n=(t+="")=="transform"?fO:xC;return e==null?this.styleTween(t,oR(t,n)).on("end.style."+t,yC(t)):typeof e=="function"?this.styleTween(t,lR(t,n,rp(this,"style."+t,e))).each(cR(this._id,t)):this.styleTween(t,aR(t,n,e),r).on("end.style."+t,null)}function uR(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function dR(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&uR(t,o,r)),n}return s._value=e,s}function fR(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,dR(t,e,r??""))}function pR(t){return function(){this.textContent=t}}function mR(t){return function(){var e=t(this);this.textContent=e??""}}function gR(t){return this.tween("text",typeof t=="function"?mR(rp(this,"text",t)):pR(t==null?"":t+""))}function xR(t){return function(e){this.textContent=t.call(this,e)}}function yR(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&xR(i)),e}return n._value=t,n}function bR(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,yR(t))}function CR(){for(var t=this._name,e=this._id,r=bC(),n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,l,c=0;c<a;++c)if(l=o[c]){var u=Yr(l,e);Xc(l,t,r,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Sn(n,this._parents,t,r)}function kR(){var t,e,r=this,n=r._id,i=r.size();return new Promise(function(s,o){var a={value:o},l={value:function(){--i===0&&s()}};r.each(function(){var c=pn(this,n),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),i===0&&s()})}var vR=0;function Sn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function bC(){return++vR}var yn=Sa.prototype;Sn.prototype={constructor:Sn,select:rR,selectAll:nR,selectChild:yn.selectChild,selectChildren:yn.selectChildren,filter:XO,merge:KO,selection:sR,transition:CR,call:yn.call,nodes:yn.nodes,node:yn.node,size:yn.size,empty:yn.empty,each:yn.each,on:JO,attr:MO,attrTween:OO,style:hR,styleTween:fR,text:gR,textTween:bR,remove:eR,tween:_O,delay:zO,duration:HO,ease:GO,easeVarying:YO,end:kR,[Symbol.iterator]:yn[Symbol.iterator]};function wR(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var SR={time:null,delay:0,duration:250,ease:wR};function TR(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}function _R(t){var e,r;t instanceof Sn?(e=t._id,t=t._name):(e=bC(),(r=SR).time=tp(),t=t==null?null:t+"");for(var n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&Xc(l,t,e,c,o,r||TR(l,e));return new Sn(n,this._parents,t,e)}Sa.prototype.interrupt=wO;Sa.prototype.transition=_R;const hd=Math.PI,ud=2*hd,fi=1e-6,ER=ud-fi;function CC(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function NR(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return CC;const r=10**e;return function(n){this._+=n[0];for(let i=1,s=n.length;i<s;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class jR{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?CC:NR(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,s,o){this._append`C${+e},${+r},${+n},${+i},${this._x1=+s},${this._y1=+o}`}arcTo(e,r,n,i,s){if(e=+e,r=+r,n=+n,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,l=n-e,c=i-r,u=o-e,d=a-r,p=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(p>fi)if(!(Math.abs(d*l-c*u)>fi)||!s)this._append`L${this._x1=e},${this._y1=r}`;else{let f=n-o,m=i-a,x=l*l+c*c,g=f*f+m*m,y=Math.sqrt(x),b=Math.sqrt(p),k=s*Math.tan((hd-Math.acos((x+p-g)/(2*y*b)))/2),T=k/b,_=k/y;Math.abs(T-1)>fi&&this._append`L${e+T*u},${r+T*d}`,this._append`A${s},${s},0,0,${+(d*f>u*m)},${this._x1=e+_*l},${this._y1=r+_*c}`}}arc(e,r,n,i,s,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),l=n*Math.sin(i),c=e+a,u=r+l,d=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>fi||Math.abs(this._y1-u)>fi)&&this._append`L${c},${u}`,n&&(p<0&&(p=p%ud+ud),p>ER?this._append`A${n},${n},0,1,${d},${e-a},${r-l}A${n},${n},0,1,${d},${this._x1=c},${this._y1=u}`:p>fi&&this._append`A${n},${n},0,${+(p>=hd)},${d},${this._x1=e+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Vi(t){return function(){return t}}const vZ=Math.abs,wZ=Math.atan2,SZ=Math.cos,TZ=Math.max,_Z=Math.min,EZ=Math.sin,NZ=Math.sqrt,rx=1e-12,np=Math.PI,nx=np/2,jZ=2*np;function LZ(t){return t>1?0:t<-1?np:Math.acos(t)}function BZ(t){return t>=1?nx:t<=-1?-nx:Math.asin(t)}function LR(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new jR(e)}function BR(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function kC(t){this._context=t}kC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Yo(t){return new kC(t)}function AR(t){return t[0]}function MR(t){return t[1]}function IR(t,e){var r=Vi(!0),n=null,i=Yo,s=null,o=LR(a);t=typeof t=="function"?t:t===void 0?AR:Vi(t),e=typeof e=="function"?e:e===void 0?MR:Vi(e);function a(l){var c,u=(l=BR(l)).length,d,p=!1,f;for(n==null&&(s=i(f=o())),c=0;c<=u;++c)!(c<u&&r(d=l[c],c,l))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+t(d,c,l),+e(d,c,l));if(f)return s=null,f+""||null}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:Vi(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Vi(+l),a):e},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Vi(!!l),a):r},a.curve=function(l){return arguments.length?(i=l,n!=null&&(s=i(n)),a):i},a.context=function(l){return arguments.length?(l==null?n=s=null:s=i(n=l),a):n},a}class vC{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function wC(t){return new vC(t,!0)}function SC(t){return new vC(t,!1)}function Xn(){}function oc(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function Kc(t){this._context=t}Kc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:oc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:oc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function dd(t){return new Kc(t)}function TC(t){this._context=t}TC.prototype={areaStart:Xn,areaEnd:Xn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:oc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function FR(t){return new TC(t)}function _C(t){this._context=t}_C.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:oc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function PR(t){return new _C(t)}function EC(t,e){this._basis=new Kc(t),this._beta=e}EC.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n=t[0],i=e[0],s=t[r]-n,o=e[r]-i,a=-1,l;++a<=r;)l=a/r,this._basis.point(this._beta*t[a]+(1-this._beta)*(n+l*s),this._beta*e[a]+(1-this._beta)*(i+l*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const DR=(function t(e){function r(n){return e===1?new Kc(n):new EC(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function ac(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function ip(t,e){this._context=t,this._k=(1-e)/6}ip.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ac(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:ac(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const NC=(function t(e){function r(n){return new ip(n,e)}return r.tension=function(n){return t(+n)},r})(0);function sp(t,e){this._context=t,this._k=(1-e)/6}sp.prototype={areaStart:Xn,areaEnd:Xn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:ac(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const OR=(function t(e){function r(n){return new sp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function op(t,e){this._context=t,this._k=(1-e)/6}op.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ac(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const RR=(function t(e){function r(n){return new op(n,e)}return r.tension=function(n){return t(+n)},r})(0);function ap(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>rx){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>rx){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,s,o,t._x2,t._y2)}function jC(t,e){this._context=t,this._alpha=e}jC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:ap(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const LC=(function t(e){function r(n){return e?new jC(n,e):new ip(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function BC(t,e){this._context=t,this._alpha=e}BC.prototype={areaStart:Xn,areaEnd:Xn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:ap(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const $R=(function t(e){function r(n){return e?new BC(n,e):new sp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function AC(t,e){this._context=t,this._alpha=e}AC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ap(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const zR=(function t(e){function r(n){return e?new AC(n,e):new op(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function MC(t){this._context=t}MC.prototype={areaStart:Xn,areaEnd:Xn,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function WR(t){return new MC(t)}function ix(t){return t<0?-1:1}function sx(t,e,r){var n=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),a=(s*i+o*n)/(n+i);return(ix(s)+ix(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function ox(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function nu(t,e,r){var n=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-n)/3;t._context.bezierCurveTo(n+a,i+a*e,s-a,o-a*r,s,o)}function lc(t){this._context=t}lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:nu(this,this._t0,ox(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,nu(this,ox(this,r=sx(this,t,e)),r);break;default:nu(this,this._t0,r=sx(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function IC(t){this._context=new FC(t)}(IC.prototype=Object.create(lc.prototype)).point=function(t,e){lc.prototype.point.call(this,e,t)};function FC(t){this._context=t}FC.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,s){this._context.bezierCurveTo(e,t,n,r,s,i)}};function PC(t){return new lc(t)}function DC(t){return new IC(t)}function OC(t){this._context=t}OC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=ax(t),i=ax(e),s=0,o=1;o<r;++s,++o)this._context.bezierCurveTo(n[0][s],i[0][s],n[1][s],i[1][s],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function ax(t){var e,r=t.length-1,n,i=new Array(r),s=new Array(r),o=new Array(r);for(i[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,s[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/s[e-1],s[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/s[r-1],e=r-2;e>=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function RC(t){return new OC(t)}function Zc(t,e){this._context=t,this._t=e}Zc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function $C(t){return new Zc(t,.5)}function zC(t){return new Zc(t,0)}function WC(t){return new Zc(t,1)}function Po(t,e,r){this.k=t,this.x=e,this.y=r}Po.prototype={constructor:Po,scale:function(t){return t===1?this:new Po(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Po(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Po.prototype;var qR=v(t=>{var i;const{securityLevel:e}=re();let r=Gt("body");if(e==="sandbox"){const o=((i=Gt(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=Gt(o.body)}return r.select(`#${t}`)},"selectSvgElement");function lp(t){return typeof t>"u"||t===null}v(lp,"isNothing");function qC(t){return typeof t=="object"&&t!==null}v(qC,"isObject");function HC(t){return Array.isArray(t)?t:lp(t)?[]:[t]}v(HC,"toArray");function UC(t,e){var r,n,i,s;if(e)for(s=Object.keys(e),r=0,n=s.length;r<n;r+=1)i=s[r],t[i]=e[i];return t}v(UC,"extend");function GC(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(GC,"repeat");function VC(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(VC,"isNegativeZero");var HR=lp,UR=qC,GR=HC,VR=GC,YR=VC,XR=UC,Fe={isNothing:HR,isObject:UR,toArray:GR,repeat:VR,isNegativeZero:YR,extend:XR};function cp(t,e){var r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
470
+
471
+ `+t.mark.snippet),n+" "+r):n}v(cp,"formatError");function Ws(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=cp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}v(Ws,"YAMLException$1");Ws.prototype=Object.create(Error.prototype);Ws.prototype.constructor=Ws;Ws.prototype.toString=v(function(e){return this.name+": "+cp(this,e)},"toString");var fr=Ws;function Sl(t,e,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-e>a&&(s=" ... ",e=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+t.slice(e,r).replace(/\t/g,"→")+o,pos:n-e+s.length}}v(Sl,"getLine");function Tl(t,e){return Fe.repeat(" ",e-t.length)+t}v(Tl,"padStart");function YC(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=r.exec(t.buffer);)i.push(s.index),n.push(s.index+s[0].length),t.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",l,c,u=Math.min(t.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+u+3);for(l=1;l<=e.linesBefore&&!(o-l<0);l++)c=Sl(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Fe.repeat(" ",e.indent)+Tl((t.line-l+1).toString(),u)+" | "+c.str+`
472
+ `+a;for(c=Sl(t.buffer,n[o],i[o],t.position,d),a+=Fe.repeat(" ",e.indent)+Tl((t.line+1).toString(),u)+" | "+c.str+`
473
+ `,a+=Fe.repeat("-",e.indent+u+3+c.pos)+`^
474
+ `,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=Sl(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Fe.repeat(" ",e.indent)+Tl((t.line+l+1).toString(),u)+" | "+c.str+`
475
+ `;return a.replace(/\n$/,"")}v(YC,"makeSnippet");var KR=YC,ZR=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],QR=["scalar","sequence","mapping"];function XC(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v(XC,"compileStyleAliases");function KC(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(ZR.indexOf(r)===-1)throw new fr('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=XC(e.styleAliases||null),QR.indexOf(this.kind)===-1)throw new fr('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(KC,"Type$1");var Ye=KC;function fd(t,e){var r=[];return t[e].forEach(function(n){var i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}v(fd,"compileList");function ZC(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,r;function n(i){i.multi?(t.multi[i.kind].push(i),t.multi.fallback.push(i)):t[i.kind][i.tag]=t.fallback[i.tag]=i}for(v(n,"collectType"),e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(n);return t}v(ZC,"compileMap");function cc(t){return this.extend(t)}v(cc,"Schema$1");cc.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Ye)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new fr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ye))throw new fr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new fr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new fr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof Ye))throw new fr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(cc.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=fd(i,"implicit"),i.compiledExplicit=fd(i,"explicit"),i.compiledTypeMap=ZC(i.compiledImplicit,i.compiledExplicit),i},"extend");var JR=cc,t$=new Ye("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),e$=new Ye("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),r$=new Ye("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),n$=new JR({explicit:[t$,e$,r$]});function QC(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(QC,"resolveYamlNull");function JC(){return null}v(JC,"constructYamlNull");function tk(t){return t===null}v(tk,"isNull");var i$=new Ye("tag:yaml.org,2002:null",{kind:"scalar",resolve:QC,construct:JC,predicate:tk,represent:{canonical:v(function(){return"~"},"canonical"),lowercase:v(function(){return"null"},"lowercase"),uppercase:v(function(){return"NULL"},"uppercase"),camelcase:v(function(){return"Null"},"camelcase"),empty:v(function(){return""},"empty")},defaultStyle:"lowercase"});function ek(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}v(ek,"resolveYamlBoolean");function rk(t){return t==="true"||t==="True"||t==="TRUE"}v(rk,"constructYamlBoolean");function nk(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(nk,"isBoolean");var s$=new Ye("tag:yaml.org,2002:bool",{kind:"scalar",resolve:ek,construct:rk,predicate:nk,represent:{lowercase:v(function(t){return t?"true":"false"},"lowercase"),uppercase:v(function(t){return t?"TRUE":"FALSE"},"uppercase"),camelcase:v(function(t){return t?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function ik(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(ik,"isHexCode");function sk(t){return 48<=t&&t<=55}v(sk,"isOctCode");function ok(t){return 48<=t&&t<=57}v(ok,"isDecCode");function ak(t){if(t===null)return!1;var e=t.length,r=0,n=!1,i;if(!e)return!1;if(i=t[r],(i==="-"||i==="+")&&(i=t[++r]),i==="0"){if(r+1===e)return!0;if(i=t[++r],i==="b"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!ik(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!sk(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!ok(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(ak,"resolveYamlInteger");function lk(t){var e=t,r=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}v(lk,"constructYamlInteger");function ck(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Fe.isNegativeZero(t)}v(ck,"isInteger");var o$=new Ye("tag:yaml.org,2002:int",{kind:"scalar",resolve:ak,construct:lk,predicate:ck,represent:{binary:v(function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},"binary"),octal:v(function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},"octal"),decimal:v(function(t){return t.toString(10)},"decimal"),hexadecimal:v(function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),a$=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function hk(t){return!(t===null||!a$.test(t)||t[t.length-1]==="_")}v(hk,"resolveYamlFloat");function uk(t){var e,r;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}v(uk,"constructYamlFloat");var l$=/^[-+]?[0-9]+e/;function dk(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Fe.isNegativeZero(t))return"-0.0";return r=t.toString(10),l$.test(r)?r.replace("e",".e"):r}v(dk,"representYamlFloat");function fk(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Fe.isNegativeZero(t))}v(fk,"isFloat");var c$=new Ye("tag:yaml.org,2002:float",{kind:"scalar",resolve:hk,construct:uk,predicate:fk,represent:dk,defaultStyle:"lowercase"}),pk=n$.extend({implicit:[i$,s$,o$,c$]}),h$=pk,mk=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),gk=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function xk(t){return t===null?!1:mk.exec(t)!==null||gk.exec(t)!==null}v(xk,"resolveYamlTimestamp");function yk(t){var e,r,n,i,s,o,a,l=0,c=null,u,d,p;if(e=mk.exec(t),e===null&&(e=gk.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(r,n,i));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],d=+(e[11]||0),c=(u*60+d)*6e4,e[9]==="-"&&(c=-c)),p=new Date(Date.UTC(r,n,i,s,o,a,l)),c&&p.setTime(p.getTime()-c),p}v(yk,"constructYamlTimestamp");function bk(t){return t.toISOString()}v(bk,"representYamlTimestamp");var u$=new Ye("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:xk,construct:yk,instanceOf:Date,represent:bk});function Ck(t){return t==="<<"||t===null}v(Ck,"resolveYamlMerge");var d$=new Ye("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Ck}),hp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
476
+ \r`;function kk(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=hp;for(r=0;r<i;r++)if(e=s.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}v(kk,"resolveYamlBinary");function vk(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=hp,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return r=i%4*6,r===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):r===18?(a.push(o>>10&255),a.push(o>>2&255)):r===12&&a.push(o>>4&255),new Uint8Array(a)}v(vk,"constructYamlBinary");function wk(t){var e="",r=0,n,i,s=t.length,o=hp;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]),r=(r<<8)+t[n];return i=s%3,i===0?(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]):i===2?(e+=o[r>>10&63],e+=o[r>>4&63],e+=o[r<<2&63],e+=o[64]):i===1&&(e+=o[r>>2&63],e+=o[r<<4&63],e+=o[64],e+=o[64]),e}v(wk,"representYamlBinary");function Sk(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(Sk,"isBinary");var f$=new Ye("tag:yaml.org,2002:binary",{kind:"scalar",resolve:kk,construct:vk,predicate:Sk,represent:wk}),p$=Object.prototype.hasOwnProperty,m$=Object.prototype.toString;function Tk(t){if(t===null)return!0;var e=[],r,n,i,s,o,a=t;for(r=0,n=a.length;r<n;r+=1){if(i=a[r],o=!1,m$.call(i)!=="[object Object]")return!1;for(s in i)if(p$.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}v(Tk,"resolveYamlOmap");function _k(t){return t!==null?t:[]}v(_k,"constructYamlOmap");var g$=new Ye("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Tk,construct:_k}),x$=Object.prototype.toString;function Ek(t){if(t===null)return!0;var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1){if(n=o[e],x$.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}v(Ek,"resolveYamlPairs");function Nk(t){if(t===null)return[];var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1)n=o[e],i=Object.keys(n),s[e]=[i[0],n[i[0]]];return s}v(Nk,"constructYamlPairs");var y$=new Ye("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Ek,construct:Nk}),b$=Object.prototype.hasOwnProperty;function jk(t){if(t===null)return!0;var e,r=t;for(e in r)if(b$.call(r,e)&&r[e]!==null)return!1;return!0}v(jk,"resolveYamlSet");function Lk(t){return t!==null?t:{}}v(Lk,"constructYamlSet");var C$=new Ye("tag:yaml.org,2002:set",{kind:"mapping",resolve:jk,construct:Lk}),Bk=h$.extend({implicit:[u$,d$],explicit:[f$,g$,y$,C$]}),Kn=Object.prototype.hasOwnProperty,hc=1,Ak=2,Mk=3,uc=4,iu=1,k$=2,lx=3,v$=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,w$=/[\x85\u2028\u2029]/,S$=/[,\[\]\{\}]/,Ik=/^(?:!|!!|![a-z\-]+!)$/i,Fk=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function pd(t){return Object.prototype.toString.call(t)}v(pd,"_class");function Hr(t){return t===10||t===13}v(Hr,"is_EOL");function Un(t){return t===9||t===32}v(Un,"is_WHITE_SPACE");function er(t){return t===9||t===32||t===10||t===13}v(er,"is_WS_OR_EOL");function yi(t){return t===44||t===91||t===93||t===123||t===125}v(yi,"is_FLOW_INDICATOR");function Pk(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(Pk,"fromHexCode");function Dk(t){return t===120?2:t===117?4:t===85?8:0}v(Dk,"escapedHexLen");function Ok(t){return 48<=t&&t<=57?t-48:-1}v(Ok,"fromDecimalCode");function md(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
477
+ `:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"…":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}v(md,"simpleEscapeSequence");function Rk(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v(Rk,"charFromCodepoint");function up(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(up,"setProperty");var $k=new Array(256),zk=new Array(256);for(ui=0;ui<256;ui++)$k[ui]=md(ui)?1:0,zk[ui]=md(ui);var ui;function Wk(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Bk,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}v(Wk,"State$1");function dp(t,e){var r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=KR(r),new fr(e,r)}v(dp,"generateError");function Et(t,e){throw dp(t,e)}v(Et,"throwError");function aa(t,e){t.onWarning&&t.onWarning.call(null,dp(t,e))}v(aa,"throwWarning");var cx={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&Et(e,"duplication of %YAML directive"),n.length!==1&&Et(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Et(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Et(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&aa(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&Et(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],Ik.test(i)||Et(e,"ill-formed tag handle (first argument) of the TAG directive"),Kn.call(e.tagMap,i)&&Et(e,'there is a previously declared suffix for "'+i+'" tag handle'),Fk.test(s)||Et(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Et(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function vn(t,e,r,n){var i,s,o,a;if(e<r){if(a=t.input.slice(e,r),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||Et(t,"expected valid JSON character");else v$.test(a)&&Et(t,"the stream contains non-printable characters");t.result+=a}}v(vn,"captureSegment");function gd(t,e,r,n){var i,s,o,a;for(Fe.isObject(r)||Et(t,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),o=0,a=i.length;o<a;o+=1)s=i[o],Kn.call(e,s)||(up(e,s,r[s]),n[s]=!0)}v(gd,"mergeMappings");function bi(t,e,r,n,i,s,o,a,l){var c,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,u=i.length;c<u;c+=1)Array.isArray(i[c])&&Et(t,"nested arrays are not supported inside keys"),typeof i=="object"&&pd(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&pd(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,u=s.length;c<u;c+=1)gd(t,e,s[c],r);else gd(t,e,s,r);else!t.json&&!Kn.call(r,i)&&Kn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,Et(t,"duplicated mapping key")),up(e,i,s),delete r[i];return e}v(bi,"storeMappingPair");function Qc(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):Et(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v(Qc,"readLineBreak");function _e(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;Un(i);)i===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&i===35)do i=t.input.charCodeAt(++t.position);while(i!==10&&i!==13&&i!==0);if(Hr(i))for(Qc(t),i=t.input.charCodeAt(t.position),n++,t.lineIndent=0;i===32;)t.lineIndent++,i=t.input.charCodeAt(++t.position);else break}return r!==-1&&n!==0&&t.lineIndent<r&&aa(t,"deficient indentation"),n}v(_e,"skipSeparationSpace");function _a(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||er(r)))}v(_a,"testDocumentSeparator");function Jc(t,e){e===1?t.result+=" ":e>1&&(t.result+=Fe.repeat(`
478
+ `,e-1))}v(Jc,"writeFoldedLines");function qk(t,e,r){var n,i,s,o,a,l,c,u,d=t.kind,p=t.result,f;if(f=t.input.charCodeAt(t.position),er(f)||yi(f)||f===35||f===38||f===42||f===33||f===124||f===62||f===39||f===34||f===37||f===64||f===96||(f===63||f===45)&&(i=t.input.charCodeAt(t.position+1),er(i)||r&&yi(i)))return!1;for(t.kind="scalar",t.result="",s=o=t.position,a=!1;f!==0;){if(f===58){if(i=t.input.charCodeAt(t.position+1),er(i)||r&&yi(i))break}else if(f===35){if(n=t.input.charCodeAt(t.position-1),er(n))break}else{if(t.position===t.lineStart&&_a(t)||r&&yi(f))break;if(Hr(f))if(l=t.line,c=t.lineStart,u=t.lineIndent,_e(t,!1,-1),t.lineIndent>=e){a=!0,f=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=l,t.lineStart=c,t.lineIndent=u;break}}a&&(vn(t,s,o,!1),Jc(t,t.line-l),s=o=t.position,a=!1),Un(f)||(o=t.position+1),f=t.input.charCodeAt(++t.position)}return vn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=p,!1)}v(qk,"readPlainScalar");function Hk(t,e){var r,n,i;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=i=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(vn(t,n,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)n=t.position,t.position++,i=t.position;else return!0;else Hr(r)?(vn(t,n,i,!0),Jc(t,_e(t,!1,e)),n=i=t.position):t.position===t.lineStart&&_a(t)?Et(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);Et(t,"unexpected end of the stream within a single quoted scalar")}v(Hk,"readSingleQuotedScalar");function Uk(t,e){var r,n,i,s,o,a;if(a=t.input.charCodeAt(t.position),a!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(a=t.input.charCodeAt(t.position))!==0;){if(a===34)return vn(t,r,t.position,!0),t.position++,!0;if(a===92){if(vn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),Hr(a))_e(t,!1,e);else if(a<256&&$k[a])t.result+=zk[a],t.position++;else if((o=Dk(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=Pk(a))>=0?s=(s<<4)+o:Et(t,"expected hexadecimal character");t.result+=Rk(s),t.position++}else Et(t,"unknown escape sequence");r=n=t.position}else Hr(a)?(vn(t,r,n,!0),Jc(t,_e(t,!1,e)),r=n=t.position):t.position===t.lineStart&&_a(t)?Et(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}Et(t,"unexpected end of the stream within a double quoted scalar")}v(Uk,"readDoubleQuotedScalar");function Gk(t,e){var r=!0,n,i,s,o=t.tag,a,l=t.anchor,c,u,d,p,f,m=Object.create(null),x,g,y,b;if(b=t.input.charCodeAt(t.position),b===91)u=93,f=!1,a=[];else if(b===123)u=125,f=!0,a={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),b=t.input.charCodeAt(++t.position);b!==0;){if(_e(t,!0,e),b=t.input.charCodeAt(t.position),b===u)return t.position++,t.tag=o,t.anchor=l,t.kind=f?"mapping":"sequence",t.result=a,!0;r?b===44&&Et(t,"expected the node content, but found ','"):Et(t,"missed comma between flow collection entries"),g=x=y=null,d=p=!1,b===63&&(c=t.input.charCodeAt(t.position+1),er(c)&&(d=p=!0,t.position++,_e(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,Ei(t,e,hc,!1,!0),g=t.tag,x=t.result,_e(t,!0,e),b=t.input.charCodeAt(t.position),(p||t.line===n)&&b===58&&(d=!0,b=t.input.charCodeAt(++t.position),_e(t,!0,e),Ei(t,e,hc,!1,!0),y=t.result),f?bi(t,a,m,g,x,y,n,i,s):d?a.push(bi(t,null,m,g,x,y,n,i,s)):a.push(x),_e(t,!0,e),b=t.input.charCodeAt(t.position),b===44?(r=!0,b=t.input.charCodeAt(++t.position)):r=!1}Et(t,"unexpected end of the stream within a flow collection")}v(Gk,"readFlowCollection");function Vk(t,e){var r,n,i=iu,s=!1,o=!1,a=e,l=0,c=!1,u,d;if(d=t.input.charCodeAt(t.position),d===124)n=!1;else if(d===62)n=!0;else return!1;for(t.kind="scalar",t.result="";d!==0;)if(d=t.input.charCodeAt(++t.position),d===43||d===45)iu===i?i=d===43?lx:k$:Et(t,"repeat of a chomping mode identifier");else if((u=Ok(d))>=0)u===0?Et(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Et(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(Un(d)){do d=t.input.charCodeAt(++t.position);while(Un(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!Hr(d)&&d!==0)}for(;d!==0;){for(Qc(t),t.lineIndent=0,d=t.input.charCodeAt(t.position);(!o||t.lineIndent<a)&&d===32;)t.lineIndent++,d=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>a&&(a=t.lineIndent),Hr(d)){l++;continue}if(t.lineIndent<a){i===lx?t.result+=Fe.repeat(`
479
+ `,s?1+l:l):i===iu&&s&&(t.result+=`
480
+ `);break}for(n?Un(d)?(c=!0,t.result+=Fe.repeat(`
481
+ `,s?1+l:l)):c?(c=!1,t.result+=Fe.repeat(`
482
+ `,l+1)):l===0?s&&(t.result+=" "):t.result+=Fe.repeat(`
483
+ `,l):t.result+=Fe.repeat(`
484
+ `,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!Hr(d)&&d!==0;)d=t.input.charCodeAt(++t.position);vn(t,r,t.position,!1)}return!0}v(Vk,"readBlockScalar");function xd(t,e){var r,n=t.tag,i=t.anchor,s=[],o,a=!1,l;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=s),l=t.input.charCodeAt(t.position);l!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Et(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!er(o))));){if(a=!0,t.position++,_e(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,Ei(t,e,Mk,!1,!0),s.push(t.result),_e(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)Et(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return a?(t.tag=n,t.anchor=i,t.kind="sequence",t.result=s,!0):!1}v(xd,"readBlockSequence");function Yk(t,e,r){var n,i,s,o,a,l,c=t.tag,u=t.anchor,d={},p=Object.create(null),f=null,m=null,x=null,g=!1,y=!1,b;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=d),b=t.input.charCodeAt(t.position);b!==0;){if(!g&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,Et(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(b===63||b===58)&&er(n))b===63?(g&&(bi(t,d,p,f,m,null,o,a,l),f=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):Et(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,b=n;else{if(o=t.line,a=t.lineStart,l=t.position,!Ei(t,r,Ak,!1,!0))break;if(t.line===s){for(b=t.input.charCodeAt(t.position);Un(b);)b=t.input.charCodeAt(++t.position);if(b===58)b=t.input.charCodeAt(++t.position),er(b)||Et(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(bi(t,d,p,f,m,null,o,a,l),f=m=x=null),y=!0,g=!1,i=!1,f=t.tag,m=t.result;else if(y)Et(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=c,t.anchor=u,!0}else if(y)Et(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=c,t.anchor=u,!0}if((t.line===s||t.lineIndent>e)&&(g&&(o=t.line,a=t.lineStart,l=t.position),Ei(t,e,uc,!0,i)&&(g?m=t.result:x=t.result),g||(bi(t,d,p,f,m,x,o,a,l),f=m=x=null),_e(t,!0,-1),b=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&b!==0)Et(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&bi(t,d,p,f,m,null,o,a,l),y&&(t.tag=c,t.anchor=u,t.kind="mapping",t.result=d),y}v(Yk,"readBlockMapping");function Xk(t){var e,r=!1,n=!1,i,s,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&Et(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(r=!0,o=t.input.charCodeAt(++t.position)):o===33?(n=!0,i="!!",o=t.input.charCodeAt(++t.position)):i="!",e=t.position,r){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(s=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):Et(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!er(o);)o===33&&(n?Et(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),Ik.test(i)||Et(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);s=t.input.slice(e,t.position),S$.test(s)&&Et(t,"tag suffix cannot contain flow indicator characters")}s&&!Fk.test(s)&&Et(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Et(t,"tag name is malformed: "+s)}return r?t.tag=s:Kn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:Et(t,'undeclared tag handle "'+i+'"'),!0}v(Xk,"readTagProperty");function Kk(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&Et(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!er(r)&&!yi(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&Et(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(Kk,"readAnchorProperty");function Zk(t){var e,r,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!er(n)&&!yi(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&Et(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Kn.call(t.anchorMap,r)||Et(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],_e(t,!0,-1),!0}v(Zk,"readAlias");function Ei(t,e,r,n,i){var s,o,a,l=1,c=!1,u=!1,d,p,f,m,x,g;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,s=o=a=uc===r||Mk===r,n&&_e(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;Xk(t)||Kk(t);)_e(t,!0,-1)?(c=!0,a=s,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||uc===r)&&(hc===r||Ak===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&(xd(t,g)||Yk(t,g,x))||Gk(t,x)?u=!0:(o&&Vk(t,x)||Hk(t,x)||Uk(t,x)?u=!0:Zk(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&Et(t,"alias node should not have any properties")):qk(t,x,hc===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&xd(t,g))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&Et(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,p=t.implicitTypes.length;d<p;d+=1)if(m=t.implicitTypes[d],m.resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(Kn.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,f=t.typeMap.multi[t.kind||"fallback"],d=0,p=f.length;d<p;d+=1)if(t.tag.slice(0,f[d].tag.length)===f[d].tag){m=f[d];break}m||Et(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&Et(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):Et(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||u}v(Ei,"composeNode");function Qk(t){var e=t.position,r,n,i,s=!1,o;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(o=t.input.charCodeAt(t.position))!==0&&(_e(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||o!==37));){for(s=!0,o=t.input.charCodeAt(++t.position),r=t.position;o!==0&&!er(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&Et(t,"directive name must not be less than one character in length");o!==0;){for(;Un(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!Hr(o));break}if(Hr(o))break;for(r=t.position;o!==0&&!er(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&Qc(t),Kn.call(cx,n)?cx[n](t,n,i):aa(t,'unknown document directive "'+n+'"')}if(_e(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,_e(t,!0,-1)):s&&Et(t,"directives end mark is expected"),Ei(t,t.lineIndent-1,uc,!1,!0),_e(t,!0,-1),t.checkLineBreaks&&w$.test(t.input.slice(e,t.position))&&aa(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&_a(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,_e(t,!0,-1));return}if(t.position<t.length-1)Et(t,"end of the stream or a document separator is expected");else return}v(Qk,"readDocument");function fp(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
485
+ `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new Wk(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,Et(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Qk(r);return r.documents}v(fp,"loadDocuments");function T$(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=fp(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(T$,"loadAll$1");function Jk(t,e){var r=fp(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new fr("expected a single document in the stream, but found more")}}v(Jk,"load$1");var _$=Jk,E$={load:_$},tv=Object.prototype.toString,ev=Object.prototype.hasOwnProperty,pp=65279,N$=9,la=10,j$=13,L$=32,B$=33,A$=34,yd=35,M$=37,I$=38,F$=39,P$=42,rv=44,D$=45,dc=58,O$=61,R$=62,$$=63,z$=64,nv=91,iv=93,W$=96,sv=123,q$=124,ov=125,Ke={};Ke[0]="\\0";Ke[7]="\\a";Ke[8]="\\b";Ke[9]="\\t";Ke[10]="\\n";Ke[11]="\\v";Ke[12]="\\f";Ke[13]="\\r";Ke[27]="\\e";Ke[34]='\\"';Ke[92]="\\\\";Ke[133]="\\N";Ke[160]="\\_";Ke[8232]="\\L";Ke[8233]="\\P";var H$=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],U$=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function av(t,e){var r,n,i,s,o,a,l;if(e===null)return{};for(r={},n=Object.keys(e),i=0,s=n.length;i<s;i+=1)o=n[i],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=t.compiledTypeMap.fallback[o],l&&ev.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}v(av,"compileStyleMap");function lv(t){var e,r,n;if(e=t.toString(16).toUpperCase(),t<=255)r="x",n=2;else if(t<=65535)r="u",n=4;else if(t<=4294967295)r="U",n=8;else throw new fr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Fe.repeat("0",n-e.length)+e}v(lv,"encodeHex");var G$=1,ca=2;function cv(t){this.schema=t.schema||Bk,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Fe.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=av(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?ca:G$,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}v(cv,"State");function bd(t,e){for(var r=Fe.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
486
+ `,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
487
+ `&&(s+=r),s+=o;return s}v(bd,"indentString");function fc(t,e){return`
488
+ `+Fe.repeat(" ",t.indent*e)}v(fc,"generateNextLine");function hv(t,e){var r,n,i;for(r=0,n=t.implicitTypes.length;r<n;r+=1)if(i=t.implicitTypes[r],i.resolve(e))return!0;return!1}v(hv,"testImplicitResolving");function ha(t){return t===L$||t===N$}v(ha,"isWhitespace");function qs(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==pp||65536<=t&&t<=1114111}v(qs,"isPrintable");function Cd(t){return qs(t)&&t!==pp&&t!==j$&&t!==la}v(Cd,"isNsCharOrWhitespace");function kd(t,e,r){var n=Cd(t),i=n&&!ha(t);return(r?n:n&&t!==rv&&t!==nv&&t!==iv&&t!==sv&&t!==ov)&&t!==yd&&!(e===dc&&!i)||Cd(e)&&!ha(e)&&t===yd||e===dc&&i}v(kd,"isPlainSafe");function uv(t){return qs(t)&&t!==pp&&!ha(t)&&t!==D$&&t!==$$&&t!==dc&&t!==rv&&t!==nv&&t!==iv&&t!==sv&&t!==ov&&t!==yd&&t!==I$&&t!==P$&&t!==B$&&t!==q$&&t!==O$&&t!==R$&&t!==F$&&t!==A$&&t!==M$&&t!==z$&&t!==W$}v(uv,"isPlainSafeFirst");function dv(t){return!ha(t)&&t!==dc}v(dv,"isPlainSafeLast");function ls(t,e){var r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}v(ls,"codePointAt");function mp(t){var e=/^\n* /;return e.test(t)}v(mp,"needIndentIndicator");var fv=1,vd=2,pv=3,mv=4,ss=5;function gv(t,e,r,n,i,s,o,a){var l,c=0,u=null,d=!1,p=!1,f=n!==-1,m=-1,x=uv(ls(t,0))&&dv(ls(t,t.length-1));if(e||o)for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=ls(t,l),!qs(c))return ss;x=x&&kd(c,u,a),u=c}else{for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=ls(t,l),c===la)d=!0,f&&(p=p||l-m-1>n&&t[m+1]!==" ",m=l);else if(!qs(c))return ss;x=x&&kd(c,u,a),u=c}p=p||f&&l-m-1>n&&t[m+1]!==" "}return!d&&!p?x&&!o&&!i(t)?fv:s===ca?ss:vd:r>9&&mp(t)?ss:o?s===ca?ss:vd:p?mv:pv}v(gv,"chooseScalarStyle");function xv(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===ca?'""':"''";if(!t.noCompatMode&&(H$.indexOf(e)!==-1||U$.test(e)))return t.quotingType===ca?'"'+e+'"':"'"+e+"'";var s=t.indent*Math.max(1,r),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-s),a=n||t.flowLevel>-1&&r>=t.flowLevel;function l(c){return hv(t,c)}switch(v(l,"testAmbiguity"),gv(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case fv:return e;case vd:return"'"+e.replace(/'/g,"''")+"'";case pv:return"|"+wd(e,t.indent)+Sd(bd(e,s));case mv:return">"+wd(e,t.indent)+Sd(bd(yv(e,o),s));case ss:return'"'+bv(e)+'"';default:throw new fr("impossible error: invalid scalar style")}})()}v(xv,"writeScalar");function wd(t,e){var r=mp(t)?String(e):"",n=t[t.length-1]===`
489
+ `,i=n&&(t[t.length-2]===`
490
+ `||t===`
491
+ `),s=i?"+":n?"":"-";return r+s+`
492
+ `}v(wd,"blockHeader");function Sd(t){return t[t.length-1]===`
493
+ `?t.slice(0,-1):t}v(Sd,"dropEndingNewline");function yv(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var c=t.indexOf(`
494
+ `);return c=c!==-1?c:t.length,r.lastIndex=c,Td(t.slice(0,c),e)})(),i=t[0]===`
495
+ `||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
496
+ `:"")+Td(l,e),i=s}return n}v(yv,"foldString");function Td(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,n,i=0,s,o=0,a=0,l="";n=r.exec(t);)a=n.index,a-i>e&&(s=o>i?o:a,l+=`
497
+ `+t.slice(i,s),i=s+1),o=a;return l+=`
498
+ `,t.length-i>e&&o>i?l+=t.slice(i,o)+`
499
+ `+t.slice(o+1):l+=t.slice(i),l.slice(1)}v(Td,"foldLine");function bv(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=ls(t,i),n=Ke[r],!n&&qs(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||lv(r);return e}v(bv,"escapeString");function Cv(t,e,r){var n="",i=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(ln(t,e,a,!1,!1)||typeof a>"u"&&ln(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}v(Cv,"writeFlowSequence");function _d(t,e,r,n){var i="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(ln(t,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&ln(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=fc(t,e)),t.dump&&la===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v(_d,"writeBlockSequence");function kv(t,e,r){var n="",i=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),ln(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),ln(t,e,c,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}v(kv,"writeFlowMapping");function vv(t,e,r,n){var i="",s=t.tag,o=Object.keys(r),a,l,c,u,d,p;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new fr("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)p="",(!n||i!=="")&&(p+=fc(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),ln(t,e+1,c,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&la===t.dump.charCodeAt(0)?p+="?":p+="? "),p+=t.dump,d&&(p+=fc(t,e)),ln(t,e+1,u,!0,d)&&(t.dump&&la===t.dump.charCodeAt(0)?p+=":":p+=": ",p+=t.dump,i+=p));t.tag=s,t.dump=i||"{}"}v(vv,"writeBlockMapping");function Ed(t,e,r){var n,i,s,o,a,l;for(i=r?t.explicitTypes:t.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,tv.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(ev.call(a.represent,l))n=a.represent[l](e,l);else throw new fr("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}v(Ed,"detectType");function ln(t,e,r,n,i,s,o){t.tag=null,t.dump=r,Ed(t,r,!1)||Ed(t,r,!0);var a=tv.call(t.dump),l=n,c;n&&(n=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",d,p;if(u&&(d=t.duplicates.indexOf(r),p=d!==-1),(t.tag!==null&&t.tag!=="?"||p||t.indent!==2&&e>0)&&(i=!1),p&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(u&&p&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),a==="[object Object]")n&&Object.keys(t.dump).length!==0?(vv(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(kv(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?_d(t,e-1,t.dump,i):_d(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(Cv(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&xv(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new fr("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}v(ln,"writeNode");function wv(t,e){var r=[],n=[],i,s;for(pc(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v(wv,"getDuplicateReferences");function pc(t,e,r){var n,i,s;if(t!==null&&typeof t=="object")if(i=e.indexOf(t),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(e.push(t),Array.isArray(t))for(i=0,s=t.length;i<s;i+=1)pc(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)pc(t[n[i]],e,r)}v(pc,"inspectNode");function V$(t,e){e=e||{};var r=new cv(e);r.noRefs||wv(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),ln(r,0,n,!0,!0)?r.dump+`
500
+ `:""}v(V$,"dump$1");function Y$(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}v(Y$,"renamed");var X$=pk,K$=E$.load;/*! Bundled license information:
501
+
502
+ js-yaml/dist/js-yaml.mjs:
503
+ (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
504
+ */var Co=v((t,e)=>{if(e)return"translate("+-t.width/2+", "+-t.height/2+")";const r=t.x??0,n=t.y??0;return"translate("+-(r+t.width/2)+", "+-(n+t.height/2)+")"},"computeLabelTransform"),Ue={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4,arrow_barb:0,arrow_barb_neo:5.5},hx={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function Do(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=xe(t),e=xe(e);const[r,n]=[t.x,t.y],[i,s]=[e.x,e.y],o=i-r,a=s-n;return{angle:Math.atan(a/o),deltaX:o,deltaY:a}}v(Do,"calculateDeltaAndAngle");var xe=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),Z$=v(t=>({x:v(function(e,r,n){let i=0;const s=xe(n[0]).x<xe(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(Ue,t.arrowTypeStart)){const{angle:f,deltaX:m}=Do(n[0],n[1]);i=Ue[t.arrowTypeStart]*Math.cos(f)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ue,t.arrowTypeEnd)){const{angle:f,deltaX:m}=Do(n[n.length-1],n[n.length-2]);i=Ue[t.arrowTypeEnd]*Math.cos(f)*(m>=0?1:-1)}const o=Math.abs(xe(e).x-xe(n[n.length-1]).x),a=Math.abs(xe(e).y-xe(n[n.length-1]).y),l=Math.abs(xe(e).x-xe(n[0]).x),c=Math.abs(xe(e).y-xe(n[0]).y),u=Ue[t.arrowTypeStart],d=Ue[t.arrowTypeEnd],p=1;if(o<d&&o>0&&a<d){let f=d+p-o;f*=s==="right"?-1:1,i-=f}if(l<u&&l>0&&c<u){let f=u+p-l;f*=s==="right"?-1:1,i+=f}return xe(e).x+i},"x"),y:v(function(e,r,n){let i=0;const s=xe(n[0]).y<xe(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(Ue,t.arrowTypeStart)){const{angle:f,deltaY:m}=Do(n[0],n[1]);i=Ue[t.arrowTypeStart]*Math.abs(Math.sin(f))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ue,t.arrowTypeEnd)){const{angle:f,deltaY:m}=Do(n[n.length-1],n[n.length-2]);i=Ue[t.arrowTypeEnd]*Math.abs(Math.sin(f))*(m>=0?1:-1)}const o=Math.abs(xe(e).y-xe(n[n.length-1]).y),a=Math.abs(xe(e).x-xe(n[n.length-1]).x),l=Math.abs(xe(e).y-xe(n[0]).y),c=Math.abs(xe(e).x-xe(n[0]).x),u=Ue[t.arrowTypeStart],d=Ue[t.arrowTypeEnd],p=1;if(o<d&&o>0&&a<d){let f=d+p-o;f*=s==="up"?-1:1,i-=f}if(l<u&&l>0&&c<u){let f=u+p-l;f*=s==="up"?-1:1,i+=f}return xe(e).y+i},"y")}),"getLineFunctionsWithOffset"),Ka={},Me={},ux;function Q$(){return ux||(ux=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.BLANK_URL=Me.relativeFirstCharacters=Me.whitespaceEscapeCharsRegex=Me.urlSchemeRegex=Me.ctrlCharactersRegex=Me.htmlCtrlEntityRegex=Me.htmlEntitiesRegex=Me.invalidProtocolRegex=void 0,Me.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,Me.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,Me.htmlCtrlEntityRegex=/&(newline|tab);/gi,Me.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Me.urlSchemeRegex=/^.+(:|&colon;)/gim,Me.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Me.relativeFirstCharacters=[".","/"],Me.BLANK_URL="about:blank"),Me}var dx;function J$(){if(dx)return Ka;dx=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.sanitizeUrl=s;var t=Q$();function e(o){return t.relativeFirstCharacters.indexOf(o[0])>-1}function r(o){var a=o.replace(t.ctrlCharactersRegex,"");return a.replace(t.htmlEntitiesRegex,function(l,c){return String.fromCharCode(c)})}function n(o){return URL.canParse(o)}function i(o){try{return decodeURIComponent(o)}catch{return o}}function s(o){if(!o)return t.BLANK_URL;var a,l=i(o.trim());do l=r(l).replace(t.htmlCtrlEntityRegex,"").replace(t.ctrlCharactersRegex,"").replace(t.whitespaceEscapeCharsRegex,"").trim(),l=i(l),a=l.match(t.ctrlCharactersRegex)||l.match(t.htmlEntitiesRegex)||l.match(t.htmlCtrlEntityRegex)||l.match(t.whitespaceEscapeCharsRegex);while(a&&a.length>0);var c=l;if(!c)return t.BLANK_URL;if(e(c))return c;var u=c.trimStart(),d=u.match(t.urlSchemeRegex);if(!d)return c;var p=d[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(p))return t.BLANK_URL;var f=u.replace(/\\/g,"/");if(p==="mailto:"||p.includes("://"))return f;if(p==="http:"||p==="https:"){if(!n(f))return t.BLANK_URL;var m=new URL(f);return m.protocol=m.protocol.toLowerCase(),m.hostname=m.hostname.toLowerCase(),m.toString()}return f}return Ka}var t6=J$();function su(t){var r;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const n=t[Symbol.toStringTag];return n==null||!((r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&r.writable)?!1:t.toString()===`[object ${n}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function e6(){}function Sv(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function gp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const r6="[object RegExp]",Tv="[object String]",_v="[object Number]",Ev="[object Boolean]",Nv="[object Arguments]",n6="[object Symbol]",i6="[object Date]",s6="[object Map]",o6="[object Set]",a6="[object Array]",l6="[object ArrayBuffer]",c6="[object Object]",h6="[object DataView]",u6="[object Uint8Array]",d6="[object Uint8ClampedArray]",f6="[object Uint16Array]",p6="[object Uint32Array]",m6="[object Int8Array]",g6="[object Int16Array]",x6="[object Int32Array]",y6="[object Float32Array]",b6="[object Float64Array]",fx=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();function xp(t){return typeof fx.Buffer<"u"&&fx.Buffer.isBuffer(t)}function C6(t){return Number.isSafeInteger(t)&&t>=0}function jv(t){return t!=null&&typeof t!="function"&&C6(t.length)}function k6(t){return t==="__proto__"}function yp(t){return t==null||typeof t!="object"&&typeof t!="function"}function bp(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function v6(t,e){return cs(t,void 0,t,new Map,e)}function cs(t,e,r,n=new Map,i=void 0){const s=i==null?void 0:i(t,e,r,n);if(s!==void 0)return s;if(yp(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){const o=new Array(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=cs(t[a],a,r,n,i);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;n.set(t,o);for(const[a,l]of t)o.set(a,cs(l,a,r,n,i));return o}if(t instanceof Set){const o=new Set;n.set(t,o);for(const a of t)o.add(cs(a,void 0,r,n,i));return o}if(xp(t))return t.subarray();if(bp(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=cs(t[a],a,r,n,i);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return n.set(t,o),Or(o,t,r,n,i),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return n.set(t,o),Or(o,t,r,n,i),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return n.set(t,o),Or(o,t,r,n,i),o}if(t instanceof Error){const o=structuredClone(t);return n.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,o.constructor=t.constructor,Or(o,t,r,n,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return n.set(t,o),Or(o,t,r,n,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return n.set(t,o),Or(o,t,r,n,i),o}if(t instanceof String){const o=new String(t.valueOf());return n.set(t,o),Or(o,t,r,n,i),o}if(typeof t=="object"&&w6(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),Or(o,t,r,n,i),o}return t}function Or(t,e,r=t,n,i){const s=[...Object.keys(e),...Sv(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=cs(e[a],a,r,n,i))}}function w6(t){switch(gp(t)){case Nv:case a6:case l6:case h6:case Ev:case i6:case y6:case b6:case m6:case g6:case x6:case s6:case _v:case c6:case r6:case o6:case Tv:case n6:case u6:case d6:case f6:case p6:return!0;default:return!1}}function S6(t,e){return v6(t,(r,n,i,s)=>{if(typeof t=="object"){if(gp(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Or(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case _v:case Tv:case Ev:{const o=new t.constructor(t==null?void 0:t.valueOf());return Or(o,t),o}case Nv:{const o={};return Or(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function px(t){return S6(t)}function Nd(t){return t!==null&&typeof t=="object"&&gp(t)==="[object Arguments]"}function jd(t){return typeof t=="object"&&t!==null}function T6(t){return jd(t)&&jv(t)}function Ea(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");const r=function(...n){const i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);const o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Ea.Cache||Map),r}Ea.Cache=Map;function _l(t){return bp(t)}function _6(t){const e=t==null?void 0:t.constructor;return t===(typeof e=="function"?e.prototype:Object.prototype)}function E6(t){if(yp(t))return t;if(Array.isArray(t)||bp(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t);if(e==null)return Object.assign(Object.create(e),t);const r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const n=new r(t);return n.lastIndex=t.lastIndex,n}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){let n;return t instanceof AggregateError?n=new r(t.errors,t.message,{cause:t.cause}):n=new r(t.message,{cause:t.cause}),n.stack=t.stack,Object.assign(n,t),n}return typeof File<"u"&&t instanceof File?new r([t],t.name,{type:t.type,lastModified:t.lastModified}):typeof t=="object"?Object.assign(Object.create(e),t):t}function N6(t,...e){const r=e.slice(0,-1),n=e[e.length-1];let i=t;for(let s=0;s<r.length;s++){const o=r[s];i=El(i,o,n,new Map)}return i}function El(t,e,r,n){if(yp(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return E6(n.get(e));if(n.set(e,t),Array.isArray(e)){e=e.slice();for(let s=0;s<e.length;s++)e[s]=e[s]??void 0}const i=[...Object.keys(e),...Sv(e)];for(let s=0;s<i.length;s++){const o=i[s];if(k6(o))continue;let a=e[o],l=t[o];if(Nd(a)&&(a={...a}),Nd(l)&&(l={...l}),xp(a)&&(a=px(a)),Array.isArray(a))if(Array.isArray(l)){const u=[],d=Reflect.ownKeys(l);for(let p=0;p<d.length;p++){const f=d[p];u[f]=l[f]}l=u}else if(T6(l)){const u=[];for(let d=0;d<l.length;d++)u[d]=l[d];l=u}else l=[];const c=r(l,a,o,t,e,n);c!==void 0?t[o]=c:Array.isArray(a)||jd(l)&&jd(a)&&(su(l)||su(a)||_l(l)||_l(a))?t[o]=El(l,a,r,n):l==null&&su(a)?t[o]=El({},a,r,n):l==null&&_l(a)?t[o]=px(a):(l===void 0||a!==void 0)&&(t[o]=a)}return t}function j6(t,...e){return N6(t,...e,e6)}function mx(t){if(t==null)return!0;if(jv(t))return typeof t.splice!="function"&&typeof t!="string"&&!xp(t)&&!_l(t)&&!Nd(t)?!1:t.length===0;if(typeof t=="object"){if(t instanceof Map||t instanceof Set)return t.size===0;const e=Object.keys(t);return _6(t)?e.filter(r=>r!=="constructor").length===0:e.length===0}return!0}var L6="​",B6={curveBasis:dd,curveBasisClosed:FR,curveBasisOpen:PR,curveBumpX:wC,curveBumpY:SC,curveBundle:DR,curveCardinalClosed:OR,curveCardinalOpen:RR,curveCardinal:NC,curveCatmullRomClosed:$R,curveCatmullRomOpen:zR,curveCatmullRom:LC,curveLinear:Yo,curveLinearClosed:WR,curveMonotoneX:PC,curveMonotoneY:DC,curveNatural:RC,curveStep:$C,curveStepAfter:WC,curveStepBefore:zC},A6=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,M6=v(function(t,e){const r=Lv(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);Xl(o),n=Ie(n,[...o])}else n=r.args;if(!n)return;let i=Hf(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),Lv=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${A6.source})(?=[}][%]{2}).*
505
+ `,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),tt.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=Go.exec(t))!==null;)if(s.index===Go.lastIndex&&Go.lastIndex++,s&&!e||e&&((r=s[1])!=null&&r.match(e))||e&&((n=s[2])!=null&&n.match(e))){const a=s[1]?s[1]:s[2],l=s[3]?s[3].trim():s[4]?JSON.parse(s[4].trim()):null;o.push({type:a,args:l})}return o.length===0?{type:t,args:null}:o.length===1?o[0]:o}catch(i){return tt.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),I6=v(function(t){return t.replace(Go,"")},"removeDirectives"),F6=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function Cp(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return B6[r]??e}v(Cp,"interpolateToCurve");function Bv(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?t6.sanitizeUrl(r):r}v(Bv,"formatUrl");var P6=v((t,...e)=>{const r=t.split("."),n=r.length-1,i=r[n];let s=window;for(let o=0;o<n;o++)if(s=s[r[o]],!s){tt.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function kp(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(kp,"distance");function Av(t){let e,r=0;t.forEach(i=>{r+=kp(i,e),e=i});const n=r/2;return vp(t,n)}v(Av,"traverseEdge");function Mv(t){return t.length===1?t[0]:Av(t)}v(Mv,"calcLabelPosition");var gx=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),vp=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=kp(i,r);if(s===0)return r;if(s<n)n-=s;else{const o=n/s;if(o<=0)return r;if(o>=1)return{x:i.x,y:i.y};if(o>0&&o<1)return{x:gx((1-o)*r.x+o*i.x,5),y:gx((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),D6=v((t,e,r)=>{tt.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=vp(e,25),s=t?10:5,o=Math.atan2(e[0].y-i.y,e[0].x-i.x),a={x:0,y:0};return a.x=Math.sin(o)*s+(e[0].x+i.x)/2,a.y=-Math.cos(o)*s+(e[0].y+i.y)/2,a},"calcCardinalityPosition");function Iv(t,e,r){const n=structuredClone(r);tt.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=vp(n,i),o=10+t*.5,a=Math.atan2(n[0].y-s.y,n[0].x-s.x),l={x:0,y:0};return e==="start_left"?(l.x=Math.sin(a+Math.PI)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a+Math.PI)*o+(n[0].y+s.y)/2):e==="end_right"?(l.x=Math.sin(a-Math.PI)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a-Math.PI)*o+(n[0].y+s.y)/2-5):e==="end_left"?(l.x=Math.sin(a)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2-5):(l.x=Math.sin(a)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2),l}v(Iv,"calcTerminalLabelPosition");function Fv(t){let e="",r="";for(const n of t)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":e=e+n+";");return{style:e,labelStyle:r}}v(Fv,"getStylesFromArray");var xx=0,O6=v(()=>(xx++,"id-"+Math.random().toString(36).substr(2,12)+"-"+xx),"generateId");function Pv(t){let e="";const r="0123456789abcdef",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}v(Pv,"makeRandomHex");var R6=v(t=>Pv(t.length),"random"),$6=v(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),z6=v(function(t,e){const r=e.text.replace(wa.lineBreakRegex," "),[,n]=th(e.fontSize),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.style("text-anchor",e.anchor),i.style("font-family",e.fontFamily),i.style("font-size",n),i.style("font-weight",e.fontWeight),i.attr("fill",e.fill),e.class!==void 0&&i.attr("class",e.class);const s=i.append("tspan");return s.attr("x",e.x+e.textMargin*2),s.attr("fill",e.fill),s.text(r),i},"drawSimpleText"),W6=Ea((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),wa.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const l=Tn(`${o} `,r),c=Tn(s,r);if(l>e){const{hyphenatedStrings:p,remainingWord:f}=q6(o,e,"-",r);i.push(s,...p),s=f}else c+l>=e?(i.push(s),s=o):s=[s,o].filter(Boolean).join(" ");a+1===n.length&&i.push(s)}),i.filter(o=>o!=="").join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),q6=Ea((t,e,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);const i=[...t],s=[];let o="";return i.forEach((a,l)=>{const c=`${o}${a}`;if(Tn(c,n)>=e){const d=l+1,p=i.length===d,f=`${c}${r}`;s.push(p?c:f),o=""}else o=c}),{hyphenatedStrings:s,remainingWord:o}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function Dv(t,e){return wp(t,e).height}v(Dv,"calculateTextHeight");function Tn(t,e){return wp(t,e).width}v(Tn,"calculateTextWidth");var wp=Ea((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=th(r),o=["sans-serif",n],a=t.split(wa.lineBreakRegex),l=[],c=Gt("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const u=c.append("svg");for(const p of o){let f=0;const m={width:0,height:0,lineHeight:0};for(const x of a){const g=$6();g.text=x||L6;const y=z6(u,g).style("font-size",s).style("font-weight",i).style("font-family",p),b=(y._groups||y)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,b.width)),f=Math.round(b.height),m.height+=f,m.lineHeight=Math.round(Math.max(m.lineHeight,f))}l.push(m)}u.remove();const d=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[d]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),As,H6=(As=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},v(As,"InitIDGenerator"),As),Za,U6=v(function(t){return Za=Za||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Za.innerHTML=t,unescape(Za.textContent)},"entityDecode");function Sp(t){return"str"in t}v(Sp,"isDetailedError");var G6=v((t,e,r,n)=>{var s;if(!n)return;const i=(s=t.node())==null?void 0:s.getBBox();i&&t.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",e)},"insertTitle"),th=v(t=>{if(typeof t=="number")return[t,t+"px"];const e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");function Tp(t,e){return j6({},t,e)}v(Tp,"cleanAndMerge");var Wr={assignWithDepth:Ie,wrapLabel:W6,calculateTextHeight:Dv,calculateTextWidth:Tn,calculateTextDimensions:wp,cleanAndMerge:Tp,detectInit:M6,detectDirective:Lv,isSubstringInArray:F6,interpolateToCurve:Cp,calcLabelPosition:Mv,calcCardinalityPosition:D6,calcTerminalLabelPosition:Iv,formatUrl:Bv,getStylesFromArray:Fv,generateId:O6,random:R6,runFunc:P6,entityDecode:U6,insertTitle:G6,isLabelCoordinateInPath:Ov,parseFontSize:th,InitIDGenerator:H6},V6=v(function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){const n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"fl°°"+n+"¶ß":"fl°"+n+"¶ß"}),e},"encodeEntities"),Ni=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),AZ=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function De(t){return t??null}v(De,"handleUndefinedAttr");function Ov(t,e){const r=Math.round(t.x),n=Math.round(t.y),i=e.replace(/(\d+\.\d+)/g,s=>Math.round(parseFloat(s)).toString());return i.includes(r.toString())||i.includes(n.toString())}v(Ov,"isLabelCoordinateInPath");var _p=v(({flowchart:t})=>{var i,s;const e=((i=t==null?void 0:t.subGraphTitleMargin)==null?void 0:i.top)??0,r=((s=t==null?void 0:t.subGraphTitleMargin)==null?void 0:s.bottom)??0,n=e+r;return{subGraphTitleTopMargin:e,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins");async function Rv(t,e){const r=t.getElementsByTagName("img");if(!r||r.length===0)return;const n=e.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...r].map(i=>new Promise(s=>{function o(){if(i.style.display="flex",i.style.flexDirection="column",n){const a=re().fontSize?re().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[c=F1.fontSize]=th(a),u=c*l+"px";i.style.minWidth=u,i.style.maxWidth=u}else i.style.width="100%";s(i)}v(o,"setupImage"),setTimeout(()=>{i.complete&&o()}),i.addEventListener("error",o),i.addEventListener("load",o)})))}v(Rv,"configureLabelImages");var Y6=v(t=>{const{handDrawnSeed:e}=re();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Xs=v(t=>{const e=X6([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),X6=v(t=>{const e=new Map;return t.forEach(r=>{const[n,i]=r.split(":");e.set(n.trim(),i==null?void 0:i.trim())}),e},"styles2Map"),$v=v(t=>t==="color"||t==="font-size"||t==="font-family"||t==="font-weight"||t==="font-style"||t==="text-decoration"||t==="text-align"||t==="text-transform"||t==="line-height"||t==="letter-spacing"||t==="word-spacing"||t==="text-shadow"||t==="text-overflow"||t==="white-space"||t==="word-wrap"||t==="word-break"||t==="overflow-wrap"||t==="hyphens","isLabelStyle"),Ct=v(t=>{const{stylesArray:e}=Xs(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];$v(a)?r.push(o.join(":")+" !important"):(n.push(o.join(":")+" !important"),a.includes("stroke")&&i.push(o.join(":")+" !important"),a==="fill"&&s.push(o.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:e,borderStyles:i,backgroundStyles:s}},"styles2String"),bt=v((t,e)=>{var l;const{themeVariables:r,handDrawnSeed:n}=re(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Xs(t);return Object.assign({roughness:.7,fill:o.get("fill")||s,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:o.get("stroke")||i,seed:n,strokeWidth:((l=o.get("stroke-width"))==null?void 0:l.replace("px",""))||1.3,fillLineDash:[0,0],strokeLineDash:K6(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),K6=v(t=>{if(!t)return[0,0];const e=t.trim().split(/\s+/).map(Number);if(e.length===1){const i=isNaN(e[0])?0:e[0];return[i,i]}const r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?0:e[1];return[r,n]},"getStrokeDashArray");const Z6=Object.freeze({left:0,top:0,width:16,height:16}),mc=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),zv=Object.freeze({...Z6,...mc}),Q6=Object.freeze({...zv,body:"",hidden:!1}),J6=Object.freeze({width:null,height:null}),t8=Object.freeze({...J6,...mc}),e8=(t,e,r,n="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;n=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const a=i.pop(),l=i.pop(),c={provider:i.length>0?i[0]:n,prefix:l,name:a};return ou(c)?c:null}const s=i[0],o=s.split("-");if(o.length>1){const a={provider:n,prefix:o.shift(),name:o.join("-")};return ou(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return ou(a,r)?a:null}return null},ou=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function r8(t,e){const r={};!t.hFlip!=!e.hFlip&&(r.hFlip=!0),!t.vFlip!=!e.vFlip&&(r.vFlip=!0);const n=((t.rotate||0)+(e.rotate||0))%4;return n&&(r.rotate=n),r}function yx(t,e){const r=r8(t,e);for(const n in Q6)n in mc?n in t&&!(n in r)&&(r[n]=mc[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function n8(t,e){const r=t.icons,n=t.aliases||Object.create(null),i=Object.create(null);function s(o){if(r[o])return i[o]=[];if(!(o in i)){i[o]=null;const a=n[o]&&n[o].parent,l=a&&s(a);l&&(i[o]=[a].concat(l))}return i[o]}return(e||Object.keys(r).concat(Object.keys(n))).forEach(s),i}function bx(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=yx(n[a]||i[a],s)}return o(e),r.forEach(o),yx(t,s)}function i8(t,e){if(t.icons[e])return bx(t,e,[]);const r=n8(t,[e])[e];return r?bx(t,e,r):null}const s8=/(-?[0-9.]*[0-9]+[0-9.]*)/g,o8=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Cx(t,e,r){if(e===1)return t;if(r=r||100,typeof t=="number")return Math.ceil(t*e*r)/r;if(typeof t!="string")return t;const n=t.split(s8);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=o8.test(s);for(;;){if(o){const a=parseFloat(s);isNaN(a)?i.push(s):i.push(Math.ceil(a*e*r)/r)}else i.push(s);if(s=n.shift(),s===void 0)return i.join("");o=!o}}function a8(t,e="defs"){let r="";const n=t.indexOf("<"+e);for(;n>=0;){const i=t.indexOf(">",n),s=t.indexOf("</"+e);if(i===-1||s===-1)break;const o=t.indexOf(">",s);if(o===-1)break;r+=t.slice(i+1,s).trim(),t=t.slice(0,n).trim()+t.slice(o+1)}return{defs:r,content:t}}function l8(t,e){return t?"<defs>"+t+"</defs>"+e:e}function c8(t,e,r){const n=a8(t);return l8(n.defs,e+n.content+r)}const h8=t=>t==="unset"||t==="undefined"||t==="none";function u8(t,e){const r={...zv,...t},n={...t8,...e},i={left:r.left,top:r.top,width:r.width,height:r.height};let s=r.body;[r,n].forEach(x=>{const g=[],y=x.hFlip,b=x.vFlip;let k=x.rotate;y?b?k+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):b&&(g.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),g.push("scale(1 -1)"),i.top=i.left=0);let T;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:T=i.height/2+i.top,g.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:T=i.width/2+i.left,g.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}k%2===1&&(i.left!==i.top&&(T=i.left,i.left=i.top,i.top=T),i.width!==i.height&&(T=i.width,i.width=i.height,i.height=T)),g.length&&(s=c8(s,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=n.width,a=n.height,l=i.width,c=i.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?c:a,u=Cx(d,l/c)):(u=o==="auto"?l:o,d=a===null?Cx(u,c/l):a==="auto"?c:a);const p={},f=(x,g)=>{h8(g)||(p[x]=g.toString())};f("width",u),f("height",d);const m=[i.left,i.top,l,c];return p.viewBox=m.join(" "),{attributes:p,viewBox:m,body:s}}const d8=/\sid="(\S+)"/g,kx=new Map;function f8(t){t=t.replace(/[0-9]+$/,"")||"a";const e=kx.get(t)||0;return kx.set(t,e+1),e?`${t}${e}`:t}function p8(t){const e=[];let r;for(;r=d8.exec(t);)e.push(r[1]);if(!e.length)return t;const n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return e.forEach(i=>{const s=f8(i),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+s+n+"$3")}),t=t.replace(new RegExp(n,"g"),""),t}function m8(t,e){let r=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)r+=" "+n+'="'+e[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+t+"</svg>"}function Ep(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Fi=Ep();function Wv(t){Fi=t}var Xo={exec:()=>null};function ne(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(rr.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var g8=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),rr={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},x8=/^(?:[ \t]*(?:\n|$))+/,y8=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,b8=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Na=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,C8=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Np=/(?:[*+-]|\d{1,9}[.)])/,qv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Hv=ne(qv).replace(/bull/g,Np).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),k8=ne(qv).replace(/bull/g,Np).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),jp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,v8=/^[^\n]+/,Lp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,w8=ne(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Lp).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),S8=ne(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Np).getRegex(),eh="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Bp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,T8=ne("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Bp).replace("tag",eh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Uv=ne(jp).replace("hr",Na).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",eh).getRegex(),_8=ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Uv).getRegex(),Ap={blockquote:_8,code:y8,def:w8,fences:b8,heading:C8,hr:Na,html:T8,lheading:Hv,list:S8,newline:x8,paragraph:Uv,table:Xo,text:v8},vx=ne("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Na).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",eh).getRegex(),E8={...Ap,lheading:k8,table:vx,paragraph:ne(jp).replace("hr",Na).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vx).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",eh).getRegex()},N8={...Ap,html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Bp).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Xo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(jp).replace("hr",Na).replace("heading",` *#{1,6} *[^
506
+ ]`).replace("lheading",Hv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},j8=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,L8=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gv=/^( {2,}|\\)\n(?!\s*$)/,B8=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rh=/[\p{P}\p{S}]/u,Mp=/[\s\p{P}\p{S}]/u,Vv=/[^\s\p{P}\p{S}]/u,A8=ne(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Mp).getRegex(),Yv=/(?!~)[\p{P}\p{S}]/u,M8=/(?!~)[\s\p{P}\p{S}]/u,I8=/(?:[^\s\p{P}\p{S}]|~)/u,F8=ne(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",g8?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Xv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,P8=ne(Xv,"u").replace(/punct/g,rh).getRegex(),D8=ne(Xv,"u").replace(/punct/g,Yv).getRegex(),Kv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",O8=ne(Kv,"gu").replace(/notPunctSpace/g,Vv).replace(/punctSpace/g,Mp).replace(/punct/g,rh).getRegex(),R8=ne(Kv,"gu").replace(/notPunctSpace/g,I8).replace(/punctSpace/g,M8).replace(/punct/g,Yv).getRegex(),$8=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Vv).replace(/punctSpace/g,Mp).replace(/punct/g,rh).getRegex(),z8=ne(/\\(punct)/,"gu").replace(/punct/g,rh).getRegex(),W8=ne(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),q8=ne(Bp).replace("(?:-->|$)","-->").getRegex(),H8=ne("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",q8).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),gc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,U8=ne(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",gc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Zv=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",gc).replace("ref",Lp).getRegex(),Qv=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",Lp).getRegex(),G8=ne("reflink|nolink(?!\\()","g").replace("reflink",Zv).replace("nolink",Qv).getRegex(),wx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ip={_backpedal:Xo,anyPunctuation:z8,autolink:W8,blockSkip:F8,br:Gv,code:L8,del:Xo,emStrongLDelim:P8,emStrongRDelimAst:O8,emStrongRDelimUnd:$8,escape:j8,link:U8,nolink:Qv,punctuation:A8,reflink:Zv,reflinkSearch:G8,tag:H8,text:B8,url:Xo},V8={...Ip,link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",gc).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",gc).getRegex()},Ld={...Ip,emStrongRDelimAst:R8,emStrongLDelim:D8,url:ne(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",wx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ne(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",wx).getRegex()},Y8={...Ld,br:ne(Gv).replace("{2,}","*").getRegex(),text:ne(Ld.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Qa={normal:Ap,gfm:E8,pedantic:N8},ko={normal:Ip,gfm:Ld,breaks:Y8,pedantic:V8},X8={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Sx=t=>X8[t];function tn(t,e){if(e){if(rr.escapeTest.test(t))return t.replace(rr.escapeReplace,Sx)}else if(rr.escapeTestNoEncode.test(t))return t.replace(rr.escapeReplaceNoEncode,Sx);return t}function Tx(t){try{t=encodeURI(t).replace(rr.percentDecode,"%")}catch{return null}return t}function _x(t,e){var s;let r=t.replace(rr.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(rr.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!((s=n.at(-1))!=null&&s.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(rr.slashPipe,"|");return n}function vo(t,e,r){let n=t.length;if(n===0)return"";let i=0;for(;i<n&&t.charAt(n-i-1)===e;)i++;return t.slice(0,n-i)}function K8(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function Ex(t,e,r,n,i){let s=e.href,o=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:s,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function Z8(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
507
+ `).map(s=>{let o=s.match(r.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
508
+ `)}var xc=class{constructor(e){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=e||Fi}space(e){let r=this.rules.block.newline.exec(e);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(e){let r=this.rules.block.code.exec(e);if(r){let n=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:vo(n,`
509
+ `)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=Z8(n,r[3]||"",this.rules);return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:i}}}heading(e){let r=this.rules.block.heading.exec(e);if(r){let n=r[2].trim();if(this.rules.other.endingHash.test(n)){let i=vo(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let r=this.rules.block.hr.exec(e);if(r)return{type:"hr",raw:vo(r[0],`
510
+ `)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=vo(r[0],`
511
+ `).split(`
512
+ `),i="",s="",o=[];for(;n.length>0;){let a=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),a=!0;else if(!a)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
513
+ `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
514
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
515
+ ${u}`:u,s=s?`${s}
516
+ ${d}`:d;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=p,n.length===0)break;let f=o.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let m=f,x=m.raw+`
517
+ `+n.join(`
518
+ `),g=this.blockquote(x);o[o.length-1]=g,i=i.substring(0,i.length-m.raw.length)+g.raw,s=s.substring(0,s.length-m.text.length)+g.text;break}else if((f==null?void 0:f.type)==="list"){let m=f,x=m.raw+`
519
+ `+n.join(`
520
+ `),g=this.list(x);o[o.length-1]=g,i=i.substring(0,i.length-f.raw.length)+g.raw,s=s.substring(0,s.length-m.raw.length)+g.raw,n=x.substring(o.at(-1).raw.length).split(`
521
+ `);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){let r=this.rules.block.list.exec(e);if(r){let n=r[1].trim(),i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;e;){let c=!1,u="",d="";if(!(r=o.exec(e))||this.rules.block.hr.test(e))break;u=r[0],e=e.substring(u.length);let p=r[2].split(`
522
+ `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),f=e.split(`
523
+ `,1)[0],m=!p.trim(),x=0;if(this.options.pedantic?(x=2,d=p.trimStart()):m?x=r[1].length+1:(x=r[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=p.slice(x),x+=r[1].length),m&&this.rules.other.blankLine.test(f)&&(u+=f+`
524
+ `,e=e.substring(f.length+1),c=!0),!c){let b=this.rules.other.nextBulletRegex(x),k=this.rules.other.hrRegex(x),T=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),w=this.rules.other.htmlBeginRegex(x);for(;e;){let E=e.split(`
525
+ `,1)[0],L;if(f=E,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),L=f):L=f.replace(this.rules.other.tabCharGlobal," "),T.test(f)||_.test(f)||w.test(f)||b.test(f)||k.test(f))break;if(L.search(this.rules.other.nonSpaceChar)>=x||!f.trim())d+=`
526
+ `+L.slice(x);else{if(m||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(p)||_.test(p)||k.test(p))break;d+=`
527
+ `+f}!m&&!f.trim()&&(m=!0),u+=E+`
528
+ `,e=e.substring(E.length+1),p=L.slice(x)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0));let g=null,y;this.options.gfm&&(g=this.rules.other.listIsTask.exec(d),g&&(y=g[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:u,task:!!g,checked:y,loose:!1,text:d,tokens:[]}),s.raw+=u}let l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){let u=s.items[c].tokens.filter(p=>p.type==="space"),d=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));s.loose=d}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(e){let r=this.rules.block.html.exec(e);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(e){let r=this.rules.block.def.exec(e);if(r){let n=r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:i,title:s}}}table(e){var a;let r=this.rules.block.table.exec(e);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let n=_x(r[1]),i=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=r[3])!=null&&a.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
529
+ `):[],o={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let l of i)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<n.length;l++)o.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:o.align[l]});for(let l of s)o.rows.push(_x(l,o.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:o.align[u]})));return o}}lheading(e){let r=this.rules.block.lheading.exec(e);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(e){let r=this.rules.block.paragraph.exec(e);if(r){let n=r[1].charAt(r[1].length-1)===`
530
+ `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let r=this.rules.block.text.exec(e);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(e){let r=this.rules.inline.escape.exec(e);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(e){let r=this.rules.inline.tag.exec(e);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(e){let r=this.rules.inline.link.exec(e);if(r){let n=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=vo(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=K8(r[2],"()");if(o===-2)return;if(o>-1){let a=(r[0].indexOf("!")===0?5:4)+r[1].length+o;r[2]=r[2].substring(0,o),r[0]=r[0].substring(0,a).trim(),r[3]=""}}let i=r[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[3])}else s=r[3]?r[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),Ex(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(e,r){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=r[i.toLowerCase()];if(!s){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Ex(n,s,n[0],this.lexer,this.rules)}}emStrong(e,r,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...i[0]].length-1,o,a,l=s,c=0,u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,r=r.slice(-1*e.length+s);(i=u.exec(r))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(a=[...o].length,i[3]||i[4]){l+=a;continue}else if((i[5]||i[6])&&s%3&&!((s+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let d=[...i[0]][0].length,p=e.slice(0,s+i.index+d+a);if(Math.min(s,a)%2){let m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let f=p.slice(2,-2);return{type:"strong",raw:p,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){let r=this.rules.inline.code.exec(e);if(r){let n=r[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:r[0],text:n}}}br(e){let r=this.rules.inline.br.exec(e);if(r)return{type:"br",raw:r[0]}}del(e){let r=this.rules.inline.del.exec(e);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(e){let r=this.rules.inline.autolink.exec(e);if(r){let n,i;return r[2]==="@"?(n=r[1],i="mailto:"+n):(n=r[1],i=n),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let r;if(r=this.rules.inline.url.exec(e)){let i,s;if(r[2]==="@")i=r[0],s="mailto:"+i;else{let o;do o=r[0],r[0]=((n=this.rules.inline._backpedal.exec(r[0]))==null?void 0:n[0])??"";while(o!==r[0]);i=r[0],r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let r=this.rules.inline.text.exec(e);if(r){let n=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:n}}}},Rr=class Bd{constructor(e){ie(this,"tokens");ie(this,"options");ie(this,"state");ie(this,"tokenizer");ie(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Fi,this.options.tokenizer=this.options.tokenizer||new xc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:rr,block:Qa.normal,inline:ko.normal};this.options.pedantic?(r.block=Qa.pedantic,r.inline=ko.pedantic):this.options.gfm&&(r.block=Qa.gfm,this.options.breaks?r.inline=ko.breaks:r.inline=ko.gfm),this.tokenizer.rules=r}static get rules(){return{block:Qa,inline:ko}}static lex(e,r){return new Bd(r).lex(e)}static lexInline(e,r){return new Bd(r).inlineTokens(e)}lex(e){e=e.replace(rr.carriageReturn,`
531
+ `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var i,s,o;for(this.options.pedantic&&(e=e.replace(rr.tabCharGlobal," ").replace(rr.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=r.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
532
+ `:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
533
+ `)?"":`
534
+ `)+a.raw,c.text+=`
535
+ `+a.text,this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
536
+ `)?"":`
537
+ `)+a.raw,c.text+=`
538
+ `+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},r.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),r.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=r.at(-1);n&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
539
+ `)?"":`
540
+ `)+a.raw,c.text+=`
541
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a),n=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
542
+ `)?"":`
543
+ `)+a.raw,c.text+=`
544
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var l,c,u,d,p;let n=e,i=null;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)f.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)s=i[2]?i[2].length:0,n=n.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},n))??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let f;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(x=>(f=x.call({lexer:this},e,r))?(e=e.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.escape(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.tag(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.link(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(f.raw.length);let x=r.at(-1);f.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=f.raw,x.text+=f.text):r.push(f);continue}if(f=this.tokenizer.emStrong(e,n,a)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.codespan(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.br(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.del(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.autolink(e)){e=e.substring(f.raw.length),r.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(e))){e=e.substring(f.raw.length),r.push(f);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let x=1/0,g=e.slice(1),y;this.options.extensions.startInline.forEach(b=>{y=b.call({lexer:this},g),typeof y=="number"&&y>=0&&(x=Math.min(x,y))}),x<1/0&&x>=0&&(m=e.substring(0,x+1))}if(f=this.tokenizer.inlineText(m)){e=e.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(a=f.raw.slice(-1)),o=!0;let x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=f.raw,x.text+=f.text):r.push(f);continue}if(e){let x="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},yc=class{constructor(e){ie(this,"options");ie(this,"parser");this.options=e||Fi}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(rr.notSpaceStart))==null?void 0:o[0],s=e.replace(rr.endingNewline,"")+`
545
+ `;return i?'<pre><code class="language-'+tn(i)+'">'+(n?s:tn(s,!0))+`</code></pre>
546
+ `:"<pre><code>"+(n?s:tn(s,!0))+`</code></pre>
547
+ `}blockquote({tokens:e}){return`<blockquote>
548
+ ${this.parser.parse(e)}</blockquote>
549
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
550
+ `}hr(e){return`<hr>
551
+ `}list(e){let r=e.ordered,n=e.start,i="";for(let a=0;a<e.items.length;a++){let l=e.items[a];i+=this.listitem(l)}let s=r?"ol":"ul",o=r&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
552
+ `+i+"</"+s+`>
553
+ `}listitem(e){var n;let r="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+tn(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):r+=i+" "}return r+=this.parser.parse(e.tokens,!!e.loose),`<li>${r}</li>
554
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
555
+ `}table(e){let r="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);r+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let a=0;a<o.length;a++)n+=this.tablecell(o[a]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
556
+ <thead>
557
+ `+r+`</thead>
558
+ `+i+`</table>
559
+ `}tablerow({text:e}){return`<tr>
560
+ ${e}</tr>
561
+ `}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
562
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${tn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:r,tokens:n}){let i=this.parser.parseInline(n),s=Tx(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+tn(r)+'"'),o+=">"+i+"</a>",o}image({href:e,title:r,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=Tx(e);if(s===null)return tn(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${tn(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:tn(e.text)}},Fp=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},$r=class Ad{constructor(e){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=e||Fi,this.options.renderer=this.options.renderer||new yc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Fp}static parse(e,r){return new Ad(r).parse(e)}static parseInline(e,r){return new Ad(r).parseInline(e)}parse(e,r=!0){var i,s;let n="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){n+=u||"";continue}}let l=a;switch(l.type){case"space":{n+=this.renderer.space(l);continue}case"hr":{n+=this.renderer.hr(l);continue}case"heading":{n+=this.renderer.heading(l);continue}case"code":{n+=this.renderer.code(l);continue}case"table":{n+=this.renderer.table(l);continue}case"blockquote":{n+=this.renderer.blockquote(l);continue}case"list":{n+=this.renderer.list(l);continue}case"html":{n+=this.renderer.html(l);continue}case"def":{n+=this.renderer.def(l);continue}case"paragraph":{n+=this.renderer.paragraph(l);continue}case"text":{let c=l,u=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],u+=`
563
+ `+this.renderer.text(c);r?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(e,r=this.renderer){var i,s;let n="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=c||"";continue}}let l=a;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=r.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},gl,Oo=(gl=class{constructor(e){ie(this,"options");ie(this,"block");this.options=e||Fi}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Rr.lex:Rr.lexInline}provideParser(){return this.block?$r.parse:$r.parseInline}},ie(gl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(gl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),gl),Q8=class{constructor(...e){ie(this,"defaults",Ep());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",$r);ie(this,"Renderer",yc);ie(this,"TextRenderer",Fp);ie(this,"Lexer",Rr);ie(this,"Tokenizer",xc);ie(this,"Hooks",Oo);this.use(...e)}walkTokens(e,r){var i,s;let n=[];for(let o of e)switch(n=n.concat(r.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)n=n.concat(this.walkTokens(l.tokens,r));for(let l of a.rows)for(let c of l)n=n.concat(this.walkTokens(c.tokens,r));break}case"list":{let a=o;n=n.concat(this.walkTokens(a.items,r));break}default:{let a=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);n=n.concat(this.walkTokens(c,r))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,r)))}}return n}use(...e){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=r.renderers[s.name];o?r.renderers[s.name]=function(...a){let l=s.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:r.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=r[s.level];o?o.unshift(s.tokenizer):r[s.level]=[s.tokenizer],s.start&&(s.level==="block"?r.startBlock?r.startBlock.push(s.start):r.startBlock=[s.start]:s.level==="inline"&&(r.startInline?r.startInline.push(s.start):r.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(r.childTokens[s.name]=s.childTokens)}),i.extensions=r),n.renderer){let s=this.defaults.renderer||new yc(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=n.renderer[a],c=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new xc(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=n.tokenizer[a],c=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Oo;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=n.hooks[a],c=s[a];Oo.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&Oo.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await l.call(s,u);return c.call(s,p)})();let d=l.call(s,u);return c.call(s,d)}:s[a]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(s,u);return p===!1&&(p=await c.apply(s,u)),p})();let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),s&&(l=l.concat(s.call(this,a))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,r){return Rr.lex(e,r??this.defaults)}parser(e,r){return $r.parse(e,r??this.defaults)}parseMarkdown(e){return(r,n)=>{let i={...n},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(r):r,l=await(s.hooks?await s.hooks.provideLexer():e?Rr.lex:Rr.lexInline)(a,s),c=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?$r.parse:$r.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(o);try{s.hooks&&(r=s.hooks.preprocess(r));let a=(s.hooks?s.hooks.provideLexer():e?Rr.lex:Rr.lexInline)(r,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():e?$r.parse:$r.parseInline)(a,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,r){return n=>{if(n.message+=`
564
+ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+tn(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},ji=new Q8;function se(t,e){return ji.parse(t,e)}se.options=se.setOptions=function(t){return ji.setOptions(t),se.defaults=ji.defaults,Wv(se.defaults),se};se.getDefaults=Ep;se.defaults=Fi;se.use=function(...t){return ji.use(...t),se.defaults=ji.defaults,Wv(se.defaults),se};se.walkTokens=function(t,e){return ji.walkTokens(t,e)};se.parseInline=ji.parseInline;se.Parser=$r;se.parser=$r.parse;se.Renderer=yc;se.TextRenderer=Fp;se.Lexer=Rr;se.lexer=Rr.lex;se.Tokenizer=xc;se.Hooks=Oo;se.parse=se;se.options;se.setOptions;se.use;se.walkTokens;se.parseInline;$r.parse;Rr.lex;function Jv(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=Array.from(typeof t=="string"?[t]:t);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,"");var i=n.reduce(function(a,l){var c=l.match(/\n([\t ]+|(?!\s).)/g);return c?a.concat(c.map(function(u){var d,p;return(p=(d=u.match(/[\t ]/g))===null||d===void 0?void 0:d.length)!==null&&p!==void 0?p:0})):a},[]);if(i.length){var s=new RegExp(`
565
+ [ ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(a){return a.replace(s,`
566
+ `)})}n[0]=n[0].replace(/^\r?\n/,"");var o=n[0];return e.forEach(function(a,l){var c=o.match(/(?:^|\n)( *)$/),u=c?c[1]:"",d=a;typeof a=="string"&&a.includes(`
567
+ `)&&(d=String(a).split(`
568
+ `).map(function(p,f){return f===0?p:""+u+p}).join(`
569
+ `)),o+=d+n[l+1]}),o}var J8={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},Md=new Map,tw=new Map,tz=v(t=>{for(const e of t){if(!e.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(tt.debug("Registering icon pack:",e.name),"loader"in e)tw.set(e.name,e.loader);else if("icons"in e)Md.set(e.name,e.icons);else throw tt.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),ew=v(async(t,e)=>{const r=e8(t,!0,e!==void 0);if(!r)throw new Error(`Invalid icon name: ${t}`);const n=r.prefix||e;if(!n)throw new Error(`Icon name must contain a prefix: ${t}`);let i=Md.get(n);if(!i){const o=tw.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},Md.set(n,i)}catch(a){throw tt.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=i8(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),ez=v(async t=>{try{return await ew(t),!0}catch{return!1}},"isIconAvailable"),ja=v(async(t,e,r)=>{let n;try{n=await ew(t,e==null?void 0:e.fallbackPrefix)}catch(o){tt.error(o),n=J8}const i=u8(n,e),s=m8(p8(i.body),{...i.attributes,...r});return Gr(s,be())},"getIconSVG");function rw(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
570
+ `).replace(/\n{2,}/g,`
571
+ `);return Jv(n)}v(rw,"preprocessMarkdown");function nw(t){return t.split(/\\n|\n|<br\s*\/?>/gi).map(e=>{var r;return((r=e.trim().match(/<[^>]+>|[^\s<>]+/g))==null?void 0:r.map(n=>({content:n,type:"normal"})))??[]})}v(nw,"nonMarkdownToLines");function iw(t,e={}){const r=rw(t,e),n=se.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
572
+ `).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(p=>{p=p.replace(/&#39;/g,"'"),p&&i[s].push({content:p,type:l})})}):a.type==="strong"||a.type==="em"?a.tokens.forEach(c=>{o(c,a.type)}):a.type==="html"&&i[s].push({content:a.text,type:"normal"})}return v(o,"processNode"),n.forEach(a=>{var l;a.type==="paragraph"?(l=a.tokens)==null||l.forEach(c=>{o(c)}):a.type==="html"?i[s].push({content:a.text,type:"normal"}):i[s].push({content:a.raw,type:"normal"})}),i}v(iw,"markdownToLines");function sw(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(sw,"nonMarkdownToHTML");function ow(t,{markdownAutoWrap:e}={}){const r=se.lexer(t);function n(i){var s,o,a;return i.type==="text"?e===!1?i.text.replace(/\n */g,"<br/>").replace(/ /g,"&nbsp;"):i.text.replace(/\n */g,"<br/>"):i.type==="strong"?`<strong>${(s=i.tokens)==null?void 0:s.map(n).join("")}</strong>`:i.type==="em"?`<em>${(o=i.tokens)==null?void 0:o.map(n).join("")}</em>`:i.type==="paragraph"?`<p>${(a=i.tokens)==null?void 0:a.map(n).join("")}</p>`:i.type==="space"?"":i.type==="html"?`${i.text}`:i.type==="escape"?i.text:(tt.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(ow,"markdownToHTML");function aw(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(aw,"splitTextToChars");function lw(t,e){const r=aw(e.content);return Pp(t,[],r,e.type)}v(lw,"splitWordToFitWidth");function Pp(t,e,r,n){if(r.length===0)return[{content:e.join(""),type:n},{content:"",type:n}];const[i,...s]=r,o=[...e,i];return t([{content:o.join(""),type:n}])?Pp(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v(Pp,"splitWordToFitWidthRecursion");function cw(t,e){if(t.some(({content:r})=>r.includes(`
573
+ `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return bc(t,e)}v(cw,"splitLineToFitWidth");function bc(t,e,r=[],n=[]){if(t.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let i="";t[0].content===" "&&(i=" ",t.shift());const s=t.shift()??{content:" ",type:"normal"},o=[...n];if(i!==""&&o.push({content:i,type:"normal"}),o.push(s),e(o))return bc(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=lw(e,s);r.push([a]),l.content&&t.unshift(l)}return bc(t,e,r)}v(bc,"splitLineToFitWidthRecursion");function Id(t,e){e&&t.attr("style",e)}v(Id,"applyStyle");var Nx=16384;async function hw(t,e,r,n,i=!1,s=be()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,Nx)}px`),o.attr("height",`${Math.min(10*r,Nx)}px`);const a=o.append("xhtml:div"),l=ra(e.label)?await U1(e.label.replace(wa.lineBreakRegex,`
574
+ `),s):Gr(e.label,s),c=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),Id(u,e.labelStyle),u.attr("class",`${c} ${n}`),Id(a,e.labelStyle),a.style("display","table-cell"),a.style("white-space","nowrap"),a.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(a.style("max-width",r+"px"),a.style("text-align","center")),a.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&a.attr("class","labelBkg");let d=a.node().getBoundingClientRect();return d.width===r&&(a.style("display","table"),a.style("white-space","break-spaces"),a.style("width",r+"px"),d=a.node().getBoundingClientRect()),o.node()}v(hw,"addHtmlSpan");function nh(t,e,r,n=!1){const i=t.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*r-.1+"em").attr("dy",r+"em");return n&&i.attr("text-anchor","middle"),i}v(nh,"createTspan");function uw(t,e,r){const n=t.append("text"),i=nh(n,1,e);ih(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(uw,"computeWidthOfText");function rz(t,e,r){var o;const n=t.append("text"),i=nh(n,1,e);ih(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(rz,"computeDimensionOfText");function dw(t,e,r,n=!1,i=!1){const o=e.append("g"),a=o.insert("rect").attr("class","background").attr("style","stroke: none"),l=o.append("text").attr("y","-10.1");i&&l.attr("text-anchor","middle");let c=0;for(const u of r){const d=v(f=>uw(o,1.1,f)<=t,"checkWidth"),p=d(u)?[u]:cw(u,d);for(const f of p){const m=nh(l,c,1.1,i);ih(m,f),c++}}if(n){const u=l.node().getBBox(),d=2;return a.attr("x",u.x-d).attr("y",u.y-d).attr("width",u.width+2*d).attr("height",u.height+2*d),o.node()}else return l.node()}v(dw,"createFormattedText");function Fd(t){const e=/&(amp|lt|gt);/g;return t.replace(e,(r,n)=>{switch(n){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return r}})}v(Fd,"decodeHTMLEntities");function ih(t,e){t.text(""),e.forEach((r,n)=>{const i=t.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?i.text(Fd(r.content)):i.text(" "+Fd(r.content))})}v(ih,"updateTextContentAndStyles");async function fw(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await ez(a)?await ja(a,void 0,{class:"label-icon"}):`<i class='${Gr(i,e).replace(":"," ")}'></i>`})()),i));const n=await Promise.all(r);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}v(fw,"replaceIconSubstring");var Nn=v(async(t,e="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:s=!0,markdown:o=!0,isNode:a=!0,width:l=200,addSvgBackground:c=!1}={},u)=>{if(tt.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",c),s){const d=o?ow(e,u):sw(e),p=await fw(Ni(d),u),f=e.replace(/\\\\/g,"\\"),m={isNode:a,label:ra(e)?f:p,labelStyle:r.replace("fill:","color:")};return await hw(t,m,l,i,c,u)}else{const d=Ni(e.replace(/<br\s*\/?>/g,"<br/>")),p=o?iw(d.replace("<br>","<br/>"),u):nw(d),f=dw(l,t,p,e?c:!1,!a);if(a){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Gt(f).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Gt(f).select("rect").attr("style",m.replace(/background:/g,"fill:"));const x=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Gt(f).select("text").attr("style",x)}return n?Gt(f).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Gt(f).selectAll("tspan.text-outer-tspan").classed("row",!0),f}},"createText");function au(t,e,r){if(t&&t.length){const[n,i]=e,s=Math.PI/180*r,o=Math.cos(s),a=Math.sin(s);for(const l of t){const[c,u]=l;l[0]=(c-n)*o-(u-i)*a+n,l[1]=(c-n)*a+(u-i)*o+i}}}function nz(t,e){return t[0]===e[0]&&t[1]===e[1]}function iz(t,e,r,n=1){const i=r,s=Math.max(e,.1),o=t[0]&&t[0][0]&&typeof t[0][0]=="number"?[t]:t,a=[0,0];if(i)for(const c of o)au(c,a,i);const l=(function(c,u,d){const p=[];for(const b of c){const k=[...b];nz(k[0],k[k.length-1])||k.push([k[0][0],k[0][1]]),k.length>2&&p.push(k)}const f=[];u=Math.max(u,.1);const m=[];for(const b of p)for(let k=0;k<b.length-1;k++){const T=b[k],_=b[k+1];if(T[1]!==_[1]){const w=Math.min(T[1],_[1]);m.push({ymin:w,ymax:Math.max(T[1],_[1]),x:w===T[1]?T[0]:_[0],islope:(_[0]-T[0])/(_[1]-T[1])})}}if(m.sort(((b,k)=>b.ymin<k.ymin?-1:b.ymin>k.ymin?1:b.x<k.x?-1:b.x>k.x?1:b.ymax===k.ymax?0:(b.ymax-k.ymax)/Math.abs(b.ymax-k.ymax))),!m.length)return f;let x=[],g=m[0].ymin,y=0;for(;x.length||m.length;){if(m.length){let b=-1;for(let k=0;k<m.length&&!(m[k].ymin>g);k++)b=k;m.splice(0,b+1).forEach((k=>{x.push({s:g,edge:k})}))}if(x=x.filter((b=>!(b.edge.ymax<=g))),x.sort(((b,k)=>b.edge.x===k.edge.x?0:(b.edge.x-k.edge.x)/Math.abs(b.edge.x-k.edge.x))),(d!==1||y%u==0)&&x.length>1)for(let b=0;b<x.length;b+=2){const k=b+1;if(k>=x.length)break;const T=x[b].edge,_=x[k].edge;f.push([[Math.round(T.x),g],[Math.round(_.x),g]])}g+=d,x.forEach((b=>{b.edge.x=b.edge.x+d*b.edge.islope})),y++}return f})(o,s,n);if(i){for(const c of o)au(c,a,-i);(function(c,u,d){const p=[];c.forEach((f=>p.push(...f))),au(p,u,d)})(l,a,-i)}return l}function La(t,e){var r;const n=e.hachureAngle+90;let i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.round(Math.max(i,.1));let s=1;return e.roughness>=1&&(((r=e.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(s=i),iz(t,i,n,s||1)}class Dp{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=La(e,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(e,r){const n=[];for(const i of e)n.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],r));return n}}function sh(t){const e=t[0],r=t[1];return Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2))}class sz extends Dp{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=La(e,Object.assign({},r,{hachureGap:n})),s=Math.PI/180*r.hachureAngle,o=[],a=.5*n*Math.cos(s),l=.5*n*Math.sin(s);for(const[c,u]of i)sh([c,u])&&o.push([[c[0]-a,c[1]+l],[...u]],[[c[0]+a,c[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(o,r)}}}class oz extends Dp{fillPolygons(e,r){const n=this._fillPolygons(e,r),i=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),s=this._fillPolygons(e,i);return n.ops=n.ops.concat(s.ops),n}}class az{constructor(e){this.helper=e}fillPolygons(e,r){const n=La(e,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(e,r){const n=[];let i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);let s=r.fillWeight;s<0&&(s=r.strokeWidth/2);const o=i/4;for(const a of e){const l=sh(a),c=l/i,u=Math.ceil(c)-1,d=l-u*i,p=(a[0][0]+a[1][0])/2-i/4,f=Math.min(a[0][1],a[1][1]);for(let m=0;m<u;m++){const x=f+d+m*i,g=p-o+2*Math.random()*o,y=x-o+2*Math.random()*o,b=this.helper.ellipse(g,y,s,s,r);n.push(...b.ops)}}return{type:"fillSketch",ops:n}}}class lz{constructor(e){this.helper=e}fillPolygons(e,r){const n=La(e,r);return{type:"fillSketch",ops:this.dashedLine(n,r)}}dashedLine(e,r){const n=r.dashOffset<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashOffset,i=r.dashGap<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashGap,s=[];return e.forEach((o=>{const a=sh(o),l=Math.floor(a/(n+i)),c=(a+i-l*(n+i))/2;let u=o[0],d=o[1];u[0]>d[0]&&(u=o[1],d=o[0]);const p=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let f=0;f<l;f++){const m=f*(n+i),x=m+n,g=[u[0]+m*Math.cos(p)+c*Math.cos(p),u[1]+m*Math.sin(p)+c*Math.sin(p)],y=[u[0]+x*Math.cos(p)+c*Math.cos(p),u[1]+x*Math.sin(p)+c*Math.sin(p)];s.push(...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],r))}})),s}}class cz{constructor(e){this.helper=e}fillPolygons(e,r){const n=r.hachureGap<0?4*r.strokeWidth:r.hachureGap,i=r.zigzagOffset<0?n:r.zigzagOffset,s=La(e,r=Object.assign({},r,{hachureGap:n+i}));return{type:"fillSketch",ops:this.zigzagLines(s,i,r)}}zigzagLines(e,r,n){const i=[];return e.forEach((s=>{const o=sh(s),a=Math.round(o/(2*r));let l=s[0],c=s[1];l[0]>c[0]&&(l=s[1],c=s[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let d=0;d<a;d++){const p=2*d*r,f=2*(d+1)*r,m=Math.sqrt(2*Math.pow(r,2)),x=[l[0]+p*Math.cos(u),l[1]+p*Math.sin(u)],g=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],y=[x[0]+m*Math.cos(u+Math.PI/4),x[1]+m*Math.sin(u+Math.PI/4)];i.push(...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],n),...this.helper.doubleLineOps(y[0],y[1],g[0],g[1],n))}})),i}}const hr={};class hz{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const uz=0,lu=1,jx=2,Ja={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function cu(t,e){return t.type===e}function Op(t){const e=[],r=(function(o){const a=new Array;for(;o!=="";)if(o.match(/^([ \t\r\n,]+)/))o=o.substr(RegExp.$1.length);else if(o.match(/^([aAcChHlLmMqQsStTvVzZ])/))a[a.length]={type:uz,text:RegExp.$1},o=o.substr(RegExp.$1.length);else{if(!o.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];a[a.length]={type:lu,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:jx,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!cu(s,jx);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return Op("M0,0"+t);i++,o=Ja[s.text],n=s.text}else cu(s,lu)?o=Ja[n]:(i++,o=Ja[s.text],n=s.text);if(!(i+o<r.length))throw new Error("Path data ended short");for(let l=i;l<i+o;l++){const c=r[l];if(!cu(c,lu))throw new Error("Param not a number: "+n+","+c.text);a[a.length]=+c.text}if(typeof Ja[n]!="number")throw new Error("Bad segment: "+n);{const l={key:n,data:a};e.push(l),i+=o,s=r[i],n==="M"&&(n="L"),n==="m"&&(n="l")}}return e}function pw(t){let e=0,r=0,n=0,i=0;const s=[];for(const{key:o,data:a}of t)switch(o){case"M":s.push({key:"M",data:[...a]}),[e,r]=a,[n,i]=a;break;case"m":e+=a[0],r+=a[1],s.push({key:"M",data:[e,r]}),n=e,i=r;break;case"L":s.push({key:"L",data:[...a]}),[e,r]=a;break;case"l":e+=a[0],r+=a[1],s.push({key:"L",data:[e,r]});break;case"C":s.push({key:"C",data:[...a]}),e=a[4],r=a[5];break;case"c":{const l=a.map(((c,u)=>u%2?c+r:c+e));s.push({key:"C",data:l}),e=l[4],r=l[5];break}case"Q":s.push({key:"Q",data:[...a]}),e=a[2],r=a[3];break;case"q":{const l=a.map(((c,u)=>u%2?c+r:c+e));s.push({key:"Q",data:l}),e=l[2],r=l[3];break}case"A":s.push({key:"A",data:[...a]}),e=a[5],r=a[6];break;case"a":e+=a[5],r+=a[6],s.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],e,r]});break;case"H":s.push({key:"H",data:[...a]}),e=a[0];break;case"h":e+=a[0],s.push({key:"H",data:[e]});break;case"V":s.push({key:"V",data:[...a]}),r=a[0];break;case"v":r+=a[0],s.push({key:"V",data:[r]});break;case"S":s.push({key:"S",data:[...a]}),e=a[2],r=a[3];break;case"s":{const l=a.map(((c,u)=>u%2?c+r:c+e));s.push({key:"S",data:l}),e=l[2],r=l[3];break}case"T":s.push({key:"T",data:[...a]}),e=a[0],r=a[1];break;case"t":e+=a[0],r+=a[1],s.push({key:"T",data:[e,r]});break;case"Z":case"z":s.push({key:"Z",data:[]}),e=n,r=i}return s}function mw(t){const e=[];let r="",n=0,i=0,s=0,o=0,a=0,l=0;for(const{key:c,data:u}of t){switch(c){case"M":e.push({key:"M",data:[...u]}),[n,i]=u,[s,o]=u;break;case"C":e.push({key:"C",data:[...u]}),n=u[4],i=u[5],a=u[2],l=u[3];break;case"L":e.push({key:"L",data:[...u]}),[n,i]=u;break;case"H":n=u[0],e.push({key:"L",data:[n,i]});break;case"V":i=u[0],e.push({key:"L",data:[n,i]});break;case"S":{let d=0,p=0;r==="C"||r==="S"?(d=n+(n-a),p=i+(i-l)):(d=n,p=i),e.push({key:"C",data:[d,p,...u]}),a=u[0],l=u[1],n=u[2],i=u[3];break}case"T":{const[d,p]=u;let f=0,m=0;r==="Q"||r==="T"?(f=n+(n-a),m=i+(i-l)):(f=n,m=i);const x=n+2*(f-n)/3,g=i+2*(m-i)/3,y=d+2*(f-d)/3,b=p+2*(m-p)/3;e.push({key:"C",data:[x,g,y,b,d,p]}),a=f,l=m,n=d,i=p;break}case"Q":{const[d,p,f,m]=u,x=n+2*(d-n)/3,g=i+2*(p-i)/3,y=f+2*(d-f)/3,b=m+2*(p-m)/3;e.push({key:"C",data:[x,g,y,b,f,m]}),a=d,l=p,n=f,i=m;break}case"A":{const d=Math.abs(u[0]),p=Math.abs(u[1]),f=u[2],m=u[3],x=u[4],g=u[5],y=u[6];d===0||p===0?(e.push({key:"C",data:[n,i,g,y,g,y]}),n=g,i=y):(n!==g||i!==y)&&(gw(n,i,g,y,d,p,f,m,x).forEach((function(b){e.push({key:"C",data:b})})),n=g,i=y);break}case"Z":e.push({key:"Z",data:[]}),n=s,i=o}r=c}return e}function wo(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function gw(t,e,r,n,i,s,o,a,l,c){const u=(d=o,Math.PI*d/180);var d;let p=[],f=0,m=0,x=0,g=0;if(c)[f,m,x,g]=c;else{[t,e]=wo(t,e,-u),[r,n]=wo(r,n,-u);const q=(t-r)/2,O=(e-n)/2;let I=q*q/(i*i)+O*O/(s*s);I>1&&(I=Math.sqrt(I),i*=I,s*=I);const F=i*i,D=s*s,R=F*D-F*O*O-D*q*q,j=F*O*O+D*q*q,S=(a===l?-1:1)*Math.sqrt(Math.abs(R/j));x=S*i*O/s+(t+r)/2,g=S*-s*q/i+(e+n)/2,f=Math.asin(parseFloat(((e-g)/s).toFixed(9))),m=Math.asin(parseFloat(((n-g)/s).toFixed(9))),t<x&&(f=Math.PI-f),r<x&&(m=Math.PI-m),f<0&&(f=2*Math.PI+f),m<0&&(m=2*Math.PI+m),l&&f>m&&(f-=2*Math.PI),!l&&m>f&&(m-=2*Math.PI)}let y=m-f;if(Math.abs(y)>120*Math.PI/180){const q=m,O=r,I=n;m=l&&m>f?f+120*Math.PI/180*1:f+120*Math.PI/180*-1,p=gw(r=x+i*Math.cos(m),n=g+s*Math.sin(m),O,I,i,s,o,0,l,[m,q,x,g])}y=m-f;const b=Math.cos(f),k=Math.sin(f),T=Math.cos(m),_=Math.sin(m),w=Math.tan(y/4),E=4/3*i*w,L=4/3*s*w,M=[t,e],N=[t+E*k,e-L*b],P=[r+E*_,n-L*T],$=[r,n];if(N[0]=2*M[0]-N[0],N[1]=2*M[1]-N[1],c)return[N,P,$].concat(p);{p=[N,P,$].concat(p);const q=[];for(let O=0;O<p.length;O+=3){const I=wo(p[O][0],p[O][1],u),F=wo(p[O+1][0],p[O+1][1],u),D=wo(p[O+2][0],p[O+2][1],u);q.push([I[0],I[1],F[0],F[1],D[0],D[1]])}return q}}const dz={randOffset:function(t,e){return Ft(t,e)},randOffsetWithRange:function(t,e,r){return Cc(t,e,r)},ellipse:function(t,e,r,n,i){const s=yw(r,n,i);return Pd(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Zn(t,e,r,n,i,!0)}};function xw(t,e,r,n,i){return{type:"path",ops:Zn(t,e,r,n,i)}}function Nl(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Zn(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Zn(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?xw(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function fz(t,e,r,n,i){return(function(s,o){return Nl(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function Lx(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=tl(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:tl(r[0],1.5*(1+.22*e.roughness),Mx(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=tl(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:tl(o,1.5*(1+.22*e.roughness),Mx(e));for(const c of a)c.op!=="move"&&n.push(c);for(const c of l)c.op!=="move"&&i.push(c)}}return{type:"path",ops:n.concat(i)}}return{type:"path",ops:[]}}function yw(t,e,r){const n=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),i=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*n)),s=2*Math.PI/i;let o=Math.abs(t/2),a=Math.abs(e/2);const l=1-r.curveFitting;return o+=Ft(o*l,r),a+=Ft(a*l,r),{increment:s,rx:o,ry:a}}function Pd(t,e,r,n){const[i,s]=Ix(n.increment,t,e,n.rx,n.ry,1,n.increment*Cc(.1,Cc(.4,1,r),r),r);let o=kc(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=Ix(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=kc(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function Bx(t,e,r,n,i,s,o,a,l){const c=t,u=e;let d=Math.abs(r/2),p=Math.abs(n/2);d+=Ft(.01*d,l),p+=Ft(.01*p,l);let f=i,m=s;for(;f<0;)f+=2*Math.PI,m+=2*Math.PI;m-f>2*Math.PI&&(f=0,m=2*Math.PI);const x=2*Math.PI/l.curveStepCount,g=Math.min(x/2,(m-f)/2),y=Fx(g,c,u,d,p,f,m,1,l);if(!l.disableMultiStroke){const b=Fx(g,c,u,d,p,f,m,1.5,l);y.push(...b)}return o&&(a?y.push(...Zn(c,u,c+d*Math.cos(f),u+p*Math.sin(f),l),...Zn(c,u,c+d*Math.cos(m),u+p*Math.sin(m),l)):y.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+d*Math.cos(f),u+p*Math.sin(f)]})),{type:"path",ops:y}}function Ax(t,e){const r=mw(pw(Op(t))),n=[];let i=[0,0],s=[0,0];for(const{key:o,data:a}of r)switch(o){case"M":s=[a[0],a[1]],i=[a[0],a[1]];break;case"L":n.push(...Zn(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[l,c,u,d,p,f]=a;n.push(...pz(l,c,u,d,p,f,s,e)),s=[p,f];break}case"Z":n.push(...Zn(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function hu(t,e){const r=[];for(const n of t)if(n.length){const i=e.maxRandomnessOffset||0,s=n.length;if(s>2){r.push({op:"move",data:[n[0][0]+Ft(i,e),n[0][1]+Ft(i,e)]});for(let o=1;o<s;o++)r.push({op:"lineTo",data:[n[o][0]+Ft(i,e),n[o][1]+Ft(i,e)]})}}return{type:"fillPath",ops:r}}function Yi(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!hr[i])switch(i){case"zigzag":hr[i]||(hr[i]=new sz(n));break;case"cross-hatch":hr[i]||(hr[i]=new oz(n));break;case"dots":hr[i]||(hr[i]=new az(n));break;case"dashed":hr[i]||(hr[i]=new lz(n));break;case"zigzag-line":hr[i]||(hr[i]=new cz(n));break;default:i="hachure",hr[i]||(hr[i]=new Dp(n))}return hr[i]})(e,dz).fillPolygons(t,e)}function Mx(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function bw(t){return t.randomizer||(t.randomizer=new hz(t.seed||0)),t.randomizer.next()}function Cc(t,e,r,n=1){return r.roughness*n*(bw(r)*(e-t)+t)}function Ft(t,e,r=1){return Cc(-t,t,e,r)}function Zn(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=Dd(t,e,r,n,i,!0,!1);if(o)return a;const l=Dd(t,e,r,n,i,!0,!0);return a.concat(l)}function Dd(t,e,r,n,i,s,o){const a=Math.pow(t-r,2)+Math.pow(e-n,2),l=Math.sqrt(a);let c=1;c=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>a&&(u=l/10);const d=u/2,p=.2+.2*bw(i);let f=i.bowing*i.maxRandomnessOffset*(n-e)/200,m=i.bowing*i.maxRandomnessOffset*(t-r)/200;f=Ft(f,i,c),m=Ft(m,i,c);const x=[],g=()=>Ft(d,i,c),y=()=>Ft(u,i,c),b=i.preserveVertices;return o?x.push({op:"move",data:[t+(b?0:g()),e+(b?0:g())]}):x.push({op:"move",data:[t+(b?0:Ft(u,i,c)),e+(b?0:Ft(u,i,c))]}),o?x.push({op:"bcurveTo",data:[f+t+(r-t)*p+g(),m+e+(n-e)*p+g(),f+t+2*(r-t)*p+g(),m+e+2*(n-e)*p+g(),r+(b?0:g()),n+(b?0:g())]}):x.push({op:"bcurveTo",data:[f+t+(r-t)*p+y(),m+e+(n-e)*p+y(),f+t+2*(r-t)*p+y(),m+e+2*(n-e)*p+y(),r+(b?0:y()),n+(b?0:y())]}),x}function tl(t,e,r){if(!t.length)return[];const n=[];n.push([t[0][0]+Ft(e,r),t[0][1]+Ft(e,r)]),n.push([t[0][0]+Ft(e,r),t[0][1]+Ft(e,r)]);for(let i=1;i<t.length;i++)n.push([t[i][0]+Ft(e,r),t[i][1]+Ft(e,r)]),i===t.length-1&&n.push([t[i][0]+Ft(e,r),t[i][1]+Ft(e,r)]);return kc(n,null,r)}function kc(t,e,r){const n=t.length,i=[];if(n>3){const s=[],o=1-r.curveTightness;i.push({op:"move",data:[t[1][0],t[1][1]]});for(let a=1;a+2<n;a++){const l=t[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*t[a+1][0]-o*t[a-1][0])/6,l[1]+(o*t[a+1][1]-o*t[a-1][1])/6],s[2]=[t[a+1][0]+(o*t[a][0]-o*t[a+2][0])/6,t[a+1][1]+(o*t[a][1]-o*t[a+2][1])/6],s[3]=[t[a+1][0],t[a+1][1]],i.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}}else n===3?(i.push({op:"move",data:[t[1][0],t[1][1]]}),i.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):n===2&&i.push(...Dd(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function Ix(t,e,r,n,i,s,o,a){const l=[],c=[];if(a.roughness===0){t/=4,c.push([e+n*Math.cos(-t),r+i*Math.sin(-t)]);for(let u=0;u<=2*Math.PI;u+=t){const d=[e+n*Math.cos(u),r+i*Math.sin(u)];l.push(d),c.push(d)}c.push([e+n*Math.cos(0),r+i*Math.sin(0)]),c.push([e+n*Math.cos(t),r+i*Math.sin(t)])}else{const u=Ft(.5,a)-Math.PI/2;c.push([Ft(s,a)+e+.9*n*Math.cos(u-t),Ft(s,a)+r+.9*i*Math.sin(u-t)]);const d=2*Math.PI+u-.01;for(let p=u;p<d;p+=t){const f=[Ft(s,a)+e+n*Math.cos(p),Ft(s,a)+r+i*Math.sin(p)];l.push(f),c.push(f)}c.push([Ft(s,a)+e+n*Math.cos(u+2*Math.PI+.5*o),Ft(s,a)+r+i*Math.sin(u+2*Math.PI+.5*o)]),c.push([Ft(s,a)+e+.98*n*Math.cos(u+o),Ft(s,a)+r+.98*i*Math.sin(u+o)]),c.push([Ft(s,a)+e+.9*n*Math.cos(u+.5*o),Ft(s,a)+r+.9*i*Math.sin(u+.5*o)])}return[c,l]}function Fx(t,e,r,n,i,s,o,a,l){const c=s+Ft(.1,l),u=[];u.push([Ft(a,l)+e+.9*n*Math.cos(c-t),Ft(a,l)+r+.9*i*Math.sin(c-t)]);for(let d=c;d<=o;d+=t)u.push([Ft(a,l)+e+n*Math.cos(d),Ft(a,l)+r+i*Math.sin(d)]);return u.push([e+n*Math.cos(o),r+i*Math.sin(o)]),u.push([e+n*Math.cos(o),r+i*Math.sin(o)]),kc(u,null,l)}function pz(t,e,r,n,i,s,o,a){const l=[],c=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let u=[0,0];const d=a.disableMultiStroke?1:2,p=a.preserveVertices;for(let f=0;f<d;f++)f===0?l.push({op:"move",data:[o[0],o[1]]}):l.push({op:"move",data:[o[0]+(p?0:Ft(c[0],a)),o[1]+(p?0:Ft(c[0],a))]}),u=p?[i,s]:[i+Ft(c[f],a),s+Ft(c[f],a)],l.push({op:"bcurveTo",data:[t+Ft(c[f],a),e+Ft(c[f],a),r+Ft(c[f],a),n+Ft(c[f],a),u[0],u[1]]});return l}function So(t){return[...t]}function Px(t,e=0){const r=t.length;if(r<3)throw new Error("A curve must have at least three points.");const n=[];if(r===3)n.push(So(t[0]),So(t[1]),So(t[2]),So(t[2]));else{const i=[];i.push(t[0],t[0]);for(let a=1;a<t.length;a++)i.push(t[a]),a===t.length-1&&i.push(t[a]);const s=[],o=1-e;n.push(So(i[0]));for(let a=1;a+2<i.length;a++){const l=i[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*i[a+1][0]-o*i[a-1][0])/6,l[1]+(o*i[a+1][1]-o*i[a-1][1])/6],s[2]=[i[a+1][0]+(o*i[a][0]-o*i[a+2][0])/6,i[a+1][1]+(o*i[a][1]-o*i[a+2][1])/6],s[3]=[i[a+1][0],i[a+1][1]],n.push(s[1],s[2],s[3])}}return n}function jl(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function mz(t,e,r){const n=jl(e,r);if(n===0)return jl(t,e);let i=((t[0]-e[0])*(r[0]-e[0])+(t[1]-e[1])*(r[1]-e[1]))/n;return i=Math.max(0,Math.min(1,i)),jl(t,pi(e,r,i))}function pi(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function Od(t,e,r,n){const i=n||[];if((function(a,l){const c=a[l+0],u=a[l+1],d=a[l+2],p=a[l+3];let f=3*u[0]-2*c[0]-p[0];f*=f;let m=3*u[1]-2*c[1]-p[1];m*=m;let x=3*d[0]-2*p[0]-c[0];x*=x;let g=3*d[1]-2*p[1]-c[1];return g*=g,f<x&&(f=x),m<g&&(m=g),f+m})(t,e)<r){const a=t[e+0];i.length?(s=i[i.length-1],o=a,Math.sqrt(jl(s,o))>1&&i.push(a)):i.push(a),i.push(t[e+3])}else{const l=t[e+0],c=t[e+1],u=t[e+2],d=t[e+3],p=pi(l,c,.5),f=pi(c,u,.5),m=pi(u,d,.5),x=pi(p,f,.5),g=pi(f,m,.5),y=pi(x,g,.5);Od([l,p,x,y],0,r,i),Od([y,g,m,d],0,r,i)}var s,o;return i}function gz(t,e){return vc(t,0,t.length,e)}function vc(t,e,r,n,i){const s=i||[],o=t[e],a=t[r-1];let l=0,c=1;for(let u=e+1;u<r-1;++u){const d=mz(t[u],o,a);d>l&&(l=d,c=u)}return Math.sqrt(l)>n?(vc(t,e,c+1,n,s),vc(t,c,r,n,s)):(s.length||s.push(o),s.push(a)),s}function uu(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)Od(t,3*s,e,n);return r&&r>0?vc(n,0,n.length,r):n}const Cr="none";class wc{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,r,n){return{shape:e,sets:r||[],options:n||this.defaultOptions}}line(e,r,n,i,s){const o=this._o(s);return this._d("line",[xw(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=fz(e,r,n,i,o);if(o.fill){const c=[[e,r],[e+n,r],[e+n,r+i],[e,r+i]];o.fillStyle==="solid"?a.push(hu([c],o)):a.push(Yi([c],o))}return o.stroke!==Cr&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=yw(n,i,o),c=Pd(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=Pd(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push(Yi([c.estimatedPoints],o));return o.stroke!==Cr&&a.push(c.opset),this._d("ellipse",a,o)}circle(e,r,n,i){const s=this.ellipse(e,r,n,n,i);return s.shape="circle",s}linearPath(e,r){const n=this._o(r);return this._d("linearPath",[Nl(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,l){const c=this._o(l),u=[],d=Bx(e,r,n,i,s,o,a,!0,c);if(a&&c.fill)if(c.fillStyle==="solid"){const p=Object.assign({},c);p.disableMultiStroke=!0;const f=Bx(e,r,n,i,s,o,!0,!1,p);f.type="fillPath",u.push(f)}else u.push((function(p,f,m,x,g,y,b){const k=p,T=f;let _=Math.abs(m/2),w=Math.abs(x/2);_+=Ft(.01*_,b),w+=Ft(.01*w,b);let E=g,L=y;for(;E<0;)E+=2*Math.PI,L+=2*Math.PI;L-E>2*Math.PI&&(E=0,L=2*Math.PI);const M=(L-E)/b.curveStepCount,N=[];for(let P=E;P<=L;P+=M)N.push([k+_*Math.cos(P),T+w*Math.sin(P)]);return N.push([k+_*Math.cos(L),T+w*Math.sin(L)]),N.push([k,T]),Yi([N],b)})(e,r,n,i,s,o,c));return c.stroke!==Cr&&u.push(d),this._d("arc",u,c)}curve(e,r){const n=this._o(r),i=[],s=Lx(e,n);if(n.fill&&n.fill!==Cr)if(n.fillStyle==="solid"){const o=Lx(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(o.ops)})}else{const o=[],a=e;if(a.length){const l=typeof a[0][0]=="number"?[a]:a;for(const c of l)c.length<3?o.push(...c):c.length===3?o.push(...uu(Px([c[0],c[0],c[1],c[2]]),10,(1+n.roughness)/2)):o.push(...uu(Px(c),10,(1+n.roughness)/2))}o.length&&i.push(Yi([o],n))}return n.stroke!==Cr&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=Nl(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(hu([e],n)):i.push(Yi([e],n))),n.stroke!==Cr&&i.push(s),this._d("polygon",i,n)}path(e,r){const n=this._o(r),i=[];if(!e)return this._d("path",i,n);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const s=n.fill&&n.fill!=="transparent"&&n.fill!==Cr,o=n.stroke!==Cr,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,p){const f=mw(pw(Op(u))),m=[];let x=[],g=[0,0],y=[];const b=()=>{y.length>=4&&x.push(...uu(y,d)),y=[]},k=()=>{b(),x.length&&(m.push(x),x=[])};for(const{key:_,data:w}of f)switch(_){case"M":k(),g=[w[0],w[1]],x.push(g);break;case"L":b(),x.push([w[0],w[1]]);break;case"C":if(!y.length){const E=x.length?x[x.length-1]:g;y.push([E[0],E[1]])}y.push([w[0],w[1]]),y.push([w[2],w[3]]),y.push([w[4],w[5]]);break;case"Z":b(),x.push([g[0],g[1]])}if(k(),!p)return m;const T=[];for(const _ of m){const w=gz(_,p);w.length&&T.push(w)}return T})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),c=Ax(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=Ax(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else i.push(hu(l,n));else i.push(Yi(l,n));return o&&(a?l.forEach((u=>{i.push(Nl(u,!1,n))})):i.push(c)),this._d("path",i,n)}opsToPath(e,r){let n="";for(const i of e.ops){const s=typeof r=="number"&&r>=0?i.data.map((o=>+o.toFixed(r))):i.data;switch(i.op){case"move":n+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":n+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":n+=`L${s[0]} ${s[1]} `}}return n.trim()}toPaths(e){const r=e.sets||[],n=e.options||this.defaultOptions,i=[];for(const s of r){let o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:Cr};break;case"fillPath":o={d:this.opsToPath(s),stroke:Cr,strokeWidth:0,fill:n.fill||Cr};break;case"fillSketch":o=this.fillSketch(s,n)}o&&i.push(o)}return i}fillSketch(e,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(e),stroke:r.fill||Cr,strokeWidth:n,fill:Cr}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class xz{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new wc(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.ctx,s=e.options.fixedDecimalPlaceDigits;for(const o of r)switch(o.type){case"path":i.save(),i.strokeStyle=n.stroke==="none"?"transparent":n.stroke,i.lineWidth=n.strokeWidth,n.strokeLineDash&&i.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(i.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(i,o,s),i.restore();break;case"fillPath":{i.save(),i.fillStyle=n.fill||"";const a=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,o,s,a),i.restore();break}case"fillSketch":this.fillSketch(i,o,n)}}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2),e.save(),n.fillLineDash&&e.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(e.lineDashOffset=n.fillLineDashOffset),e.strokeStyle=n.fill||"",e.lineWidth=i,this._drawToContext(e,r,n.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,r,n,i="nonzero"){e.beginPath();for(const s of r.ops){const o=typeof n=="number"&&n>=0?s.data.map((a=>+a.toFixed(n))):s.data;switch(s.op){case"move":e.moveTo(o[0],o[1]);break;case"bcurveTo":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":e.lineTo(o[0],o[1])}}r.type==="fillPath"?e.fill(i):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,r,n,i,s){const o=this.gen.line(e,r,n,i,s);return this.draw(o),o}rectangle(e,r,n,i,s){const o=this.gen.rectangle(e,r,n,i,s);return this.draw(o),o}ellipse(e,r,n,i,s){const o=this.gen.ellipse(e,r,n,i,s);return this.draw(o),o}circle(e,r,n,i){const s=this.gen.circle(e,r,n,i);return this.draw(s),s}linearPath(e,r){const n=this.gen.linearPath(e,r);return this.draw(n),n}polygon(e,r){const n=this.gen.polygon(e,r);return this.draw(n),n}arc(e,r,n,i,s,o,a=!1,l){const c=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(c),c}curve(e,r){const n=this.gen.curve(e,r);return this.draw(n),n}path(e,r){const n=this.gen.path(e,r);return this.draw(n),n}}const el="http://www.w3.org/2000/svg";class yz{constructor(e,r){this.svg=e,this.gen=new wc(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(el,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(el,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=i.createElementNS(el,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),e.shape!=="curve"&&e.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(i,a,n)}l&&s.appendChild(l)}return s}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);const s=e.createElementNS(el,"path");return s.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),s.setAttribute("stroke",n.fill||""),s.setAttribute("stroke-width",i+""),s.setAttribute("fill","none"),n.fillLineDash&&s.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&s.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),s}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,r){return this.gen.opsToPath(e,r)}line(e,r,n,i,s){const o=this.gen.line(e,r,n,i,s);return this.draw(o)}rectangle(e,r,n,i,s){const o=this.gen.rectangle(e,r,n,i,s);return this.draw(o)}ellipse(e,r,n,i,s){const o=this.gen.ellipse(e,r,n,i,s);return this.draw(o)}circle(e,r,n,i){const s=this.gen.circle(e,r,n,i);return this.draw(s)}linearPath(e,r){const n=this.gen.linearPath(e,r);return this.draw(n)}polygon(e,r){const n=this.gen.polygon(e,r);return this.draw(n)}arc(e,r,n,i,s,o,a=!1,l){const c=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(c)}curve(e,r){const n=this.gen.curve(e,r);return this.draw(n)}path(e,r){const n=this.gen.path(e,r);return this.draw(n)}}var xt={canvas:(t,e)=>new xz(t,e),svg:(t,e)=>new yz(t,e),generator:t=>new wc(t),newSeed:()=>wc.newSeed()},Mt=v(async(t,e,r)=>{var f,m;let n;const i=e.useHtmlLabels||En((f=re())==null?void 0:f.htmlLabels);r?n=r:n="node default";const s=t.insert("g").attr("class",n).attr("id",e.domId||e.id),o=s.insert("g").attr("class","label").attr("style",De(e.labelStyle));let a;e.label===void 0?a="":a=typeof e.label=="string"?e.label:e.label[0];const l=!!e.icon||!!e.img,c=e.labelType==="markdown",u=await Nn(o,Gr(Ni(a),re()),{useHtmlLabels:i,width:e.width||((m=re().flowchart)==null?void 0:m.wrappingWidth),classes:c?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:c},re());let d=u.getBBox();const p=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=Gt(u);await Rv(x,a),d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height)}return i?o.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"):o.attr("transform","translate(0, "+-d.height/2+")"),e.centerLabel&&o.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:s,bbox:d,halfPadding:p,label:o}},"labelHelper"),du=v(async(t,e,r)=>{var l,c;const n=r.useHtmlLabels??or(re()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await Nn(i,Gr(Ni(e),re()),{useHtmlLabels:n,width:r.width||((c=(l=re())==null?void 0:l.flowchart)==null?void 0:c.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let o=s.getBBox();const a=r.padding/2;if(or(re())){const u=s.children[0],d=Gt(s);o=u.getBoundingClientRect(),d.attr("width",o.width),d.attr("height",o.height)}return n?i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):i.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:t,bbox:o,halfPadding:a,label:i}},"insertLabel"),wt=v((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),Bt=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Qt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Qt,"createPathFromPoints");function Qn(t,e,r,n,i,s){const o=[],l=r-t,c=n-e,u=l/s,d=2*Math.PI/u,p=e+c/2;for(let f=0;f<=50;f++){const m=f/50,x=t+m*l,g=p+i*Math.sin(d*(x-t));o.push({x,y:g})}return o}v(Qn,"generateFullSineWavePoints");function ua(t,e,r,n,i,s){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(ua,"generateCirclePoints");function Rd(t){const e=Array.from(t.childNodes).filter(l=>l.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=e.map(l=>l.getAttribute("d")).filter(l=>l!==null).join(" ");r.setAttribute("d",n);const i=e.find(l=>l.getAttribute("fill")!=="none"),s=e.find(l=>l.getAttribute("stroke")!=="none"),o=v((l,c)=>(l==null?void 0:l.getAttribute(c))??void 0,"getAttr");if(i){const l={fill:o(i,"fill"),"fill-opacity":o(i,"fill-opacity")??"1"};Object.entries(l).forEach(([c,u])=>{u&&r.setAttribute(c,u)})}if(s){const l={stroke:o(s,"stroke"),"stroke-width":o(s,"stroke-width")??"1","stroke-opacity":o(s,"stroke-opacity")??"1"};Object.entries(l).forEach(([c,u])=>{u&&r.setAttribute(c,u)})}const a=document.createElementNS("http://www.w3.org/2000/svg","g");return a.appendChild(r),a}v(Rd,"mergePaths");var bz=v((t,e)=>{var r=t.x,n=t.y,i=e.x-r,s=e.y-n,o=t.width/2,a=t.height/2,l,c;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),l=s===0?0:a*i/s,c=a):(i<0&&(o=-o),l=o,c=i===0?0:o*s/i),{x:r+l,y:n+c}},"intersectRect"),Ks=bz,Cz=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=re(),a=or(o);return await Nn(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),Wn=Cz,ii=v((t,e,r,n,i)=>["M",t+i,e,"H",t+r-i,"A",i,i,0,0,1,t+r,e+i,"V",e+n-i,"A",i,i,0,0,1,t+r-i,e+n,"H",t+i,"A",i,i,0,0,1,t,e+n-i,"V",e+i,"A",i,i,0,0,1,t+i,e,"Z"].join(" "),"createRoundedRectPathD"),Cw=v(async(t,e)=>{tt.info("Creating subgraph rect for ",e.id,e);const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=Ct(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=or(r),f=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await Nn(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width}):m=await Wn(f,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(or(r)){const E=m.children[0],L=Gt(m);x=E.getBoundingClientRect(),L.attr("width",x.width),L.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,b=e.x-g/2,k=e.y-y/2;tt.trace("Data ",e,JSON.stringify(e));let T;if(e.look==="handDrawn"){const E=xt.svg(d),L=bt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),M=E.path(ii(b,k,g,y,0),L);T=d.insert(()=>(tt.debug("Rough node insert CXC",M),M),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=d.insert("rect",":first-child"),T.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",k).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=_p(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const E=f.select("span");E&&E.attr("style",a)}const w=T.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(E){return Ks(e,E)},{cluster:d,labelBBox:x}},"rect"),kz=v((t,e)=>{const r=t.insert("g").attr("class","note-cluster").attr("id",e.domId),n=r.insert("rect",":first-child"),i=0*e.padding,s=i/2;n.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-s).attr("y",e.y-e.height/2-s).attr("width",e.width+i).attr("height",e.height+i).attr("fill","none");const o=n.node().getBBox();return e.width=o.width,e.height=o.height,e.intersect=function(a){return Ks(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),vz=v(async(t,e)=>{const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:s,compositeBackground:o,compositeTitleBackground:a,nodeBorder:l}=n,c=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-id",e.id).attr("data-look",e.look),u=c.insert("g",":first-child"),d=c.insert("g").attr("class","cluster-label");let p=c.append("rect");const f=await Wn(d,e.label,e.labelStyle,void 0,!0);let m=f.getBBox();if(or(r)){const M=f.children[0],N=Gt(f);m=M.getBoundingClientRect(),N.attr("width",m.width),N.attr("height",m.height)}const x=0*e.padding,g=x/2,y=(e.width<=m.width+e.padding?m.width+e.padding:e.width)+x;e.width<=m.width+e.padding?e.diff=(y-e.width)/2-e.padding:e.diff=-e.padding;const b=e.height+x,k=e.height+x-m.height-6,T=e.x-y/2,_=e.y-b/2;e.width=y;const w=e.y-e.height/2-g+m.height+2;let E;if(e.look==="handDrawn"){const M=e.cssClasses.includes("statediagram-cluster-alt"),N=xt.svg(c),P=e.rx||e.ry?N.path(ii(T,_,y,b,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):N.rectangle(T,_,y,b,{seed:i});E=c.insert(()=>P,":first-child");const $=N.rectangle(T,w,y,k,{fill:M?s:o,fillStyle:M?"hachure":"solid",stroke:l,seed:i});E=c.insert(()=>P,":first-child"),p=c.insert(()=>$)}else E=u.insert("rect",":first-child"),E.attr("class","outer").attr("x",T).attr("y",_).attr("width",y).attr("height",b).attr("data-look",e.look),p.attr("class","inner").attr("x",T).attr("y",w).attr("width",y).attr("height",k);d.attr("transform",`translate(${e.x-m.width/2}, ${_+1-(or(r)?0:3)})`);const L=E.node().getBBox();return e.height=L.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(M){return Ks(e,M)},{cluster:c,labelBBox:m}},"roundedWithTitle"),wz=v(async(t,e)=>{tt.info("Creating subgraph rect for ",e.id,e);const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=Ct(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=or(r),f=d.insert("g").attr("class","cluster-label "),m=await Nn(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width});let x=m.getBBox();if(or(r)){const E=m.children[0],L=Gt(m);x=E.getBoundingClientRect(),L.attr("width",x.width),L.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,b=e.x-g/2,k=e.y-y/2;tt.trace("Data ",e,JSON.stringify(e));let T;if(e.look==="handDrawn"){const E=xt.svg(d),L=bt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),M=E.path(ii(b,k,g,y,e.rx),L);T=d.insert(()=>(tt.debug("Rough node insert CXC",M),M),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=d.insert("rect",":first-child"),T.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",k).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=_p(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const E=f.select("span");E&&E.attr("style",a)}const w=T.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(E){return Ks(e,E)},{cluster:d,labelBBox:x}},"kanbanSection"),Sz=v((t,e)=>{const r=re(),{themeVariables:n,handDrawnSeed:i}=r,{nodeBorder:s}=n,o=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-look",e.look),a=o.insert("g",":first-child"),l=0*e.padding,c=e.width+l;e.diff=-e.padding;const u=e.height+l,d=e.x-c/2,p=e.y-u/2;e.width=c;let f;if(e.look==="handDrawn"){const g=xt.svg(o).rectangle(d,p,c,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:s,seed:i});f=o.insert(()=>g,":first-child")}else{f=a.insert("rect",":first-child");let x="outer";e.look,x="divider",f.attr("class",x).attr("x",d).attr("y",p).attr("width",c).attr("height",u).attr("data-look",e.look)}const m=f.node().getBBox();return e.height=m.height,e.offsetX=0,e.offsetY=0,e.intersect=function(x){return Ks(e,x)},{cluster:o,labelBBox:{}}},"divider"),Tz=Cw,_z={rect:Cw,squareRect:Tz,roundedWithTitle:vz,noteGroup:kz,divider:Sz,kanbanSection:wz},kw=new Map,Ez=v(async(t,e)=>{const r=e.shape||"rect",n=await _z[r](t,e);return kw.set(e.id,n),n},"insertCluster"),OZ=v(()=>{kw=new Map},"clear");function vw(t,e){return t.intersect(e)}v(vw,"intersectNode");var Nz=vw;function ww(t,e,r,n){var i=t.x,s=t.y,o=i-n.x,a=s-n.y,l=Math.sqrt(e*e*a*a+r*r*o*o),c=Math.abs(e*r*o/l);n.x<i&&(c=-c);var u=Math.abs(e*r*a/l);return n.y<s&&(u=-u),{x:i+c,y:s+u}}v(ww,"intersectEllipse");var Sw=ww;function Tw(t,e,r){return Sw(t,e,e,r)}v(Tw,"intersectCircle");var jz=Tw;function _w(t,e,r,n){{const i=e.y-t.y,s=t.x-e.x,o=e.x*t.y-t.x*e.y,a=i*r.x+s*r.y+o,l=i*n.x+s*n.y+o,c=1e-6;if(a!==0&&l!==0&&$d(a,l))return;const u=n.y-r.y,d=r.x-n.x,p=n.x*r.y-r.x*n.y,f=u*t.x+d*t.y+p,m=u*e.x+d*e.y+p;if(Math.abs(f)<c&&Math.abs(m)<c&&$d(f,m))return;const x=i*d-u*s;if(x===0)return;const g=Math.abs(x/2);let y=s*p-d*o;const b=y<0?(y-g)/x:(y+g)/x;y=u*o-i*p;const k=y<0?(y-g)/x:(y+g)/x;return{x:b,y:k}}}v(_w,"intersectLine");function $d(t,e){return t*e>0}v($d,"sameSign");var Lz=_w;function Ew(t,e,r){let n=t.x,i=t.y,s=[],o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;typeof e.forEach=="function"?e.forEach(function(u){o=Math.min(o,u.x),a=Math.min(a,u.y)}):(o=Math.min(o,e.x),a=Math.min(a,e.y));let l=n-t.width/2-o,c=i-t.height/2-a;for(let u=0;u<e.length;u++){let d=e[u],p=e[u<e.length-1?u+1:0],f=Lz(t,r,{x:l+d.x,y:c+d.y},{x:l+p.x,y:c+p.y});f&&s.push(f)}return s.length?(s.length>1&&s.sort(function(u,d){let p=u.x-r.x,f=u.y-r.y,m=Math.sqrt(p*p+f*f),x=d.x-r.x,g=d.y-r.y,y=Math.sqrt(x*x+g*g);return m<y?-1:m===y?0:1}),s[0]):t}v(Ew,"intersectPolygon");var Bz=Ew,pt={node:Nz,circle:jz,ellipse:Sw,polygon:Bz,rect:Ks};function Nw(t,e){const{labelStyles:r}=Ct(e);e.labelStyle=r;const n=Bt(e);let i=n;n||(i="anchor");const s=t.insert("g").attr("class",i).attr("id",e.domId||e.id),o=1,{cssStyles:a}=e,l=xt.svg(s),c=bt(e,{fill:"black",stroke:"none",fillStyle:"solid"});e.look!=="handDrawn"&&(c.roughness=0);const u=l.circle(0,0,o*2,c),d=s.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",De(a)),wt(e,d),e.intersect=function(p){return tt.info("Circle intersect",e,o,p),pt.circle(e,o,p)},s}v(Nw,"anchor");function zd(t,e,r,n,i,s,o){const l=(t+r)/2,c=(e+n)/2,u=Math.atan2(n-e,r-t),d=(r-t)/2,p=(n-e)/2,f=d/i,m=p/s,x=Math.sqrt(f**2+m**2);if(x>1)throw new Error("The given radii are too small to create an arc between the points.");const g=Math.sqrt(1-x**2),y=l+g*s*Math.sin(u)*(o?-1:1),b=c-g*i*Math.cos(u)*(o?-1:1),k=Math.atan2((e-b)/s,(t-y)/i);let _=Math.atan2((n-b)/s,(r-y)/i)-k;o&&_<0&&(_+=2*Math.PI),!o&&_>0&&(_-=2*Math.PI);const w=[];for(let E=0;E<20;E++){const L=E/19,M=k+L*_,N=y+i*Math.cos(M),P=b+s*Math.sin(M);w.push({x:N,y:P})}return w}v(zd,"generateArcPoints");function jw(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(jw,"calculateArcSagitta");async function Lw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=v(M=>M+o,"calcTotalHeight"),l=v(M=>{const N=M/2;return[N/(2.5+M/50),N]},"calcEllipseRadius"),{shapeSvg:c,bbox:u}=await Mt(t,e,Bt(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[p,f]=l(d),m=jw(d,p,f),g=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2+m-m,y=d,{cssStyles:b}=e,k=[{x:g/2,y:-y/2},{x:-g/2,y:-y/2},...zd(-g/2,-y/2,-g/2,y/2,p,f,!1),{x:g/2,y:y/2},...zd(g/2,y/2,g/2,-y/2,p,f,!0)],T=xt.svg(c),_=bt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=Qt(k),E=T.path(w,_),L=c.insert(()=>E,":first-child");return L.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(${p/2}, 0)`),wt(e,L),e.intersect=function(M){return pt.polygon(e,k,M)},c}v(Lw,"bowTieRect");function jn(t,e,r,n){return t.insert("polygon",":first-child").attr("points",n.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}v(jn,"insertPolygonShape");var rl=12;async function Bw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?28:i,o=e.look==="neo"?24:i,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s+rl),u=((e==null?void 0:e.height)??l.height)+(e.look==="neo"?o*2:o),d=0,p=c,f=-u,m=0,x=[{x:d+rl,y:f},{x:p,y:f},{x:p,y:m},{x:d,y:m},{x:d,y:f+rl},{x:d+rl,y:f}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const b=xt.svg(a),k=bt(e,{}),T=Qt(x),_=b.path(T,k);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-c/2}, ${u/2})`),y&&g.attr("style",y)}else g=jn(a,c,u,x);return n&&g.attr("style",n),wt(e,g),e.intersect=function(b){return pt.polygon(e,x,b)},a}v(Bw,"card");function Aw(t,e){const{nodeStyles:r}=Ct(e);e.label="";const n=t.insert("g").attr("class",Bt(e)).attr("id",e.domId??e.id),{cssStyles:i}=e,s=Math.max(28,e.width??0),o=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}],a=xt.svg(n),l=bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Qt(o),u=a.path(c,l),d=n.insert(()=>u,":first-child");return i&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",i),r&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",r),e.width=28,e.height=28,e.intersect=function(p){return pt.polygon(e,o,p)},n}v(Aw,"choice");async function Rp(t,e,r){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await Mt(t,e,Bt(e)),l=16,c=(r==null?void 0:r.padding)??a,u=e.look==="neo"?o.width/2+l*2:o.width/2+c;let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const f=xt.svg(s),m=bt(e,{}),x=f.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",De(p))}else d=s.insert("circle",":first-child").attr("class","basic label-container").attr("style",i).attr("r",u).attr("cx",0).attr("cy",0);return wt(e,d),e.calcIntersect=function(f,m){const x=f.width/2;return pt.circle(f,x,m)},e.intersect=function(f){return tt.info("Circle intersect",e,u,f),pt.circle(e,u,f)},s}v(Rp,"circle");function Mw(t){const e=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=t*2,i={x:n/2*e,y:n/2*r},s={x:-(n/2)*e,y:n/2*r},o={x:-(n/2)*e,y:-(n/2)*r},a={x:n/2*e,y:-(n/2)*r};return`M ${s.x},${s.y} L ${a.x},${a.y}
575
+ M ${i.x},${i.y} L ${o.x},${o.y}`}v(Mw,"createLine");function Iw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r,e.label="";const i=t.insert("g").attr("class",Bt(e)).attr("id",e.domId??e.id),s=Math.max(30,(e==null?void 0:e.width)??0),{cssStyles:o}=e,a=xt.svg(i),l=bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=a.circle(0,0,s*2,l),u=Mw(s),d=a.path(u,l),p=i.insert(()=>c,":first-child");return p.insert(()=>d),p.attr("class","outer-path"),o&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",o),n&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",n),wt(e,p),e.intersect=function(f){return tt.info("crossedCircle intersect",e,{radius:s,point:f}),pt.circle(e,s,f)},i}v(Iw,"crossedCircle");function bn(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(bn,"generateCirclePoints");async function Fw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,Bt(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+a,u=s.height+l,d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...bn(c/2,-u/2,d,30,-90,0),{x:-c/2-d,y:d},...bn(c/2+d*2,-d,d,20,-180,-270),...bn(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:-u/2},...bn(c/2,u/2,d,20,0,90)],m=[{x:c/2,y:-u/2-d},{x:-c/2,y:-u/2-d},...bn(c/2,-u/2,d,20,-90,0),{x:-c/2-d,y:-d},...bn(c/2+c*.1,-d,d,20,-180,-270),...bn(c/2+c*.1,d,d,20,-90,-180),{x:-c/2-d,y:u/2},...bn(c/2,u/2,d,20,0,90),{x:-c/2,y:u/2+d},{x:c/2,y:u/2+d}],x=xt.svg(i),g=bt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Qt(f).replace("Z",""),k=x.path(b,g),T=Qt(m),_=x.path(T,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":first-child").attr("stroke-opacity",0),w.insert(()=>k,":first-child"),w.attr("class","text"),p&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${d}, 0)`),o.attr("transform",`translate(${-c/2+d-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),wt(e,w),e.intersect=function(E){return pt.polygon(e,m,E)},i}v(Fw,"curlyBraceLeft");function Cn(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:f,y:m})}return o}v(Cn,"generateCirclePoints");async function Pw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,Bt(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...Cn(c/2,-u/2,d,20,-90,0),{x:c/2+d,y:-d},...Cn(c/2+d*2,-d,d,20,-180,-270),...Cn(c/2+d*2,d,d,20,-90,-180),{x:c/2+d,y:u/2},...Cn(c/2,u/2,d,20,0,90)],m=[{x:-c/2,y:-u/2-d},{x:c/2,y:-u/2-d},...Cn(c/2,-u/2,d,20,-90,0),{x:c/2+d,y:-d},...Cn(c/2+d*2,-d,d,20,-180,-270),...Cn(c/2+d*2,d,d,20,-90,-180),{x:c/2+d,y:u/2},...Cn(c/2,u/2,d,20,0,90),{x:c/2,y:u/2+d},{x:-c/2,y:u/2+d}],x=xt.svg(i),g=bt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Qt(f).replace("Z",""),k=x.path(b,g),T=Qt(m),_=x.path(T,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":first-child").attr("stroke-opacity",0),w.insert(()=>k,":first-child"),w.attr("class","text"),p&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${-d}, 0)`),o.attr("transform",`translate(${-c/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),wt(e,w),e.intersect=function(E){return pt.polygon(e,m,E)},i}v(Pw,"curlyBraceRight");function $e(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v($e,"generateCirclePoints");async function Dw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,Bt(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...$e(c/2,-u/2,d,30,-90,0),{x:-c/2-d,y:d},...$e(c/2+d*2,-d,d,20,-180,-270),...$e(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:-u/2},...$e(c/2,u/2,d,20,0,90)],m=[...$e(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...$e(-c/2-d/2,-d,d,20,0,90),...$e(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...$e(-c/2+d+d/2,u/2,d,30,-180,-270)],x=[{x:c/2,y:-u/2-d},{x:-c/2,y:-u/2-d},...$e(c/2,-u/2,d,20,-90,0),{x:-c/2-d,y:-d},...$e(c/2+d*2,-d,d,20,-180,-270),...$e(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:u/2},...$e(c/2,u/2,d,20,0,90),{x:-c/2,y:u/2+d},{x:c/2-d-d/2,y:u/2+d},...$e(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...$e(-c/2-d/2,-d,d,20,0,90),...$e(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...$e(-c/2+d+d/2,u/2,d,30,-180,-270)],g=xt.svg(i),y=bt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const k=Qt(f).replace("Z",""),T=g.path(k,y),w=Qt(m).replace("Z",""),E=g.path(w,y),L=Qt(x),M=g.path(L,{...y}),N=i.insert("g",":first-child");return N.insert(()=>M,":first-child").attr("stroke-opacity",0),N.insert(()=>T,":first-child"),N.insert(()=>E,":first-child"),N.attr("class","text"),p&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),N.attr("transform",`translate(${d-d/4}, 0)`),o.attr("transform",`translate(${-c/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),wt(e,N),e.intersect=function(P){return pt.polygon(e,x,P)},i}v(Dw,"curlyBraces");async function Ow(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=20,l=5,{shapeSvg:c,bbox:u}=await Mt(t,e,Bt(e)),d=Math.max(a,(u.width+s*2)*1.25,(e==null?void 0:e.width)??0),p=Math.max(l,u.height+o*2,(e==null?void 0:e.height)??0),f=p/2,{cssStyles:m}=e,x=xt.svg(c),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,b=p,k=y-f,T=b/4,_=[{x:k,y:0},{x:T,y:0},{x:0,y:b/2},{x:T,y:b},{x:k,y:b},...ua(-k,-b/2,f,50,270,90)],w=Qt(_),E=x.path(w,g),L=c.insert(()=>E,":first-child");return L.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&L.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&L.selectChildren("path").attr("style",n),L.attr("transform",`translate(${-d/2}, ${-p/2})`),wt(e,L),e.intersect=function(M){return pt.polygon(e,_,M)},c}v(Ow,"curvedTrapezoid");var Az=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),Mz=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),Iz=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Dx=8,Ox=8;async function Rw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?24:i,o=e.look==="neo"?24:i;if(e.width||e.height){const g=e.width??0;e.width=(e.width??0)-o,e.width<Ox&&(e.width=Ox);const b=g/2/(2.5+g/50);e.height=(e.height??0)-s-b*3,e.height<Dx&&(e.height=Dx)}const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,Bt(e)),u=(e.width?e.width:l.width)+o,d=u/2,p=d/(2.5+u/50),f=(e.height?e.height:l.height)+s+p;let m;const{cssStyles:x}=e;if(e.look==="handDrawn"){const g=xt.svg(a),y=Mz(0,0,u,f,d,p),b=Iz(0,p,u,f,d,p),k=bt(e,{}),T=g.path(y,k),_=g.path(b,bt(e,{fill:"none"}));m=a.insert(()=>_,":first-child"),m=a.insert(()=>T,":first-child"),m.attr("class","basic label-container"),x&&m.attr("style",x)}else{const g=Az(0,0,u,f,d,p);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",De(x)).attr("style",n)}return m.attr("label-offset-y",p),m.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),wt(e,m),c.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+(e.padding??0)/1.5-(l.y-(l.top??0))})`),e.intersect=function(g){const y=pt.rect(e,g),b=y.x-(e.x??0);if(d!=0&&(Math.abs(b)<(e.width??0)/2||Math.abs(b)==(e.width??0)/2&&Math.abs(y.y-(e.y??0))>(e.height??0)/2-p)){let k=p*p*(1-b*b/(d*d));k>0&&(k=Math.sqrt(k)),k=p-k,g.y-(e.y??0)>0&&(k=-k),y.y+=k}return y},a}v(Rw,"cylinder");async function Zs(t,e,r){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await Mt(t,e,Bt(e)),a=Math.max(o.width+r.labelPaddingX*2,(e==null?void 0:e.width)||0),l=Math.max(o.height+r.labelPaddingY*2,(e==null?void 0:e.height)||0),c=-a/2,u=-l/2;let d,{rx:p,ry:f}=e;const{cssStyles:m}=e;if(r!=null&&r.rx&&r.ry&&(p=r.rx,f=r.ry),e.look==="handDrawn"){const x=xt.svg(s),g=bt(e,{}),y=p||f?x.path(ii(c,u,a,l,p||0),g):x.rectangle(c,u,a,l,g);d=s.insert(()=>y,":first-child"),d.attr("class","basic label-container").attr("style",De(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",De(p)).attr("ry",De(f)).attr("x",c).attr("y",u).attr("width",a).attr("height",l);return wt(e,d),e.calcIntersect=function(x,g){return pt.rect(x,g)},e.intersect=function(x){return pt.rect(e,x)},s}v(Zs,"drawRect");async function $w(t,e){const{cssClasses:r,labelPaddingX:n,labelPaddingY:i,padding:s,width:o,height:a}=e,l={rx:0,ry:0,labelPaddingX:n??(s??0)*2,labelPaddingY:i??s??0},c=await Zs(t,e,l);if(e.look==="handDrawn"){const f=xt.svg(c),m=bt(e,{}),x=c.select(".basic.label-container > path:nth-child(2)"),g=x.node();if(!g)return c;let y=null;if(g instanceof SVGGraphicsElement)y=g.getBBox();else return c;return c.insert(()=>f.line(y.x,y.y,y.x+y.width,y.y,m),".basic.label-container g.label"),c.insert(()=>f.line(y.x,y.y+y.height,y.x+y.width,y.y+y.height,m),".basic.label-container g.label"),x.remove(),c}const u=c.select(".basic.label-container"),d=(Number(u.attr("width"))||o)??0,p=(Number(u.attr("height"))||a)??0;return d>0&&p>0&&u.attr("stroke-dasharray",`${d} ${p}`),c}v($w,"datastore");async function zw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?16:e.padding??0,{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,Bt(e)),c=a.width+i,u=a.height+s,d=u*.2,p=-c/2,f=-u/2-d/2,{cssStyles:m}=e,x=xt.svg(o),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:p,y:f+d},{x:-p,y:f+d},{x:-p,y:-f},{x:p,y:-f},{x:p,y:f},{x:-p,y:f},{x:-p,y:f+d}],b=x.polygon(y.map(T=>[T.x,T.y]),g),k=o.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),l.attr("transform",`translate(${p+(e.padding??0)/2-(a.x-(a.left??0))}, ${f+d+(e.padding??0)/2-(a.y-(a.top??0))})`),wt(e,k),e.intersect=function(T){return pt.rect(e,T)},o}v(zw,"dividedRectangle");async function Ww(t,e){var f,m;const{labelStyles:r,nodeStyles:n}=Ct(e),i=e.look==="neo"?12:5;e.labelStyle=r;const s=e.padding??0,o=e.look==="neo"?16:s,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=(e!=null&&e.width?(e==null?void 0:e.width)/2:l.width/2)+(o??0),u=c-i;let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const x=xt.svg(a),g=bt(e,{roughness:.2,strokeWidth:2.5}),y=bt(e,{roughness:.2,strokeWidth:1.5}),b=x.circle(0,0,c*2,g),k=x.circle(0,0,u*2,y);d=a.insert("g",":first-child"),d.attr("class",De(e.cssClasses)).attr("style",De(p)),(f=d.node())==null||f.appendChild(b),(m=d.node())==null||m.appendChild(k)}else{d=a.insert("g",":first-child");const x=d.insert("circle",":first-child"),g=d.insert("circle");d.attr("class","basic label-container").attr("style",n),x.attr("class","outer-circle").attr("style",n).attr("r",c).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",n).attr("r",u).attr("cx",0).attr("cy",0)}return wt(e,d),e.intersect=function(x){return tt.info("DoubleCircle intersect",e,c,x),pt.circle(e,c,x)},a}v(Ww,"doublecircle");function qw(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=Ct(e);e.label="",e.labelStyle=n;const s=t.insert("g").attr("class",Bt(e)).attr("id",e.domId??e.id),o=7,{cssStyles:a}=e,l=xt.svg(s),{nodeBorder:c}=r,u=bt(e,{fillStyle:"solid"});e.look!=="handDrawn"&&(u.roughness=0);const d=l.circle(0,0,o*2,u),p=s.insert(()=>d,":first-child");return p.selectAll("path").attr("style",`fill: ${c} !important;`),a&&a.length>0&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",a),i&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",i),wt(e,p),e.intersect=function(f){return tt.info("filledCircle intersect",e,{radius:o,point:f}),pt.circle(e,o,f)},s}v(qw,"filledCircle");var Rx=10,$x=10;async function Hw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?i*2:i;(e.width||e.height)&&(e.height=(e==null?void 0:e.height)??0,e.height<Rx&&(e.height=Rx),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<$x&&(e.width=$x));const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,Bt(e)),c=(e!=null&&e.width?e==null?void 0:e.width:a.width)+(s??0),u=e!=null&&e.height?e==null?void 0:e.height:c+a.height,d=u,p=[{x:0,y:-u},{x:d,y:-u},{x:d/2,y:0}],{cssStyles:f}=e,m=xt.svg(o),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Qt(p),y=m.path(g,x),b=o.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`).attr("class","outer-path");return f&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),e.width=c,e.height=u,wt(e,b),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-u/2+(e.padding??0)/2+(a.y-(a.top??0))})`),e.intersect=function(k){return tt.info("Triangle intersect",e,p,k),pt.polygon(e,p,k)},o}v(Hw,"flippedTriangle");function Uw(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=Ct(e);e.label="";const o=t.insert("g").attr("class",Bt(e)).attr("id",e.domId??e.id),{cssStyles:a}=e;let l=Math.max(70,(e==null?void 0:e.width)??0),c=Math.max(10,(e==null?void 0:e.height)??0);r==="LR"&&(l=Math.max(10,(e==null?void 0:e.width)??0),c=Math.max(70,(e==null?void 0:e.height)??0));const u=-1*l/2,d=-1*c/2,p=xt.svg(o),f=bt(e,{stroke:i.lineColor,fill:i.lineColor});e.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const m=p.rectangle(u,d,l,c,f),x=o.insert(()=>m,":first-child");a&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",a),s&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",s),wt(e,x);const g=(n==null?void 0:n.padding)??0;return e.width&&e.height&&(e.width+=g/2||0,e.height+=g/2||0),e.intersect=function(y){return pt.rect(e,y)},o}v(Uw,"forkJoin");async function Gw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=15,s=10,o=e.look==="neo"?16:e.padding??0,a=e.look==="neo"?12:e.padding??0;(e.width||e.height)&&(e.height=((e==null?void 0:e.height)??0)-a*2,e.height<s&&(e.height=s),e.width=((e==null?void 0:e.width)??0)-o*2,e.width<i&&(e.width=i));const{shapeSvg:l,bbox:c}=await Mt(t,e,Bt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:Math.max(i,c.width))+o*2,d=(e!=null&&e.height?e==null?void 0:e.height:Math.max(s,c.height))+a*2,p=d/2,{cssStyles:f}=e,m=xt.svg(l),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-u/2,y:-d/2},{x:u/2-p,y:-d/2},...ua(-u/2+p,0,p,50,90,270),{x:u/2-p,y:d/2},{x:-u/2,y:d/2}],y=Qt(g),b=m.path(y,x),k=l.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),wt(e,k),e.intersect=function(T){return tt.info("Pill intersect",e,{radius:p,point:T}),pt.polygon(e,g,T)},l}v(Gw,"halfRoundedRectangle");var Fz=v((t,e,r,n,i)=>[`M${t+i},${e}`,`L${t+r-i},${e}`,`L${t+r},${e-n/2}`,`L${t+r-i},${e-n}`,`L${t+i},${e-n}`,`L${t},${e-n/2}`,"Z"].join(" "),"createHexagonPathD");async function Vw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e),i=e.look==="neo"?3.5:4;e.labelStyle=r;const s=e.padding??0,o=70,a=32,l=e.look==="neo"?o:s,c=e.look==="neo"?a:s;if(e.width||e.height){const k=(e.height??0)/i;e.width=((e==null?void 0:e.width)??0)-2*k-c,e.height=(e.height??0)-l}const{shapeSvg:u,bbox:d}=await Mt(t,e,Bt(e)),p=(e!=null&&e.height?e==null?void 0:e.height:d.height)+l,f=p/i,m=(e!=null&&e.width?e==null?void 0:e.width:d.width)+2*f+c,x=[{x:f,y:0},{x:m-f,y:0},{x:m,y:-p/2},{x:m-f,y:-p},{x:f,y:-p},{x:0,y:-p/2}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const b=xt.svg(u),k=bt(e,{}),T=Fz(0,0,m,p,f),_=b.path(T,k);g=u.insert(()=>_,":first-child").attr("transform",`translate(${-m/2}, ${p/2})`),y&&g.attr("style",y)}else g=jn(u,m,p,x);return n&&g.attr("style",n),e.width=m,e.height=p,wt(e,g),e.intersect=function(b){return pt.polygon(e,x,b)},u}v(Vw,"hexagon");async function Yw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await Mt(t,e,Bt(e)),s=Math.max(30,(e==null?void 0:e.width)??0),o=Math.max(30,(e==null?void 0:e.height)??0),{cssStyles:a}=e,l=xt.svg(i),c=bt(e,{});e.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const u=[{x:0,y:0},{x:s,y:0},{x:0,y:o},{x:s,y:o}],d=Qt(u),p=l.path(d,c),f=i.insert(()=>p,":first-child");return f.attr("class","basic label-container outer-path"),a&&e.look!=="handDrawn"&&f.selectChildren("path").attr("style",a),n&&e.look!=="handDrawn"&&f.selectChildren("path").attr("style",n),f.attr("transform",`translate(${-s/2}, ${-o/2})`),wt(e,f),e.intersect=function(m){return tt.info("Pill intersect",e,{points:u}),pt.polygon(e,u,m)},i}v(Yw,"hourglass");async function Xw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,label:d}=await Mt(t,e,"icon-shape default"),p=e.pos==="t",f=a,m=a,{nodeBorder:x}=r,{stylesMap:g}=Xs(e),y=-m/2,b=-f/2,k=e.label?8:0,T=xt.svg(c),_=bt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=T.rectangle(y,b,m,f,_),E=Math.max(m,u.width),L=f+u.height+k,M=T.rectangle(-E/2,-L/2,E,L,{..._,fill:"transparent",stroke:"none"}),N=c.insert(()=>w,":first-child"),P=c.insert(()=>M);if(e.icon){const $=c.append("g");$.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const q=$.node().getBBox(),O=q.width,I=q.height,F=q.x,D=q.y;$.attr("transform",`translate(${-O/2-F},${p?u.height/2+k/2-I/2-D:-u.height/2-k/2-I/2-D})`),$.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-L/2:L/2-u.height})`),N.attr("transform",`translate(0,${p?u.height/2+k/2:-u.height/2-k/2})`),wt(e,P),e.intersect=function($){if(tt.info("iconSquare intersect",e,$),!e.label)return pt.rect(e,$);const q=e.x??0,O=e.y??0,I=e.height??0;let F=[];return p?F=[{x:q-u.width/2,y:O-I/2},{x:q+u.width/2,y:O-I/2},{x:q+u.width/2,y:O-I/2+u.height+k},{x:q+m/2,y:O-I/2+u.height+k},{x:q+m/2,y:O+I/2},{x:q-m/2,y:O+I/2},{x:q-m/2,y:O-I/2+u.height+k},{x:q-u.width/2,y:O-I/2+u.height+k}]:F=[{x:q-m/2,y:O-I/2},{x:q+m/2,y:O-I/2},{x:q+m/2,y:O-I/2+f},{x:q+u.width/2,y:O-I/2+f},{x:q+u.width/2/2,y:O+I/2},{x:q-u.width/2,y:O+I/2},{x:q-u.width/2,y:O-I/2+f},{x:q-m/2,y:O-I/2+f}],pt.polygon(e,F,$)},c}v(Xw,"icon");async function Kw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,label:d}=await Mt(t,e,"icon-shape default"),p=20,f=e.label?8:0,m=e.pos==="t",{nodeBorder:x,mainBkg:g}=r,{stylesMap:y}=Xs(e),b=xt.svg(c),k=bt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const T=y.get("fill");k.stroke=T??g;const _=c.append("g");e.icon&&_.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const w=_.node().getBBox(),E=w.width,L=w.height,M=w.x,N=w.y,P=Math.max(E,L)*Math.SQRT2+p*2,$=b.circle(0,0,P,k),q=Math.max(P,u.width),O=P+u.height+f,I=b.rectangle(-q/2,-O/2,q,O,{...k,fill:"transparent",stroke:"none"}),F=c.insert(()=>$,":first-child"),D=c.insert(()=>I);return _.attr("transform",`translate(${-E/2-M},${m?u.height/2+f/2-L/2-N:-u.height/2-f/2-L/2-N})`),_.attr("style",`color: ${y.get("stroke")??x};`),d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${m?-O/2:O/2-u.height})`),F.attr("transform",`translate(0,${m?u.height/2+f/2:-u.height/2-f/2})`),wt(e,D),e.intersect=function(R){return tt.info("iconSquare intersect",e,R),pt.rect(e,R)},c}v(Kw,"iconCircle");async function Zw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,halfPadding:d,label:p}=await Mt(t,e,"icon-shape default"),f=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:b}=Xs(e),k=-x/2,T=-m/2,_=e.label?8:0,w=xt.svg(c),E=bt(e,{});e.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");const L=b.get("fill");E.stroke=L??y;const M=w.path(ii(k,T,x,m,5),E),N=Math.max(x,u.width),P=m+u.height+_,$=w.rectangle(-N/2,-P/2,N,P,{...E,fill:"transparent",stroke:"none"}),q=c.insert(()=>M,":first-child").attr("class","icon-shape2"),O=c.insert(()=>$);if(e.icon){const I=c.append("g");I.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=I.node().getBBox(),D=F.width,R=F.height,j=F.x,S=F.y;I.attr("transform",`translate(${-D/2-j},${f?u.height/2+_/2-R/2-S:-u.height/2-_/2-R/2-S})`),I.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-P/2:P/2-u.height})`),q.attr("transform",`translate(0,${f?u.height/2+_/2:-u.height/2-_/2})`),wt(e,O),e.intersect=function(I){if(tt.info("iconSquare intersect",e,I),!e.label)return pt.rect(e,I);const F=e.x??0,D=e.y??0,R=e.height??0;let j=[];return f?j=[{x:F-u.width/2,y:D-R/2},{x:F+u.width/2,y:D-R/2},{x:F+u.width/2,y:D-R/2+u.height+_},{x:F+x/2,y:D-R/2+u.height+_},{x:F+x/2,y:D+R/2},{x:F-x/2,y:D+R/2},{x:F-x/2,y:D-R/2+u.height+_},{x:F-u.width/2,y:D-R/2+u.height+_}]:j=[{x:F-x/2,y:D-R/2},{x:F+x/2,y:D-R/2},{x:F+x/2,y:D-R/2+m},{x:F+u.width/2,y:D-R/2+m},{x:F+u.width/2/2,y:D+R/2},{x:F-u.width/2,y:D+R/2},{x:F-u.width/2,y:D-R/2+m},{x:F-x/2,y:D-R/2+m}],pt.polygon(e,j,I)},c}v(Zw,"iconRounded");async function Qw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:c,bbox:u,halfPadding:d,label:p}=await Mt(t,e,"icon-shape default"),f=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:b}=Xs(e),k=-x/2,T=-m/2,_=e.label?8:0,w=xt.svg(c),E=bt(e,{});e.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");const L=b.get("fill");E.stroke=L??y;const M=w.path(ii(k,T,x,m,.1),E),N=Math.max(x,u.width),P=m+u.height+_,$=w.rectangle(-N/2,-P/2,N,P,{...E,fill:"transparent",stroke:"none"}),q=c.insert(()=>M,":first-child"),O=c.insert(()=>$);if(e.icon){const I=c.append("g");I.html(`<g>${await ja(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=I.node().getBBox(),D=F.width,R=F.height,j=F.x,S=F.y;I.attr("transform",`translate(${-D/2-j},${f?u.height/2+_/2-R/2-S:-u.height/2-_/2-R/2-S})`),I.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-P/2:P/2-u.height})`),q.attr("transform",`translate(0,${f?u.height/2+_/2:-u.height/2-_/2})`),wt(e,O),e.intersect=function(I){if(tt.info("iconSquare intersect",e,I),!e.label)return pt.rect(e,I);const F=e.x??0,D=e.y??0,R=e.height??0;let j=[];return f?j=[{x:F-u.width/2,y:D-R/2},{x:F+u.width/2,y:D-R/2},{x:F+u.width/2,y:D-R/2+u.height+_},{x:F+x/2,y:D-R/2+u.height+_},{x:F+x/2,y:D+R/2},{x:F-x/2,y:D+R/2},{x:F-x/2,y:D-R/2+u.height+_},{x:F-u.width/2,y:D-R/2+u.height+_}]:j=[{x:F-x/2,y:D-R/2},{x:F+x/2,y:D-R/2},{x:F+x/2,y:D-R/2+m},{x:F+u.width/2,y:D-R/2+m},{x:F+u.width/2/2,y:D+R/2},{x:F-u.width/2,y:D+R/2},{x:F-u.width/2,y:D-R/2+m},{x:F-x/2,y:D-R/2+m}],pt.polygon(e,j,I)},c}v(Qw,"iconSquare");async function Jw(t,e,{config:{flowchart:r}}){const n=new Image;n.src=(e==null?void 0:e.img)??"",await n.decode();const i=Number(n.naturalWidth.toString().replace("px","")),s=Number(n.naturalHeight.toString().replace("px",""));e.imageAspectRatio=i/s;const{labelStyles:o}=Ct(e);e.labelStyle=o;const a=r==null?void 0:r.wrappingWidth;e.defaultWidth=r==null?void 0:r.wrappingWidth;const l=Math.max(e.label?a??0:0,(e==null?void 0:e.assetWidth)??i),c=e.constraint==="on"&&e!=null&&e.assetHeight?e.assetHeight*e.imageAspectRatio:l,u=e.constraint==="on"?c/e.imageAspectRatio:(e==null?void 0:e.assetHeight)??s;e.width=Math.max(c,a??0);const{shapeSvg:d,bbox:p,label:f}=await Mt(t,e,"image-shape default"),m=e.pos==="t",x=-c/2,g=-u/2,y=e.label?8:0,b=xt.svg(d),k=bt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const T=b.rectangle(x,g,c,u,k),_=Math.max(c,p.width),w=u+p.height+y,E=b.rectangle(-_/2,-w/2,_,w,{...k,fill:"none",stroke:"none"}),L=d.insert(()=>T,":first-child"),M=d.insert(()=>E);if(e.img){const N=d.append("image");N.attr("href",e.img),N.attr("width",c),N.attr("height",u),N.attr("preserveAspectRatio","none"),N.attr("transform",`translate(${-c/2},${m?w/2-u:-w/2})`)}return f.attr("transform",`translate(${-p.width/2-(p.x-(p.left??0))},${m?-u/2-p.height/2-y/2:u/2-p.height/2+y/2})`),L.attr("transform",`translate(0,${m?p.height/2+y/2:-p.height/2-y/2})`),wt(e,M),e.intersect=function(N){if(tt.info("iconSquare intersect",e,N),!e.label)return pt.rect(e,N);const P=e.x??0,$=e.y??0,q=e.height??0;let O=[];return m?O=[{x:P-p.width/2,y:$-q/2},{x:P+p.width/2,y:$-q/2},{x:P+p.width/2,y:$-q/2+p.height+y},{x:P+c/2,y:$-q/2+p.height+y},{x:P+c/2,y:$+q/2},{x:P-c/2,y:$+q/2},{x:P-c/2,y:$-q/2+p.height+y},{x:P-p.width/2,y:$-q/2+p.height+y}]:O=[{x:P-c/2,y:$-q/2},{x:P+c/2,y:$-q/2},{x:P+c/2,y:$-q/2+u},{x:P+p.width/2,y:$-q/2+u},{x:P+p.width/2/2,y:$+q/2},{x:P-p.width/2,y:$+q/2},{x:P-p.width/2,y:$-q/2+u},{x:P-c/2,y:$-q/2+u}],pt.polygon(e,O,N)},d}v(Jw,"imageSquare");async function t2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=Math.max(l.width+(o??0)*2,(e==null?void 0:e.width)??0),u=Math.max(l.height+(s??0)*2,(e==null?void 0:e.height)??0),d=[{x:0,y:0},{x:c,y:0},{x:c+3*u/6,y:-u},{x:-3*u/6,y:-u}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${u/2})`),f&&p.attr("style",f)}else p=jn(a,c,u,d);return n&&p.attr("style",n),e.width=c,e.height=u,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(t2,"inv_trapezoid");async function e2(t,e){const{shapeSvg:r,bbox:n,label:i}=await Mt(t,e,"label"),s=r.insert("rect",":first-child");return s.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),i.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),wt(e,s),e.intersect=function(l){return pt.rect(e,l)},r}v(e2,"labelRect");async function r2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:0,y:0},{x:u+3*c/6,y:0},{x:u,y:-c},{x:-(3*c)/6,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=jn(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(r2,"lean_left");async function n2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*c/6,y:0},{x:u,y:0},{x:u+3*c/6,y:-c},{x:0,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=jn(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(n2,"lean_right");function i2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.label="",e.labelStyle=r;const i=t.insert("g").attr("class",Bt(e)).attr("id",e.domId??e.id),{cssStyles:s}=e,o=Math.max(35,(e==null?void 0:e.width)??0),a=Math.max(35,(e==null?void 0:e.height)??0),l=7,c=[{x:o,y:0},{x:0,y:a+l/2},{x:o-2*l,y:a+l/2},{x:0,y:2*a},{x:o,y:a-l/2},{x:2*l,y:a-l/2}],u=xt.svg(i),d=bt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const p=Qt(c),f=u.path(p,d),m=i.insert(()=>f,":first-child");return m.attr("class","outer-path"),s&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",s),n&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",n),m.attr("transform",`translate(-${o/2},${-a})`),wt(e,m),e.intersect=function(x){return tt.info("lightningBolt intersect",e,x),pt.polygon(e,c,x)},i}v(i2,"lightningBolt");var Pz=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),Dz=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),Oz=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),zx=10,Wx=10;async function s2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?24:i;if(e.width||e.height){const y=e.width??0;e.width=(e.width??0)-s,e.width<Wx&&(e.width=Wx);const k=y/2/(2.5+y/50);e.height=(e.height??0)-o-k*3,e.height<zx&&(e.height=zx)}const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,Bt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=u/2,p=d/(2.5+u/50),f=(e!=null&&e.height?e==null?void 0:e.height:l.height)+p+o*2,m=f*.1;let x;const{cssStyles:g}=e;if(e.look==="handDrawn"){const y=xt.svg(a),b=Dz(0,0,u,f,d,p,m),k=Oz(0,p,u,f,d,p),T=bt(e,{}),_=y.path(b,T),w=y.path(k,T);a.insert(()=>w,":first-child").attr("class","line"),x=a.insert(()=>_,":first-child"),x.attr("class","basic label-container"),g&&x.attr("style",g)}else{const y=Pz(0,0,u,f,d,p,m);x=a.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",De(g)).attr("style",n)}return x.attr("label-offset-y",p),x.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),wt(e,x),c.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+p-(l.y-(l.top??0))})`),e.intersect=function(y){const b=pt.rect(e,y),k=b.x-(e.x??0);if(d!=0&&(Math.abs(k)<(e.width??0)/2||Math.abs(k)==(e.width??0)/2&&Math.abs(b.y-(e.y??0))>(e.height??0)/2-p)){let T=p*p*(1-k*k/(d*d));T>0&&(T=Math.sqrt(T)),T=p-T,y.y-(e.y??0)>0&&(T=-T),b.y+=T}return b},a}v(s2,"linedCylinder");async function o2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;if(e.width||e.height){const T=e.width;e.width=(T??0)*10/11-s*2,e.width<10&&(e.width=10),e.height=((e==null?void 0:e.height)??0)-o*2,e.height<10&&(e.height=10)}const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,Bt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+(s??0)*2,d=(e!=null&&e.height?e==null?void 0:e.height:l.height)+(o??0)*2,p=e.look==="neo"?d/4:d/8,f=d+p,{cssStyles:m}=e,x=xt.svg(a),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:-u/2-u/2*.1,y:-f/2},{x:-u/2-u/2*.1,y:f/2},...Qn(-u/2-u/2*.1,f/2,u/2+u/2*.1,f/2,p,.8),{x:u/2+u/2*.1,y:-f/2},{x:-u/2-u/2*.1,y:-f/2},{x:-u/2,y:-f/2},{x:-u/2,y:f/2*1.1},{x:-u/2,y:-f/2}],b=x.polygon(y.map(T=>[T.x,T.y]),g),k=a.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(0,${-p/2})`),c.attr("transform",`translate(${-u/2+(e.padding??0)+u/2*.1/2-(l.x-(l.left??0))},${-d/2+(e.padding??0)-p/2-(l.y-(l.top??0))})`),wt(e,k),e.intersect=function(T){return pt.polygon(e,y,T)},a}v(o2,"linedWaveEdgedRect");async function a2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=e.look==="neo"?10:5;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-s*2-2*a,10),e.height=Math.max(((e==null?void 0:e.height)??0)-o*2-2*a,10));const{shapeSvg:l,bbox:c,label:u}=await Mt(t,e,Bt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:c.width)+s*2+2*a,p=(e!=null&&e.height?e==null?void 0:e.height:c.height)+o*2+2*a,f=d-2*a,m=p-2*a,x=-f/2,g=-m/2,{cssStyles:y}=e,b=xt.svg(l),k=bt(e,{}),T=[{x:x-a,y:g+a},{x:x-a,y:g+m+a},{x:x+f-a,y:g+m+a},{x:x+f-a,y:g+m},{x:x+f,y:g+m},{x:x+f,y:g+m-a},{x:x+f+a,y:g+m-a},{x:x+f+a,y:g-a},{x:x+a,y:g-a},{x:x+a,y:g},{x,y:g},{x,y:g+a}],_=[{x,y:g+a},{x:x+f-a,y:g+a},{x:x+f-a,y:g+m},{x:x+f,y:g+m},{x:x+f,y:g},{x,y:g}];e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const w=Qt(T);let E=b.path(w,k);const L=Qt(_);let M=b.path(L,k);e.look!=="handDrawn"&&(E=Rd(E),M=Rd(M));const N=l.insert("g",":first-child");return N.insert(()=>E),N.insert(()=>M),N.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),u.attr("transform",`translate(${-(c.width/2)-a-(c.x-(c.left??0))}, ${-(c.height/2)+a-(c.y-(c.top??0))})`),wt(e,N),e.intersect=function(P){return pt.polygon(e,T,P)},l}v(a2,"multiRect");async function l2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,Bt(e)),a=e.padding??0,l=e.look==="neo"?16:a,c=e.look==="neo"?12:a;let u=!0;(e.width||e.height)&&(u=!1,e.width=((e==null?void 0:e.width)??0)-l*2,e.height=((e==null?void 0:e.height)??0)-c*3);const d=Math.max(s.width,(e==null?void 0:e.width)??0)+l*2,p=Math.max(s.height,(e==null?void 0:e.height)??0)+c*3,f=e.look==="neo"?p/4:p/8,m=p+(u?f/2:-f/2),x=-d/2,g=-m/2,y=10,{cssStyles:b}=e,k=Qn(x-y,g+m+y,x+d-y,g+m+y,f,.8),T=k==null?void 0:k[k.length-1],_=[{x:x-y,y:g+y},{x:x-y,y:g+m+y},...k,{x:x+d-y,y:T.y-y},{x:x+d,y:T.y-y},{x:x+d,y:T.y-2*y},{x:x+d+y,y:T.y-2*y},{x:x+d+y,y:g-y},{x:x+y,y:g-y},{x:x+y,y:g},{x,y:g},{x,y:g+y}],w=[{x,y:g+y},{x:x+d-y,y:g+y},{x:x+d-y,y:T.y-y},{x:x+d,y:T.y-y},{x:x+d,y:g},{x,y:g}],E=xt.svg(i),L=bt(e,{});e.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const M=Qt(_),N=E.path(M,L),P=Qt(w),$=E.path(P,L),q=i.insert(()=>N,":first-child");return q.insert(()=>$),q.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&q.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&q.selectAll("path").attr("style",n),q.attr("transform",`translate(0,${-f/2})`),o.attr("transform",`translate(${-(s.width/2)-y-(s.x-(s.left??0))}, ${-(s.height/2)+y-f/2-(s.y-(s.top??0))})`),wt(e,q),e.intersect=function(O){return pt.polygon(e,_,O)},i}v(l2,"multiWaveEdgedRectangle");async function c2(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n,e.useHtmlLabels||or(be())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,Bt(e)),c=Math.max(a.width+(e.padding??0)*2,(e==null?void 0:e.width)??0),u=Math.max(a.height+(e.padding??0)*2,(e==null?void 0:e.height)??0),d=-c/2,p=-u/2,{cssStyles:f}=e,m=xt.svg(o),x=bt(e,{fill:r.noteBkgColor,stroke:r.noteBorderColor});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=m.rectangle(d,p,c,u,x),y=o.insert(()=>g,":first-child");return y.attr("class","basic label-container outer-path"),l.attr("class","label noteLabel"),f&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",f),i&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",i),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),wt(e,y),e.intersect=function(b){return pt.rect(e,b)},o}v(c2,"note");var Rz=v((t,e,r)=>[`M${t+r/2},${e}`,`L${t+r},${e-r/2}`,`L${t+r/2},${e-r}`,`L${t},${e-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function h2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Mt(t,e,Bt(e)),o=s.width+(e.padding??0),a=s.height+(e.padding??0),l=o+a,c=.5,u=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const f=xt.svg(i),m=bt(e,{}),x=Rz(0,0,l),g=f.path(x,m);d=i.insert(()=>g,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),p&&d.attr("style",p)}else d=jn(i,l,l,u),d.attr("transform",`translate(${-l/2+c}, ${l/2})`);return n&&d.attr("style",n),wt(e,d),e.calcIntersect=function(f,m){const x=f.width,g=[{x:x/2,y:0},{x,y:-x/2},{x:x/2,y:-x},{x:0,y:-x/2}],y=pt.polygon(f,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(f){return this.calcIntersect(e,f)},i}v(h2,"question");async function u2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?21:i??0,o=e.look==="neo"?12:i??0,{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,Bt(e)),u=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s),d=((e==null?void 0:e.height)??l.height)+(e.look==="neo"?o*2:o),p=-u/2,f=-d/2,m=f/2,x=[{x:p+m,y:f},{x:p,y:0},{x:p+m,y:-f},{x:-p,y:-f},{x:-p,y:f}],{cssStyles:g}=e,y=xt.svg(a),b=bt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const k=Qt(x),T=y.path(k,b),_=a.insert(()=>T,":first-child");return _.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",g),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${-m/2},0)`),c.attr("transform",`translate(${-m/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),wt(e,_),e.intersect=function(w){return pt.polygon(e,x,w)},a}v(u2,"rect_left_inv_arrow");async function d2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;let i;e.cssClasses?i="node "+e.cssClasses:i="node default";const s=t.insert("g").attr("class",i).attr("id",e.domId||e.id),o=s.insert("g"),a=s.insert("g").attr("class","label").attr("style",n),l=e.description,c=e.label,u=await Wn(a,c,e.labelStyle,!0,!0);let d={width:0,height:0};if(or(re())){const L=u.children[0],M=Gt(u);d=L.getBoundingClientRect(),M.attr("width",d.width),M.attr("height",d.height)}tt.info("Text 2",l);const p=l||[],f=u.getBBox(),m=await Wn(a,Array.isArray(p)?p.join("<br/>"):p,e.labelStyle,!0,!0),x=m.children[0],g=Gt(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;Gt(m).attr("transform","translate( "+(d.width>f.width?0:(f.width-d.width)/2)+", "+(f.height+y+5)+")"),Gt(u).attr("transform","translate( "+(d.width<f.width?0:-(f.width-d.width)/2)+", 0)"),d=a.node().getBBox(),a.attr("transform","translate("+-d.width/2+", "+(-d.height/2-y+3)+")");const b=d.width+(e.padding||0),k=d.height+(e.padding||0),T=-d.width/2-y,_=-d.height/2-y;let w,E;if(e.look==="handDrawn"){const L=xt.svg(s),M=bt(e,{}),N=L.path(ii(T,_,b,k,e.rx||0),M),P=L.line(-d.width/2-y,-d.height/2-y+f.height+y,d.width/2+y,-d.height/2-y+f.height+y,M);E=s.insert(()=>(tt.debug("Rough node insert CXC",N),P),":first-child"),w=s.insert(()=>(tt.debug("Rough node insert CXC",N),N),":first-child")}else w=o.insert("rect",":first-child"),E=o.insert("line"),w.attr("class","outer title-state").attr("style",n).attr("x",-d.width/2-y).attr("y",-d.height/2-y).attr("width",d.width+(e.padding||0)).attr("height",d.height+(e.padding||0)),E.attr("class","divider").attr("x1",-d.width/2-y).attr("x2",d.width/2+y).attr("y1",-d.height/2-y+f.height+y).attr("y2",-d.height/2-y+f.height+y);return wt(e,w),e.intersect=function(L){return pt.rect(e,L)},s}v(d2,"rectWithTitle");async function f2(t,e,{config:{themeVariables:r}}){const n=(r==null?void 0:r.radius)??5,i={rx:n,ry:n,labelPaddingX:((e==null?void 0:e.padding)??0)*1,labelPaddingY:((e==null?void 0:e.padding)??0)*1};return Zs(t,e,i)}v(f2,"roundedRect");var di=8;async function p2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?12:e.padding??0,{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,Bt(e)),c=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?di:di*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=c-di,p=u,f=di-c/2,m=-u/2,{cssStyles:x}=e,g=xt.svg(o),y=bt(e,{});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=[{x:f,y:m},{x:f+d,y:m},{x:f+d,y:m+p},{x:f-di,y:m+p},{x:f-di,y:m},{x:f,y:m},{x:f,y:m+p}],k=g.polygon(b.map(_=>[_.x,_.y]),y),T=o.insert(()=>k,":first-child");return T.attr("class","basic label-container outer-path").attr("style",De(x)),n&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",n),l.attr("transform",`translate(${di/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),wt(e,T),e.intersect=function(_){return pt.rect(e,_)},o}v(p2,"shadedProcess");async function m2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-s*2,10),e.height=Math.max(((e==null?void 0:e.height)??0)/1.5-o*2,10));const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,Bt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=((e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2)*1.5,p=u,f=d/1.5,m=-p/2,x=-f/2,{cssStyles:g}=e,y=xt.svg(a),b=bt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const k=[{x:m,y:x},{x:m,y:x+f},{x:m+p,y:x+f},{x:m+p,y:x-f/2}],T=Qt(k),_=y.path(T,b),w=a.insert(()=>_,":first-child");return w.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&w.selectChildren("path").attr("style",g),n&&e.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),w.attr("transform",`translate(0, ${f/4})`),c.attr("transform",`translate(${-p/2+(e.padding??0)-(l.x-(l.left??0))}, ${-f/4+(e.padding??0)-(l.y-(l.top??0))})`),wt(e,w),e.intersect=function(E){return pt.polygon(e,k,E)},a}v(m2,"slopedRect");async function g2(t,e){const r=e.padding??0,n=e.look==="neo"?16:r*2,i=e.look==="neo"?12:r,s={rx:0,ry:0,labelPaddingX:e.labelPaddingX??n,labelPaddingY:i};return Zs(t,e,s)}v(g2,"squareRect");async function x2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?20:i,o=e.look==="neo"?12:i,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=l.height+(e.look==="neo"?o*2:o),u=l.width+c/4+(e.look==="neo"?s*2:s),d=c/2,{cssStyles:p}=e,f=xt.svg(a),m=bt(e,{});e.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const x=[{x:-u/2+d,y:-c/2},{x:u/2-d,y:-c/2},...ua(-u/2+d,0,d,50,90,270),{x:u/2-d,y:c/2},...ua(u/2-d,0,d,50,270,450)],g=Qt(x),y=f.path(g,m),b=a.insert(()=>y,":first-child");return b.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",p),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),wt(e,b),e.intersect=function(k){return pt.polygon(e,x,k)},a}v(x2,"stadium");async function y2(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return Zs(t,e,r)}v(y2,"state");function b2(t,e,{config:{themeVariables:r}}){var b,k;const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{cssStyles:s}=e,{lineColor:o,stateBorder:a,nodeBorder:l,nodeShadow:c}=r;(e.width||e.height)&&((e.width??0)<14&&(e.width=14),(e.height??0)<14&&(e.height=14)),e.width||(e.width=14),e.height||(e.height=14);const u=t.insert("g").attr("class","node default").attr("id",e.domId??e.id),d=xt.svg(u),p=bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const f=d.circle(0,0,e.width,{...p,stroke:o,strokeWidth:2}),m=a??l,x=(e.width??0)*5/14,g=d.circle(0,0,x,{...p,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),y=u.insert(()=>f,":first-child");if(y.insert(()=>g),e.look!=="handDrawn"&&y.attr("class","outer-path"),s&&y.selectAll("path").attr("style",s),i&&y.selectAll("path").attr("style",i),e.width<25&&c&&e.look!=="handDrawn"){const T=((k=(b=t.node())==null?void 0:b.ownerSVGElement)==null?void 0:k.id)??"",_=T?`${T}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${_})`)}return wt(e,y),e.intersect=function(T){return pt.circle(e,(e.width??0)/2,T)},u}v(b2,"stateEnd");function C2(t,e,{config:{themeVariables:r}}){var a,l;const{lineColor:n,nodeShadow:i}=r;(e.width||e.height)&&((e.width??0)<14&&(e.width=14),(e.height??0)<14&&(e.height=14)),e.width||(e.width=14),e.height||(e.height=14);const s=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let o;if(e.look==="handDrawn"){const u=xt.svg(s).circle(0,0,e.width,Y6(n));o=s.insert(()=>u),o.attr("class","state-start").attr("r",(e.width??7)/2).attr("width",e.width??14).attr("height",e.height??14)}else o=s.insert("circle",":first-child"),o.attr("class","state-start").attr("r",(e.width??7)/2).attr("width",e.width??14).attr("height",e.height??14);if(e.width<25&&i&&e.look!=="handDrawn"){const c=((l=(a=t.node())==null?void 0:a.ownerSVGElement)==null?void 0:l.id)??"",u=c?`${c}-drop-shadow-small`:"drop-shadow-small";o.attr("style",`filter:url(#${u})`)}return wt(e,o),e.intersect=function(c){return pt.circle(e,(e.width??7)/2,c)},s}v(C2,"stateStart");var Xi=8;async function k2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=(e==null?void 0:e.padding)??8,s=e.look==="neo"?28:i,o=e.look==="neo"?12:i,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=((e==null?void 0:e.width)??l.width)+2*Xi+s,u=((e==null?void 0:e.height)??l.height)+o,d=c-2*Xi,p=u,f=-c/2,m=-u/2,x=[{x:0,y:0},{x:d,y:0},{x:d,y:-p},{x:0,y:-p},{x:0,y:0},{x:-8,y:0},{x:d+8,y:0},{x:d+8,y:-p},{x:-8,y:-p},{x:-8,y:0}];if(e.look==="handDrawn"){const g=xt.svg(a),y=bt(e,{}),b=g.rectangle(f,m,d+16,p,y),k=g.line(f+Xi,m,f+Xi,m+p,y),T=g.line(f+Xi+d,m,f+Xi+d,m+p,y);a.insert(()=>k,":first-child"),a.insert(()=>T,":first-child");const _=a.insert(()=>b,":first-child"),{cssStyles:w}=e;_.attr("class","basic label-container").attr("style",De(w)),wt(e,_)}else{const g=jn(a,d,p,x);n&&g.attr("style",n),wt(e,g)}return e.intersect=function(g){return pt.polygon(e,x,g)},a}v(k2,"subroutine");var fu=.2;async function v2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;(e.width||e.height)&&(e.height=Math.max(((e==null?void 0:e.height)??0)-o*2,10),e.width=Math.max(((e==null?void 0:e.width)??0)-s*2-fu*(e.height+o*2),10));const{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2,u=fu*c,d=fu*c,f=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2+u-u,m=c,x=-f/2,g=-m/2,{cssStyles:y}=e,b=xt.svg(a),k=bt(e,{}),T=[{x:x-u/2,y:g},{x:x+f+u/2,y:g},{x:x+f+u/2,y:g+m},{x:x-u/2,y:g+m}],_=[{x:x+f-u/2,y:g+m},{x:x+f+u/2,y:g+m},{x:x+f+u/2,y:g+m-d}];e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const w=Qt(T),E=b.path(w,k),L=Qt(_),M=b.path(L,{...k,fillStyle:"solid"}),N=a.insert(()=>M,":first-child");return N.insert(()=>E,":first-child"),N.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),wt(e,N),e.intersect=function(P){return pt.polygon(e,T,P)},a}v(v2,"taggedRect");async function w2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Mt(t,e,Bt(e)),a=Math.max(s.width+(e.padding??0)*2,(e==null?void 0:e.width)??0),l=Math.max(s.height+(e.padding??0)*2,(e==null?void 0:e.height)??0),c=l/8,u=.2*a,d=.2*l,p=l+c,{cssStyles:f}=e,m=xt.svg(i),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:p/2},...Qn(-a/2-a/2*.1,p/2,a/2+a/2*.1,p/2,c,.8),{x:a/2+a/2*.1,y:-p/2},{x:-a/2-a/2*.1,y:-p/2}],y=-a/2+a/2*.1,b=-p/2-d*.4,k=[{x:y+a-u,y:(b+l)*1.3},{x:y+a,y:b+l-d},{x:y+a,y:(b+l)*.9},...Qn(y+a,(b+l)*1.25,y+a-u,(b+l)*1.3,-l*.02,.5)],T=Qt(g),_=m.path(T,x),w=Qt(k),E=m.path(w,{...x,fillStyle:"solid"}),L=i.insert(()=>E,":first-child");return L.insert(()=>_,":first-child"),L.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-a/2+(e.padding??0)-(s.x-(s.left??0))},${-l/2+(e.padding??0)-c/2-(s.y-(s.top??0))})`),wt(e,L),e.intersect=function(M){return pt.polygon(e,g,M)},i}v(w2,"taggedWaveEdgedRectangle");async function S2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Mt(t,e,Bt(e)),o=Math.max(s.width+(e.padding??0),(e==null?void 0:e.width)||0),a=Math.max(s.height+(e.padding??0),(e==null?void 0:e.height)||0),l=-o/2,c=-a/2,u=i.insert("rect",":first-child");return u.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",l).attr("y",c).attr("width",o).attr("height",a),wt(e,u),e.intersect=function(d){return pt.rect(e,d)},i}v(S2,"text");var $z=v((t,e,r,n,i,s)=>`M${t},${e}
576
+ a${i},${s} 0,0,1 0,${-n}
577
+ l${r},0
578
+ a${i},${s} 0,0,1 0,${n}
579
+ M${r},${-n}
580
+ a${i},${s} 0,0,0 0,${n}
581
+ l${-r},0`,"createCylinderPathD"),zz=v((t,e,r,n,i,s)=>[`M${t},${e}`,`M${t+r},${e}`,`a${i},${s} 0,0,0 0,${-n}`,`l${-r},0`,`a${i},${s} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),Wz=v((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),qx=5,Hx=10;async function T2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?12:i/2;if(e.width||e.height){const x=e.height??0;e.height=(e.height??0)-s,e.height<qx&&(e.height=qx);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<Hx&&(e.width=Hx)}const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,Bt(e)),c=(e.height?e.height:a.height)+s,u=c/2,d=u/(2.5+c/50),p=(e.width?e.width:a.width)+d+s,{cssStyles:f}=e;let m;if(e.look==="handDrawn"){const x=xt.svg(o),g=zz(0,0,p,c,d,u),y=Wz(0,0,p,c,d,u),b=x.path(g,bt(e,{})),k=x.path(y,bt(e,{fill:"none"}));m=o.insert(()=>k,":first-child"),m=o.insert(()=>b,":first-child"),m.attr("class","basic label-container"),f&&m.attr("style",f)}else{const x=$z(0,0,p,c,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",De(f)).attr("style",n),m.attr("class","basic label-container outer-path"),f&&m.selectAll("path").attr("style",f),n&&m.selectAll("path").attr("style",n)}return m.attr("label-offset-x",d),m.attr("transform",`translate(${-p/2}, ${c/2} )`),l.attr("transform",`translate(${-(a.width/2)-d-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),wt(e,m),e.intersect=function(x){const g=pt.rect(e,x),y=g.y-(e.y??0);if(u!=0&&(Math.abs(y)<(e.height??0)/2||Math.abs(y)==(e.height??0)/2&&Math.abs(g.x-(e.x??0))>(e.width??0)/2-d)){let b=d*d*(1-y*y/(u*u));b!=0&&(b=Math.sqrt(Math.abs(b))),b=d-b,x.x-(e.x??0)>0&&(b=-b),g.x+=b}return g},o}v(T2,"tiltedCylinder");async function _2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=(e.look==="neo",i),o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*c/6,y:0},{x:u+3*c/6,y:0},{x:u,y:-c},{x:0,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Qt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=jn(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,wt(e,p),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(_2,"trapezoid");async function E2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=15,l=5;(e.width||e.height)&&(e.height=(e.height??0)-o*2,e.height<l&&(e.height=l),e.width=(e.width??0)-s*2,e.width<a&&(e.width=a));const{shapeSvg:c,bbox:u}=await Mt(t,e,Bt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2,p=(e!=null&&e.height?e==null?void 0:e.height:u.height)+o*2,{cssStyles:f}=e,m=xt.svg(c),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-d/2*.8,y:-p/2},{x:d/2*.8,y:-p/2},{x:d/2,y:-p/2*.6},{x:d/2,y:p/2},{x:-d/2,y:p/2},{x:-d/2,y:-p/2*.6}],y=Qt(g),b=m.path(y,x),k=c.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),wt(e,k),e.intersect=function(T){return pt.polygon(e,g,T)},c}v(E2,"trapezoidalPentagon");var Ux=10,Gx=10;async function N2(t,e){var T;const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?i*2:i;(e.width||e.height)&&(e.width=(((e==null?void 0:e.width)??0)-s)/2,e.width<Gx&&(e.width=Gx),e.height=(e==null?void 0:e.height)??0,e.height<Ux&&(e.height=Ux));const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,Bt(e)),c=En((T=re().flowchart)==null?void 0:T.htmlLabels),u=(e!=null&&e.width?e==null?void 0:e.width:a.width)+s,d=e!=null&&e.height?e==null?void 0:e.height:u+a.height,p=d,f=[{x:0,y:0},{x:p,y:0},{x:p/2,y:-d}],{cssStyles:m}=e,x=xt.svg(o),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Qt(f),b=x.path(y,g),k=o.insert(()=>b,":first-child").attr("transform",`translate(${-d/2}, ${d/2})`).attr("class","outer-path");return m&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),e.width=u,e.height=d,wt(e,k),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${d/2-(a.height+(e.padding??0)/(c?2:1)-(a.y-(a.top??0)))})`),e.intersect=function(_){return tt.info("Triangle intersect",e,f,_),pt.polygon(e,f,_)},o}v(N2,"triangle");async function j2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;let a=!0;(e.width||e.height)&&(a=!1,e.width=((e==null?void 0:e.width)??0)-s*2,e.width<10&&(e.width=10),e.height=((e==null?void 0:e.height)??0)-o*2,e.height<10&&(e.height=10));const{shapeSvg:l,bbox:c,label:u}=await Mt(t,e,Bt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:c.width)+(s??0)*2,p=(e!=null&&e.height?e==null?void 0:e.height:c.height)+(o??0)*2,f=e.look==="neo"?p/4:p/8,m=p+(a?f:-f),{cssStyles:x}=e,y=14-d,b=y>0?y/2:0,k=xt.svg(l),T=bt(e,{});e.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const _=[{x:-d/2-b,y:m/2},...Qn(-d/2-b,m/2,d/2+b,m/2,f,.8),{x:d/2+b,y:-m/2},{x:-d/2-b,y:-m/2}],w=Qt(_),E=k.path(w,T),L=l.insert(()=>E,":first-child");return L.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(0,${-f/2})`),u.attr("transform",`translate(${-d/2+(e.padding??0)-(c.x-(c.left??0))},${-p/2+(e.padding??0)-f-(c.y-(c.top??0))})`),wt(e,L),e.intersect=function(M){return pt.polygon(e,_,M)},l}v(j2,"waveEdgedRectangle");async function L2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?20:i;if(e.width||e.height){e.width=(e==null?void 0:e.width)??0,e.width<20&&(e.width=20),e.height=(e==null?void 0:e.height)??0,e.height<10&&(e.height=10);const T=Math.min(e.height*.2,e.height/4);e.height=Math.ceil(e.height-o-T*(20/9)),e.width=e.width-s*2}const{shapeSvg:a,bbox:l}=await Mt(t,e,Bt(e)),c=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,u=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o,d=u/8,p=u+d*2,{cssStyles:f}=e,m=xt.svg(a),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-c/2,y:p/2},...Qn(-c/2,p/2,c/2,p/2,d,1),{x:c/2,y:-p/2},...Qn(c/2,-p/2,-c/2,-p/2,d,-1)],y=Qt(g),b=m.path(y,x),k=a.insert(()=>b,":first-child");return k.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),wt(e,k),e.intersect=function(T){return pt.polygon(e,g,T)},a}v(L2,"waveRectangle");var ve=10;async function B2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?12:e.padding??0;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-i*2-ve,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-ve,10));const{shapeSvg:o,bbox:a,label:l}=await Mt(t,e,Bt(e)),c=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+ve,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+ve,d=c-ve,p=u-ve,f=-d/2,m=-p/2,{cssStyles:x}=e,g=xt.svg(o),y=bt(e,{}),b=[{x:f-ve,y:m-ve},{x:f-ve,y:m+p},{x:f+d,y:m+p},{x:f+d,y:m-ve}],k=`M${f-ve},${m-ve} L${f+d},${m-ve} L${f+d},${m+p} L${f-ve},${m+p} L${f-ve},${m-ve}
582
+ M${f-ve},${m} L${f+d},${m}
583
+ M${f},${m-ve} L${f},${m+p}`;e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const T=g.path(k,y),_=o.insert(()=>T,":first-child");return _.attr("transform",`translate(${ve/2}, ${ve/2})`),_.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),l.attr("transform",`translate(${-(a.width/2)+ve/2-(a.x-(a.left??0))}, ${-(a.height/2)+ve/2-(a.y-(a.top??0))})`),wt(e,_),e.intersect=function(w){return pt.polygon(e,b,w)},o}v(B2,"windowPane");var Vx=new Set(["redux-color","redux-dark-color"]),qz=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function $p(t,e){var ot,It,ht,at;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=be(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:K}=be(),{background:lt}=K,yt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${lt}`]};await $p(t,yt)}const c=be();e.useHtmlLabels=c.htmlLabels;let u=((ot=c.er)==null?void 0:ot.diagramPadding)??10,d=((It=c.er)==null?void 0:It.entityPadding)??6;const{cssStyles:p}=e,{labelStyles:f,nodeStyles:m}=Ct(e);if(r.attributes.length===0&&e.label){const K={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};Tn(e.label,c)+K.labelPaddingX*2<c.er.minEntityWidth&&(e.width=c.er.minEntityWidth);const lt=await Zs(t,e,K);if(n!=null&&Vx.has(n)){const yt=r.colorIndex??0;lt.attr("data-color-id",`color-${yt%l.length}`)}if(!En(c.htmlLabels)){const yt=lt.select("text"),At=(ht=yt.node())==null?void 0:ht.getBBox();yt.attr("transform",`translate(${-At.width/2}, 0)`)}return lt}c.htmlLabels||(u*=1.25,d*=1.25);let x=Bt(e);x||(x="node default");const g=t.insert("g").attr("class",x).attr("id",e.domId||e.id),y=await os(g,e.label??"",c,0,0,["name"],f);y.height+=d;let b=0;const k=[],T=[];let _=0,w=0,E=0,L=0,M=!0,N=!0;for(const K of r.attributes){const lt=await os(g,K.type,c,0,b,["attribute-type"],f);_=Math.max(_,lt.width+u);const yt=await os(g,K.name,c,0,b,["attribute-name"],f);w=Math.max(w,yt.width+u);const At=await os(g,K.keys.join(),c,0,b,["attribute-keys"],f);E=Math.max(E,At.width+u);const Dt=await os(g,K.comment,c,0,b,["attribute-comment"],f);L=Math.max(L,Dt.width+u);const ue=Math.max(lt.height,yt.height,At.height,Dt.height)+d;T.push({yOffset:b,rowHeight:ue}),b+=ue}let P=4;E<=u&&(M=!1,E=0,P--),L<=u&&(N=!1,L=0,P--);const $=g.node().getBBox();if(y.width+u*2-(_+w+E+L)>0){const K=y.width+u*2-(_+w+E+L);_+=K/P,w+=K/P,E>0&&(E+=K/P),L>0&&(L+=K/P)}const q=_+w+E+L,O=xt.svg(g),I=bt(e,{});e.look!=="handDrawn"&&(I.roughness=0,I.fillStyle="solid");let F=0;T.length>0&&(F=T.reduce((K,lt)=>K+((lt==null?void 0:lt.rowHeight)??0),0));const D=Math.max($.width+u*2,(e==null?void 0:e.width)||0,q),R=Math.max((F??0)+y.height,(e==null?void 0:e.height)||0),j=-D/2,S=-R/2;if(g.selectAll("g:not(:first-child)").each((K,lt,yt)=>{const At=Gt(yt[lt]),Dt=At.attr("transform");let ue=0,ae=0;if(Dt){const Zt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Dt);Zt&&(ue=parseFloat(Zt[1]),ae=parseFloat(Zt[2]),At.attr("class").includes("attribute-name")?ue+=_:At.attr("class").includes("attribute-keys")?ue+=_+w:At.attr("class").includes("attribute-comment")&&(ue+=_+w+E))}At.attr("transform",`translate(${j+u/2+ue}, ${ae+S+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(S+d/2)+")"),n!=null&&Vx.has(n)){const K=r.colorIndex??0;g.attr("data-color-id",`color-${K%l.length}`)}const U=O.rectangle(j,S,D,R,I),Q=g.insert(()=>U,":first-child").attr("class","outer-path").attr("style",p.join(""));k.push(0);for(const[K,lt]of T.entries()){const At=(K+1)%2===0&&lt.yOffset!==0,Dt=O.rectangle(j,y.height+S+(lt==null?void 0:lt.yOffset),D,lt==null?void 0:lt.rowHeight,{...I,fill:At?s:o,stroke:a});g.insert(()=>Dt,"g.label").attr("style",p.join("")).attr("class",`row-rect-${At?"even":"odd"}`)}const A=1e-4;let rt=as(j,y.height+S,D+j,y.height+S,A),ut=O.polygon(rt.map(K=>[K.x,K.y]),I);if(g.insert(()=>ut).attr("class","divider"),rt=as(_+j,y.height+S,_+j,R+S,A),ut=O.polygon(rt.map(K=>[K.x,K.y]),I),g.insert(()=>ut).attr("class","divider"),M){const K=_+w+j;rt=as(K,y.height+S,K,R+S,A),ut=O.polygon(rt.map(lt=>[lt.x,lt.y]),I),g.insert(()=>ut).attr("class","divider")}if(N){const K=_+w+E+j;rt=as(K,y.height+S,K,R+S,A),ut=O.polygon(rt.map(lt=>[lt.x,lt.y]),I),g.insert(()=>ut).attr("class","divider")}for(const K of k){const lt=y.height+S+K;rt=as(j,lt,D+j,lt,A),ut=O.polygon(rt.map(yt=>[yt.x,yt.y]),I),g.insert(()=>ut).attr("class","divider")}if(wt(e,Q),m&&e.look!=="handDrawn")if(n!=null&&qz.has(n))g.selectAll("path").attr("style",m);else{const K=m.split(";"),lt=(at=K==null?void 0:K.filter(yt=>yt.includes("stroke")))==null?void 0:at.map(yt=>`${yt}`).join("; ");g.selectAll("path").attr("style",lt??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(K){return pt.rect(e,K)},g}v($p,"erBox");async function os(t,e,r,n=0,i=0,s=[],o=""){const a=t.insert("g").attr("class",`label ${s.join(" ")}`).attr("transform",`translate(${n}, ${i})`).attr("style",o);e!==Dg(e)&&(e=Dg(e),e=e.replaceAll("<","&lt;").replaceAll(">","&gt;"));const l=a.node().appendChild(await Nn(a,e,{width:Tn(e,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(e.includes("&lt;")||e.includes("&gt;")){let u=l.children[0];for(u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">")}let c=l.getBBox();if(En(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const d=Gt(l);c=u.getBoundingClientRect(),d.attr("width",c.width),d.attr("height",c.height)}return c}v(os,"addText");function as(t,e,r,n,i){return t===r?[{x:t-i/2,y:e},{x:t+i/2,y:e},{x:r+i/2,y:n},{x:r-i/2,y:n}]:[{x:t,y:e-i/2},{x:t,y:e+i/2},{x:r,y:n+i/2},{x:r,y:n-i/2}]}v(as,"lineToPolygon");async function A2(t,e,r,n,i=r.class.padding??12){const s=n?0:3,o=t.insert("g").attr("class",Bt(e)).attr("id",e.domId||e.id);let a=null,l=null,c=null,u=null,d=0,p=0,f=0;if(a=o.insert("g").attr("class","annotation-group text"),e.annotations.length>0){const b=e.annotations[0];await Ro(a,{text:`«${b}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await Ro(l,e,0,["font-weight: bolder"]);const m=l.node().getBBox();p=m.height,c=o.insert("g").attr("class","members-group text");let x=0;for(const b of e.members){const k=await Ro(c,b,x,[b.parseClassifier()]);x+=k+s}f=c.node().getBBox().height,f<=0&&(f=i/2),u=o.insert("g").attr("class","methods-group text");let g=0;for(const b of e.methods){const k=await Ro(u,b,g,[b.parseClassifier()]);g+=k+s}let y=o.node().getBBox();if(a!==null){const b=a.node().getBBox();a.attr("transform",`translate(${-b.width/2})`)}return l.attr("transform",`translate(${-m.width/2}, ${d})`),y=o.node().getBBox(),c.attr("transform",`translate(0, ${d+p+i*2})`),y=o.node().getBBox(),u.attr("transform",`translate(0, ${d+p+(f?f+i*4:i*2)})`),y=o.node().getBBox(),{shapeSvg:o,bbox:y}}v(A2,"textHelper");async function Ro(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=be();let o="useHtmlLabels"in e?e.useHtmlLabels:En(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),ra(a)&&(o=!0);const l=await Nn(i,Xf(Ni(a)),{width:Tn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let c,u=1;if(o){const d=l.children[0],p=Gt(l);u=d.innerHTML.split("<br>").length,d.innerHTML.includes("</math>")&&(u+=d.innerHTML.split("<mrow>").length-1);const f=d.getElementsByTagName("img");if(f){const m=a.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...f].map(x=>new Promise(g=>{function y(){var b;if(x.style.display="flex",x.style.flexDirection="column",m){const k=((b=s.fontSize)==null?void 0:b.toString())??window.getComputedStyle(document.body).fontSize,_=parseInt(k,10)*5+"px";x.style.minWidth=_,x.style.maxWidth=_}else x.style.width="100%";g(x)}v(y,"setupImage"),setTimeout(()=>{x.complete&&y()}),x.addEventListener("error",y),x.addEventListener("load",y)})))}c=d.getBoundingClientRect(),p.attr("width",c.width),p.attr("height",c.height)}else{n.includes("font-weight: bolder")&&Gt(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const d=l.children[0];(l.textContent===""||l.textContent.includes("&gt"))&&(d.textContent=a[0]+a.substring(1).replaceAll("&gt;",">").replaceAll("&lt;","<").trim(),a[1]===" "&&(d.textContent=d.textContent[0]+" "+d.textContent.substring(1))),d.textContent==="undefined"&&(d.textContent=""),c=l.getBBox()}return i.attr("transform","translate(0,"+(-c.height/(2*u)+r)+")"),c.height}v(Ro,"addText");async function M2(t,e){var O,I;const r=re(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??En(r.htmlLabels)??!0,l=e;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];const{shapeSvg:c,bbox:u}=await A2(t,e,r,a,o),{labelStyles:d,nodeStyles:p}=Ct(e);e.labelStyle=d,e.cssStyles=l.styles||"";const f=((O=l.styles)==null?void 0:O.join(";"))||p||"";e.cssStyles||(e.cssStyles=f.replaceAll("!important","").split(";"));const m=l.members.length===0&&l.methods.length===0&&!((I=r.class)!=null&&I.hideEmptyMembersBox),x=xt.svg(c),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Math.max(e.width??0,u.width);let b=Math.max(e.height??0,u.height);const k=(e.height??0)>u.height;l.members.length===0&&l.methods.length===0?b+=o:l.members.length>0&&l.methods.length===0&&(b+=o*2);const T=-y/2,_=-b/2;let w=m?s*2:l.members.length===0&&l.methods.length===0?-s:0;k&&(w=s*2);const E=x.rectangle(T-s,_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0),y+2*s,b+2*s+w,g),L=c.insert(()=>E,":first-child");L.attr("class","basic label-container outer-path");const M=L.node().getBBox(),N=c.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,P=c.select(".label-group").node().getBBox().height-(m?s/2:0)||0,$=c.select(".members-group").node().getBBox().height-(m?s/2:0)||0,q=(N+P+_+s-(_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(c.selectAll(".text").each((F,D,R)=>{var rt,ut;const j=Gt(R[D]),S=j.attr("transform");let U=0;if(S){const It=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(S);It&&(U=parseFloat(It[2]))}let Q=U+_+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(j.attr("class").includes("methods-group")){const ot=Math.max($,o/2);k?Q=Math.max(q,N+P+ot+_+o*2+s)+o*2:Q=N+P+ot+_+o*4+s}l.members.length===0&&l.methods.length===0&&((rt=r.class)!=null&&rt.hideEmptyMembersBox)&&(l.annotations.length>0?Q=U-o:Q=U),a||(Q-=4);let A=T;(j.attr("class").includes("label-group")||j.attr("class").includes("annotation-group"))&&(A=-((ut=j.node())==null?void 0:ut.getBBox().width)/2||0,c.selectAll("text").each(function(ot,It,ht){window.getComputedStyle(ht[It]).textAnchor==="middle"&&(A=0)})),j.attr("transform",`translate(${A}, ${Q})`)}),l.members.length>0||l.methods.length>0||m){const F=N+P+_+s,D=x.line(M.x,F,M.x+M.width,F+.001,g);c.insert(()=>D).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(m||l.members.length>0||l.methods.length>0){const F=N+P+$+_+o*2+s,D=x.line(M.x,k?Math.max(q,F):F,M.x+M.width,(k?Math.max(q,F):F)+.001,g);c.insert(()=>D).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(l.look!=="handDrawn"&&c.selectAll("path").attr("style",f),L.select(":nth-child(2)").attr("style",f),c.selectAll(".divider").select("path").attr("style",f),e.labelStyle?c.selectAll("span").attr("style",e.labelStyle):c.selectAll("span").attr("style",f),!a){const F=RegExp(/color\s*:\s*([^;]*)/),D=F.exec(f);if(D){const R=D[0].replace("color","fill");c.selectAll("tspan").attr("style",R)}else if(d){const R=F.exec(d);if(R){const j=R[0].replace("color","fill");c.selectAll("tspan").attr("style",j)}}}return wt(e,L),e.intersect=function(F){return pt.rect(e,F)},c}v(M2,"classBox");async function I2(t,e){var M,N;const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,c=Bt(e),{themeVariables:u}=re(),{borderColorArray:d,requirementEdgeLabelBackground:p}=u,f=t.insert("g").attr("class",c).attr("id",e.domId??e.id);let m;l?m=await en(f,`&lt;&lt;${i.type}&gt;&gt;`,0,e.labelStyle):m=await en(f,"&lt;&lt;Element&gt;&gt;",0,e.labelStyle);let x=m;const g=await en(f,i.name,x,e.labelStyle+"; font-weight: bold;");if(x+=g+a,l){const P=await en(f,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=P;const $=await en(f,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=$;const q=await en(f,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=q,await en(f,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const P=await en(f,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=P,await en(f,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((M=f.node())==null?void 0:M.getBBox().width)??200)+o,b=(((N=f.node())==null?void 0:N.getBBox().height)??200)+o,k=-y/2,T=-b/2,_=xt.svg(f),w=bt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const E=_.rectangle(k,T,y,b,w),L=f.insert(()=>E,":first-child");if(L.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const P=e.colorIndex??0;f.attr("data-color-id",`color-${P%d.length}`)}if(f.selectAll(".label").each((P,$,q)=>{const O=Gt(q[$]),I=O.attr("transform");let F=0,D=0;if(I){const U=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(I);U&&(F=parseFloat(U[1]),D=parseFloat(U[2]))}const R=D-b/2;let j=k+o/2;($===0||$===1)&&(j=F),O.attr("transform",`translate(${j}, ${R+o})`)}),x>m+g+a){const P=T+m+g+a;let $;if(e.look==="neo"){const I=[[k,P],[k+y,P],[k+y,P+.001],[k,P+.001]];$=_.polygon(I,w)}else $=_.line(k,P,k+y,P,w);f.insert(()=>$).attr("class","divider")}return wt(e,L),e.intersect=function(P){return pt.rect(e,P)},n&&e.look!=="handDrawn"&&(p||d!=null&&d.length)&&f.selectAll("path").attr("style",n),f}v(I2,"requirementBox");async function en(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=re(),o=s.htmlLabels??!0,a=await Nn(i,Xf(Ni(e)),{width:Tn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let l;if(o){const c=a.children[0],u=Gt(a);l=c.getBoundingClientRect(),u.attr("width",l.width),u.attr("height",l.height)}else{const c=a.children[0];for(const u of c.children)n&&u.setAttribute("style",n);l=a.getBBox(),l.height+=6}return i.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}v(en,"addText");var Hz=v(t=>{switch(t){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function F2(t,e,{config:r}){var $,q;const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n||"";const s=10,o=e.width;e.width=(e.width??200)-10;const{shapeSvg:a,bbox:l,label:c}=await Mt(t,e,Bt(e)),u=e.padding||10;let d="",p;"ticket"in e&&e.ticket&&(($=r==null?void 0:r.kanban)!=null&&$.ticketBaseUrl)&&(d=(q=r==null?void 0:r.kanban)==null?void 0:q.ticketBaseUrl.replace("#TICKET#",e.ticket),p=a.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",d).attr("target","_blank"));const f={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1};let m,x;p?{label:m,bbox:x}=await du(p,"ticket"in e&&e.ticket||"",f):{label:m,bbox:x}=await du(a,"ticket"in e&&e.ticket||"",f);const{label:g,bbox:y}=await du(a,"assigned"in e&&e.assigned||"",f);e.width=o;const b=10,k=(e==null?void 0:e.width)||0,T=Math.max(x.height,y.height)/2,_=Math.max(l.height+b*2,(e==null?void 0:e.height)||0)+T,w=-k/2,E=-_/2;c.attr("transform","translate("+(u-k/2)+", "+(-T-l.height/2)+")"),m.attr("transform","translate("+(u-k/2)+", "+(-T+l.height/2)+")"),g.attr("transform","translate("+(u+k/2-y.width-2*s)+", "+(-T+l.height/2)+")");let L;const{rx:M,ry:N}=e,{cssStyles:P}=e;if(e.look==="handDrawn"){const O=xt.svg(a),I=bt(e,{}),F=M||N?O.path(ii(w,E,k,_,M||0),I):O.rectangle(w,E,k,_,I);L=a.insert(()=>F,":first-child"),L.attr("class","basic label-container").attr("style",P||null)}else{L=a.insert("rect",":first-child"),L.attr("class","basic label-container __APA__").attr("style",i).attr("rx",M??5).attr("ry",N??5).attr("x",w).attr("y",E).attr("width",k).attr("height",_);const O="priority"in e&&e.priority;if(O){const I=a.append("line"),F=w+2,D=E+Math.floor((M??0)/2),R=E+_-Math.floor((M??0)/2);I.attr("x1",F).attr("y1",D).attr("x2",F).attr("y2",R).attr("stroke-width","4").attr("stroke",Hz(O))}}return wt(e,L),e.height=_,e.intersect=function(O){return pt.rect(e,O)},a}v(F2,"kanbanItem");async function P2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Mt(t,e,Bt(e)),l=s.width+10*o,c=s.height+8*o,u=.15*l,{cssStyles:d}=e,p=s.width+20,f=s.height+20,m=Math.max(l,p),x=Math.max(c,f);a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let g;const y=`M0 0
584
+ a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
585
+ a${u},${u} 1 0,0 ${m*.25},0
586
+ a${u},${u} 1 0,0 ${m*.25},0
587
+ a${u},${u} 1 0,0 ${m*.25},${x*.1}
588
+
589
+ a${u},${u} 1 0,0 ${m*.15},${x*.33}
590
+ a${u*.8},${u*.8} 1 0,0 0,${x*.34}
591
+ a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
592
+
593
+ a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
594
+ a${u},${u} 1 0,0 ${-1*m*.25},0
595
+ a${u},${u} 1 0,0 ${-1*m*.25},0
596
+ a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
597
+
598
+ a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
599
+ a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
600
+ a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
601
+ H0 V0 Z`;if(e.look==="handDrawn"){const b=xt.svg(i),k=bt(e,{}),T=b.path(y,k);g=i.insert(()=>T,":first-child"),g.attr("class","basic label-container").attr("style",De(d))}else g=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return g.attr("transform",`translate(${-m/2}, ${-x/2})`),wt(e,g),e.calcIntersect=function(b,k){return pt.rect(b,k)},e.intersect=function(b){return tt.info("Bang intersect",e,b),pt.rect(e,b)},i}v(P2,"bang");async function D2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Mt(t,e,Bt(e)),l=s.width+2*o,c=s.height+2*o,u=.15*l,d=.25*l,p=.35*l,f=.2*l,{cssStyles:m}=e;let x;const g=`M0 0
602
+ a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
603
+ a${p},${p} 1 0,1 ${l*.4},${-1*l*.1}
604
+ a${d},${d} 1 0,1 ${l*.35},${l*.2}
605
+
606
+ a${u},${u} 1 0,1 ${l*.15},${c*.35}
607
+ a${f},${f} 1 0,1 ${-1*l*.15},${c*.65}
608
+
609
+ a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
610
+ a${p},${p} 1 0,1 ${-1*l*.5},0
611
+ a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
612
+
613
+ a${u},${u} 1 0,1 ${-1*l*.1},${-1*c*.35}
614
+ a${f},${f} 1 0,1 ${l*.1},${-1*c*.65}
615
+ H0 V0 Z`;if(e.look==="handDrawn"){const y=xt.svg(i),b=bt(e,{}),k=y.path(g,b);x=i.insert(()=>k,":first-child"),x.attr("class","basic label-container").attr("style",De(m))}else x=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",g);return a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),x.attr("transform",`translate(${-l/2}, ${-c/2})`),wt(e,x),e.calcIntersect=function(y,b){return pt.rect(y,b)},e.intersect=function(y){return tt.info("Cloud intersect",e,y),pt.rect(e,y)},i}v(D2,"cloud");async function O2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Mt(t,e,Bt(e)),l=s.width+8*o,c=s.height+2*o,u=5,d=e.look==="neo"?`
616
+ M${-l/2} ${c/2-u}
617
+ v${-c+2*u}
618
+ q0,-${u} ${u},-${u}
619
+ h${l-2*u}
620
+ q${u},0 ${u},${u}
621
+ v${c-u}
622
+ H${-l/2}
623
+ Z
624
+ `:`
625
+ M${-l/2} ${c/2-u}
626
+ v${-c+2*u}
627
+ q0,-${u} ${u},-${u}
628
+ h${l-2*u}
629
+ q${u},0 ${u},${u}
630
+ v${c-2*u}
631
+ q0,${u} ${-u},${u}
632
+ h${-(l-2*u)}
633
+ q${-u},0 ${-u},${-u}
634
+ Z
635
+ `;if(!e.domId)throw new Error(`defaultMindmapNode: node "${e.id}" is missing a domId — was render.ts domId prefixing skipped?`);const p=i.append("path").attr("id",e.domId).attr("class","node-bkg node-"+e.type).attr("style",n).attr("d",d);return i.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),i.append(()=>a.node()),wt(e,p),e.calcIntersect=function(f,m){return pt.rect(f,m)},e.intersect=function(f){return pt.rect(e,f)},i}v(O2,"defaultMindmapNode");async function R2(t,e){const r={padding:e.padding??0};return Rp(t,e,r)}v(R2,"mindmapCircle");var Uz=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:g2},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:f2},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:x2},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:k2},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Rw},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:$w},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Rp},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:P2},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:D2},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:h2},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Vw},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:n2},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:r2},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:_2},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:t2},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Ww},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:S2},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Bw},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:p2},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:C2},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:b2},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Uw},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Yw},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Fw},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Pw},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:Dw},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:i2},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:j2},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Gw},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:T2},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:s2},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Ow},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:zw},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:N2},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:B2},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:qw},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:E2},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Hw},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:m2},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:l2},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:a2},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Lw},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Iw},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:w2},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:v2},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:L2},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:u2},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:o2}],Gz=v(()=>{const e=[...Object.entries({state:y2,choice:Aw,note:c2,rectWithTitle:d2,labelRect:e2,iconSquare:Qw,iconCircle:Kw,icon:Xw,iconRounded:Zw,imageSquare:Jw,anchor:Nw,kanbanItem:F2,mindmapCircle:R2,defaultMindmapNode:O2,classBox:M2,erBox:$p,requirementBox:I2}),...Uz.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),$2=Gz();function Vz(t){return t in $2}v(Vz,"isValidShape");var oh=new Map;async function z2(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?$2[e.shape]:void 0;if(!s)throw new Error(`No such shape: ${e.shape}. Please check your syntax.`);if(e.link){let o;r.config.securityLevel==="sandbox"?o="_top":e.linkTarget&&(o=e.linkTarget||"_blank"),n=t.insert("svg:a").attr("xlink:href",e.link).attr("target",o??null),i=await s(n,e,r)}else i=await s(t,e,r),n=i;return n.attr("data-look",De(e.look)),e.tooltip&&i.attr("title",e.tooltip),oh.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(z2,"insertNode");var RZ=v((t,e)=>{oh.set(e.id,t)},"setNodeElem"),$Z=v(()=>{oh.clear()},"clear"),zZ=v(t=>{const e=oh.get(t.id);tt.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const r=8,n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-r)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},"positionNode"),Yz=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&Yx(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&Yx(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),Xz={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_barb_neo:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},Kz=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],Yx=v((t,e,r,n,i,s,o=!1,a)=>{var m;const l=Xz[r],c=l&&Kz.includes(l.type);if(!l){tt.warn(`Unknown arrow type: ${r}`);return}const u=l.type,f=`${i}_${s}-${u}${e==="start"?"Start":"End"}${o&&c?"-margin":""}`;if(a&&a.trim()!==""){const x=a.replace(/[^\dA-Za-z]/g,"_"),g=`${f}_${x}`;if(!document.getElementById(g)){const y=document.getElementById(f);if(y){const b=y.cloneNode(!0);b.id=g,b.querySelectorAll("path, circle, line").forEach(T=>{T.setAttribute("stroke",a),l.fill&&T.setAttribute("fill",a)}),(m=y.parentNode)==null||m.appendChild(b)}}t.attr(`marker-${e}`,`url(${n}#${g})`)}else t.attr(`marker-${e}`,`url(${n}#${f})`)},"addEdgeMarker"),Zz=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=re())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),Sc=new Map,ze=new Map,WZ=v(()=>{Sc.clear(),ze.clear()},"clear"),To=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),Qz=v(async(t,e)=>{const r=re();let n=or(r);const{labelStyles:i}=Ct(e);e.labelStyle=i;const s=t.insert("g").attr("class","edgeLabel"),o=s.insert("g").attr("class","label").attr("data-id",e.id),a=e.labelType==="markdown",c=await Nn(t,e.label,{style:To(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(c),tt.info("abc82",e,e.labelType);let u=c.getBBox(),d=u;if(n){const f=c.children[0],m=Gt(c);u=f.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const f=Gt(c).select("text").node();f&&typeof f.getBBox=="function"&&(d=f.getBBox())}o.attr("transform",Co(d,n)),Sc.set(e.id,s),e.width=u.width,e.height=u.height;let p;if(e.startLabelLeft){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Wn(m,e.startLabelLeft,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).startLeft=f,$o(p,e.startLabelLeft)}if(e.startLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Wn(m,e.startLabelRight,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).startRight=f,$o(p,e.startLabelRight)}if(e.endLabelLeft){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Wn(f,e.endLabelLeft,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).endLeft=f,$o(p,e.endLabelLeft)}if(e.endLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Wn(f,e.endLabelRight,To(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",Co(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).endRight=f,$o(p,e.endLabelRight)}return c},"insertEdgeLabel");function $o(t,e){or(re())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v($o,"setTerminalWidth");var Jz=v((t,e)=>{tt.debug("Moving label abc88 ",t.id,t.label,Sc.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=re(),{subGraphTitleTotalMargin:i}=_p(n);if(t.label){const s=Sc.get(t.id);let o=t.x,a=t.y;if(r){const l=Wr.calcLabelPosition(r);tt.debug("Moving label "+t.label+" from (",o,",",a,") to (",l.x,",",l.y,") abc88"),e.updatedPath&&(o=l.x,a=l.y)}s.attr("transform",`translate(${o}, ${a+i/2})`)}if(t.startLabelLeft){const s=ze.get(t.id).startLeft;let o=t.x,a=t.y;if(r){const l=Wr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.startLabelRight){const s=ze.get(t.id).startRight;let o=t.x,a=t.y;if(r){const l=Wr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelLeft){const s=ze.get(t.id).endLeft;let o=t.x,a=t.y;if(r){const l=Wr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelRight){const s=ze.get(t.id).endRight;let o=t.x,a=t.y;if(r){const l=Wr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}},"positionEdgeLabel"),t9=v((t,e)=>{const r=t.x,n=t.y,i=Math.abs(e.x-r),s=Math.abs(e.y-n),o=t.width/2,a=t.height/2;return i>=o||s>=a},"outsideNode"),e9=v((t,e,r)=>{tt.debug(`intersection calc abc89:
636
+ outsidePoint: ${JSON.stringify(e)}
637
+ insidePoint : ${JSON.stringify(r)}
638
+ node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const n=t.x,i=t.y,s=Math.abs(n-r.x),o=t.width/2;let a=r.x<e.x?o-s:o+s;const l=t.height/2,c=Math.abs(e.y-r.y),u=Math.abs(e.x-r.x);if(Math.abs(i-e.y)*o>Math.abs(n-e.x)*l){let d=r.y<e.y?e.y-l-i:i-l-e.y;a=u*d/c;const p={x:r.x<e.x?r.x+a:r.x-u+a,y:r.y<e.y?r.y+c-d:r.y-c+d};return a===0&&(p.x=e.x,p.y=e.y),u===0&&(p.x=e.x),c===0&&(p.y=e.y),tt.debug(`abc89 top/bottom calc, Q ${c}, q ${d}, R ${u}, r ${a}`,p),p}else{r.x<e.x?a=e.x-o-n:a=n-o-e.x;let d=c*a/u,p=r.x<e.x?r.x+u-a:r.x-u+a,f=r.y<e.y?r.y+d:r.y-d;return tt.debug(`sides calc abc89, Q ${c}, q ${d}, R ${u}, r ${a}`,{_x:p,_y:f}),a===0&&(p=e.x,f=e.y),u===0&&(p=e.x),c===0&&(f=e.y),{x:p,y:f}}},"intersection"),Xx=v((t,e)=>{tt.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(tt.info("abc88 checking point",s,e),!t9(e,s)&&!i){const o=e9(e,n,s);tt.debug("abc88 inside",s,n,o),tt.debug("abc88 intersection",o,e);let a=!1;r.forEach(l=>{a=a||l.x===o.x&&l.y===o.y}),r.some(l=>l.x===o.x&&l.y===o.y)?tt.warn("abc88 no intersect",o,r):r.push(o),i=!0}else tt.warn("abc88 outside",s,n),n=s,i||r.push(s)}),tt.debug("returning points",r),r},"cutPathAtIntersect");function W2(t){const e=[],r=[];for(let n=1;n<t.length-1;n++){const i=t[n-1],s=t[n],o=t[n+1];(i.x===s.x&&s.y===o.y&&Math.abs(s.x-o.x)>5&&Math.abs(s.y-i.y)>5||i.y===s.y&&s.x===o.x&&Math.abs(s.x-i.x)>5&&Math.abs(s.y-o.y)>5)&&(e.push(s),r.push(n))}return{cornerPoints:e,cornerPointPositions:r}}v(W2,"extractCornerPoints");var Kx=v(function(t,e,r){const n=e.x-t.x,i=e.y-t.y,s=Math.sqrt(n*n+i*i),o=r/s;return{x:e.x-o*n,y:e.y-o*i}},"findAdjacentPoint"),r9=v(function(t){const{cornerPointPositions:e}=W2(t),r=[];for(let n=0;n<t.length;n++)if(e.includes(n)){const i=t[n-1],s=t[n+1],o=t[n],a=Kx(i,o,5),l=Kx(s,o,5),c=l.x-a.x,u=l.y-a.y;r.push(a);const d=Math.sqrt(2)*2;let p={x:o.x,y:o.y};if(Math.abs(s.x-i.x)>10&&Math.abs(s.y-i.y)>=10){tt.debug("Corner point fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));const f=5;o.x===a.x?p={x:c<0?a.x-f+d:a.x+f-d,y:u<0?a.y-d:a.y+d}:p={x:c<0?a.x-d:a.x+d,y:u<0?a.y-f+d:a.y+f-d}}else tt.debug("Corner point skipping fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));r.push(p,l)}else r.push(t[n]);return r},"fixCorners"),n9=v((t,e,r)=>{const n=t-e-r,i=2,s=2,o=i+s,a=Math.floor(n/o),l=Array(a).fill(`${i} ${s}`).join(" ");return`0 ${e} ${l} ${r}`},"generateDashArray"),i9=v(function(t,e,r,n,i,s,o,a=!1){var D;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:l}=re();let c=e.points,u=!1;const d=i;var p=s;const f=[];for(const R in e.cssCompiledStyles)$v(R)||f.push(e.cssCompiledStyles[R]);tt.debug("UIO intersect check",e.points,p.x,d.x),p.intersect&&d.intersect&&!a&&(c=c.slice(1,e.points.length-1),c.unshift(d.intersect(c[0])),tt.debug("Last point UIO",e.start,"-->",e.end,c[c.length-1],p,p.intersect(c[c.length-1])),c.push(p.intersect(c[c.length-1])));const m=btoa(JSON.stringify(c));e.toCluster&&(tt.info("to cluster abc88",r.get(e.toCluster)),c=Xx(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(tt.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(c,null,2)),c=Xx(c.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=c.filter(R=>!Number.isNaN(R.y));const g=Zz(e.curve);g!=="rounded"&&(x=r9(x));let y=Yo;switch(g){case"linear":y=Yo;break;case"basis":y=dd;break;case"cardinal":y=NC;break;case"bumpX":y=wC;break;case"bumpY":y=SC;break;case"catmullRom":y=LC;break;case"monotoneX":y=PC;break;case"monotoneY":y=DC;break;case"natural":y=RC;break;case"step":y=$C;break;case"stepAfter":y=WC;break;case"stepBefore":y=zC;break;case"rounded":y=Yo;break;default:y=dd}const{x:b,y:k}=Z$(e),T=IR().x(b).y(k).curve(y);let _;switch(e.thickness){case"normal":_="edge-thickness-normal";break;case"thick":_="edge-thickness-thick";break;case"invisible":_="edge-thickness-invisible";break;default:_="edge-thickness-normal"}switch(e.pattern){case"solid":_+=" edge-pattern-solid";break;case"dotted":_+=" edge-pattern-dotted";break;case"dashed":_+=" edge-pattern-dashed";break;default:_+=" edge-pattern-solid"}let w,E=g==="rounded"?q2(H2(x,e),5):T(x);const L=Array.isArray(e.style)?e.style:[e.style];let M=L.find(R=>R==null?void 0:R.startsWith("stroke:")),N="";e.animate&&(N="edge-animation-fast"),e.animation&&(N="edge-animation-"+e.animation);let P=!1;if(e.look==="handDrawn"){const R=xt.svg(t);Object.assign([],x);const j=R.path(E,{roughness:.3,seed:l});_+=" transition",w=Gt(j).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(N?" "+N:"")).attr("style",L?L.reduce((U,Q)=>U+";"+Q,""):"");let S=w.attr("d");w.attr("d",S),t.node().appendChild(w.node())}else{const R=f.join(";"),j=L?L.reduce((ut,ot)=>ut+ot+";",""):"",S=(R?R+";"+j+";":j)+";"+(L?L.reduce((ut,ot)=>ut+";"+ot,""):"");w=t.append("path").attr("d",E).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(N?" "+N:"")).attr("style",S),M=(D=S.match(/stroke:([^;]+)/))==null?void 0:D[1],P=e.animate===!0||!!e.animation||R.includes("animation");const U=w.node(),Q=typeof U.getTotalLength=="function"?U.getTotalLength():0,A=hx[e.arrowTypeStart]||0,rt=hx[e.arrowTypeEnd]||0;if(e.look==="neo"&&!P){const ot=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?n9(Q,A,rt):`0 ${A} ${Q-A-rt} ${rt}`}; stroke-dashoffset: 0;`;w.attr("style",ot+w.attr("style"))}}w.attr("data-edge",!0),w.attr("data-et","edge"),w.attr("data-id",e.id),w.attr("data-points",m),w.attr("data-look",De(e.look)),e.showPoints&&x.forEach(R=>{t.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",R.x).attr("cy",R.y)});let $="";(re().flowchart.arrowMarkerAbsolute||re().state.arrowMarkerAbsolute)&&($=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,$=$.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),tt.info("arrowTypeStart",e.arrowTypeStart),tt.info("arrowTypeEnd",e.arrowTypeEnd);const q=!P&&(e==null?void 0:e.look)==="neo";Yz(w,e,$,o,n,q,M);const O=Math.floor(c.length/2),I=c[O];Wr.isLabelCoordinateInPath(I,w.attr("d"))||(u=!0);let F={};return u&&(F.updatedPath=c),F.originalPath=e.points,F},"insertEdge");function q2(t,e){if(t.length<2)return"";let r="";const n=t.length,i=1e-5;for(let s=0;s<n;s++){const o=t[s],a=t[s-1],l=t[s+1];if(s===0)r+=`M${o.x},${o.y}`;else if(s===n-1)r+=`L${o.x},${o.y}`;else{const c=o.x-a.x,u=o.y-a.y,d=l.x-o.x,p=l.y-o.y,f=Math.hypot(c,u),m=Math.hypot(d,p);if(f<i||m<i){r+=`L${o.x},${o.y}`;continue}const x=c/f,g=u/f,y=d/m,b=p/m,k=x*y+g*b,T=Math.max(-1,Math.min(1,k)),_=Math.acos(T);if(_<i||Math.abs(Math.PI-_)<i){r+=`L${o.x},${o.y}`;continue}const w=Math.min(e/Math.sin(_/2),f/2,m/2),E=o.x-x*w,L=o.y-g*w,M=o.x+y*w,N=o.y+b*w;r+=`L${E},${L}`,r+=`Q${o.x},${o.y} ${M},${N}`}}return r}v(q2,"generateRoundedPath");function Wd(t,e){if(!t||!e)return{angle:0,deltaX:0,deltaY:0};const r=e.x-t.x,n=e.y-t.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}v(Wd,"calculateDeltaAndAngle");function H2(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&Ue[e.arrowTypeStart]){const i=Ue[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=Wd(s,o),l=i*Math.cos(a),c=i*Math.sin(a);r[0].x=s.x+l,r[0].y=s.y+c}const n=t.length;if(n>=2&&Ue[e.arrowTypeEnd]){const i=Ue[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=Wd(o,s),l=i*Math.cos(a),c=i*Math.sin(a);r[n-1].x=s.x-l,r[n-1].y=s.y-c}return r}v(H2,"applyMarkerOffsetsToPoints");var s9=v((t,e,r,n)=>{e.forEach(i=>{N9[i](t,r,n)})},"insertMarkers"),o9=v((t,e,r)=>{tt.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),t.append("marker").attr("id",r+"_"+e+"-extensionStart-margin").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd-margin").attr("class","marker extension "+e).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),a9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart-margin").attr("class","marker composition "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("viewBox","0 0 15 15").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd-margin").attr("class","marker composition "+e).attr("refX",3.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),l9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart-margin").attr("class","marker aggregation "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd-margin").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),c9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart-margin").attr("class","marker dependency "+e).attr("refX",4).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd-margin").attr("class","marker dependency "+e).attr("refX",16).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),h9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart-margin").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd-margin").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2)},"lollipop"),u9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",11.5).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",10.5).attr("markerHeight",14).attr("orient","auto").append("path").attr("d","M 0 0 L 11.5 7 L 0 14 z").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",1).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11.5).attr("markerHeight",14).attr("orient","auto").append("polygon").attr("points","0,7 11.5,14 11.5,0").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"point"),d9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refY",5).attr("refX",12.25).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-2).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"circle"),f9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossEnd-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",17.7).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5),t.append("marker").attr("id",r+"_"+e+"-crossStart-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",-3.5).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5).style("stroke-dasharray","1,0")},"cross"),p9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),m9=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{transitionColor:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd-margin").attr("refX",17).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z").attr("fill",`${s}`)},"barbNeo"),g9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),x9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),y9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),b9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),C9=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M9,0 L9,18 M15,0 L15,18").attr("stroke-width",`${s}`),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M3,0 L3,18 M9,0 L9,18").attr("stroke-width",`${s}`)},"only_one_neo"),k9=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{strokeWidth:s,mainBkg:o}=i,a=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse");a.append("circle").attr("fill",o??"white").attr("cx",21).attr("cy",9).attr("stroke-width",`${s}`).attr("r",6),a.append("path").attr("d","M9,0 L9,18").attr("stroke-width",`${s}`);const l=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("markerUnits","userSpaceOnUse").attr("orient","auto");l.append("circle").attr("fill",o??"white").attr("cx",9).attr("cy",9).attr("stroke-width",`${s}`).attr("r",6),l.append("path").attr("d","M21,0 L21,18").attr("stroke-width",`${s}`)},"zero_or_one_neo"),v9=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width",`${s}`),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width",`${s}`)},"one_or_more_neo"),w9=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{strokeWidth:s,mainBkg:o}=i,a=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto");a.append("circle").attr("fill",o??"white").attr("cx",45.5).attr("cy",18).attr("r",6).attr("stroke-width",`${s}`),a.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width",`${s}`);const l=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse");l.append("circle").attr("fill",o??"white").attr("cx",11).attr("cy",18).attr("r",6).attr("stroke-width",`${s}`),l.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width",`${s}`)},"zero_or_more_neo"),S9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
639
+ L20,10
640
+ M20,10
641
+ L0,20`)},"requirement_arrow"),T9=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${s}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
642
+ L20,10
643
+ M20,10
644
+ L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),_9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),E9=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{strokeWidth:s}=i,o=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),N9={extension:o9,composition:a9,aggregation:l9,dependency:c9,lollipop:h9,point:u9,circle:d9,cross:f9,barb:p9,barbNeo:m9,only_one:g9,zero_or_one:x9,one_or_more:y9,zero_or_more:b9,only_one_neo:C9,zero_or_one_neo:k9,one_or_more_neo:v9,zero_or_more_neo:w9,requirement_arrow:S9,requirement_contains:_9,requirement_arrow_neo:T9,requirement_contains_neo:E9},j9=s9,L9={common:wa,getConfig:be,insertCluster:Ez,insertEdge:i9,insertEdgeLabel:Qz,insertMarkers:j9,insertNode:z2,interpolateToCurve:Cp,labelHelper:Mt,log:tt,positionEdgeLabel:Jz},da={},U2=v(t=>{for(const e of t)da[e.name]=e},"registerLayoutLoaders"),B9=v(()=>{U2([{name:"dagre",loader:v(async()=>await Jt(()=>import("./dagre-BM42HDAG-DaPz_mPt.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Jt(()=>import("./cose-bilkent-S5V4N54A-MHpsrtBZ.js"),__vite__mapDeps([8,7,3,4,5,6])),"loader")}])},"registerDefaultLayoutLoaders");B9();var qZ=v(async(t,e)=>{if(!(t.layoutAlgorithm in da))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);if(t.diagramId)for(const u of t.nodes){const d=u.domId||u.id;u.domId=`${t.diagramId}-${d}`}const r=da[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:l}=s,c=e.attr("id");if(e.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),o){const u=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");u.append("svg:stop").attr("offset","0%").attr("stop-color",a).attr("stop-opacity",1),u.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return n.render(t,e,L9,{algorithm:r.algorithm})},"render"),HZ=v((t="",{fallback:e="dagre"}={})=>{if(t in da)return t;if(e in da)return tt.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),zp="comm",G2="rule",V2="decl",A9="@media",M9="@import",I9="@supports",F9="@namespace",qd="@keyframes",Y2="@layer",P9="@scope",D9=Math.abs,Ko=String.fromCharCode;function X2(t){return t.trim()}function Hd(t,e,r){return t.replace(e,r)}function gs(t,e){return t.charCodeAt(e)|0}function Hs(t,e,r){return t.slice(e,r)}function nn(t){return t.length}function K2(t){return t.length}function nl(t,e){return e.push(t),t}var ah=1,Us=1,Z2=0,Mr=0,je=0,Qs="";function Wp(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:ah,column:Us,length:o,return:"",siblings:a}}function O9(){return je}function R9(){return je=Mr>0?gs(Qs,--Mr):0,Us--,je===10&&(Us=1,ah--),je}function Ur(){return je=Mr<Z2?gs(Qs,Mr++):0,Us++,je===10&&(Us=1,ah++),je}function qn(){return gs(Qs,Mr)}function Ll(){return Mr}function lh(t,e){return Hs(Qs,t,e)}function fa(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $9(t){return ah=Us=1,Z2=nn(Qs=t),Mr=0,[]}function z9(t){return Qs="",t}function pu(t){return X2(lh(Mr-1,Ud(t===91?t+2:t===40?t+1:t)))}function W9(t){for(;(je=qn())&&je<33;)Ur();return fa(t)>2||fa(je)>3?"":" "}function q9(t,e){for(;--e&&Ur()&&!(je<48||je>102||je>57&&je<65||je>70&&je<97););return lh(t,Ll()+(e<6&&qn()==32&&Ur()==32))}function Ud(t){for(;Ur();)switch(je){case t:return Mr;case 34:case 39:t!==34&&t!==39&&Ud(je);break;case 40:t===41&&Ud(t);break;case 92:Ur();break}return Mr}function H9(t,e){for(;Ur()&&t+je!==57;)if(t+je===84&&qn()===47)break;return"/*"+lh(e,Mr-1)+"*"+Ko(t===47?t:Ur())}function U9(t){for(;!fa(qn());)Ur();return lh(t,Mr)}function G9(t){return z9(Bl("",null,null,null,[""],t=$9(t),0,[0],t))}function Bl(t,e,r,n,i,s,o,a,l){for(var c=0,u=0,d=o,p=0,f=0,m=0,x=1,g=1,y=1,b=0,k=0,T="",_=i,w=s,E=n,L=T;g;)switch(m=k,k=Ur()){case 40:m!=108&&gs(L,d-1)==58?(b++,L+="("):L+=pu(k);break;case 41:b--,L+=")";break;case 34:case 39:case 91:L+=pu(k);break;case 9:case 10:case 13:case 32:if(b>0){L+=Ko(k);break}L+=W9(m);break;case 92:L+=q9(Ll()-1,7);continue;case 47:switch(qn()){case 42:case 47:nl(V9(H9(Ur(),Ll()),e,r,l),l),(fa(m||1)==5||fa(qn()||1)==5)&&nn(L)&&Hs(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*x:a[c++]=nn(L)*y;case 125*x:case 59:case 0:if(b>0&&k){L+=Ko(k);break}switch(k){case 0:case 125:g=0;case 59+u:y==-1&&(L=Hd(L,/\f/g,"")),f>0&&(nn(L)-d||x===0)&&nl(f>32?Qx(L+";",n,r,d-1,l):Qx(Hd(L," ","")+";",n,r,d-2,l),l);break;case 59:L+=";";default:if(nl(E=Zx(L,e,r,c,u,i,a,T,_=[],w=[],d,s),s),k===123)if(u===0)Bl(L,e,E,E,_,s,d,a,w);else{switch(p){case 99:if(gs(L,3)===110)break;case 108:if(gs(L,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Bl(t,E,E,n&&nl(Zx(t,E,E,0,0,i,a,T,i,_=[],d,w),w),i,w,d,a,n?_:w):Bl(L,E,E,E,[""],w,0,a,w)}}c=u=f=0,x=y=1,T=L="",d=o;break;case 58:d=1+nn(L),f=m;default:if(x<1){if(k==123)--x;else if(k==125&&x++==0&&R9()==125)continue}switch(L+=Ko(k),k*x){case 38:y=u>0?1:(L+="\f",-1);break;case 44:if(b>0)break;a[c++]=(nn(L)-1)*y,y=1;break;case 64:qn()===45&&(L+=pu(Ur())),p=qn(),u=d=nn(T=L+=U9(Ll())),k++;break;case 45:m===45&&nn(L)==2&&(x=0)}}return s}function Zx(t,e,r,n,i,s,o,a,l,c,u,d){for(var p=i-1,f=i===0?s:[""],m=K2(f),x=0,g=0,y=0;x<n;++x)for(var b=0,k=Hs(t,p+1,p=D9(g=o[x])),T=t;b<m;++b)(T=X2(g>0?f[b]+" "+k:Hd(k,/&\f/g,f[b])))&&(l[y++]=T);return Wp(t,e,r,i===0?G2:a,l,c,u,d)}function V9(t,e,r,n){return Wp(t,e,r,zp,Ko(O9()),Hs(t,2,-2),0,n)}function Qx(t,e,r,n,i){return Wp(t,e,r,V2,Hs(t,0,n),Hs(t,n+1,-1),n,i)}function Gd(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function Y9(t,e,r,n){switch(t.type){case Y2:if(t.children.length)break;case M9:case F9:case V2:return t.return=t.return||t.value;case zp:return"";case qd:return t.return=t.value+"{"+Gd(t.children,n)+"}";case G2:if(!nn(t.value=t.props.join(",")))return""}return nn(r=Gd(t.children,n))?t.return=t.value+"{"+r+"}":""}function X9(t){var e=K2(t);return function(r,n,i,s){for(var o="",a=0;a<e;a++)o+=t[a](r,n,i,s)||"";return o}}var Q2="c4",K9=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),Z9=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./c4Diagram-AAUBKEIU-DRKW39LH.js");return{diagram:e}},__vite__mapDeps([9,10,3,4,5,6,7]));return{id:Q2,diagram:t}},"loader"),Q9={id:Q2,detector:K9,loader:Z9},J9=Q9,J2="flowchart",t7=v((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),e7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DdpxVf-5.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:J2,diagram:t}},"loader"),r7={id:J2,detector:t7,loader:e7},n7=r7,tS="flowchart-v2",i7=v((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),s7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DdpxVf-5.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:tS,diagram:t}},"loader"),o7={id:tS,detector:i7,loader:s7},a7=o7,eS="er",l7=v(t=>/^\s*erDiagram/.test(t),"detector"),c7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./erDiagram-TEJ5UH35-B3OLgtKK.js");return{diagram:e}},__vite__mapDeps([16,13,14,15,3,4,5,6,7]));return{id:eS,diagram:t}},"loader"),h7={id:eS,detector:l7,loader:c7},u7=h7,rS="gitGraph",d7=v(t=>/^\s*gitGraph/.test(t),"detector"),f7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-PVQCEYII-nITcPPED.js");return{diagram:e}},__vite__mapDeps([17,18,19,20,5,3,4,6,7]));return{id:rS,diagram:t}},"loader"),p7={id:rS,detector:d7,loader:f7},m7=p7,nS="gantt",g7=v(t=>/^\s*gantt/.test(t),"detector"),x7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ganttDiagram-6RSMTGT7-QALT_Lj9.js");return{diagram:e}},__vite__mapDeps([21,3,4,22,23,24,5,6,7]));return{id:nS,diagram:t}},"loader"),y7={id:nS,detector:g7,loader:x7},b7=y7,iS="info",C7=v(t=>/^\s*info/.test(t),"detector"),k7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./infoDiagram-5YYISTIA-CjlRce3x.js");return{diagram:e}},__vite__mapDeps([25,20,5,3,4,6,7]));return{id:iS,diagram:t}},"loader"),v7={id:iS,detector:C7,loader:k7},sS="pie",w7=v(t=>/^\s*pie/.test(t),"detector"),S7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./pieDiagram-4H26LBE5-DaU2jPjX.js");return{diagram:e}},__vite__mapDeps([26,18,20,5,3,4,6,27,28,23,7]));return{id:sS,diagram:t}},"loader"),T7={id:sS,detector:w7,loader:S7},oS="quadrantChart",_7=v(t=>/^\s*quadrantChart/.test(t),"detector"),E7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./quadrantDiagram-W4KKPZXB-HFtjZSAT.js");return{diagram:e}},__vite__mapDeps([29,22,23,24,3,4,5,6,7]));return{id:oS,diagram:t}},"loader"),N7={id:oS,detector:_7,loader:E7},j7=N7,aS="xychart",L7=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),B7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./xychartDiagram-2RQKCTM6-1_H1qVde.js");return{diagram:e}},__vite__mapDeps([30,23,28,22,24,3,4,5,6,7]));return{id:aS,diagram:t}},"loader"),A7={id:aS,detector:L7,loader:B7},M7=A7,lS="requirement",I7=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),F7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./requirementDiagram-4Y6WPE33-CX_Mz3gv.js");return{diagram:e}},__vite__mapDeps([31,13,14,3,4,5,6,7]));return{id:lS,diagram:t}},"loader"),P7={id:lS,detector:I7,loader:F7},D7=P7,cS="sequence",O7=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),R7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sequenceDiagram-3UESZ5HK-CtHp0Qnp.js");return{diagram:e}},__vite__mapDeps([32,10,19,3,4,5,6,7]));return{id:cS,diagram:t}},"loader"),$7={id:cS,detector:O7,loader:R7},z7=$7,hS="class",W7=v((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),q7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-4FO5ZUOK-D2RRwp7J.js");return{diagram:e}},__vite__mapDeps([33,34,12,10,13,14,3,4,5,6,7]));return{id:hS,diagram:t}},"loader"),H7={id:hS,detector:W7,loader:q7},U7=H7,uS="classDiagram",G7=v((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),V7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-v2-Q7XG4LA2-D2RRwp7J.js");return{diagram:e}},__vite__mapDeps([35,34,12,10,13,14,3,4,5,6,7]));return{id:uS,diagram:t}},"loader"),Y7={id:uS,detector:G7,loader:V7},X7=Y7,dS="state",K7=v((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),Z7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-AJRCARHV-DmiEmD6G.js");return{diagram:e}},__vite__mapDeps([36,37,13,14,1,2,3,4,5,6,7]));return{id:dS,diagram:t}},"loader"),Q7={id:dS,detector:K7,loader:Z7},J7=Q7,fS="stateDiagram",tW=v((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),eW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-BHNVJYJU-7rdO1Tgp.js");return{diagram:e}},__vite__mapDeps([38,37,13,14,3,4,5,6,7]));return{id:fS,diagram:t}},"loader"),rW={id:fS,detector:tW,loader:eW},nW=rW,pS="journey",iW=v(t=>/^\s*journey/.test(t),"detector"),sW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./journeyDiagram-JHISSGLW-3FaFyfLR.js");return{diagram:e}},__vite__mapDeps([39,12,10,27,3,4,5,6,7]));return{id:pS,diagram:t}},"loader"),oW={id:pS,detector:iW,loader:sW},aW=oW,lW=v((t,e,r)=>{tt.debug(`rendering svg for syntax error
645
+ `);const n=qR(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),G1(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),mS={draw:lW},cW=mS,hW={db:{},renderer:mS,parser:{parse:v(()=>{},"parse")}},uW=hW,gS="flowchart-elk",dW=v((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),fW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DdpxVf-5.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:gS,diagram:t}},"loader"),pW={id:gS,detector:dW,loader:fW},mW=pW,xS="timeline",gW=v(t=>/^\s*timeline/.test(t),"detector"),xW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./timeline-definition-PNZ67QCA-GSHqrJ3A.js");return{diagram:e}},__vite__mapDeps([40,27,3,4,5,6,7]));return{id:xS,diagram:t}},"loader"),yW={id:xS,detector:gW,loader:xW},bW=yW,yS="mindmap",CW=v(t=>/^\s*mindmap/.test(t),"detector"),kW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./mindmap-definition-RKZ34NQL-C0CwWNdR.js");return{diagram:e}},__vite__mapDeps([41,13,14,3,4,5,6,7]));return{id:yS,diagram:t}},"loader"),vW={id:yS,detector:CW,loader:kW},wW=vW,bS="kanban",SW=v(t=>/^\s*kanban/.test(t),"detector"),TW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./kanban-definition-UN3LZRKU-DUPnRo3q.js");return{diagram:e}},__vite__mapDeps([42,12,3,4,5,6,7]));return{id:bS,diagram:t}},"loader"),_W={id:bS,detector:SW,loader:TW},EW=_W,CS="sankey",NW=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),jW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sankeyDiagram-5OEKKPKP-BR2_eTy9.js");return{diagram:e}},__vite__mapDeps([43,28,23,3,4,5,6,7]));return{id:CS,diagram:t}},"loader"),LW={id:CS,detector:NW,loader:jW},BW=LW,kS="packet",AW=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),MW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-LMA3HP47-vnySSoyd.js");return{diagram:e}},__vite__mapDeps([44,18,20,5,3,4,6,7]));return{id:kS,diagram:t}},"loader"),IW={id:kS,detector:AW,loader:MW},vS="radar",FW=v(t=>/^\s*radar-beta/.test(t),"detector"),PW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-2AECGRRQ-DIdstuOm.js");return{diagram:e}},__vite__mapDeps([45,18,20,5,3,4,6,7]));return{id:vS,diagram:t}},"loader"),DW={id:vS,detector:FW,loader:PW},wS="block",OW=v(t=>/^\s*block(-beta)?/.test(t),"detector"),RW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./blockDiagram-GPEHLZMM-N7MotI_5.js");return{diagram:e}},__vite__mapDeps([46,12,1,15,3,4,5,6,7]));return{id:wS,diagram:t}},"loader"),$W={id:wS,detector:OW,loader:RW},zW=$W,SS="treeView",WW=v(t=>/^\s*treeView-beta/.test(t),"detector"),qW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-5GNKFQAL-DbkTGVES.js");return{diagram:e}},__vite__mapDeps([47,18,19,20,5,3,4,6,7]));return{id:SS,diagram:t}},"loader"),HW={id:SS,detector:WW,loader:qW},UW=HW,TS="architecture",GW=v(t=>/^\s*architecture/.test(t),"detector"),VW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./architectureDiagram-3BPJPVTR-itmOSZLE.js");return{diagram:e}},__vite__mapDeps([48,18,20,5,3,4,6,7]));return{id:TS,diagram:t}},"loader"),YW={id:TS,detector:GW,loader:VW},XW=YW,_S="eventmodeling",KW=v(t=>/^\s*eventmodeling/.test(t),"detector"),ZW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-KO2AKTUF-BPalYJed.js");return{diagram:e}},__vite__mapDeps([49,18,20,5,3,4,6,7]));return{id:_S,diagram:t}},"loader"),QW={id:_S,detector:KW,loader:ZW},JW=QW,ES="ishikawa",tq=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),eq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-YF4QCWOH-OyKVgxOz.js");return{diagram:e}},__vite__mapDeps([50,3,4,5,6,7]));return{id:ES,diagram:t}},"loader"),rq={id:ES,detector:tq,loader:eq},NS="venn",nq=v(t=>/^\s*venn-beta/.test(t),"detector"),iq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./vennDiagram-CIIHVFJN-CNxhQnCU.js");return{diagram:e}},__vite__mapDeps([51,3,4,5,6,7]));return{id:NS,diagram:t}},"loader"),sq={id:NS,detector:nq,loader:iq},oq=sq,jS="treemap",aq=v(t=>/^\s*treemap/.test(t),"detector"),lq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-OG6HWLK6-Dv3BUJft.js");return{diagram:e}},__vite__mapDeps([52,14,18,20,5,3,4,6,24,28,23,7]));return{id:jS,diagram:t}},"loader"),cq={id:jS,detector:aq,loader:lq},LS="wardley-beta",hq=v(t=>/^\s*wardley-beta/i.test(t),"detector"),uq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./wardleyDiagram-YWT4CUSO-RGxoapr7.js");return{diagram:e}},__vite__mapDeps([53,18,20,5,3,4,6,7]));return{id:LS,diagram:t}},"loader"),dq={id:LS,detector:hq,loader:uq},fq=dq,Jx=!1,ch=v(()=>{Jx||(Jx=!0,Jl("error",uW,t=>t.toLowerCase().trim()==="error"),Jl("---",{db:{clear:v(()=>{},"clear")},styles:{},renderer:{draw:v(()=>{},"draw")},parser:{parse:v(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:v(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),Zu(mW,wW,XW),Zu(J9,EW,X7,U7,u7,b7,v7,T7,D7,z7,a7,n7,bW,m7,nW,J7,aW,j7,BW,IW,M7,zW,JW,UW,DW,rq,cq,oq,fq))},"addDiagrams"),pq=v(async()=>{tt.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(Si).map(async([r,{detector:n,loader:i}])=>{if(i)try{rd(r)}catch{try{const{diagram:s,id:o}=await i();Jl(o,s,n)}catch(s){throw tt.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Si[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){tt.error(`Failed to load ${e.length} external diagrams`);for(const r of e)tt.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),mq="graphics-document document";function BS(t,e){t.attr("role",mq),e!==""&&t.attr("aria-roledescription",e)}v(BS,"setA11yDiagramInfo");function AS(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}v(AS,"addSVGa11yTitleDescription");var ki,Vd=(ki=class{constructor(e,r,n,i,s){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=s}static async fromText(e,r={}){var c,u;const n=be(),i=Hf(e,n);e=V6(e)+`
646
+ `;try{rd(i)}catch{const d=c4(i);if(!d)throw new B1(`Diagram ${i} not found.`);const{id:p,diagram:f}=await d();Jl(p,f)}const{db:s,parser:o,renderer:a,init:l}=rd(i);return o.parser&&(o.parser.yy=s),(c=s.clear)==null||c.call(s),l==null||l(n),r.title&&((u=s.setDiagramTitle)==null||u.call(s,r.title)),await o.parse(e),new ki(i,e,s,o,a)}async render(e,r){await this.renderer.draw(this.text,e,r,this)}getParser(){return this.parser}getType(){return this.type}},v(ki,"Diagram"),ki),t0=[],gq=v(()=>{t0.forEach(t=>{t()}),t0=[]},"attachFunctions"),xq=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function MS(t){const e=t.match(L1);if(!e)return{text:t,metadata:{}};let r=K$(e[1],{schema:X$})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:t.slice(e[0].length),metadata:n}}v(MS,"extractFrontMatter");var yq=v(t=>t.replace(/\r\n?/g,`
647
+ `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),bq=v(t=>{const{text:e,metadata:r}=MS(t),{displayMode:n,title:i,config:s={}}=r;return n&&(s.gantt||(s.gantt={}),s.gantt.displayMode=n),{title:i,config:s,text:e}},"processFrontmatter"),Cq=v(t=>{const e=Wr.detectInit(t)??{},r=Wr.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:n})=>n==="wrap"):(r==null?void 0:r.type)==="wrap"&&(e.wrap=!0),{text:I6(t),directive:e}},"processDirectives");function qp(t){const e=yq(t),r=bq(e),n=Cq(r.text),i=Tp(r.config,n.directive);return t=xq(n.text),{code:t,title:r.title,config:i}}v(qp,"preprocessDiagram");function IS(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(IS,"toBase64");var kq=5e4,vq="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",wq="sandbox",Sq="loose",Tq="http://www.w3.org/2000/svg",_q="http://www.w3.org/1999/xlink",Eq="http://www.w3.org/1999/xhtml",Nq="100%",jq="100%",Lq="border:0;margin:0;",Bq="margin:0",Aq="allow-top-navigation-by-user-activation allow-popups",Mq='The "iframe" tag is not supported by your browser.',Iq=["foreignobject"],Fq=["dominant-baseline"];function Hp(t){const e=qp(t);return Zl(),P4(e.config??{}),e}v(Hp,"processAndSetConfigs");async function FS(t,e){ch();try{const{code:r,config:n}=Hp(t);return{diagramType:(await DS(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(FS,"parse");var e0=v((t,e,r=[])=>{const n=P1(`{ ${r.join(" !important; ")} !important; }`);return`.${t} ${e} ${n}`},"cssImportantStyles"),Pq=v((t,e=new Map)=>{const r=new CSSStyleSheet;if(t.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${t.fontFamily}}`,r.cssRules.length),t.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${t.altFontFamily}}`,r.cssRules.length),e instanceof Map){const a=or(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(l=>{mx(l.styles)||a.forEach(c=>{r.insertRule(e0(l.id,c,l.styles),r.cssRules.length)}),mx(l.textStyles)||r.insertRule(e0(l.id,"tspan",((l==null?void 0:l.textStyles)||[]).map(c=>c.replace("color","fill"))),r.cssRules.length)})}let n="";if(t.themeCSS!==void 0)if(typeof r.replaceSync=="function"){const i=new CSSStyleSheet;i.replaceSync(t.themeCSS),n=ed(i)+`
648
+ `}else n+=`${t.themeCSS}
649
+ `;return n+ed(r)},"createCssStyles"),Dq=v((t,e)=>Gd(G9(`${t}{${e}}`),X9([v(function(n,i,s,o){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===qd)return;n.props=n.props.map(a=>a.startsWith(t)?a:`${t} ${a}`)}else n.type.startsWith("@")&&([...[A9,I9,Y2,P9,"@container","@starting-style"],qd].includes(n.type)||(tt.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=zp))},"addNamespace"),Y9])),"compileCSS"),Oq=v((t,e,r,n)=>{const i=Pq(t,r),s=eP(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return Dq(n,s)},"createUserStyles"),Rq=v((t="",e,r)=>{let n=t;return!r&&!e&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=Ni(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),$q=v((t="",e)=>{var i,s;const r=(s=(i=e==null?void 0:e.viewBox)==null?void 0:i.baseVal)!=null&&s.height?e.viewBox.baseVal.height+"px":jq,n=IS(`<body style="${Bq}">${t}</body>`);return`<iframe style="width:${Nq};height:${r};${Lq}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${Aq}">
650
+ ${Mq}
651
+ </iframe>`},"putIntoIFrame"),r0=v((t,e,r,n,i)=>{const s=t.append("div");s.attr("id",r),n&&s.attr("style",n);const o=s.append("svg").attr("id",e).attr("width","100%").attr("xmlns",Tq);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function Yd(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(Yd,"sandboxedIframe");var zq=v((t,e,r,n)=>{var i,s,o;(i=t.getElementById(e))==null||i.remove(),(s=t.getElementById(r))==null||s.remove(),(o=t.getElementById(n))==null||o.remove()},"removeExistingElements"),Wq=v(async function(t,e,r){var $,q,O,I,F,D;ch();const n=Hp(e);e=n.code;const i=be();tt.debug(i),e.length>((i==null?void 0:i.maxTextSize)??kq)&&(e=vq);const s=`#${t}`,o="i"+t,a="#"+o,l="d"+t,c="#"+l,u=v(()=>{const j=Gt(p?a:c).node();j&&"remove"in j&&j.remove()},"removeTempElements");let d=Gt(document.body);const p=i.securityLevel===wq,f=i.securityLevel===Sq,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),p){const R=Yd(Gt(r),o);d=Gt(R.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Gt(r);r0(d,t,l,`font-family: ${m}`,_q)}else{if(zq(document,t,l,o),p){const R=Yd(Gt(document.body),o);d=Gt(R.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Gt("body");r0(d,t,l)}let x,g;try{x=await Vd.fromText(e,{title:n.title})}catch(R){if(i.suppressErrorRendering)throw u(),R;x=await Vd.fromText("error"),g=R}const y=d.select(c).node(),b=x.type,k=y.firstChild,T=k.firstChild,_=(q=($=x.renderer).getClasses)==null?void 0:q.call($,e,x),w=Oq(i,b,_,s),E=document.createElement("style");E.innerHTML=w,k.insertBefore(E,T);try{await x.renderer.draw(e,t,"11.15.0",x)}catch(R){throw i.suppressErrorRendering?u():cW.draw(e,t,"11.15.0"),R}const L=d.select(`${c} svg`),M=(I=(O=x.db).getAccTitle)==null?void 0:I.call(O),N=(D=(F=x.db).getAccDescription)==null?void 0:D.call(F);OS(b,L,M,N),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",Eq);let P=d.select(c).node().innerHTML;if(tt.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),P=Rq(P,p,En(i.arrowMarkerAbsolute)),p){const R=d.select(c+" svg").node();P=$q(P,R)}else f||(P=Os.sanitize(P,{ADD_TAGS:Iq,ADD_ATTR:Fq,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(gq(),g)throw g;return u(),{diagramType:b,svg:P,bindFunctions:x.db.bindFunctions}},"render");function PS(t={}){var n;const e=Ie({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),I4(e),e!=null&&e.theme&&e.theme in kn?e.themeVariables=kn[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=kn.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?M4(e):D1();qf(r.logLevel),ch()}v(PS,"initialize");var DS=v((t,e={})=>{const{code:r}=qp(t);return Vd.fromText(r,e)},"getDiagramFromText");function OS(t,e,r,n){BS(e,t),AS(e,r,n,e.attr("id"))}v(OS,"addA11yInfo");var Li=Object.freeze({render:Wq,parse:FS,getDiagramFromText:DS,initialize:PS,getConfig:be,setConfig:O1,getSiteConfig:D1,updateSiteConfig:F4,reset:v(()=>{Zl()},"reset"),globalReset:v(()=>{Zl(Rs)},"globalReset"),defaultConfig:Rs});qf(be().logLevel);Zl(be());var qq=v((t,e,r)=>{tt.warn(t),Sp(t)?(r&&r(t.str,t.hash),e.push({...t,message:t.str,error:t})):(r&&r(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),RS=v(async function(t={querySelector:".mermaid"}){try{await Hq(t)}catch(e){if(Sp(e)&&tt.error(e.str),Sr.parseError&&Sr.parseError(e),!t.suppressErrors)throw tt.error("Use the suppressErrors option to suppress these errors"),e}},"run"),Hq=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=Li.getConfig();tt.debug(`${t?"":"No "}Callback function found`);let i;if(r)i=r;else if(e)i=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");tt.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(tt.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),Li.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new Wr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const l of Array.from(i)){if(tt.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${s.next()}`;o=l.innerHTML,o=Jv(Wr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Wr.detectInit(o);u&&tt.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:p}=await qS(c,o,l);l.innerHTML=d,t&&await t(c),p&&p(l)}catch(d){qq(d,a,Sr.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),$S=v(function(t){Li.initialize(t)},"initialize"),Uq=v(async function(t,e,r){tt.warn("mermaid.init is deprecated. Please use run instead."),t&&$S(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await RS(n)},"init"),Gq=v(async(t,{lazyLoad:e=!0}={})=>{ch(),Zu(...t),e===!1&&await pq()},"registerExternalDiagrams"),zS=v(function(){if(Sr.startOnLoad){const{startOnLoad:t}=Li.getConfig();t&&Sr.run().catch(e=>tt.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",zS,!1);var Vq=v(function(t){Sr.parseError=t},"setParseErrorHandler"),Tc=[],mu=!1,WS=v(async()=>{if(!mu){for(mu=!0;Tc.length>0;){const t=Tc.shift();if(t)try{await t()}catch(e){tt.error("Error executing queue",e)}}mu=!1}},"executeQueue"),Yq=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{Li.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;tt.error("Error parsing",a),(l=Sr.parseError)==null||l.call(Sr,a),o(a),n(a)})}),"performCall");Tc.push(i),WS().catch(n)}),"parse"),qS=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{Li.render(t,e,r).then(l=>{o(l),n(l)},l=>{var c;tt.error("Error parsing",l),(c=Sr.parseError)==null||c.call(Sr,l),a(l),i(l)})}),"performCall");Tc.push(s),WS().catch(i)}),"render"),Xq=v(()=>Object.keys(Si).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),Sr={startOnLoad:!0,mermaidAPI:Li,parse:Yq,render:qS,init:Uq,run:RS,registerExternalDiagrams:Gq,registerLayoutLoaders:U2,initialize:$S,parseError:void 0,contentLoaded:zS,setParseErrorHandler:Vq,detectType:Hf,registerIconPacks:tz,getRegisteredDiagramsMetadata:Xq},HS=Sr;/*! Check if previously processed *//*!
652
+ * Wait for document loaded before starting the execution
653
+ */HS.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function Kq({code:t}){const e=C.useRef(null),r=C.useId(),[n,i]=C.useState(null),[s,o]=C.useState(null);return C.useEffect(()=>{let a=!1;const l=`mermaid-${r.replace(/:/g,"")}`;return HS.render(l,t).then(({svg:c})=>{a||i(c)}).catch(c=>{a||o(c.message||"Invalid diagram")}),()=>{a=!0}},[t,r]),s?h.jsx("pre",{className:"text-[11px] text-destructive bg-destructive/10 border border-destructive/20 rounded p-3 overflow-x-auto",children:`Mermaid error: ${s}
654
+
655
+ ${t}`}):n?h.jsx("div",{ref:e,className:"my-3 overflow-x-auto",dangerouslySetInnerHTML:{__html:n}}):h.jsx("div",{className:"text-[11px] text-muted-foreground py-2",children:"Rendering diagram..."})}function Zq({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?h.jsx(Kq,{code:String(e).trim()}):h.jsx("code",{className:t,...r,children:e})}function Qq(t){const e={name:"",children:new Map,files:[]};for(const r of t){const n=r.split("/");let i=e;for(let s=0;s<n.length-1;s++)i.children.has(n[s])||i.children.set(n[s],{name:n[s],children:new Map,files:[]}),i=i.children.get(n[s]);i.files.push({name:n[n.length-1],path:r})}return e}function US(t,e){if(!e)return t;const r=e.toLowerCase(),n={name:t.name,children:new Map,files:t.files.filter(i=>i.name.toLowerCase().includes(r)||i.path.toLowerCase().includes(r))};for(const[i,s]of t.children){const o=US(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function GS(t){let e=t.files.length;for(const r of t.children.values())e+=GS(r);return e}function VS({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=Jq(t,e),c=r.has(l)||!!a,u=GS(t);return h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>n(l),className:"flex items-center gap-1.5 w-full px-2 py-1 text-left hover:bg-muted/30 transition-colors rounded-sm",style:{paddingLeft:`${e*16+4}px`},children:[c?h.jsx(nM,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):h.jsx(Bf,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name}),h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto tabular-nums shrink-0",children:u})]}),c&&h.jsxs(h.Fragment,{children:[[...t.children.values()].sort((d,p)=>d.name.localeCompare(p.name)).map(d=>h.jsx(VS,{node:d,depth:e+1,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a},d.name)),t.files.sort((d,p)=>d.name.localeCompare(p.name)).map(d=>h.jsx(YS,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function YS({file:t,depth:e,isSelected:r,isTracked:n,onSelect:i}){return h.jsxs("button",{onClick:i,className:nt("flex items-center gap-1.5 w-full px-2 py-1 text-left transition-colors rounded-sm",r?"bg-accent/10 text-accent":"hover:bg-muted/30"),style:{paddingLeft:`${e*16+4}px`},children:[h.jsx(Mi,{className:"h-3 w-3 shrink-0",style:{color:n?"hsl(var(--primary))":void 0}}),h.jsx("span",{className:nt("text-xs truncate",r?"text-accent font-medium":"text-foreground"),children:t.name}),n&&h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 ml-auto",style:{background:"hsl(var(--primary))"}})]})}function Jq(t,e){return`dir-${e}-${t.name}`}function XS({items:t,selectedFile:e,onSelectedFileChange:r,previousView:n,onBack:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,c]=C.useState([]),[u,d]=C.useState(!0),[p,f]=C.useState(null),m=e||p,x=K=>{f(K),r&&r(K)},[g,y]=C.useState(null),[b,k]=C.useState(!1),[T,_]=C.useState(!1),[w,E]=C.useState(""),[L,M]=C.useState(null),[N,P]=C.useState(!1),$=C.useRef(null),[q,O]=C.useState(""),[I,F]=C.useState(()=>new Set(["dir-0-docs"])),[D,R]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),j=C.useRef(!1),S=C.useRef(null),U=C.useCallback(K=>{K.preventDefault(),j.current=!0;const lt=At=>{if(!j.current||!S.current)return;const Dt=S.current.getBoundingClientRect(),ue=Math.min(Math.max(At.clientX-Dt.left,160),500);R(ue)},yt=()=>{j.current=!1,document.removeEventListener("mousemove",lt),document.removeEventListener("mouseup",yt),R(At=>(localStorage.setItem("compose:docsTreeWidth",At),At))};document.addEventListener("mousemove",lt),document.addEventListener("mouseup",yt)},[]),Q=T&&w!==L,A=C.useCallback(async()=>{if(!(!m||N)){P(!0);try{(await zt("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:w})})).ok&&(M(w),y(w))}catch{}P(!1)}},[m,w,N]),rt=C.useCallback(()=>{_(K=>(!K&&g!==null&&(E(g),M(g)),!K))},[g]);C.useEffect(()=>{if(!T)return;const K=lt=>{(lt.metaKey||lt.ctrlKey)&&lt.key==="s"&&(lt.preventDefault(),A())};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[T,A]),C.useEffect(()=>{_(!1),E(""),M(null)},[m]),C.useEffect(()=>{zt("/api/files").then(K=>K.json()).then(K=>{c(K.files||[]),d(!1);const lt=new Set(["dir-0-docs"]);for(const yt of K.files||[]){const At=yt.split("/");At.length>1&&lt.add(`dir-1-${At[1]}`)}F(lt)}).catch(()=>d(!1))},[]),C.useEffect(()=>{if(!m){y(null);return}k(!0),zt(`/api/file?path=${encodeURIComponent(m)}`).then(K=>K.json()).then(K=>{y(K.content??null),k(!1)}).catch(()=>{y(null),k(!1)})},[m]);const ut=C.useMemo(()=>!o||!s?l:l.filter(K=>K.includes(`features/${s}/`)),[l,o,s]),ot=C.useMemo(()=>{const K=new Set,lt=yt=>yt.split("/").pop();for(const yt of t){const At=`${yt.title||""} ${yt.description||""} ${yt.planLink||""}`.toLowerCase();for(const Dt of ut)(At.includes(Dt.toLowerCase())||At.includes(lt(Dt).replace(".md","").toLowerCase()))&&K.add(Dt)}return K},[t,ut]),It=C.useMemo(()=>Qq(ut),[ut]),ht=C.useMemo(()=>US(It,q),[It,q]),at=C.useCallback(K=>{F(lt=>{const yt=new Set(lt);return yt.has(K)?yt.delete(K):yt.add(K),yt})},[]);return u?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading docs..."})}):h.jsxs("div",{ref:S,className:"flex-1 flex min-h-0",children:[h.jsxs("div",{className:"shrink-0 flex flex-col min-h-0",style:{width:`${D}px`},children:[h.jsxs("div",{className:"px-2 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:h.jsx(ka,{featureCode:s,active:o,onToggle:a})}),h.jsxs("div",{className:"relative",children:[h.jsx(ei,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(zc,{placeholder:"Search files...",value:q,onChange:K=>O(K.target.value),className:"h-7 pl-7 pr-7 text-xs"}),q&&h.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h.jsx(hn,{className:"h-3 w-3"})})]}),h.jsxs("div",{className:"flex items-center justify-between mt-1.5 px-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ut.length," files"]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ut.length-ot.size," untracked"]})]})]}),h.jsx(Yn,{className:"flex-1",children:h.jsxs("div",{className:"py-1",children:[[...ht.children.values()].sort((K,lt)=>K.name.localeCompare(lt.name)).map(K=>h.jsx(VS,{node:K,depth:0,expandedDirs:I,onToggleDir:at,selectedFile:m,onSelectFile:x,trackedPaths:ot,searchQuery:q},K.name)),ht.files.sort((K,lt)=>K.name.localeCompare(lt.name)).map(K=>h.jsx(YS,{file:K,depth:0,isSelected:m===K.path,isTracked:ot.has(K.path),onSelect:()=>x(K.path)},K.path))]})})]}),h.jsx("div",{onMouseDown:U,className:"w-1 shrink-0 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors",style:{background:"hsl(var(--border))"}}),h.jsx("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:m?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2",style:{borderBottom:"1px solid hsl(var(--border))"},children:[n&&i&&h.jsxs("button",{onClick:i,className:"flex items-center gap-1 text-xs text-accent hover:text-accent/80 transition-colors shrink-0",title:`Back to ${n}`,children:[h.jsx(MA,{className:"h-3 w-3"}),"Back to ",n.charAt(0).toUpperCase()+n.slice(1)]}),h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:m}),Q&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{color:"hsl(var(--accent))",background:"hsl(var(--accent) / 0.1)"},children:"modified"}),ot.has(m)&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{color:"hsl(var(--primary))",background:"hsl(var(--primary) / 0.1)"},children:"tracked"}),T&&h.jsxs("button",{onClick:A,disabled:N||!Q,className:nt("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",Q?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[h.jsx(BM,{className:"h-3 w-3"}),N?"Saving...":"Save"]}),h.jsx("button",{onClick:rt,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors px-1.5 py-0.5 rounded hover:bg-muted/50",title:T?"Preview":"Edit",disabled:g===null,children:T?h.jsx(Nb,{className:"h-3.5 w-3.5"}):h.jsx(Bb,{className:"h-3.5 w-3.5"})})]}),b?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):g!==null&&T?h.jsx("textarea",{ref:$,value:w,onChange:K=>E(K.target.value),className:"flex-1 w-full resize-none border-0 outline-none px-4 py-3 text-sm",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',background:"hsl(var(--background))",color:"hsl(var(--foreground))",tabSize:2},spellCheck:!1}):g!==null?h.jsx(Yn,{className:"flex-1",children:h.jsx("div",{className:"px-6 py-4 max-w-3xl",children:h.jsx("article",{className:`prose prose-sm prose-invert max-w-none
656
+ prose-headings:text-foreground prose-p:text-muted-foreground
657
+ prose-a:text-accent prose-strong:text-foreground
658
+ prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
659
+ prose-pre:bg-muted prose-pre:border prose-pre:border-border
660
+ prose-li:text-muted-foreground prose-table:text-xs
661
+ prose-th:text-foreground prose-td:text-muted-foreground
662
+ prose-hr:border-border`,children:h.jsx(Sf,{remarkPlugins:[Nf],components:{code:Zq},children:g})})})}):h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Could not load file"})})]}):h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsxs("div",{className:"text-center",children:[h.jsx(Mi,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/30"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a file to preview"}),h.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Markdown files from the project docs/ directory"})]})})})]})}const tH=Pb("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Wt=C.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},s)=>{const o=n?E3:"button";return h.jsx(o,{className:nt(tH({variant:e,size:r,className:t})),ref:s,...i})});Wt.displayName="Button";class eH{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);const s=this.castInput(e,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,r,n,i){var s;const o=b=>{if(b=this.postProcess(b,n),i){setTimeout(function(){i(b)},0);return}else return b},a=r.length,l=e.length;let c=1,u=a+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));const d=(s=n.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+d,f=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(f[0],r,e,0,n);if(f[0].oldPos+1>=l&&m+1>=a)return o(this.buildValues(f[0].lastComponent,r,e));let x=-1/0,g=1/0;const y=()=>{for(let b=Math.max(x,-c);b<=Math.min(g,c);b+=2){let k;const T=f[b-1],_=f[b+1];T&&(f[b-1]=void 0);let w=!1;if(_){const L=_.oldPos-b;w=_&&0<=L&&L<a}const E=T&&T.oldPos+1<l;if(!w&&!E){f[b]=void 0;continue}if(!E||w&&T.oldPos<_.oldPos?k=this.addToPath(_,!0,!1,0,n):k=this.addToPath(T,!1,!0,1,n),m=this.extractCommon(k,r,e,b,n),k.oldPos+1>=l&&m+1>=a)return o(this.buildValues(k.lastComponent,r,e))||!0;f[b]=k,k.oldPos+1>=l&&(g=Math.min(g,b-1)),m+1>=a&&(x=Math.max(x,b+1))}c++};if(i)(function b(){setTimeout(function(){if(c>u||Date.now()>p)return i(void 0);y()||b()},0)})();else for(;c<=u&&Date.now()<=p;){const b=y();if(b)return b}}addToPath(e,r,n,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(e,r,n,i,s){const o=r.length,a=n.length;let l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(n[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(n.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let d=r.slice(l,l+u.count);d=d.map(function(p,f){const m=n[c+f];return m.length>p.length?m:p}),u.value=this.join(d)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}}class rH extends eH{constructor(){super(...arguments),this.tokenize=sH}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
663
+ `))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
664
+ `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
665
+ `)&&(e=e.slice(0,-1)),r.endsWith(`
666
+ `)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const nH=new rH;function iH(t,e,r){return nH.diff(t,e,r)}function sH(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
667
+ `));const r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){const s=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}function Up({oldText:t,newText:e}){const[r,n]=C.useState(!1),{parts:i,addCount:s,removeCount:o}=C.useMemo(()=>{if(!t||!e)return{parts:[],addCount:0,removeCount:0};const a=iH(t,e);let l=0,c=0;for(const u of a){const d=u.value.split(`
668
+ `).filter(p=>p!=="").length;u.added&&(l+=d),u.removed&&(c+=d)}return{parts:a,addCount:l,removeCount:c}},[t,e]);return!t||!e?null:s===0&&o===0?h.jsx("span",{className:"text-[9px] text-muted-foreground/50 italic",children:"No changes"}):r?h.jsxs("div",{className:"mt-1.5",children:[h.jsx("button",{onClick:()=>n(!1),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors mb-1",children:"Hide changes"}),h.jsx("div",{className:"rounded border border-border bg-muted/30 overflow-x-auto max-h-[300px] overflow-y-auto",children:h.jsx("pre",{className:"text-[10px] font-mono leading-relaxed",children:i.map((a,l)=>{const c=a.value.split(`
669
+ `);return c[c.length-1]===""&&c.pop(),c.map((u,d)=>h.jsxs("div",{className:a.added?"bg-emerald-500/15 text-emerald-300":a.removed?"bg-red-500/15 text-red-300 line-through":"text-muted-foreground",style:{padding:"0 8px"},children:[h.jsx("span",{className:"inline-block w-3 text-muted-foreground/40 select-none mr-1",children:a.added?"+":a.removed?"-":" "}),u||" "]},`${l}-${d}`))})})})]}):h.jsxs("button",{onClick:()=>n(!0),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors",children:["Show changes (+",s," -",o,")"]})}function KS(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function oH({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=hy[t.fromPhase];return e.exists?h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r&&h.jsx("span",{className:"font-mono",children:r}),r&&": ",Math.round(e.completeness*100),"% complete"," · ",e.wordCount," words",((i=(n=e.sections)==null?void 0:n.missing)==null?void 0:i.length)>0&&h.jsxs("span",{className:"text-amber-400",children:[" (missing: ",e.sections.missing.join(", "),")"]}),!e.meetsMinWordCount&&h.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}):h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r??"Artifact"," not found"]})}function aH(t){var f;const e=t.artifactAssessment,r=t.summary;if(r){const m=new RegExp("(?<!\\bno\\s)(?<!\\b0\\s)\\b(critical|error|fail|missing)\\b","i").test(r);return{sentence:r,outcome:m?"revise":"approve"}}if(!e)return null;if(e.exists===!1)return{sentence:"Required artifact is missing",outcome:"revise"};const{completeness:n,wordCount:i,sections:s,meetsMinWordCount:o,findings:a}=e,l=(a??[]).filter(m=>/critical|error|fatal/i.test(m.severity??m.level??"")).length,c=((f=s==null?void 0:s.missing)==null?void 0:f.length)??0;if(l>0)return{sentence:`${l} critical finding${l>1?"s":""}`,outcome:"revise"};if(!o&&i!==void 0)return{sentence:`Thin artifact (${i} words)`,outcome:"revise"};if(c>0)return{sentence:`Missing ${c} section${c>1?"s":""}`,outcome:"revise"};const u=n!==void 0?`${Math.round(n*100)}% complete`:null,d=i!==void 0?`${i}w`:null;return{sentence:[u,d].filter(Boolean).join(", ")||"Ready",outcome:"approve"}}function lH({gate:t}){const e=aH(t);if(!e)return null;const r=e.outcome==="approve";return h.jsxs("div",{className:`text-[10px] px-2 py-0.5 rounded font-medium ${r?"bg-success/10 text-success border border-success/20":"bg-amber-400/10 text-amber-400 border border-amber-400/20"}`,children:[r?"Recommended: approve":"Recommended: revise"," — ",e.sentence]})}function n0({title:t,count:e,color:r,children:n}){return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:r}}),h.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:t}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:e})]}),n]})}function cH({gate:t,item:e,priorRevision:r,isExpanded:n,expandedAction:i,onExpand:s,onResolve:o,onSelect:a}){const[l,c]=C.useState(""),u=()=>{o(t.id,"revised",l||void 0),s(null,null),c("")},d=()=>{l.trim()&&(o(t.id,"killed",l),s(null,null),c(""))};return h.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent hover:bg-muted/50 transition-colors",children:[h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[h.jsx("button",{onClick:()=>a(t.itemId),className:"text-sm text-foreground hover:text-accent transition-colors truncate block",children:(e==null?void 0:e.title)??"Unknown"}),h.jsx("p",{className:"text-[10px] text-muted-foreground",children:wn[t.stepId]??`${Te[t.fromPhase]??t.fromPhase} → ${Te[t.toPhase]??t.toPhase}`}),h.jsx(oH,{gate:t}),r?h.jsxs("div",{className:"space-y-1",children:[h.jsxs("div",{className:"text-[10px] px-2 py-1 rounded bg-amber-400/10 border border-amber-400/20 text-amber-400",children:["Prior revision: ",r.comment||"No comment"]}),r.priorSnapshot&&r.currentSnapshot&&h.jsx("div",{className:"px-2",children:h.jsx(Up,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:KS(t.createdAt)})]}),h.jsx("div",{className:"mt-1.5",children:h.jsx(lH,{gate:t})}),h.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[h.jsx(Wt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>o(t.id,"approved"),children:"Approve"}),h.jsx(Wt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",n&&i==="revise"&&"bg-amber-400/10"),onClick:()=>{n&&i==="revise"?s(null,null):(s(t.id,"revise"),c(""))},children:"Revise"}),h.jsx(Wt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",n&&i==="kill"&&"bg-destructive/10"),onClick:()=>{n&&i==="kill"?s(null,null):(s(t.id,"kill"),c(""))},children:"Kill"})]}),n&&h.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[h.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none",placeholder:i==="revise"?"Feedback (optional)...":"Kill reason (required)...",value:l,onChange:p=>c(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(i==="revise"?u():i==="kill"&&d()),p.key==="Escape"&&s(null,null)},autoFocus:!0}),h.jsx(Wt,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:i==="kill"&&!l.trim(),onClick:i==="revise"?u:d,children:i==="revise"?"Submit":"Confirm Kill"})]})]})}function hH(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function uH({gate:t,item:e}){const r={approved:{color:"text-success",border:"border-success/30"},approve:{color:"text-success",border:"border-success/30"},revised:{color:"text-amber-400",border:"border-amber-400/30"},revise:{color:"text-amber-400",border:"border-amber-400/30"},killed:{color:"text-destructive",border:"border-destructive/30"},kill:{color:"text-destructive",border:"border-destructive/30"}},n=r[t.outcome]||r.approved,i=hH(t);return h.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:(e==null?void 0:e.title)??"Unknown"}),h.jsx(nr,{variant:"outline",className:nt("text-[10px] px-1.5 py-0 h-4",n.color,n.border),children:t.outcome}),i!=="human"&&h.jsx("span",{className:"text-[9px] px-1 py-0 rounded bg-muted text-muted-foreground",children:i}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:KS(t.resolvedAt)})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:wn[t.stepId]??`${Te[t.fromPhase]??t.fromPhase} → ${Te[t.toPhase]??t.toPhase}`}),t.comment&&h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function ZS({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o}){const[a,l]=C.useState(null),[c,u]=C.useState(null),d=C.useMemo(()=>{if(!s||!i)return t;const k=new Set(e.filter(T=>{var _;return T.featureCode===i||((_=T.lifecycle)==null?void 0:_.featureCode)===i}).map(T=>T.id));return t.filter(T=>k.has(T.itemId))},[t,e,s,i]),p=(k,T)=>{l(k),u(T)},{pending:f,resolved:m,priorRevisions:x}=C.useMemo(()=>{const k=[],T=[];for(const w of d)w.status==="pending"?k.push(w):w.resolvedAt&&T.push(w);k.sort((w,E)=>new Date(w.createdAt)-new Date(E.createdAt)),T.sort((w,E)=>new Date(E.resolvedAt)-new Date(w.resolvedAt));const _=new Map;for(const w of k){const E=T.find(L=>L.stepId===w.stepId&&L.itemId===w.itemId&&(L.outcome==="revised"||L.outcome==="revise")&&L.comment);E&&_.set(w.id,{comment:E.comment,priorSnapshot:E.artifactSnapshot||null,currentSnapshot:w.artifactSnapshot||null})}return{pending:k,resolved:T,priorRevisions:_}},[d]),[g,y]=C.useState(!1),b=C.useMemo(()=>new Map(e.map(k=>[k.id,k])),[e]);return h.jsxs("div",{className:"flex-1 overflow-auto flex flex-col",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0",children:[h.jsx(ka,{featureCode:i,active:s,onToggle:o}),h.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),f.length>0?h.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:[f.length," pending"]}):h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),m.length>0&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",m.length," resolved"]})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[f.length>0&&h.jsx(n0,{title:"Pending",count:f.length,color:"#f59e0b",children:f.map(k=>h.jsx(cH,{gate:k,item:b.get(k.itemId),priorRevision:x.get(k.id),isExpanded:a===k.id,expandedAction:a===k.id?c:null,onExpand:p,onResolve:r,onSelect:n},k.id))}),m.length>0&&h.jsxs(n0,{title:"History",count:m.length,color:"#22c55e",children:[(g?m.slice(0,50):m.slice(0,10)).map(k=>h.jsx(uH,{gate:k,item:b.get(k.itemId)},k.id)),m.length>10&&!g&&h.jsxs("button",{className:"w-full px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>y(!0),children:["Show all ",m.length," resolved gates"]})]}),f.length===0&&m.length===0&&h.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function QS({event:t,items:e,onNavigate:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(null);if(C.useEffect(()=>{if(!t)return;o(t),i(!0);const u=setTimeout(()=>i(!1),5e3);return()=>clearTimeout(u)},[t]),!n||!s)return null;const a=e.find(u=>u.id===s.itemId),l=(a==null?void 0:a.title)??"Unknown",c=s.type==="pending"?`Gate pending: ${Jo(s,a)}`:`Gate ${s.outcome}: ${l}`;return h.jsx("button",{onClick:()=>{r(),i(!1)},className:"fixed bottom-4 right-4 z-50 max-w-sm px-4 py-3 rounded-lg border border-border bg-card shadow-lg text-sm text-foreground cursor-pointer hover:bg-muted/50 transition-all animate-in fade-in slide-in-from-bottom-2",children:c})}function dH({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=C.useContext($c),i=r.has(t.id)?"vision-entering":n.has(t.id)?"vision-updated":"",[s,o]=C.useState(!1),[a,l]=C.useState(""),c=t.status==="complete"||t.status==="killed",{baseDesc:u,resolution:d}=C.useMemo(()=>{if(!t.description)return{baseDesc:"",resolution:""};const x=`
670
+
671
+ ---
672
+ Resolution:`,g=t.description.indexOf(x);return g===-1?{baseDesc:t.description,resolution:""}:{baseDesc:t.description.slice(0,g).trim(),resolution:t.description.slice(g+x.length).trim()}},[t.description]),p=C.useCallback(async()=>{const g=`Be brief. Summarize, give your recommendation, refine the decision wording based on the resolution if needed: ${t.description||t.title}
673
+ `;try{await fetch("http://localhost:4002/api/terminal/inject",{method:"POST",headers:us({"Content-Type":"application/json"}),body:JSON.stringify({text:g})});const y=document.querySelector(".xterm-helper-textarea");y&&y.focus()}catch(y){console.error("Failed to inject into terminal:",y)}},[t]),f=C.useCallback(()=>{const x=a.trim()?`${t.description||""}
674
+
675
+ ---
676
+ Resolution: ${a.trim()}`:t.description;e(t.id,{status:"complete",description:x}),o(!1),l("")},[t.id,t.description,a,e]),m=C.useCallback(()=>{e(t.id,{status:"killed"})},[t.id,e]);return h.jsxs("div",{className:nt("rounded-lg border p-3 space-y-2 transition-all",c?"border-border/50 bg-muted/20 opacity-60":"border-border bg-muted/30",i),children:[h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{background:c?"hsl(var(--muted-foreground))":gr.question}}),h.jsx("p",{className:nt("text-sm font-medium leading-snug flex-1",c?"text-muted-foreground line-through":"text-foreground"),children:t.title})]}),u&&h.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed pl-4",children:u}),d&&h.jsxs("div",{className:nt("ml-4 pl-3 border-l-2 border-success/40 py-1",n.has(t.id)&&"resolution-sparkle"),children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-0.5",children:"Resolution"}),h.jsx("p",{className:"text-xs text-foreground leading-relaxed",children:d})]}),s&&h.jsxs("div",{className:"ml-4 flex items-center gap-1.5",children:[h.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring",placeholder:"Resolution note (optional)...",value:a,onChange:x=>l(x.target.value),onKeyDown:x=>{x.key==="Enter"&&f(),x.key==="Escape"&&o(!1)},autoFocus:!0}),h.jsx(Wt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:f,children:h.jsx(Af,{className:"h-3 w-3"})}),h.jsx(Wt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:h.jsx(hn,{className:"h-3 w-3"})})]}),!c&&!s&&h.jsxs("div",{className:"flex items-center gap-1.5 pl-4",children:[h.jsxs("button",{onClick:p,className:"text-[10px] px-2 py-0.5 rounded-md text-accent hover:bg-accent/10 flex items-center gap-1 transition-colors",children:[h.jsx(Oc,{className:"h-2.5 w-2.5"})," Discuss"]}),h.jsxs("button",{onClick:()=>o(!0),className:"text-[10px] px-2 py-0.5 rounded-md text-success hover:bg-success/10 flex items-center gap-1 transition-colors",children:[h.jsx(ba,{className:"h-2.5 w-2.5"})," Resolve"]}),h.jsxs("button",{onClick:m,className:"text-[10px] px-2 py-0.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 flex items-center gap-1 transition-colors",children:[h.jsx(XA,{className:"h-2.5 w-2.5"})," Dismiss"]})]}),c&&h.jsx("div",{className:"pl-4",children:h.jsx("span",{className:nt("text-[10px] px-1.5 py-0.5 rounded-full",t.status==="complete"?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.status==="complete"?"Resolved":"Dismissed"})})]})}function JS({item:t,items:e,connections:r,onUpdate:n,onClose:i}){const[s,o]=C.useState(null),[a,l]=C.useState(null),[c,u]=C.useState(""),d=C.useRef(null),p=C.useMemo(()=>{const x=new Map(e.map(y=>[y.id,y])),g=[];for(const y of r)if(y.type==="contradicts"){if(y.toId===t.id){const b=x.get(y.fromId);b&&g.push(b)}if(y.fromId===t.id){const b=x.get(y.toId);b&&g.push(b)}}return g.sort((y,b)=>{const k=new Date(y.createdAt||0).getTime();return new Date(b.createdAt||0).getTime()-k}),g},[t.id,e,r]),f=p.filter(x=>x.status!=="complete"&&x.status!=="killed").length;C.useEffect(()=>{if(!(!s||a!=="running"))return d.current=setInterval(async()=>{try{const x=await zt(`http://localhost:4001/api/agent/${s}`);if(!x.ok)return;const g=await x.json();g.status!=="running"&&(l(g.status),clearInterval(d.current))}catch{}},1500),()=>clearInterval(d.current)},[s,a]);const m=C.useCallback(async()=>{if(a==="running")return;const x=t.description?`
677
+ Description: ${t.description}`:"",g=["Challenge the assumptions of this item and create counter-questions.","",`Item: "${t.title}" (type: ${t.type}, status: ${t.status})${x}`,"","Create 2-3 challenging questions that probe weaknesses, missing considerations, or alternative approaches. For each question, run:",`node scripts/vision-track.mjs create "<your question>" --type question --phase ${t.phase||"vision"} --description "<why this matters>" --connects-to ${t.id}:contradicts`,"","Be specific and constructive. Challenge the idea, not the person.","Only run the vision-track.mjs commands above. Do not do anything else."].join(`
678
+ `);l("running");try{const y=await zt("http://localhost:4001/api/agent/spawn",{method:"POST",headers:us({"Content-Type":"application/json"}),body:JSON.stringify({prompt:g})});if(!y.ok){const k=await y.json().catch(()=>({}));l("failed"),u(k.error||"Failed to spawn agent");return}const b=await y.json();o(b.agentId)}catch(y){l("failed"),u(y.message)}},[t,a]);return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:i}),h.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-xl border border-border bg-card shadow-2xl mx-4",children:[h.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3 border-b border-border shrink-0",children:[h.jsx(Wl,{className:"h-5 w-5 text-amber-400 shrink-0 mt-0.5"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pressure Test"}),h.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t.title})]}),h.jsx(Wt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:h.jsx(hn,{className:"h-3.5 w-3.5"})})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-3",children:[a==="running"&&h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[h.jsx(Lb,{className:"h-3.5 w-3.5 text-accent animate-spin"}),h.jsx("span",{className:"text-xs text-accent",children:"Generating challenges..."})]}),a==="failed"&&h.jsx("div",{className:"px-3 py-2 rounded-lg bg-destructive/10 border border-destructive/20",children:h.jsxs("span",{className:"text-xs text-destructive",children:["Failed: ",c]})}),p.length===0&&!a?h.jsxs("div",{className:"text-center py-8",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No challenges yet."}),h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Run a pressure test to generate counter-questions."})]}):p.map(x=>h.jsx(dH,{item:x,onUpdate:n},x.id))]}),h.jsxs("div",{className:"flex items-center justify-between p-4 pt-3 border-t border-border shrink-0",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:f>0?`${f} open / ${p.length} total`:p.length>0?`${p.length} resolved`:"No challenges"}),h.jsxs(Wt,{size:"sm",className:nt("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[h.jsx(Wl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const fH=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],pH=["gate","flag","skip"],mH=["light","dark","system"],i0=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function _o({title:t,children:e}){return h.jsxs("div",{className:"mb-6",children:[h.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:t}),e]})}function Ki({label:t,children:e}){return h.jsxs("div",{className:"flex items-center justify-between py-1.5 px-1",children:[h.jsx("label",{className:"text-sm text-foreground",children:t}),e]})}function gH({value:t,className:e,onCommit:r}){const[n,i]=C.useState(t||"");return C.useEffect(()=>{i(t||"")},[t]),h.jsx("input",{type:"text",className:e,value:n,onChange:s=>i(s.target.value),onBlur:()=>{n.trim()&&n.trim()!==t&&r(n.trim())}})}function tT({settings:t,onSettingsChange:e,onReset:r}){var p,f,m,x,g,y;if(!t)return h.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."});const n=C.useCallback((b,k)=>{const T=k==="null"?null:k;e({policies:{[b]:T}})},[e]),i=C.useCallback((b,k)=>{const T=parseInt(k,10);T>=1&&T<=100&&e({iterations:{[b]:{maxIterations:T}}})},[e]),s=C.useCallback((b,k)=>{k.trim()&&e({models:{[b]:k.trim()}})},[e]),o=C.useCallback(b=>{if(e({ui:{theme:b}}),b==="system"){const k=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",k),localStorage.removeItem("compose:theme")}else document.documentElement.classList.toggle("dark",b==="dark"),localStorage.setItem("compose:theme",b)},[e]),a=C.useCallback(b=>{e({ui:{defaultView:b}})},[e]),l=C.useCallback(b=>{e({capabilities:{enforcement:b}})},[e]),c=C.useCallback(()=>{window.confirm("Reset all settings to defaults?")&&r()},[r]),u="h-7 text-xs rounded-md border border-input bg-background px-2 py-1",d="h-7 text-xs rounded-md border border-input bg-background px-2 py-1 w-24";return h.jsxs("div",{className:"flex-1 overflow-auto p-6 max-w-2xl",children:[h.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Settings"}),h.jsx(_o,{title:"Phase Policies",children:fH.map(b=>h.jsx(Ki,{label:Te[b]||b,children:h.jsxs("select",{className:u,value:t.policies[b]===null?"null":t.policies[b]||"skip",onChange:k=>n(b,k.target.value),children:[b==="explore_design"&&h.jsx("option",{value:"null",children:"—"}),pH.map(k=>h.jsx("option",{value:k,children:k},k))]})},b))}),h.jsxs(_o,{title:"Iteration Limits",children:[h.jsx(Ki,{label:"Review max iterations",children:h.jsx("input",{type:"number",className:d,min:1,max:100,value:((f=(p=t.iterations)==null?void 0:p.review)==null?void 0:f.maxIterations)??10,onChange:b=>i("review",b.target.value)})}),h.jsx(Ki,{label:"Coverage max iterations",children:h.jsx("input",{type:"number",className:d,min:1,max:100,value:((x=(m=t.iterations)==null?void 0:m.coverage)==null?void 0:x.maxIterations)??15,onChange:b=>i("coverage",b.target.value)})})]}),h.jsx(_o,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var k;return h.jsx(Ki,{label:b,children:h.jsx(gH,{className:d+" w-48",value:((k=t.models)==null?void 0:k[b])||"",onCommit:T=>s(b,T)},b)},b)})}),h.jsxs(_o,{title:"Appearance",children:[h.jsx(Ki,{label:"Theme",children:h.jsx("select",{className:u,value:((g=t.ui)==null?void 0:g.theme)||"system",onChange:b=>o(b.target.value),children:mH.map(b=>h.jsx("option",{value:b,children:b},b))})}),h.jsx(Ki,{label:"Default view",children:h.jsx("select",{className:u,value:i0.includes((y=t.ui)==null?void 0:y.defaultView)?t.ui.defaultView:"graph",onChange:b=>a(b.target.value),children:i0.map(b=>h.jsx("option",{value:b,children:b},b))})})]}),h.jsx(_o,{title:"Capability Enforcement",children:h.jsxs("div",{className:"space-y-2 px-1",children:[[{value:"log",label:"Log (default)"},{value:"block",label:"Block"}].map(({value:b,label:k})=>{var T;return h.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[h.jsx("input",{type:"radio",name:"enforcement",value:b,checked:(((T=t.capabilities)==null?void 0:T.enforcement)??"log")===b,onChange:()=>l(b),className:"accent-accent"}),h.jsx("span",{className:"text-sm text-foreground",children:k})]},b)}),h.jsx("p",{className:"text-[11px] text-muted-foreground pt-1",children:"Block stops the build on disallowed tool use; Log records but continues."})]})}),h.jsx("button",{onClick:c,className:"text-xs text-destructive hover:underline mt-2",children:"Reset to Defaults"})]})}function xH({icon:t=cM,title:e,description:r,action:n,onAction:i,className:s}){return h.jsxs("div",{className:nt("flex flex-col items-center justify-center gap-3 p-8 text-center",s),children:[h.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-muted/50",children:h.jsx(t,{className:"w-6 h-6 text-muted-foreground/60"})}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:e}),r&&h.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),n&&h.jsx(Wt,{variant:"outline",size:"sm",onClick:i,children:n})]})}function yH(){const[t,e]=C.useState([]),[r,n]=C.useState(!0),[i,s]=C.useState(null);C.useEffect(()=>{zt("/api/pipeline/templates").then(a=>a.json()).then(a=>{e(a.templates||[]),n(!1)}).catch(()=>n(!1))},[]);const o=async a=>{s(a);try{await zt("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})})}catch(l){console.error("[TemplateSelector] Failed to create draft:",l)}s(null)};return r?h.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[h.jsx(Lb,{className:"w-4 h-4 animate-spin mr-2"}),"Loading templates..."]}):t.length===0?h.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"No pipeline templates found"}):h.jsxs("div",{className:"p-4 space-y-3",children:[h.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Choose a pipeline template"}),h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(a=>h.jsxs("button",{onClick:()=>o(a.id),disabled:i!==null,className:nt("flex flex-col gap-2 p-3 rounded-lg border text-left transition-all","hover:ring-1 hover:ring-accent/50",i===a.id&&"opacity-60",v_[a.category]||"border-border bg-card"),children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Mi,{className:"w-4 h-4 shrink-0"}),h.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.label})]}),h.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),h.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-auto",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(uM,{className:"w-3 h-3"})," ",a.steps," steps"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(Eb,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),h.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function eT({activeBuild:t,pipelineDraft:e,onSelectStep:r,onRefresh:n}){const[i,s]=C.useState(null),[o,a]=C.useState(!1),[l,c]=C.useState(!1),u=k=>{const T=i===k?null:k;s(T),r&&r(T)},d=()=>{n&&n()},p=async()=>{if(e!=null&&e.draftId){a(!0);try{await zt("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})})}catch(k){console.error("[PipelineView] Approve failed:",k)}a(!1)}},f=async()=>{if(e!=null&&e.draftId){c(!0);try{await zt("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})})}catch(k){console.error("[PipelineView] Reject failed:",k)}c(!1)}};if(!t&&!e)return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pipeline Templates"}),h.jsx("div",{className:"ml-auto",children:h.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border",children:[h.jsx(zl,{className:"w-3 h-3"})," Refresh"]})})]}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(yH,{})})]});if(e){const k=e.steps||[],T=e.metadata||{};return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Draft Review"}),h.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[h.jsxs("button",{onClick:f,disabled:l||o,className:nt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-red-400 border-red-500/30 hover:bg-red-500/10",l&&"opacity-60"),children:[h.jsx(hn,{className:"w-3 h-3"})," Reject"]}),h.jsxs("button",{onClick:p,disabled:o||l,className:nt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/10",o&&"opacity-60"),children:[h.jsx(ba,{className:"w-3 h-3"})," Approve"]})]})]}),h.jsxs("div",{className:"mx-3 mt-3 px-3 py-2 rounded-lg border ring-1 ring-amber-500/30 border-amber-500/20 bg-amber-500/5 text-[11px]",children:[h.jsxs("span",{className:"text-amber-400 font-medium",children:["Draft: ",T.label||T.id||"Pipeline"]}),h.jsx("span",{className:"text-muted-foreground ml-2",children:T.description||""}),T.category&&h.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",T.category]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-3",children:h.jsx("div",{className:"space-y-1",children:k.map((_,w)=>h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-slate-800/40 bg-card",children:[h.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0 bg-slate-500/15 text-slate-400 text-[10px] font-mono",children:w+1}),h.jsx("span",{className:"text-xs text-foreground",children:_.id}),_.agent&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:_.agent}),_.function&&h.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",_.function]})]},_.id||w))})})]})}const m=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(k=>[k.id,k.status])):{},x=(t==null?void 0:t.currentStepId)??null,g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(k=>[k.id,k])):{},y=bh.map(k=>{const T=g[k.id];return T?{...k,...T}:k});if(t!=null&&t.steps)for(const k of t.steps)bh.find(T=>T.id===k.id)||y.push({id:k.id,name:k.id.replace(/_/g," "),agent:"claude",phase:"implementation",...k});const b=Object.keys(Jp).map(k=>({phase:k,config:Jp[k],steps:y.filter(T=>T.phase===k)}));return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(il,{icon:fs,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),h.jsx(il,{icon:Lf,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),h.jsx(il,{icon:Mf,color:"text-slate-300 bg-slate-500/10",label:"Human"}),h.jsx(il,{icon:Ys,color:"text-amber-400 bg-amber-500/10",label:"Gate"})]}),h.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Live: ",h.jsx("span",{className:"text-blue-400 font-medium",children:t.featureCode})]}),h.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border",children:[h.jsx(zl,{className:"w-3 h-3"})," Refresh"]})]})]}),t&&h.jsxs("div",{className:"mx-3 mt-3 px-3 py-2 rounded-lg border ring-1 ring-blue-500/30 border-blue-500/20 bg-blue-500/5 text-[11px]",children:[h.jsxs("span",{className:"text-blue-400 font-medium",children:["Active Build: ",t.featureCode]}),h.jsxs("span",{className:"text-muted-foreground ml-2",children:["status: ",t.status," · step ",t.stepNum??"?","/",t.totalSteps??bh.length]}),x&&h.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",h.jsx("span",{className:"font-medium",children:x})]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:b.map(({phase:k,config:T,steps:_})=>h.jsxs("div",{className:nt("rounded-lg border p-3",T.color),children:[h.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:T.label}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:_.map((w,E)=>{const L=m[w.id]??null,M=w.id===x,N=w.id===i;return h.jsxs(Yt.Fragment,{children:[h.jsx(bH,{step:w,liveStatus:L,isCurrent:M,isSelected:N,onClick:()=>u(w.id)}),E<_.length-1&&h.jsx(wb,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},w.id)})})]},k))})]})}function bH({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?Ys:t.agent==="claude"?fs:t.agent==="codex"?Lf:Mf,o={active:"border-blue-500/80 bg-blue-500/10",done:"border-emerald-500/50 bg-emerald-500/5",failed:"border-red-500/60 bg-red-500/10",pending:"border-slate-800/60 bg-card"}[e]??"border-slate-800/40 bg-card";return h.jsxs("button",{onClick:i,className:nt("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border text-left transition-all min-w-[120px]",n?"border-accent/80 bg-accent/10":o,t.hasGate&&!e&&"border-amber-500/30 bg-amber-500/5",r&&"ring-1 ring-blue-400/40"),children:[h.jsx("div",{className:nt("w-5 h-5 rounded flex items-center justify-center shrink-0",t.hasGate?"bg-amber-500/15 text-amber-400":t.agent==="claude"?"bg-orange-500/15 text-orange-400":t.agent==="codex"?"bg-emerald-500/15 text-emerald-400":"bg-slate-500/15 text-slate-400"),children:h.jsx(s,{className:"w-3 h-3"})}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("p",{className:"text-[10px] font-medium text-foreground truncate leading-tight",children:t.name}),e&&h.jsx("p",{className:"text-[8px] text-muted-foreground capitalize",children:e})]})]})}function il({icon:t,color:e,label:r}){return h.jsxs("div",{className:nt("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",e),children:[h.jsx(t,{className:"w-3 h-3"}),h.jsx("span",{children:r})]})}function CH(t,{search:e="",agentFilter:r="all",statusFilter:n="all"}={}){let i=t;if(e){const s=e.toLowerCase();i=i.filter(o=>{var a,l,c,u;return((a=o.featureCode)==null?void 0:a.toLowerCase().includes(s))||((l=o.feature_code)==null?void 0:l.toLowerCase().includes(s))||((c=o.summary)==null?void 0:c.toLowerCase().includes(s))||((u=o.agent)==null?void 0:u.toLowerCase().includes(s))})}return r!=="all"&&(i=i.filter(s=>s.agent===r)),n!=="all"&&(i=i.filter(s=>s.status===n)),[...i].sort((s,o)=>s.status==="active"&&o.status!=="active"?-1:o.status==="active"&&s.status!=="active"?1:new Date(o.startedAt||o.created_date||0)-new Date(s.startedAt||s.created_date||0))}const kH={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:fs},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:Lf},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:fs},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:Mf},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:fs}},vH={bg:"bg-slate-800",text:"text-slate-600",Icon:fs},s0={sm:{outer:"w-6 h-6",icon:"w-3 h-3"},md:{outer:"w-8 h-8",icon:"w-4 h-4"},lg:{outer:"w-10 h-10",icon:"w-5 h-5"}};function wH({agent:t,size:e="md",className:r}){const n=kH[t]||vH,i=s0[e]||s0.md,{Icon:s}=n;return h.jsx("span",{className:nt("inline-flex items-center justify-center rounded-full shrink-0",n.bg,n.text,i.outer,r),title:t||"unassigned",children:h.jsx(s,{className:i.icon})})}function ce(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Jn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const rT=6048e5,SH=864e5,sl=43200,o0=1440;let TH={};function Ba(){return TH}function pa(t,e){var a,l,c,u;const r=Ba(),n=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??r.weekStartsOn??((u=(c=r.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,i=ce(t),s=i.getDay(),o=(s<n?7:0)+s-n;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function _c(t){return pa(t,{weekStartsOn:1})}function nT(t){const e=ce(t),r=e.getFullYear(),n=Jn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=_c(n),s=Jn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=_c(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function a0(t){const e=ce(t);return e.setHours(0,0,0,0),e}function Ec(t){const e=ce(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function _H(t,e){const r=a0(t),n=a0(e),i=+r-Ec(r),s=+n-Ec(n);return Math.round((i-s)/SH)}function EH(t){const e=nT(t),r=Jn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),_c(r)}function Al(t,e){const r=ce(t),n=ce(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function NH(t){return Jn(t,Date.now())}function jH(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function LH(t){if(!jH(t)&&typeof t!="number")return!1;const e=ce(t);return!isNaN(Number(e))}function BH(t,e){const r=ce(t),n=ce(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function AH(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function MH(t,e){return+ce(t)-+ce(e)}function IH(t){const e=ce(t);return e.setHours(23,59,59,999),e}function FH(t){const e=ce(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function PH(t){const e=ce(t);return+IH(e)==+FH(e)}function DH(t,e){const r=ce(t),n=ce(e),i=Al(r,n),s=Math.abs(BH(r,n));let o;if(s<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*s);let a=Al(r,n)===-i;PH(ce(t))&&s===1&&Al(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function OH(t,e,r){const n=MH(t,e)/1e3;return AH(r==null?void 0:r.roundingMethod)(n)}function RH(t){const e=ce(t),r=Jn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const $H={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},zH=(t,e,r)=>{let n;const i=$H[t];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function gu(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const WH={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qH={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},HH={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},UH={date:gu({formats:WH,defaultWidth:"full"}),time:gu({formats:qH,defaultWidth:"full"}),dateTime:gu({formats:HH,defaultWidth:"full"})},GH={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},VH=(t,e,r,n)=>GH[t];function Eo(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let i;if(n==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,a=r!=null&&r.width?String(r.width):o;i=t.formattingValues[a]||t.formattingValues[o]}else{const o=t.defaultWidth,a=r!=null&&r.width?String(r.width):t.defaultWidth;i=t.values[a]||t.values[o]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const YH={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},XH={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},KH={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ZH={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},QH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},JH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tU=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},eU={ordinalNumber:tU,era:Eo({values:YH,defaultWidth:"wide"}),quarter:Eo({values:XH,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Eo({values:KH,defaultWidth:"wide"}),day:Eo({values:ZH,defaultWidth:"wide"}),dayPeriod:Eo({values:QH,defaultWidth:"wide",formattingValues:JH,defaultFormattingWidth:"wide"})};function No(t){return(e,r={})=>{const n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const o=s[0],a=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?nU(a,d=>d.test(o)):rU(a,d=>d.test(o));let c;c=t.valueCallback?t.valueCallback(l):l,c=r.valueCallback?r.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function rU(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function nU(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function iU(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const i=n[0],s=e.match(t.parsePattern);if(!s)return null;let o=t.valueCallback?t.valueCallback(s[0]):s[0];o=r.valueCallback?r.valueCallback(o):o;const a=e.slice(i.length);return{value:o,rest:a}}}const sU=/^(\d+)(th|st|nd|rd)?/i,oU=/\d+/i,aU={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},lU={any:[/^b/i,/^(a|c)/i]},cU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hU={any:[/1/i,/2/i,/3/i,/4/i]},uU={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},dU={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},fU={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},pU={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},mU={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},gU={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},xU={ordinalNumber:iU({matchPattern:sU,parsePattern:oU,valueCallback:t=>parseInt(t,10)}),era:No({matchPatterns:aU,defaultMatchWidth:"wide",parsePatterns:lU,defaultParseWidth:"any"}),quarter:No({matchPatterns:cU,defaultMatchWidth:"wide",parsePatterns:hU,defaultParseWidth:"any",valueCallback:t=>t+1}),month:No({matchPatterns:uU,defaultMatchWidth:"wide",parsePatterns:dU,defaultParseWidth:"any"}),day:No({matchPatterns:fU,defaultMatchWidth:"wide",parsePatterns:pU,defaultParseWidth:"any"}),dayPeriod:No({matchPatterns:mU,defaultMatchWidth:"any",parsePatterns:gU,defaultParseWidth:"any"})},iT={code:"en-US",formatDistance:zH,formatLong:UH,formatRelative:VH,localize:eU,match:xU,options:{weekStartsOn:0,firstWeekContainsDate:1}};function yU(t){const e=ce(t);return _H(e,RH(e))+1}function bU(t){const e=ce(t),r=+_c(e)-+EH(e);return Math.round(r/rT)+1}function sT(t,e){var u,d,p,f;const r=ce(t),n=r.getFullYear(),i=Ba(),s=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((f=(p=i.locale)==null?void 0:p.options)==null?void 0:f.firstWeekContainsDate)??1,o=Jn(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=pa(o,e),l=Jn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const c=pa(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=c.getTime()?n:n-1}function CU(t,e){var a,l,c,u;const r=Ba(),n=(e==null?void 0:e.firstWeekContainsDate)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(c=r.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,i=sT(t,e),s=Jn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),pa(s,e)}function kU(t,e){const r=ce(t),n=+pa(r,e)-+CU(r,e);return Math.round(n/rT)+1}function oe(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const Dn={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return oe(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):oe(r+1,2)},d(t,e){return oe(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return oe(t.getHours()%12||12,e.length)},H(t,e){return oe(t.getHours(),e.length)},m(t,e){return oe(t.getMinutes(),e.length)},s(t,e){return oe(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return oe(i,e.length)}},Zi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},l0={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return Dn.y(t,e)},Y:function(t,e,r,n){const i=sT(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return oe(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):oe(s,e.length)},R:function(t,e){const r=nT(t);return oe(r,e.length)},u:function(t,e){const r=t.getFullYear();return oe(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return oe(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return oe(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return Dn.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return oe(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const i=kU(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):oe(i,e.length)},I:function(t,e,r){const n=bU(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):oe(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Dn.d(t,e)},D:function(t,e,r){const n=yU(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):oe(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return oe(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return oe(s,e.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return oe(i,e.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let i;switch(n===12?i=Zi.noon:n===0?i=Zi.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let i;switch(n>=17?i=Zi.evening:n>=12?i=Zi.afternoon:n>=4?i=Zi.morning:i=Zi.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Dn.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Dn.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):oe(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):oe(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Dn.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Dn.s(t,e)},S:function(t,e){return Dn.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return h0(n);case"XXXX":case"XX":return mi(n);case"XXXXX":case"XXX":default:return mi(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return h0(n);case"xxxx":case"xx":return mi(n);case"xxxxx":case"xxx":default:return mi(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+c0(n,":");case"OOOO":default:return"GMT"+mi(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+c0(n,":");case"zzzz":default:return"GMT"+mi(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return oe(n,e.length)},T:function(t,e,r){const n=t.getTime();return oe(n,e.length)}};function c0(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),s=n%60;return s===0?r+String(i):r+String(i)+e+oe(s,2)}function h0(t,e){return t%60===0?(t>0?"-":"+")+oe(Math.abs(t)/60,2):mi(t,e)}function mi(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=oe(Math.trunc(n/60),2),s=oe(n%60,2);return r+i+e+s}const u0=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},oT=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},vU=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return u0(t,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",u0(n,e)).replace("{{time}}",oT(i,e))},wU={p:oT,P:vU},SU=/^D+$/,TU=/^Y+$/,_U=["D","DD","YY","YYYY"];function EU(t){return SU.test(t)}function NU(t){return TU.test(t)}function jU(t,e,r){const n=LU(t,e,r);if(console.warn(n),_U.includes(t))throw new RangeError(n)}function LU(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const BU=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,MU=/^'([^]*?)'?$/,IU=/''/g,FU=/[a-zA-Z]/;function PU(t,e,r){var u,d,p,f;const n=Ba(),i=n.locale??iT,s=n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=n.weekStartsOn??((f=(p=n.locale)==null?void 0:p.options)==null?void 0:f.weekStartsOn)??0,a=ce(t);if(!LH(a))throw new RangeError("Invalid time value");let l=e.match(AU).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=wU[x];return g(m,i.formatLong)}return m}).join("").match(BU).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:DU(m)};if(l0[x])return{isToken:!0,value:m};if(x.match(FU))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(m=>{if(!m.isToken)return m.value;const x=m.value;(NU(x)||EU(x))&&jU(x,e,String(t));const g=l0[x[0]];return g(a,x,i.localize,c)}).join("")}function DU(t){const e=t.match(MU);return e?e[1].replace(IU,"'"):t}function OU(t,e,r){const n=Ba(),i=(r==null?void 0:r.locale)??n.locale??iT,s=2520,o=Al(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o});let l,c;o>0?(l=ce(e),c=ce(t)):(l=ce(t),c=ce(e));const u=OH(c,l),d=(Ec(c)-Ec(l))/1e3,p=Math.round((u-d)/60);let f;if(p<2)return r!=null&&r.includeSeconds?u<5?i.formatDistance("lessThanXSeconds",5,a):u<10?i.formatDistance("lessThanXSeconds",10,a):u<20?i.formatDistance("lessThanXSeconds",20,a):u<40?i.formatDistance("halfAMinute",0,a):u<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):p===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",p,a);if(p<45)return i.formatDistance("xMinutes",p,a);if(p<90)return i.formatDistance("aboutXHours",1,a);if(p<o0){const m=Math.round(p/60);return i.formatDistance("aboutXHours",m,a)}else{if(p<s)return i.formatDistance("xDays",1,a);if(p<sl){const m=Math.round(p/o0);return i.formatDistance("xDays",m,a)}else if(p<sl*2)return f=Math.round(p/sl),i.formatDistance("aboutXMonths",f,a)}if(f=DH(c,l),f<12){const m=Math.round(p/sl);return i.formatDistance("xMonths",m,a)}else{const m=f%12,x=Math.trunc(f/12);return m<3?i.formatDistance("aboutXYears",x,a):m<9?i.formatDistance("overXYears",x,a):i.formatDistance("almostXYears",x+1,a)}}function RU(t,e){return OU(t,NH(t),e)}function $U({date:t,className:e}){if(!t)return h.jsx("span",{className:nt("text-muted-foreground",e),children:"—"});let r;try{if(r=typeof t=="string"?new Date(t):t,isNaN(r.getTime()))return h.jsx("span",{className:nt("text-muted-foreground",e),children:"—"})}catch{return h.jsx("span",{className:nt("text-muted-foreground",e),children:"—"})}const n=RU(r,{addSuffix:!0}),i=PU(r,"PPpp");return h.jsx("time",{dateTime:r.toISOString(),title:i,className:nt("text-muted-foreground tabular-nums",e),children:n})}function aT({sessions:t=[],items:e=[],onSelectItem:r,featureCode:n,focusActive:i,onToggleFocus:s}){const[o,a]=C.useState(""),[l,c]=C.useState("all"),[u,d]=C.useState("all"),p=C.useMemo(()=>t.filter(m=>m.status==="active").length,[t]),f=C.useMemo(()=>{let m=CH(t,{search:o,agentFilter:l,statusFilter:u});return i&&n&&(m=m.filter(x=>x.featureCode===n||x.feature_code===n)),m},[t,o,l,u,i,n]);return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[h.jsx(ka,{featureCode:n,active:i,onToggle:s}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[h.jsx("span",{className:nt("w-2 h-2 rounded-full",p>0?"bg-emerald-400":"bg-slate-600")}),h.jsxs("span",{className:"text-muted-foreground",children:[p," active"]})]}),h.jsx("div",{className:"h-4 w-px bg-border"}),h.jsxs("div",{className:"relative",children:[h.jsx(ei,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),h.jsx("input",{type:"text",placeholder:"Search…",value:o,onChange:m=>a(m.target.value),className:"text-xs pl-5 pr-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-32"})]}),h.jsxs("select",{value:l,onChange:m=>c(m.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[h.jsx("option",{value:"all",children:"All agents"}),uy.filter(m=>m!=="unassigned").map(m=>h.jsx("option",{value:m,children:m},m))]}),h.jsxs("select",{value:u,onChange:m=>d(m.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[h.jsx("option",{value:"all",children:"All status"}),["active","completed","failed","paused"].map(m=>h.jsx("option",{value:m,children:m},m))]}),h.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[f.length,"/",t.length]})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[f.length===0&&h.jsx(xH,{icon:jf,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),f.map(m=>h.jsx(zU,{session:m,items:e,onSelectItem:r},m.id))]})]})}function zU({session:t,items:e,onSelectItem:r}){const n=t.workType||t.work_type,i=t.featureCode||t.feature_code,s=t.startedAt||t.created_date,o=Qp[n]||Qp.exploring,a=i?e.find(l=>{var c;return l.featureCode===i||l.feature_code===i||((c=l.lifecycle)==null?void 0:c.featureCode)===i}):null;return h.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2.5 border-b border-border/50 hover:bg-muted/30 transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(wH,{agent:t.agent,size:"sm",className:"shrink-0"}),h.jsx(Wf,{status:t.status,className:"shrink-0"}),n&&h.jsx("span",{className:nt("text-[10px] px-1.5 py-0.5 rounded",o),children:n}),i&&h.jsx("button",{onClick:()=>a&&(r==null?void 0:r(a.id)),className:nt("text-[10px] font-mono",a?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:i}),h.jsx($U,{date:s,className:"ml-auto text-[10px] shrink-0"})]}),t.summary&&h.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:t.summary}),h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[h.jsxs("span",{children:["📄 ",t.reads??0]}),h.jsxs("span",{children:["📤 ",t.writes??0]}),h.jsxs("span",{className:(t.errors??0)>0?"text-red-400":void 0,children:["⚠ ",t.errors??0]})]})]})}const d0=t=>Symbol.iterator in t,f0=t=>"entries"in t,p0=(t,e)=>{const r=t instanceof Map?t:new Map(t.entries()),n=e instanceof Map?e:new Map(e.entries());if(r.size!==n.size)return!1;for(const[i,s]of r)if(!n.has(i)||!Object.is(s,n.get(i)))return!1;return!0},WU=(t,e)=>{const r=t[Symbol.iterator](),n=e[Symbol.iterator]();let i=r.next(),s=n.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=r.next(),s=n.next()}return!!i.done&&!!s.done};function qU(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:d0(t)&&d0(e)?f0(t)&&f0(e)?p0(t,e):WU(t,e):p0({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Pi(t){const e=Yt.useRef(void 0);return r=>{const n=t(r);return qU(e.current,n)?e.current:e.current=n}}function lT({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=mr(Pi(g=>({items:g.items,gates:g.gates,sessions:g.sessions}))),[a,l]=C.useState(""),[c,u]=C.useState(0),d=C.useRef(null);C.useEffect(()=>{t&&(l(""),u(0),setTimeout(()=>{var g;return(g=d.current)==null?void 0:g.focus()},0))},[t]);const p=C.useMemo(()=>{if(!t)return[];if(!a.trim()){const T=s.filter(w=>w.status==="pending").slice(0,3).map(w=>({type:"gate",id:w.id,label:Jo(w,i.find(E=>E.id===w.itemId)),sub:wn[w.stepId]?`${Te[w.fromPhase]??w.fromPhase} → ${Te[w.toPhase]??w.toPhase}`:null,status:"pending",gate:w})),_=i.filter(w=>w.status==="blocked").slice(0,3).map(w=>({type:"item",id:w.id,label:w.title,sub:w.type,status:w.status,item:w}));return[...T.length?[{type:"section",label:"Pending Gates"}]:[],...T,..._.length?[{type:"section",label:"Blocked Items"}]:[],..._]}const g=a.toLowerCase(),y=i.filter(T=>{var _,w;return((_=T.title)==null?void 0:_.toLowerCase().includes(g))||((w=T.featureCode)==null?void 0:w.toLowerCase().includes(g))||(T.description||"").toLowerCase().includes(g)}).slice(0,5).map(T=>({type:"item",id:T.id,label:T.title,sub:`${T.type} · ${T.phase??""}`,status:T.status,item:T})),b=s.filter(T=>{var _;return(T.fromPhase||"").toLowerCase().includes(g)||(T.toPhase||"").toLowerCase().includes(g)||(((_=i.find(w=>w.id===T.itemId))==null?void 0:_.title)??"").toLowerCase().includes(g)}).slice(0,3).map(T=>({type:"gate",id:T.id,label:Jo(T,i.find(_=>_.id===T.itemId)),sub:T.status,status:T.status,gate:T})),k=(o||[]).filter(T=>(T.featureCode||"").toLowerCase().includes(g)||(T.summary||"").toLowerCase().includes(g)).slice(0,2).map(T=>({type:"session",id:T.id,label:T.featureCode||T.id,sub:T.summary||T.agent||"",status:T.status,session:T}));return[...y.length?[{type:"section",label:"Items"}]:[],...y,...b.length?[{type:"section",label:"Gates"}]:[],...b,...k.length?[{type:"section",label:"Sessions"}]:[],...k]},[t,a,i,s,o]),f=p.filter(g=>g.type!=="section"),m=C.useCallback(g=>{if(g.key==="Escape"){e();return}if(g.key==="ArrowDown"){g.preventDefault(),u(y=>(y+1)%Math.max(1,f.length));return}if(g.key==="ArrowUp"){g.preventDefault(),u(y=>(y-1+Math.max(1,f.length))%Math.max(1,f.length));return}if(g.key==="Enter"){const y=f[c];if(!y)return;y.type==="gate"?n==null||n(y.id):y.type==="item"?r==null||r(y.id):e();return}if(g.key==="Backspace"&&a===""){e();return}},[f,c,a,e,n,r]);let x=0;return t?h.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh]",onClick:e,children:h.jsxs("div",{className:"w-full max-w-[640px] mx-4 rounded-xl border border-slate-700 bg-card shadow-2xl overflow-hidden",onClick:g=>g.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-slate-700/50",children:[h.jsx(ei,{className:"h-4 w-4 text-muted-foreground shrink-0"}),h.jsx("input",{ref:d,value:a,onChange:g=>{l(g.target.value),u(0)},onKeyDown:m,placeholder:"Search items, gates, sessions…",className:"flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none"}),h.jsx("kbd",{className:"text-[10px] text-muted-foreground border border-border rounded px-1 py-0.5",children:"esc"})]}),h.jsxs("div",{className:"max-h-80 overflow-y-auto py-1",children:[p.length===0&&h.jsx("div",{className:"py-8 text-center text-xs text-muted-foreground",children:a?"No results":"No pending gates or blocked items"}),p.map((g,y)=>{if(g.type==="section")return h.jsx("div",{className:"px-4 pt-2 pb-1",children:h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:g.label})},`section-${y}`);const b=x++,k=c===b;return h.jsxs("button",{className:nt("flex w-full items-center gap-3 px-4 py-2 text-left transition-colors",k?"bg-accent/10":"hover:bg-muted/50"),onMouseEnter:()=>u(b),onClick:()=>{g.type==="gate"?n==null||n(g.id):g.type==="item"?r==null||r(g.id):e()},children:[g.type==="gate"&&h.jsx(Ys,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&h.jsx(Rc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&h.jsx(jf,{className:"h-4 w-4 text-blue-400 shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-sm text-foreground truncate",children:g.label}),g.sub&&h.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:g.sub})]}),g.status&&h.jsx(Wf,{status:g.status})]},g.id)})]}),h.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/50 text-[10px] text-muted-foreground",children:[h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"↑↓"})," navigate"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"↵"})," select"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"esc"})," close"]})]})]})}):null}var HU=af[" useId ".trim().toString()]||(()=>{}),UU=0;function xu(t){const[e,r]=C.useState(HU());return Fs(()=>{r(n=>n??String(UU++))},[t]),t||(e?`radix-${e}`:"")}var GU=af[" useInsertionEffect ".trim().toString()]||Fs;function VU({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[i,s,o]=YU({defaultProp:e,onChange:r}),a=t!==void 0,l=a?t:i;{const u=C.useRef(t!==void 0);C.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,n])}const c=C.useCallback(u=>{var d;if(a){const p=XU(u)?u(t):u;p!==t&&((d=o.current)==null||d.call(o,p))}else s(u)},[a,t,s,o]);return[l,c]}function YU({defaultProp:t,onChange:e}){const[r,n]=C.useState(t),i=C.useRef(r),s=C.useRef(e);return GU(()=>{s.current=e},[e]),C.useEffect(()=>{var o;i.current!==r&&((o=s.current)==null||o.call(s,r),i.current=r)},[r,i]),[r,n,s]}function XU(t){return typeof t=="function"}function KU(t,e=globalThis==null?void 0:globalThis.document){const r=Br(t);C.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var ZU="DismissableLayer",Xd="dismissableLayer.update",QU="dismissableLayer.pointerDownOutside",JU="dismissableLayer.focusOutside",m0,cT=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hT=C.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=C.useContext(cT),[u,d]=C.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=C.useState({}),m=_r(e,E=>d(E)),x=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=x.indexOf(g),b=u?x.indexOf(u):-1,k=c.layersWithOutsidePointerEventsDisabled.size>0,T=b>=y,_=rG(E=>{const L=E.target,M=[...c.branches].some(N=>N.contains(L));!T||M||(i==null||i(E),o==null||o(E),E.defaultPrevented||a==null||a())},p),w=nG(E=>{const L=E.target;[...c.branches].some(N=>N.contains(L))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},p);return KU(E=>{b===c.layers.size-1&&(n==null||n(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},p),C.useEffect(()=>{if(u)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(m0=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),g0(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=m0)}},[u,p,r,c]),C.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),g0())},[u,c]),C.useEffect(()=>{const E=()=>f({});return document.addEventListener(Xd,E),()=>document.removeEventListener(Xd,E)},[]),h.jsx(yr.div,{...l,ref:m,style:{pointerEvents:k?T?"auto":"none":void 0,...t.style},onFocusCapture:ir(t.onFocusCapture,w.onFocusCapture),onBlurCapture:ir(t.onBlurCapture,w.onBlurCapture),onPointerDownCapture:ir(t.onPointerDownCapture,_.onPointerDownCapture)})});hT.displayName=ZU;var tG="DismissableLayerBranch",eG=C.forwardRef((t,e)=>{const r=C.useContext(cT),n=C.useRef(null),i=_r(e,n);return C.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),h.jsx(yr.div,{...t,ref:i})});eG.displayName=tG;function rG(t,e=globalThis==null?void 0:globalThis.document){const r=Br(t),n=C.useRef(!1),i=C.useRef(()=>{});return C.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){uT(QU,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function nG(t,e=globalThis==null?void 0:globalThis.document){const r=Br(t),n=C.useRef(!1);return C.useEffect(()=>{const i=s=>{s.target&&!n.current&&uT(JU,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function g0(){const t=new CustomEvent(Xd);document.dispatchEvent(t)}function uT(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?n3(i,s):i.dispatchEvent(s)}var yu="focusScope.autoFocusOnMount",bu="focusScope.autoFocusOnUnmount",x0={bubbles:!1,cancelable:!0},iG="FocusScope",dT=C.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=C.useState(null),c=Br(i),u=Br(s),d=C.useRef(null),p=_r(e,x=>l(x)),f=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(n){let x=function(k){if(f.paused||!a)return;const T=k.target;a.contains(T)?d.current=T:$n(d.current,{select:!0})},g=function(k){if(f.paused||!a)return;const T=k.relatedTarget;T!==null&&(a.contains(T)||$n(d.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&$n(a)};document.addEventListener("focusin",x),document.addEventListener("focusout",g);const b=new MutationObserver(y);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",g),b.disconnect()}}},[n,a,f.paused]),C.useEffect(()=>{if(a){b0.add(f);const x=document.activeElement;if(!a.contains(x)){const y=new CustomEvent(yu,x0);a.addEventListener(yu,c),a.dispatchEvent(y),y.defaultPrevented||(sG(hG(fT(a)),{select:!0}),document.activeElement===x&&$n(a))}return()=>{a.removeEventListener(yu,c),setTimeout(()=>{const y=new CustomEvent(bu,x0);a.addEventListener(bu,u),a.dispatchEvent(y),y.defaultPrevented||$n(x??document.body,{select:!0}),a.removeEventListener(bu,u),b0.remove(f)},0)}}},[a,c,u,f]);const m=C.useCallback(x=>{if(!r&&!n||f.paused)return;const g=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,y=document.activeElement;if(g&&y){const b=x.currentTarget,[k,T]=oG(b);k&&T?!x.shiftKey&&y===T?(x.preventDefault(),r&&$n(k,{select:!0})):x.shiftKey&&y===k&&(x.preventDefault(),r&&$n(T,{select:!0})):y===b&&x.preventDefault()}},[r,n,f.paused]);return h.jsx(yr.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});dT.displayName=iG;function sG(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if($n(n,{select:e}),document.activeElement!==r)return}function oG(t){const e=fT(t),r=y0(e,t),n=y0(e.reverse(),t);return[r,n]}function fT(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function y0(t,e){for(const r of t)if(!aG(r,{upTo:e}))return r}function aG(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function lG(t){return t instanceof HTMLInputElement&&"select"in t}function $n(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&lG(t)&&e&&t.select()}}var b0=cG();function cG(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=C0(t,e),t.unshift(e)},remove(e){var r;t=C0(t,e),(r=t[0])==null||r.resume()}}}function C0(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function hG(t){return t.filter(e=>e.tagName!=="A")}var uG="Portal",pT=C.forwardRef((t,e)=>{var a;const{container:r,...n}=t,[i,s]=C.useState(!1);Fs(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?XI.createPortal(h.jsx(yr.div,{...n,ref:e}),o):null});pT.displayName=uG;var Cu=0;function dG(){C.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??k0()),document.body.insertAdjacentElement("beforeend",t[1]??k0()),Cu++,()=>{Cu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Cu--}},[])}function k0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var sn=function(){return sn=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},sn.apply(this,arguments)};function mT(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function fG(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var Ml="right-scroll-bar-position",Il="width-before-scroll-bar",pG="with-scroll-bars-hidden",mG="--removed-body-scroll-bar-size";function ku(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function gG(t,e){var r=C.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=e,r.facade}var xG=typeof window<"u"?C.useLayoutEffect:C.useEffect,v0=new WeakMap;function yG(t,e){var r=gG(null,function(n){return t.forEach(function(i){return ku(i,n)})});return xG(function(){var n=v0.get(r);if(n){var i=new Set(n),s=new Set(t),o=r.current;i.forEach(function(a){s.has(a)||ku(a,null)}),s.forEach(function(a){i.has(a)||ku(a,o)})}v0.set(r,t)},[t]),r}function bG(t){return t}function CG(t,e){e===void 0&&(e=bG);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var o=e(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),r={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),r}}}};return i}function kG(t){t===void 0&&(t={});var e=CG(null);return e.options=sn({async:!0,ssr:!1},t),e}var gT=function(t){var e=t.sideCar,r=mT(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return C.createElement(n,sn({},r))};gT.isSideCarExport=!0;function vG(t,e){return t.useMedium(e),gT}var xT=kG(),vu=function(){},hh=C.forwardRef(function(t,e){var r=C.useRef(null),n=C.useState({onScrollCapture:vu,onWheelCapture:vu,onTouchMoveCapture:vu}),i=n[0],s=n[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,p=t.sideCar,f=t.noRelative,m=t.noIsolation,x=t.inert,g=t.allowPinchZoom,y=t.as,b=y===void 0?"div":y,k=t.gapMode,T=mT(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=p,w=yG([r,e]),E=sn(sn({},T),i);return C.createElement(C.Fragment,null,u&&C.createElement(_,{sideCar:xT,removeScrollBar:c,shards:d,noRelative:f,noIsolation:m,inert:x,setCallbacks:s,allowPinchZoom:!!g,lockRef:r,gapMode:k}),o?C.cloneElement(C.Children.only(a),sn(sn({},E),{ref:w})):C.createElement(b,sn({},E,{className:l,ref:w}),a))});hh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hh.classNames={fullWidth:Il,zeroRight:Ml};var wG=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SG(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=wG();return e&&t.setAttribute("nonce",e),t}function TG(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function _G(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var EG=function(){var t=0,e=null;return{add:function(r){t==0&&(e=SG())&&(TG(e,r),_G(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},NG=function(){var t=EG();return function(e,r){C.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},yT=function(){var t=NG(),e=function(r){var n=r.styles,i=r.dynamic;return t(n,i),null};return e},jG={left:0,top:0,right:0,gap:0},wu=function(t){return parseInt(t||"",10)||0},LG=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[wu(r),wu(n),wu(i)]},BG=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return jG;var e=LG(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},AG=yT(),xs="data-scroll-locked",MG=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),`
679
+ .`.concat(pG,` {
680
+ overflow: hidden `).concat(n,`;
681
+ padding-right: `).concat(a,"px ").concat(n,`;
682
+ }
683
+ body[`).concat(xs,`] {
684
+ overflow: hidden `).concat(n,`;
685
+ overscroll-behavior: contain;
686
+ `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
687
+ padding-left: `.concat(i,`px;
688
+ padding-top: `).concat(s,`px;
689
+ padding-right: `).concat(o,`px;
690
+ margin-left:0;
691
+ margin-top:0;
692
+ margin-right: `).concat(a,"px ").concat(n,`;
693
+ `),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
694
+ }
695
+
696
+ .`).concat(Ml,` {
697
+ right: `).concat(a,"px ").concat(n,`;
698
+ }
699
+
700
+ .`).concat(Il,` {
701
+ margin-right: `).concat(a,"px ").concat(n,`;
702
+ }
703
+
704
+ .`).concat(Ml," .").concat(Ml,` {
705
+ right: 0 `).concat(n,`;
706
+ }
707
+
708
+ .`).concat(Il," .").concat(Il,` {
709
+ margin-right: 0 `).concat(n,`;
710
+ }
711
+
712
+ body[`).concat(xs,`] {
713
+ `).concat(mG,": ").concat(a,`px;
714
+ }
715
+ `)},w0=function(){var t=parseInt(document.body.getAttribute(xs)||"0",10);return isFinite(t)?t:0},IG=function(){C.useEffect(function(){return document.body.setAttribute(xs,(w0()+1).toString()),function(){var t=w0()-1;t<=0?document.body.removeAttribute(xs):document.body.setAttribute(xs,t.toString())}},[])},FG=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n;IG();var s=C.useMemo(function(){return BG(i)},[i]);return C.createElement(AG,{styles:MG(s,!e,i,r?"":"!important")})},Kd=!1;if(typeof window<"u")try{var ol=Object.defineProperty({},"passive",{get:function(){return Kd=!0,!0}});window.addEventListener("test",ol,ol),window.removeEventListener("test",ol,ol)}catch{Kd=!1}var Qi=Kd?{passive:!1}:!1,PG=function(t){return t.tagName==="TEXTAREA"},bT=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!PG(t)&&r[e]==="visible")},DG=function(t){return bT(t,"overflowY")},OG=function(t){return bT(t,"overflowX")},S0=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=CT(t,n);if(i){var s=kT(t,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},RG=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},$G=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},CT=function(t,e){return t==="v"?DG(e):OG(e)},kT=function(t,e){return t==="v"?RG(e):$G(e)},zG=function(t,e){return t==="h"&&e==="rtl"?-1:1},WG=function(t,e,r,n,i){var s=zG(t,window.getComputedStyle(e).direction),o=s*n,a=r.target,l=e.contains(a),c=!1,u=o>0,d=0,p=0;do{if(!a)break;var f=kT(t,a),m=f[0],x=f[1],g=f[2],y=x-g-s*m;(m||y)&&CT(t,a)&&(d+=y,p+=m);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(p)<1)&&(c=!0),c},al=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},T0=function(t){return[t.deltaX,t.deltaY]},_0=function(t){return t&&"current"in t?t.current:t},qG=function(t,e){return t[0]===e[0]&&t[1]===e[1]},HG=function(t){return`
716
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
717
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
718
+ `)},UG=0,Ji=[];function GG(t){var e=C.useRef([]),r=C.useRef([0,0]),n=C.useRef(),i=C.useState(UG++)[0],s=C.useState(yT)[0],o=C.useRef(t);C.useEffect(function(){o.current=t},[t]),C.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var x=fG([t.lockRef.current],(t.shards||[]).map(_0),!0).filter(Boolean);return x.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=C.useCallback(function(x,g){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var y=al(x),b=r.current,k="deltaX"in x?x.deltaX:b[0]-y[0],T="deltaY"in x?x.deltaY:b[1]-y[1],_,w=x.target,E=Math.abs(k)>Math.abs(T)?"h":"v";if("touches"in x&&E==="h"&&w.type==="range")return!1;var L=window.getSelection(),M=L&&L.anchorNode,N=M?M===w||M.contains(w):!1;if(N)return!1;var P=S0(E,w);if(!P)return!0;if(P?_=E:(_=E==="v"?"h":"v",P=S0(E,w)),!P)return!1;if(!n.current&&"changedTouches"in x&&(k||T)&&(n.current=_),!_)return!0;var $=n.current||_;return WG($,g,x,$==="h"?k:T)},[]),l=C.useCallback(function(x){var g=x;if(!(!Ji.length||Ji[Ji.length-1]!==s)){var y="deltaY"in g?T0(g):al(g),b=e.current.filter(function(_){return _.name===g.type&&(_.target===g.target||g.target===_.shadowParent)&&qG(_.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var k=(o.current.shards||[]).map(_0).filter(Boolean).filter(function(_){return _.contains(g.target)}),T=k.length>0?a(g,k[0]):!o.current.noIsolation;T&&g.cancelable&&g.preventDefault()}}},[]),c=C.useCallback(function(x,g,y,b){var k={name:x,delta:g,target:y,should:b,shadowParent:VG(y)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(T){return T!==k})},1)},[]),u=C.useCallback(function(x){r.current=al(x),n.current=void 0},[]),d=C.useCallback(function(x){c(x.type,T0(x),x.target,a(x,t.lockRef.current))},[]),p=C.useCallback(function(x){c(x.type,al(x),x.target,a(x,t.lockRef.current))},[]);C.useEffect(function(){return Ji.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Qi),document.addEventListener("touchmove",l,Qi),document.addEventListener("touchstart",u,Qi),function(){Ji=Ji.filter(function(x){return x!==s}),document.removeEventListener("wheel",l,Qi),document.removeEventListener("touchmove",l,Qi),document.removeEventListener("touchstart",u,Qi)}},[]);var f=t.removeScrollBar,m=t.inert;return C.createElement(C.Fragment,null,m?C.createElement(s,{styles:HG(i)}):null,f?C.createElement(FG,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function VG(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const YG=vG(xT,GG);var vT=C.forwardRef(function(t,e){return C.createElement(hh,sn({},t,{ref:e,sideCar:YG}))});vT.classNames=hh.classNames;var XG=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ts=new WeakMap,ll=new WeakMap,cl={},Su=0,wT=function(t){return t&&(t.host||wT(t.parentNode))},KG=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=wT(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},ZG=function(t,e,r,n){var i=KG(e,Array.isArray(t)?t:[t]);cl[r]||(cl[r]=new WeakMap);var s=cl[r],o=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))u(p);else try{var f=p.getAttribute(n),m=f!==null&&f!=="false",x=(ts.get(p)||0)+1,g=(s.get(p)||0)+1;ts.set(p,x),s.set(p,g),o.push(p),x===1&&m&&ll.set(p,!0),g===1&&p.setAttribute(r,"true"),m||p.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return u(e),a.clear(),Su++,function(){o.forEach(function(d){var p=ts.get(d)-1,f=s.get(d)-1;ts.set(d,p),s.set(d,f),p||(ll.has(d)||d.removeAttribute(n),ll.delete(d)),f||d.removeAttribute(r)}),Su--,Su||(ts=new WeakMap,ts=new WeakMap,ll=new WeakMap,cl={})}},QG=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=XG(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),ZG(n,i,r,"aria-hidden")):function(){return null}};function JG(t){const e=tV(t),r=C.forwardRef((n,i)=>{const{children:s,...o}=n,a=C.Children.toArray(s),l=a.find(rV);if(l){const c=l.props.children,u=a.map(d=>d===l?C.Children.count(c)>1?C.Children.only(null):C.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:i,children:C.isValidElement(c)?C.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function tV(t){const e=C.forwardRef((r,n)=>{const{children:i,...s}=r;if(C.isValidElement(i)){const o=iV(i),a=nV(s,i.props);return i.type!==C.Fragment&&(a.ref=n?Wc(n,o):o),C.cloneElement(i,a)}return C.Children.count(i)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var eV=Symbol("radix.slottable");function rV(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===eV}function nV(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function iV(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var uh="Dialog",[ST]=Zb(uh),[sV,Xr]=ST(uh),TT=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=C.useRef(null),l=C.useRef(null),[c,u]=VU({prop:n,defaultProp:i??!1,onChange:s,caller:uh});return h.jsx(sV,{scope:e,triggerRef:a,contentRef:l,contentId:xu(),titleId:xu(),descriptionId:xu(),open:c,onOpenChange:u,onOpenToggle:C.useCallback(()=>u(d=>!d),[u]),modal:o,children:r})};TT.displayName=uh;var _T="DialogTrigger",oV=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(_T,r),s=_r(e,i.triggerRef);return h.jsx(yr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Yp(i.open),...n,ref:s,onClick:ir(t.onClick,i.onOpenToggle)})});oV.displayName=_T;var Gp="DialogPortal",[aV,ET]=ST(Gp,{forceMount:void 0}),NT=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=Xr(Gp,e);return h.jsx(aV,{scope:e,forceMount:r,children:C.Children.map(n,o=>h.jsx(ni,{present:r||s.open,children:h.jsx(pT,{asChild:!0,container:i,children:o})}))})};NT.displayName=Gp;var Nc="DialogOverlay",jT=C.forwardRef((t,e)=>{const r=ET(Nc,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Xr(Nc,t.__scopeDialog);return s.modal?h.jsx(ni,{present:n||s.open,children:h.jsx(cV,{...i,ref:e})}):null});jT.displayName=Nc;var lV=JG("DialogOverlay.RemoveScroll"),cV=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(Nc,r);return h.jsx(vT,{as:lV,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(yr.div,{"data-state":Yp(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Bi="DialogContent",LT=C.forwardRef((t,e)=>{const r=ET(Bi,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Xr(Bi,t.__scopeDialog);return h.jsx(ni,{present:n||s.open,children:s.modal?h.jsx(hV,{...i,ref:e}):h.jsx(uV,{...i,ref:e})})});LT.displayName=Bi;var hV=C.forwardRef((t,e)=>{const r=Xr(Bi,t.__scopeDialog),n=C.useRef(null),i=_r(e,r.contentRef,n);return C.useEffect(()=>{const s=n.current;if(s)return QG(s)},[]),h.jsx(BT,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ir(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ir(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:ir(t.onFocusOutside,s=>s.preventDefault())})}),uV=C.forwardRef((t,e)=>{const r=Xr(Bi,t.__scopeDialog),n=C.useRef(!1),i=C.useRef(!1);return h.jsx(BT,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=r.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),BT=C.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Xr(Bi,r),l=C.useRef(null),c=_r(e,l);return dG(),h.jsxs(h.Fragment,{children:[h.jsx(dT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(hT,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Yp(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(dV,{titleId:a.titleId}),h.jsx(pV,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Vp="DialogTitle",AT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(Vp,r);return h.jsx(yr.h2,{id:i.titleId,...n,ref:e})});AT.displayName=Vp;var MT="DialogDescription",IT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(MT,r);return h.jsx(yr.p,{id:i.descriptionId,...n,ref:e})});IT.displayName=MT;var FT="DialogClose",PT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(FT,r);return h.jsx(yr.button,{type:"button",...n,ref:e,onClick:ir(t.onClick,()=>i.onOpenChange(!1))})});PT.displayName=FT;function Yp(t){return t?"open":"closed"}var DT="DialogTitleWarning",[UZ,OT]=a3(DT,{contentName:Bi,titleName:Vp,docsSlug:"dialog"}),dV=({titleId:t})=>{const e=OT(DT),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
719
+
720
+ If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
721
+
722
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return C.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},fV="DialogDescriptionWarning",pV=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${OT(fV).contentName}}.`;return C.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},mV=TT,gV=NT,RT=jT,$T=LT,zT=AT,WT=IT,xV=PT;const Xp=mV,yV=gV,qT=C.forwardRef(({className:t,...e},r)=>h.jsx(RT,{ref:r,className:nt("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));qT.displayName=RT.displayName;const dh=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(yV,{children:[h.jsx(qT,{}),h.jsxs($T,{ref:n,className:nt("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%]","w-full max-w-lg rounded-lg border border-slate-700 bg-card shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",t),...r,children:[e,h.jsxs(xV,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(hn,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));dh.displayName=$T.displayName;const fh=({className:t,...e})=>h.jsx("div",{className:nt("flex flex-col space-y-1.5 p-6 pb-4",t),...e});fh.displayName="DialogHeader";const Kp=({className:t,...e})=>h.jsx("div",{className:nt("flex items-center justify-end gap-2 p-6 pt-4",t),...e});Kp.displayName="DialogFooter";const ph=C.forwardRef(({className:t,...e},r)=>h.jsx(zT,{ref:r,className:nt("text-sm font-semibold text-foreground leading-none tracking-tight",t),...e}));ph.displayName=zT.displayName;const bV=C.forwardRef(({className:t,...e},r)=>h.jsx(WT,{ref:r,className:nt("text-sm text-muted-foreground",t),...e}));bV.displayName=WT.displayName;const E0=[{id:"task",label:"Task",defaults:{type:"task",phase:"planning",priority:1,governance:"flag"}},{id:"decision",label:"Decision",defaults:{type:"decision",phase:"specification",priority:2,governance:"gate"}},{id:"question",label:"Question",defaults:{type:"question",phase:"specification",priority:1,governance:"flag"}},{id:"idea",label:"Idea",defaults:{type:"idea",phase:"vision",priority:0,governance:"skip"}},{id:"spec",label:"Spec",defaults:{type:"spec",phase:"specification",priority:2,governance:"gate"}}],CV=["gate","flag","skip"];function N0(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function HT({open:t,onClose:e,parentItem:r}){const n=mr(b=>b.createItem),[i,s]=C.useState(()=>N0(r)),[o,a]=C.useState("task"),[l,c]=C.useState(!1),[u,d]=C.useState(!1),[p,f]=C.useState(""),m=C.useRef(null);C.useEffect(()=>{if(t){const b=N0(r);s(b),a("task"),c(!1),f(""),setTimeout(()=>{var k;return(k=m.current)==null?void 0:k.focus()},50)}},[t,r]);const x=b=>{const k=E0.find(T=>T.id===b);k&&(a(b),s(T=>({...T,type:k.defaults.type,phase:(r==null?void 0:r.phase)??k.defaults.phase,priority:k.defaults.priority,governance:k.defaults.governance})))},g=async()=>{if(!i.title.trim()){f("Title is required");return}d(!0),f("");try{const b={type:i.type,title:i.title.trim(),description:i.description.trim()||void 0,phase:i.phase||void 0,status:"planned",confidence:0,priority:i.priority,assignedTo:i.assignedTo!=="unassigned"?i.assignedTo:void 0,governance:i.governance!=="flag"?i.governance:void 0,featureCode:i.featureCode.trim()||void 0};await n(b),e()}catch{f("Failed to create item")}finally{d(!1)}},y=b=>{b.key==="Enter"&&!b.shiftKey&&b.target.tagName!=="TEXTAREA"&&(b.preventDefault(),g())};return h.jsx(Xp,{open:t,onOpenChange:b=>!b&&e(),children:h.jsxs(dh,{className:"max-w-md",onKeyDown:y,children:[h.jsx(fh,{children:h.jsx(ph,{children:"New Item"})}),h.jsxs("div",{className:"px-6 pb-2 space-y-4",children:[h.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:E0.map(b=>h.jsx("button",{type:"button",onClick:()=>x(b.id),className:nt("rounded-md px-2 py-1.5 text-[11px] font-medium border transition-colors",o===b.id?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:b.label},b.id))}),h.jsx("input",{ref:m,type:"text",placeholder:"Item title…",value:i.title,onChange:b=>s(k=>({...k,title:b.target.value})),className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring"}),h.jsx("textarea",{placeholder:"Description (optional)…",value:i.description,onChange:b=>s(k=>({...k,description:b.target.value})),rows:2,className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring resize-none"}),h.jsxs("button",{type:"button",onClick:()=>c(b=>!b),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l?h.jsx(Tb,{className:"h-3 w-3"}):h.jsx(Ca,{className:"h-3 w-3"}),"Advanced"]}),l&&h.jsxs("div",{className:"space-y-3 border border-border/40 rounded-md p-3 bg-muted/20",children:[h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Feature Code"}),h.jsx("input",{type:"text",placeholder:"e.g. COMP-UI-5",value:i.featureCode,onChange:b=>s(k=>({...k,featureCode:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none"})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Phase"}),h.jsx("select",{value:i.phase,onChange:b=>s(k=>({...k,phase:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:cy.map(b=>h.jsx("option",{value:b,children:Fl[b]??b},b))})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Priority"}),h.jsxs("select",{value:i.priority,onChange:b=>s(k=>({...k,priority:Number(b.target.value)})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:[h.jsx("option",{value:0,children:"Low (0)"}),h.jsx("option",{value:1,children:"Normal (1)"}),h.jsx("option",{value:2,children:"High (2)"}),h.jsx("option",{value:3,children:"Critical (3)"})]})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Assign to"}),h.jsx("select",{value:i.assignedTo,onChange:b=>s(k=>({...k,assignedTo:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:uy.map(b=>h.jsx("option",{value:b,children:b},b))})]}),h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Governance"}),h.jsx("div",{className:"flex gap-1.5",children:CV.map(b=>h.jsx("button",{type:"button",onClick:()=>s(k=>({...k,governance:b})),className:nt("flex-1 text-[11px] px-2 py-1 rounded border transition-colors",i.governance===b?b==="gate"?"bg-amber-500/20 text-amber-300 border-amber-500/40":b==="flag"?"bg-blue-500/20 text-blue-300 border-blue-500/40":"bg-slate-700 text-slate-400 border-slate-600":"border-border/40 text-muted-foreground hover:border-border"),children:b},b))})]})]}),p&&h.jsx("p",{className:"text-xs text-destructive",children:p})]}),h.jsxs(Kp,{children:[h.jsx(Wt,{variant:"ghost",size:"sm",onClick:e,disabled:u,children:"Cancel"}),h.jsx(Wt,{size:"sm",onClick:g,disabled:u||!i.title.trim(),children:u?"Creating…":"Create"})]})]})})}const kV=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],vV=[{id:"gate",Icon:Ys,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:Nb,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:Mb,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function wV(t,e){var r,n;return((n=(r=t==null?void 0:t.governance)==null?void 0:r.phases)==null?void 0:n[e])??"flag"}function UT({open:t,onClose:e,settings:r,onSettingsChange:n}){const[i,s]=C.useState(!1),o=C.useRef(null),a=C.useCallback((l,c)=>{n==null||n({governance:{phases:{[l]:c}}}),clearTimeout(o.current),s(!0),o.current=setTimeout(()=>s(!1),1500)},[n]);return h.jsx(Xp,{open:t,onOpenChange:l=>!l&&e(),children:h.jsxs(dh,{className:"max-w-sm",children:[h.jsx(fh,{children:h.jsxs("div",{className:"flex items-center justify-between pr-6",children:[h.jsx(ph,{children:"Governance Settings"}),i&&h.jsx("span",{className:"text-[11px] text-emerald-400 font-medium",children:"Saved ✓"})]})}),h.jsx("div",{className:"px-6 pb-6 space-y-1 max-h-96 overflow-y-auto",children:kV.map(l=>{const c=l==="explore_design",u=wV(r,l),d=Te[l]??l;return h.jsxs("div",{className:nt("flex items-center gap-3 rounded-md px-2 py-1.5",c&&"opacity-40"),children:[h.jsx("span",{className:nt("text-xs flex-1 min-w-0 truncate",c?"text-muted-foreground":"text-foreground"),children:d}),c?h.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"no policy"}):h.jsx("div",{className:"flex gap-1 shrink-0",children:vV.map(p=>{const f=u===p.id,{Icon:m}=p;return h.jsxs("button",{onClick:()=>a(l,p.id),title:p.label,className:nt("flex items-center gap-1 px-2 py-0.5 text-[10px] rounded border transition-colors",f?p.active:"border-border/30 text-muted-foreground hover:border-border hover:text-foreground"),children:[h.jsx(m,{className:"h-2.5 w-2.5"}),p.label]},p.id)})})]},l)})}),h.jsx("div",{className:"px-6 pb-4 text-[10px] text-muted-foreground border-t border-border/30 pt-3",children:"Agent config via Compose CLI"})]})})}function GT({onOpenGate:t}){const{gates:e,items:r}=mr(Pi(g=>({gates:g.gates,items:g.items}))),[n,i]=C.useState(new Set),[s,o]=C.useState(0),a=e.filter(g=>g.status==="pending"&&!n.has(g.id));if(a.length===0)return null;const l=Math.min(s,a.length-1),c=a[l],u=r.find(g=>g.id===c.itemId)||r.find(g=>{var y;return((y=g.lifecycle)==null?void 0:y.featureCode)&&c.featureCode&&g.lifecycle.featureCode===c.featureCode}),d=Jo(c,u),p=w_[c.fromPhase]??S_,f=()=>{i(g=>new Set([...g,c.id])),l>=a.length-1&&l>0&&o(l-1)},m=()=>o(Math.max(0,l-1)),x=()=>o(Math.min(a.length-1,l+1));return h.jsxs("div",{className:nt("shrink-0 h-10 border-t flex items-center gap-2 px-3",p.bg,p.border),children:[h.jsx(Ys,{className:nt("h-3.5 w-3.5 shrink-0",p.text)}),h.jsx("span",{className:nt("text-[11px] font-medium truncate flex-1 min-w-0",p.text),children:d}),a.length>1&&h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx("button",{onClick:m,disabled:l===0,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:h.jsx(Sb,{className:"h-3 w-3"})}),h.jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[l+1,"/",a.length]}),h.jsx("button",{onClick:x,disabled:l===a.length-1,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:h.jsx(Is,{className:"h-3 w-3"})})]}),h.jsx("button",{onClick:()=>t==null?void 0:t(c.id),className:nt("shrink-0 text-[10px] px-2 py-0.5 rounded border transition-colors hover:opacity-80",p.border,p.text),children:"Review"}),h.jsx("button",{onClick:f,className:"shrink-0 p-0.5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Dismiss (page session only)",children:h.jsx(hn,{className:"h-3 w-3"})})]})}const SV="●",TV="text-zinc-400";function _V(t,e){if(!t)return"";const n=(e??Date.now())-new Date(t).getTime(),i=Math.floor(n/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const s=Math.floor(i/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function EV(t){var e;return((e=dy[t])==null?void 0:e.icon)??SV}function NV(t){var e;return((e=dy[t])==null?void 0:e.color)??TV}const jV={IMPLEMENTER:"bg-blue-500/15 text-blue-300 border border-blue-500/25",REVIEWER:"bg-emerald-500/15 text-emerald-300 border border-emerald-500/25",PRODUCER:"bg-purple-500/15 text-purple-300 border border-purple-500/25"};function LV(t){return jV[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function BV(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function AV(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function MV({event:t,now:e}){const r=EV(t.kind),n=NV(t.kind),i=_V(t.timestamp,e);return h.jsxs("div",{"data-decision-card":!0,className:"inline-flex flex-col gap-0.5 w-40 shrink-0 rounded border border-border/40 bg-muted/20 px-2 py-1.5 text-left",children:[h.jsxs("div",{className:"flex items-center justify-between gap-1",children:[h.jsx("span",{className:nt("text-[11px] shrink-0",n),children:r}),h.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:i||AV(t.timestamp)})]}),h.jsx("p",{className:"text-[11px] text-foreground/80 truncate leading-tight",children:t.title}),t.roles&&t.roles.length>0&&h.jsx("div",{className:"flex flex-wrap gap-0.5 mt-0.5",children:t.roles.map((s,o)=>h.jsx("span",{"data-role-chip":!0,className:nt("text-[9px] px-1 py-px rounded-full leading-tight",LV(s.name)),children:s.name},o))})]})}function VT({events:t=[],currentFeatureCode:e,now:r}){const n=BV(t,e);return n.length===0?null:h.jsx("div",{className:"w-full overflow-x-auto whitespace-nowrap border-b border-border/30 bg-background/95 backdrop-blur-sm",style:{height:72,minHeight:72,maxHeight:72,position:"sticky",top:32,zIndex:20},"data-decision-timeline-strip":!0,children:h.jsx("div",{className:"flex items-center gap-2 px-3 h-full",children:n.map(i=>h.jsx(MV,{event:i,now:r},i.id))})})}function IV(t){if(!t)return[];const e=[];t.active_phase!=null&&e.push({label:"Phase",value:t.active_phase});const r=t.pending_gates??[];e.push({label:"Pending gates",value:r.length===0?"none":r.join(", ")}),e.push({label:"Open loops",value:t.open_loops_count??0}),e.push({label:"Gate load (24h)",value:t.gate_load_24h??0});const n=t.drift_alerts??[];return n.length>0?e.push({label:"Drift alerts",value:n.map(i=>i.axis_id||i.name||"unknown").join(", ")}):e.push({label:"Drift alerts",value:"none"}),t.computed_at&&e.push({label:"Updated",value:t.computed_at}),e}const FV="Select a feature to see status.";function YT({featureCode:t,snapshot:e}){const[r,n]=C.useState(!1),i=C.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??FV,o=IV(e);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-status-band":!0,onClick:i,style:{position:"sticky",top:"0px",zIndex:30,height:"32px",minHeight:"32px",maxHeight:"32px",cursor:"pointer",display:"flex",alignItems:"center",paddingLeft:"12px",paddingRight:"12px",userSelect:"none",overflow:"hidden"},className:"w-full bg-background/95 backdrop-blur-sm border-b border-border/30 text-sm text-foreground/80",title:s,"aria-expanded":r,role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&i()},children:[h.jsx("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1},children:s}),h.jsx("span",{style:{marginLeft:8,opacity:.5,fontSize:10},"aria-hidden":"true",children:r?"▲":"▼"})]}),r&&h.jsx("div",{"data-status-band-expansion":!0,style:{position:"relative",width:"100%",zIndex:29,maxHeight:200,overflowY:"auto"},className:"bg-background/98 border-b border-border/50 text-xs text-foreground/70",children:h.jsx("div",{style:{padding:"8px 12px"},children:o.length===0?h.jsx("span",{className:"text-muted-foreground",children:"No details available."}):h.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:h.jsx("tbody",{children:o.map((a,l)=>h.jsxs("tr",{children:[h.jsx("td",{style:{paddingRight:16,paddingBottom:2,fontWeight:500,whiteSpace:"nowrap"},className:"text-foreground/60",children:a.label}),h.jsx("td",{style:{paddingBottom:2},children:String(a.value)})]},l))})})})})]})}function PV({onContextSelect:t,sidebarOpen:e=!0,onToggleSidebar:r}){const{items:n,connections:i,connected:s,uiCommand:o,clearUICommand:a,recentChanges:l,createItem:c,updateItem:u,deleteItem:d,createConnection:p,deleteConnection:f,agentActivity:m,agentErrors:x,sessionState:g,registerSnapshotProvider:y,gates:b,gateEvent:k,resolveGate:T,settings:_,updateSettings:w,resetSettings:E,activeBuild:L,setActiveBuild:M,pipelineDraft:N,sessions:P,selectedPhase:$,setSelectedPhase:q,decisionEvents:O,statusSnapshots:I,setStatusSnapshot:F}=mr(),[D,R]=C.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),j=C.useRef(!!sessionStorage.getItem("vision-activeView")),[S,U]=C.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[Q,A]=C.useState(""),[rt,ut]=C.useState(null),[ot,It]=C.useState(!1),[ht,at]=C.useState(!1),[K,lt]=C.useState(!1);C.useEffect(()=>{sessionStorage.setItem("vision-activeView",S)},[S]),C.useEffect(()=>{D?sessionStorage.setItem("vision-selectedItemId",D):sessionStorage.removeItem("vision-selectedItemId")},[D]);const yt=C.useRef(!1);C.useEffect(()=>{var et;(et=_==null?void 0:_.ui)!=null&&et.defaultView&&!yt.current&&!j.current&&(U(_.ui.defaultView),yt.current=!0)},[_]),C.useEffect(()=>{o&&(o.view&&U(o.view),o.phase!==void 0&&q(o.phase),o.select!==void 0&&R(o.select),a())},[o,a]),C.useEffect(()=>{const et=()=>{var G;return["INPUT","TEXTAREA","SELECT"].includes((G=document.activeElement)==null?void 0:G.tagName)},kt=G=>{(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),It(st=>!st)),(G.metaKey||G.ctrlKey)&&G.key==="n"&&(G.preventDefault(),at(!0)),G.key===","&&!G.metaKey&&!G.ctrlKey&&!et()&&lt(!0)};return window.addEventListener("keydown",kt),()=>window.removeEventListener("keydown",kt)},[]);const At=C.useMemo(()=>{let et=n;if($&&(et=et.filter(kt=>kt.phase===$)),Q){const kt=Q.toLowerCase();et=et.filter(G=>G.title.toLowerCase().includes(kt)||(G.description||"").toLowerCase().includes(kt))}return et},[n,$,Q]),Dt=C.useMemo(()=>$?n.filter(et=>et.phase===$):n,[n,$]),ue=C.useMemo(()=>new Set(Dt.map(et=>et.id)),[Dt]),ae=C.useMemo(()=>$?b.filter(et=>ue.has(et.itemId)):b,[b,ue,$]),Pe=C.useMemo(()=>{if(!$&&!Q)return i;const et=new Set(At.map(kt=>kt.id));return i.filter(kt=>et.has(kt.fromId)&&et.has(kt.toId))},[i,At,$,Q]);C.useEffect(()=>{y(()=>({activeView:S,selectedPhase:$,searchQuery:Q,selectedItemId:D,totalItems:n.length,filteredCount:At.length,connected:s}))},[y,S,$,Q,D,n.length,At.length,s]);const Zt=C.useCallback(et=>{R(et),t&&t({type:"item",id:et})},[t]),Be=C.useCallback((et,kt)=>{u(et,kt)},[u]);C.useCallback(async()=>{const kt=await c({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:$||"vision"});kt&&kt.id&&R(kt.id)},[c,$]),C.useCallback(async et=>{await d(et),D===et&&(R(null),t&&t(null))},[d,D,t]);const V=C.useCallback(et=>{const kt=b.find(G=>G.id===et);kt&&(R(kt.itemId),t&&t({type:"item",id:kt.itemId}))},[b,t]);C.useCallback(async et=>p(et),[p]),C.useCallback(async et=>f(et),[f]);const it=C.useCallback(()=>{zt("/api/build/state").then(et=>et.json()).then(et=>M(et.state??null)).catch(()=>{})},[M]),dt=C.useCallback(et=>{t&&t({type:"step",id:et})},[t]),Nt=C.useMemo(()=>{var kt;if(!D)return null;const et=n.find(G=>G.id===D);return((kt=et==null?void 0:et.lifecycle)==null?void 0:kt.featureCode)||null},[D,n]);return C.useEffect(()=>{Nt&&(I&&I[Nt]||zt(`/api/lifecycle/status?featureCode=${encodeURIComponent(Nt)}`).then(et=>et.json()).then(et=>{et.snapshot&&F&&F(Nt,et.snapshot)}).catch(()=>{}))},[Nt]),h.jsx($c.Provider,{value:l,children:h.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[h.jsx(YT,{featureCode:Nt,snapshot:Nt?(I==null?void 0:I[Nt])??null:null}),Nt&&h.jsx(VT,{events:O,currentFeatureCode:Nt}),h.jsxs("div",{className:"flex-1 flex min-h-0",children:[h.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[r&&h.jsx("button",{className:"w-4 h-full flex items-center justify-center text-[10px] text-muted-foreground hover:text-foreground transition-colors select-none",onClick:r,title:e?"Collapse sidebar":"Expand sidebar","aria-expanded":e,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:e?"‹":"›"}),e&&h.jsx(b1,{items:n,gates:b,activeBuild:L,activeView:S,onViewChange:U,selectedPhase:$,onPhaseSelect:q,searchQuery:Q,onSearchChange:A,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Zt,onThemeChange:w,onNewItem:()=>at(!0)})]}),h.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[!s&&h.jsx("div",{className:"text-center text-[10px] py-0.5 bg-destructive text-destructive-foreground",children:"Disconnected — reconnecting..."}),S==="tree"&&h.jsx(k1,{items:At,connections:Pe,selectedItemId:D,onSelect:Zt}),S==="graph"&&h.jsx(w1,{items:At,connections:Pe,selectedItemId:D,onSelect:Zt}),S==="pipeline"&&h.jsx(eT,{activeBuild:L,pipelineDraft:N,onSelectStep:dt,onRefresh:it}),S==="sessions"&&h.jsx(aT,{sessions:P,items:n,onSelectItem:Zt}),S==="docs"&&h.jsx(XS,{items:Dt}),S==="gates"&&h.jsx(ZS,{gates:ae,items:Dt,onResolve:T,onSelect:Zt}),S==="settings"&&h.jsx(tT,{settings:_,onSettingsChange:w,onReset:E})]}),h.jsx(GT,{onOpenGate:V}),rt&&(()=>{const et=n.find(kt=>kt.id===rt);return et?h.jsx(JS,{item:et,items:n,connections:i,onUpdate:Be,onClose:()=>ut(null)}):null})(),h.jsx(QS,{event:k,items:n,onNavigate:()=>U("gates")}),h.jsx(lT,{open:ot,onClose:()=>It(!1),onSelectItem:et=>{Zt(et),It(!1)},onSelectGate:et=>{V(et),It(!1)}}),h.jsx(HT,{open:ht,onClose:()=>at(!1)}),h.jsx(UT,{open:K,onClose:()=>lt(!1),settings:_,onSettingsChange:w})]})]})})}ma.use(ly);const DV={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},OV={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function RV(t){return[{selector:"node",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"11px","font-weight":600,"font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textPrimary,"text-wrap":"wrap","text-max-width":"110px","background-color":t.overlay,"border-width":1,"border-color":"data(color)","border-opacity":.5,width:140,height:52,shape:"round-rectangle","text-outline-width":0,"overlay-padding":4,"overlay-opacity":0}},{selector:'node[shape = "diamond"]',style:{shape:"diamond",width:160,height:80,"font-size":"10px"}},{selector:"node:selected",style:{"border-width":2,"border-opacity":1,"border-color":t.accent}},{selector:"edge",style:{width:1,"line-color":t.textMuted,"target-arrow-color":t.textMuted,"target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.7,opacity:.5}},{selector:"edge[label]",style:{label:"data(label)","font-size":"10px","font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textSecondary,"text-rotation":"autorotate","text-margin-y":-8,"text-outline-width":3,"text-outline-color":t.background}},{selector:"edge[color]",style:{"line-color":"data(color)","target-arrow-color":"data(color)"}},{selector:'edge[lineStyle = "dashed"]',style:{"line-style":"dashed"}},{selector:'edge[lineStyle = "dotted"]',style:{"line-style":"dotted"}},{selector:":parent",style:{"background-color":t.overlay,"background-opacity":.3,"border-width":1,"border-color":"data(color)","border-opacity":.3,"text-valign":"top","text-halign":"center","font-size":"10px",color:t.textTertiary,padding:"16px"}}]}function $V(){const[t,e]=C.useState(()=>document.documentElement.classList.contains("dark"));return C.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const zV={"dagre-tb":{name:"dagre",rankDir:"LR",rankSep:80,nodeSep:50,padding:40},"dagre-lr":{name:"dagre",rankDir:"TB",rankSep:100,nodeSep:40,padding:40},circle:{name:"circle",padding:40},grid:{name:"grid",padding:40,rows:3},concentric:{name:"concentric",padding:40,minNodeSpacing:60},breadthfirst:{name:"breadthfirst",padding:40,spacingFactor:1.2}},WV={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function qV(t,e){const r=[];for(const n of t)r.push({data:{id:n.id,label:n.label,sublabel:n.sublabel||void 0,color:n.color||CY.textMuted,parent:n.parent||void 0,shape:n.shape||void 0},...n.position?{position:n.position}:{}});for(const n of e)r.push({data:{id:n.id||`${n.from}-${n.to}-${n.label||""}`,source:n.from,target:n.to,label:n.label||void 0,color:n.color||void 0,lineStyle:n.style||"solid",edgeType:n.type||void 0}});return r}const jc="compose:graph:";function HV(t){try{const e=localStorage.getItem(jc+t);return e?JSON.parse(e):null}catch{return null}}function UV(t,e){try{localStorage.setItem(jc+t,JSON.stringify(e))}catch{}}const GV=[{style:"solid",label:"Structural / hard",dash:null},{style:"dashed",label:"Informational / weak",dash:"4,3"},{style:"dotted",label:"Soft dependency",dash:"1.5,3"}];function hs({onClick:t,active:e,children:r,title:n}){return h.jsx("button",{onClick:t,title:n,className:"text-xs rounded cursor-pointer transition-colors font-semibold",style:{padding:"4px 8px",borderRadius:"0.375rem",border:"1px solid",borderColor:e?"hsl(var(--primary) / 0.1)":"hsl(var(--border))",background:e?"hsl(var(--primary) / 0.1)":"hsl(var(--accent))",color:e?"hsl(var(--primary))":"hsl(var(--muted-foreground))"},children:r})}function hl({mode:t,active:e,onClick:r}){return h.jsx("button",{onClick:r,className:"text-xs rounded cursor-pointer capitalize transition-colors font-semibold",style:{padding:"4px 8px",borderRadius:"0.375rem",border:"1px solid",borderColor:e?"hsl(var(--primary) / 0.1)":"hsl(var(--border))",background:e?"hsl(var(--primary) / 0.1)":"hsl(var(--accent))",color:e?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:t})}function Tu(){return h.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function j0({arrow:t,label:e,edgeStyle:r,color:n,targetLabel:i,targetColor:s,suffix:o}){return h.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:t}),h.jsx("span",{style:{color:n||"hsl(var(--muted-foreground))",fontStyle:r==="dashed"?"italic":"normal"},children:e||"connects"}),i?h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s||"hsl(var(--muted-foreground) / 0.6)"}}),h.jsx("span",{style:{color:"hsl(var(--foreground))"},children:i})]})]}):o?h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:o}):null,r&&r!=="solid"&&h.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",r,")"]})]})}function VV({nodes:t,edges:e,graphKey:r}){const[n,i]=C.useState(()=>{try{const l=localStorage.getItem(jc+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});C.useEffect(()=>{try{localStorage.setItem(jc+r+":tree-collapsed",JSON.stringify([...n]))}catch{}},[n,r]);const s=C.useMemo(()=>{const l={};for(const c of t)l[c.id]=c;return l},[t]),o=C.useMemo(()=>{var u,d;const l={},c={};for(const p of t)l[p.id]=[],c[p.id]=[];for(const p of e)(u=l[p.from])==null||u.push(p),(d=c[p.to])==null||d.push(p);return{out:l,inc:c}},[t,e]),a=l=>i(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return h.jsxs("div",{className:"w-full h-full overflow-y-auto",style:{background:"hsl(var(--background))",padding:"1rem"},children:[h.jsxs("div",{className:"flex items-center mb-4",style:{gap:"8px"},children:[h.jsx(hs,{onClick:()=>i(new Set),children:"Expand all"}),h.jsx(hs,{onClick:()=>i(new Set(t.map(l=>l.id))),children:"Collapse all"}),h.jsxs("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground))"},children:[t.length," entities · ",e.length," relations"]})]}),t.map(l=>{const c=n.has(l.id),u=o.out[l.id]||[],d=o.inc[l.id]||[],p=u.filter(g=>g.from===g.to),f=u.filter(g=>g.from!==g.to),m=d.filter(g=>g.from!==g.to),x=f.length+m.length+p.length;return h.jsxs("div",{className:"mb-0.5",children:[h.jsxs("button",{onClick:()=>a(l.id),className:"flex items-center w-full text-left bg-transparent border-none cursor-pointer rounded-md transition-colors hover:bg-[hsl(var(--accent))]",style:{gap:"8px",padding:"8px"},children:[h.jsx("span",{className:"text-xs w-4 text-center inline-block transition-transform",style:{color:"hsl(var(--muted-foreground))",transform:c?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),h.jsx("span",{className:"w-3 h-3 shrink-0",style:{borderRadius:l.shape==="diamond"?0:3,background:l.color,transform:l.shape==="diamond"?"rotate(45deg) scale(0.8)":"none"}}),h.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:l.label}),l.sublabel&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:["— ",l.sublabel]}),h.jsx("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:x})]}),!c&&h.jsxs("div",{style:{paddingLeft:"32px",paddingBottom:"4px"},children:[f.map((g,y)=>{var b,k;return h.jsx(j0,{arrow:"→",label:g.label,edgeStyle:g.style,color:g.color,targetLabel:((b=s[g.to])==null?void 0:b.label)||g.to,targetColor:(k=s[g.to])==null?void 0:k.color},`out-${y}`)}),p.map((g,y)=>h.jsx(j0,{arrow:"↻",label:g.label,edgeStyle:g.style,color:g.color,suffix:"(self)"},`self-${y}`)),m.map((g,y)=>{var b,k;return h.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:((b=s[g.from])==null?void 0:b.color)||"hsl(var(--muted-foreground) / 0.6)"}}),h.jsx("span",{style:{color:"hsl(var(--foreground))"},children:((k=s[g.from])==null?void 0:k.label)||g.from})]}),h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),h.jsx("span",{style:{color:g.color||"hsl(var(--muted-foreground))",fontStyle:g.style==="dashed"?"italic":"normal"},children:g.label||"connects"}),h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→ this"}),g.style&&g.style!=="solid"&&h.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",g.style,")"]})]},`in-${y}`)}),x===0&&h.jsx("div",{className:"text-xs italic",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground) / 0.6)"},children:"no relations"})]})]},l.id)})]})}function YV({elements:t,nodes:e,edges:r,layout:n,style:i,title:s,subtitle:o,graphKey:a="default",onNodeClick:l}){const c=C.useRef(null),u=C.useRef(null),[d,p]=C.useState(null),f=$V(),m=f?DV:OV,x=C.useMemo(()=>HV(a),[a]),[g,y]=C.useState((x==null?void 0:x.layoutKey)||"dagre-tb"),[b,k]=C.useState((x==null?void 0:x.showEdgeLabels)??!0),[T,_]=C.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[w,E]=C.useState((x==null?void 0:x.showLegend)??!0),[L,M]=C.useState((x==null?void 0:x.viewMode)||"graph");C.useEffect(()=>{UV(a,{layoutKey:g,showEdgeLabels:b,hiddenNodes:[...T],showLegend:w,viewMode:L})},[a,g,b,T,w,L]);const N=t||(e&&r?qV(e,r):[]),P=C.useMemo(()=>i||RV(m),[i,f]),$=n||zV[g],q=C.useMemo(()=>N.filter(S=>!S.data.source).map(S=>({id:S.data.id,label:S.data.label,color:S.data.color})),[JSON.stringify(N)]),O=C.useMemo(()=>T.size===0?N:N.filter(S=>S.data.source?!T.has(S.data.source)&&!T.has(S.data.target):!T.has(S.data.id)),[N,T]);C.useEffect(()=>{if(!c.current)return;const S=ma({container:c.current,elements:O,style:P,layout:$,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=S,S.on("mouseover","node",U=>{const Q=U.target;Q.style("border-width",2),Q.style("border-opacity",1);const A=Q.renderedPosition();p({x:A.x,y:A.y-Q.renderedHeight()/2-12,label:Q.data("label"),sublabel:Q.data("sublabel"),id:Q.id(),color:Q.data("color")})}),S.on("mouseout","node",U=>{U.target.style("border-width",1),U.target.style("border-opacity",.5),p(null)}),l&&S.on("tap","node",U=>l(U.target.id())),S.on("layoutstop",()=>S.fit(void 0,40)),()=>{S.destroy(),u.current=null}},[JSON.stringify(O),JSON.stringify($),f,L]),C.useEffect(()=>{const S=u.current;S&&S.edges().forEach(U=>{U.data("label")&&U.style("label",b?U.data("label"):"")})},[b]);const I=C.useCallback(()=>{var S;return(S=u.current)==null?void 0:S.fit(void 0,40)},[]),F=C.useCallback(()=>{const S=u.current;S&&S.zoom({level:S.zoom()*1.3,renderedPosition:{x:S.width()/2,y:S.height()/2}})},[]),D=C.useCallback(()=>{const S=u.current;S&&S.zoom({level:S.zoom()/1.3,renderedPosition:{x:S.width()/2,y:S.height()/2}})},[]),R=C.useCallback(S=>{_(U=>{const Q=new Set(U);return Q.has(S)?Q.delete(S):Q.add(S),Q})},[]),j=C.useCallback(()=>_(new Set),[]);return L==="tree"?h.jsxs("div",{className:"w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[h.jsxs("div",{className:"flex items-center justify-between shrink-0",style:{padding:"8px 16px",borderBottom:"1px solid hsl(var(--border))"},children:[h.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[s&&h.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&h.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),h.jsxs("div",{className:"flex",style:{gap:"4px"},children:[h.jsx(hl,{mode:"graph",active:L==="graph",onClick:()=>M("graph")}),h.jsx(hl,{mode:"tree",active:L==="tree",onClick:()=>M("tree")})]})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(VV,{nodes:e||[],edges:r||[],graphKey:a})})]}):h.jsxs("div",{className:"w-full h-full relative",style:{background:"hsl(var(--background))"},children:[(s||o)&&h.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[2] pointer-events-none",style:{padding:"8px 16px",background:"linear-gradient(to bottom, hsl(var(--background)) 0%, transparent 100%)"},children:[s&&h.jsx("div",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&h.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),h.jsxs("div",{className:"absolute top-2 right-3 z-[2] flex items-center",style:{gap:"4px"},children:[h.jsx("select",{value:g,onChange:S=>y(S.target.value),className:"text-xs rounded cursor-pointer appearance-none",style:{padding:"4px 8px",borderRadius:"0.375rem",background:"hsl(var(--accent))",border:"1px solid hsl(var(--border))",color:"hsl(var(--muted-foreground))"},title:"Graph layout",children:Object.entries(WV).map(([S,U])=>h.jsx("option",{value:S,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:U},S))}),h.jsx(Tu,{}),h.jsx(hs,{onClick:D,title:"Zoom out",children:"−"}),h.jsx(hs,{onClick:I,title:"Fit to view",children:"Fit"}),h.jsx(hs,{onClick:F,title:"Zoom in",children:"+"}),h.jsx(Tu,{}),h.jsx(hs,{onClick:()=>E(!w),active:w,title:w?"Hide legend":"Show legend",children:"Legend"}),h.jsx(Tu,{}),h.jsx(hl,{mode:"graph",active:L==="graph",onClick:()=>M("graph")}),h.jsx(hl,{mode:"tree",active:L==="tree",onClick:()=>M("tree")})]}),w&&h.jsxs("div",{className:"absolute bottom-3 left-3 z-[2]",style:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"0.5rem",padding:"8px 16px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",minWidth:150,maxWidth:210},children:[h.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Entities"}),T.size>0&&h.jsx("button",{onClick:j,className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:"hsl(var(--primary))"},children:"Show all"})]}),h.jsx("div",{className:"flex flex-col gap-1",children:q.map(S=>{const U=T.has(S.id);return h.jsxs("button",{onClick:()=>R(S.id),className:"flex items-center gap-1.5 bg-transparent border-none py-0.5 cursor-pointer transition-opacity",style:{opacity:U?.35:1},title:U?`Show ${S.label}`:`Hide ${S.label}`,children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:U?"transparent":S.color,border:`1.5px solid ${S.color}`}}),h.jsx("span",{className:"text-xs",style:{color:U?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:U?"line-through":"none"},children:S.label})]},S.id)})}),h.jsxs("div",{className:"flex justify-between items-center mt-2.5 mb-1.5",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Edges"}),h.jsx("button",{onClick:()=>k(!b),className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:b?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:b?"Hide labels":"Show labels"})]}),h.jsx("div",{className:"flex flex-col gap-1",children:GV.map(S=>h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("svg",{width:"20",height:"6",className:"shrink-0",children:h.jsx("line",{x1:"0",y1:"3",x2:"20",y2:"3",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.5",strokeDasharray:S.dash||"none"})}),h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:S.label})]},S.style))})]}),d&&h.jsxs("div",{className:"absolute z-10 text-center pointer-events-none backdrop-blur-sm",style:{left:d.x,top:d.y,transform:"translate(-50%, -100%)",background:"hsl(var(--accent))",border:"1px solid hsl(var(--border))",borderRadius:"0.5rem",padding:"4px 8px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",minWidth:110,maxWidth:200},children:[h.jsx("div",{className:"text-sm font-semibold",style:{color:d.color||"hsl(var(--foreground))"},children:d.label}),d.sublabel&&h.jsx("div",{className:"text-xs mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:d.sublabel}),h.jsx("div",{className:"text-[10px] mt-1 font-mono",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:d.id})]}),h.jsx("div",{ref:c,className:"w-full h-full"})]})}const qt={discovery:"#a78bfa",feature:"#3b82f6",track:"#06b6d4",task:"#94a3b8",spec:"#a78bfa",idea:"#fbbf24",question:"#f472b6",evaluation:"#f59e0b",thread:"#64748b",decision:"#22c55e",artifact:"#a87cb8",informs:"#64748b",pipeline:"#6366f1"},XV=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:qt.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:qt.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:qt.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:qt.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:qt.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:qt.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:qt.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:qt.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:qt.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:qt.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:qt.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:qt.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:qt.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:qt.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:qt.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:qt.decision},{id:"question",label:"Question",sublabel:"may block progress",color:qt.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:qt.artifact}],KV=[{from:"p-vision",to:"p-specification",color:qt.pipeline},{from:"p-specification",to:"p-planning",color:qt.pipeline},{from:"p-planning",to:"p-implementation",color:qt.pipeline},{from:"p-implementation",to:"p-verification",color:qt.pipeline},{from:"p-verification",to:"p-release",color:qt.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:qt.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:qt.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:qt.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:qt.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:qt.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:qt.track},{from:"task",to:"feature",label:"implements",color:qt.task},{from:"spec",to:"feature",label:"implements",color:qt.spec},{from:"feature",to:"feature",label:"blocks",color:qt.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:qt.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:qt.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:qt.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:qt.artifact},{from:"question",to:"decision",label:"contradicts",color:qt.question},{from:"feature",to:"p-vision",label:"enters",color:qt.feature,style:"dashed"}];function ZV(){return h.jsx(YV,{graphKey:"product",nodes:XV,edges:KV,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const QV="compose-popout";function XT(t){if(t==="vision://surface")return"Vision Tracker";if(t.startsWith("graph://")){const r=t.replace("graph://","");return r.charAt(0).toUpperCase()+r.slice(1)+" Graph"}const e=t.split("/");return e.length>1?e.slice(-2).join("/"):e[e.length-1]}function ul({path:t,onDock:e}){return h.jsxs("div",{className:"flex items-center justify-between px-3 shrink-0",style:{height:"28px",borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--background))"},children:[h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:XT(t)}),h.jsxs("button",{onClick:e,className:"flex items-center gap-1 px-2 py-0.5 rounded text-[10px] uppercase tracking-wider",style:{color:"hsl(var(--primary))",background:"none",border:"none",cursor:"pointer"},title:"Pop back into main window",children:[h.jsx(BA,{style:{width:11,height:11}}),"pop in"]})]})}function JV({path:t}){const[e,r]=C.useState(null),[n,i]=C.useState(!0),s=C.useRef(null),o=C.useRef(null),a=t.startsWith("vision://")?"vision":t.startsWith("graph://")?"graph":t.endsWith(".html")||t.endsWith(".htm")?"html":"markdown";C.useEffect(()=>{document.title=XT(t)+" — Compose"},[t]),C.useEffect(()=>{const c=new BroadcastChannel(QV);s.current=c,c.postMessage({type:"popout-mounted",path:t});const u=()=>{c.postMessage({type:"popout-closed",path:t})};return window.addEventListener("beforeunload",u),()=>{u(),c.close(),window.removeEventListener("beforeunload",u)}},[t]);const l=C.useCallback(()=>{var c;(c=s.current)==null||c.postMessage({type:"popout-dock",path:t}),window.close()},[t]);return C.useEffect(()=>{if(a==="vision"||a==="graph"){i(!1);return}zt(`/api/file?path=${encodeURIComponent(t)}`).then(c=>c.json()).then(c=>{c.content!==void 0&&r(c.content),i(!1)}).catch(()=>i(!1))},[t,a]),C.useEffect(()=>{if(a==="vision"||a==="graph")return;const c=window.location.protocol==="https:"?"wss:":"ws:",u=new WebSocket(`${c}//${window.location.host}/ws/files`);return o.current=u,u.onmessage=d=>{try{const p=JSON.parse(d.data);p.type==="fileChanged"&&p.path===t&&r(p.content)}catch{}},()=>u.close()},[t,a]),n?h.jsx("div",{className:"h-screen w-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a==="vision"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(ul,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(PV,{})})]}):a==="graph"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(ul,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(ZV,{})})]}):a==="html"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(ul,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx("iframe",{srcDoc:e,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin",title:t})})]}):h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(ul,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 overflow-y-auto px-8 py-6",children:h.jsx("div",{className:"canvas-markdown max-w-4xl mx-auto",children:h.jsx(Sf,{remarkPlugins:[Nf],children:e||""})})})]})}const tY="/api/stratum";async function mh(t,e={}){return(await zt(`${tY}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function eY(t,e){return mh(t,{method:"POST",body:JSON.stringify(e)})}function KT({status:t}){const e={running:"hsl(var(--background))",awaiting_gate:"#7c3aed",complete:"#166534",killed:"#7f1d1d",blocked:"#7f1d1d"},r={running:"running",awaiting_gate:"gate pending",complete:"complete",killed:"killed",blocked:"blocked"};return h.jsx("span",{style:{fontSize:"0.72em",padding:"2px 6px",borderRadius:4,background:e[t]||"#333",color:"#e5e7eb",textTransform:"uppercase",letterSpacing:"0.05em"},children:r[t]||t})}function Zp(){return h.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function rY({onAction:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState({}),[a,l]=C.useState({}),c=C.useCallback(()=>{mh("/gates").then(d=>{r(Array.isArray(d)?d:[]),i(null)}).catch(d=>i(d.message))},[]);C.useEffect(()=>{c();const d=setInterval(c,1e4);return()=>clearInterval(d)},[c]);async function u(d,p,f){const m=`${d}/${p}/${f}`;o(g=>({...g,[m]:!0}));const x=a[`${d}/${p}`]||"";try{const g=await eY(`/gates/${d}/${p}/${f}`,{note:x});g.conflict?i(`Gate already resolved (${d}/${p})`):g.error?i(g.error.message):(t==null||t(),c())}catch(g){i(g.message)}finally{o(g=>({...g,[m]:!1}))}}return e===null&&!n?h.jsx(Zp,{}):h.jsxs("section",{children:[h.jsxs("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:["Pending Gates ",(e==null?void 0:e.length)>0&&h.jsxs("span",{style:{opacity:1,color:"#f59e0b"},children:["(",e.length,")"]})]}),n&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em",margin:"0 0 8px"},children:n}),(e==null?void 0:e.length)===0&&h.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No pending gates."}),e==null?void 0:e.map(d=>{const p=`${d.flow_id}/${d.step_id}`,f=m=>s[`${p}/${m}`];return h.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",marginBottom:8,background:"#18181b"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[h.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:d.flow_name||d.flow_id}),h.jsx("span",{style:{opacity:.4,fontSize:"0.8em"},children:"›"}),h.jsx("span",{style:{fontFamily:"monospace",fontSize:"0.82em",opacity:.7},children:d.step_id}),d.function&&h.jsxs("span",{style:{opacity:.4,fontSize:"0.78em"},children:["fn:",d.function]})]}),h.jsx("input",{type:"text",placeholder:"Note (optional)",value:a[p]||"",onChange:m=>l(x=>({...x,[p]:m.target.value})),style:{width:"100%",boxSizing:"border-box",marginBottom:8,background:"#27272a",border:"1px solid #3f3f46",borderRadius:4,color:"#e4e4e7",padding:"4px 8px",fontSize:"0.82em"}}),h.jsx("div",{style:{display:"flex",gap:6},children:[{a:"approve",label:"Approve",color:"#166534",hover:"#15803d"},{a:"reject",label:"Reject",color:"#7f1d1d",hover:"#b91c1c"},{a:"revise",label:"Revise",color:"#1e3a5f",hover:"#1d4ed8"}].map(({a:m,label:x,color:g})=>h.jsx("button",{disabled:f(m),onClick:()=>u(d.flow_id,d.step_id,m),style:{padding:"4px 12px",fontSize:"0.8em",borderRadius:4,border:"none",background:g,color:"#e5e7eb",cursor:f(m)?"not-allowed":"pointer",opacity:f(m)?.5:1},children:f(m)?"…":x},m))})]},p)})]})}function nY({flowId:t,onClose:e}){const[r,n]=C.useState(null),[i,s]=C.useState(null);return C.useEffect(()=>{mh(`/flows/${t}`).then(o=>{o.error?s(o.error.message):n(o)}).catch(o=>s(o.message))},[t]),h.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",background:"#18181b"},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[h.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:(r==null?void 0:r.flow_name)||t}),h.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"1.1em"},children:"✕"})]}),i&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:i}),!r&&!i&&h.jsx(Zp,{}),r&&h.jsx("div",{style:{fontSize:"0.82em",opacity:.8},children:(()=>{const o=new Set(Array.isArray(r.completed_steps)?r.completed_steps:[]),a=new Set(Array.isArray(r.active_steps)?r.active_steps:[]),l=o.size,c=r.step_count??"?";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:[h.jsx("span",{children:h.jsx(KT,{status:r.status})}),h.jsxs("span",{children:["steps ",l,"/",c,a.size>0&&h.jsxs("span",{style:{marginLeft:6,color:"#34d399",fontSize:"0.85em"},children:["∥ ",a.size," running"]})]}),r.round>0&&h.jsxs("span",{children:["round ",r.round]})]}),Array.isArray(r.ordered_steps)&&r.ordered_steps.length>0&&h.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",lineHeight:1.7},children:r.ordered_steps.map(u=>h.jsxs("li",{style:{opacity:o.has(u.id)?.4:1,fontWeight:a.has(u.id)?700:"normal",color:a.has(u.id)?"#34d399":"inherit"},children:[h.jsx("span",{style:{fontFamily:"monospace"},children:u.id}),u.mode==="gate"&&h.jsx("span",{style:{marginLeft:6,color:"#f59e0b",fontSize:"0.9em"},children:"gate"}),a.has(u.id)&&h.jsx("span",{style:{marginLeft:6,fontSize:"0.85em"},children:"∥ running"})]},u.id))})]})})()})]})}function iY({activeBuild:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState(null),a=C.useCallback(()=>{mh("/flows").then(l=>{r(Array.isArray(l)?l:[]),i(null)}).catch(l=>i(l.message))},[]);return C.useEffect(()=>{a();const l=setInterval(a,15e3);return()=>clearInterval(l)},[a]),C.useEffect(()=>{t&&a()},[t,a]),e===null&&!n?h.jsx(Zp,{}):h.jsxs("section",{children:[h.jsx("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:"Flows"}),n&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:n}),(e==null?void 0:e.length)===0&&h.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No flows found."}),e==null?void 0:e.map(l=>h.jsx("div",{onClick:()=>o(s===l.flow_id?null:l.flow_id),style:{border:`1px solid ${s===l.flow_id?"#6366f1":"#3f3f46"}`,borderRadius:6,padding:"8px 12px",marginBottom:6,background:s===l.flow_id?"#1e1b4b":"#18181b",cursor:"pointer"},children:h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx("span",{style:{fontSize:"0.88em",fontWeight:500},children:l.flow_name||l.flow_id}),h.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[h.jsxs("span",{style:{fontSize:"0.78em",opacity:.5},children:[Array.isArray(l.completed_steps)?l.completed_steps.length:l.completed_steps??0,"/",l.step_count??"?"]}),h.jsx(KT,{status:l.status})]})]})},l.flow_id)),s&&h.jsx("div",{style:{marginTop:8},children:h.jsx(nY,{flowId:s,onClose:()=>o(null)})})]})}const sY={display:"inline-block",width:8,height:8,borderRadius:"50%",background:"#22c55e",marginRight:8,animation:"pulse-dot 1.5s ease-in-out infinite"};if(typeof document<"u"&&!document.getElementById("pulse-dot-style")){const t=document.createElement("style");t.id="pulse-dot-style",t.textContent="@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }",document.head.appendChild(t)}function oY({build:t,onDismiss:e}){const r=t.status==="running",n=["complete","failed","aborted"].includes(t.status);C.useEffect(()=>{if(t.status==="complete"){const s=setTimeout(()=>e==null?void 0:e(),5e3);return()=>clearTimeout(s)}},[t.status,e]);const i={running:"#166534",complete:"#14532d",failed:"#7f1d1d",aborted:"#78350f"};return h.jsxs("div",{style:{border:`1px solid ${r?"#22c55e33":"#3f3f46"}`,borderRadius:6,padding:"10px 12px",marginBottom:12,background:i[t.status]||"#18181b"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[r&&h.jsx("span",{style:sY}),h.jsx("span",{style:{fontWeight:600,fontSize:"0.88em"},children:t.featureCode}),h.jsx("span",{style:{opacity:.5,fontSize:"0.78em"},children:r?"building":t.status})]}),n&&t.status!=="complete"&&h.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"0.9em"},children:"✕"})]}),h.jsxs("div",{style:{fontSize:"0.8em",opacity:.7,marginTop:4,fontFamily:"monospace"},children:[t.currentStepId,t.stepNum!=null&&t.totalSteps!=null&&h.jsxs("span",{style:{marginLeft:8,opacity:.5},children:["(",t.stepNum,"/",t.totalSteps,")"]}),t.retries>0&&h.jsxs("span",{style:{marginLeft:8,color:"#f59e0b"},children:["retry ",t.retries]})]})]})}function aY(){const t=mr(s=>s.activeBuild),[e,r]=C.useState(null),n=C.useCallback(()=>{t&&r(`${t.flowId}:${t.completedAt}`)},[t]);C.useEffect(()=>{(t==null?void 0:t.status)==="running"&&r(null)},[t==null?void 0:t.status]);const i=t&&!(e&&e===`${t.flowId}:${t.completedAt}`);return h.jsxs("div",{style:{padding:"12px 14px",color:"#e4e4e7",fontSize:"0.9em",overflowY:"auto",height:"100%"},children:[i&&h.jsx(oY,{build:t,onDismiss:n}),h.jsx(rY,{}),h.jsx("div",{style:{marginTop:20},children:h.jsx(iY,{activeBuild:t})})]})}function lY({projectName:t,projectRoot:e,onSwitch:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(e||""),a=C.useRef(null);return C.useEffect(()=>{o(e||"")},[e]),C.useEffect(()=>{if(!n)return;const l=c=>{var u;(u=a.current)!=null&&u.contains(c.target)||i(!1)};return window.addEventListener("mousedown",l),()=>window.removeEventListener("mousedown",l)},[n]),C.useEffect(()=>{if(!n)return;const l=c=>{c.key==="Escape"&&i(!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]),h.jsxs("div",{ref:a,className:"flex items-center shrink-0 gap-2 relative",children:[h.jsx("span",{className:"text-xs font-semibold tracking-widest uppercase text-blue-600 dark:text-accent",children:"Compose"}),h.jsx("button",{"data-testid":"project-btn",className:"text-[10px] uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(l=>!l),title:e||"Switch project","aria-label":"Switch project","aria-haspopup":"dialog","aria-expanded":n,children:t||"no project"}),n&&h.jsxs("div",{"data-testid":"project-popover",role:"dialog","aria-label":"Switch project",className:"absolute top-full left-0 mt-1 z-50 p-2 rounded-md shadow-lg",style:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",minWidth:"280px"},children:[h.jsxs("div",{className:"text-[10px] text-muted-foreground mb-1 px-1",children:["Current: ",e]}),h.jsx("input",{autoFocus:!0,"data-testid":"project-input",className:"w-full px-2 py-1 text-xs rounded border bg-background text-foreground",style:{borderColor:"hsl(var(--border))"},placeholder:"Absolute path to project...",value:s,onChange:l=>o(l.target.value),onKeyDown:async l=>{l.key==="Enter"&&await r(s)&&i(!1),l.key==="Escape"&&i(!1)}})]})]})}const cY={dashboard:{label:"Dashboard",icon:fM,tip:"Overview of project status and activity"},tree:{label:"Items",icon:jb,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:SM,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:XM,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:jf,tip:"Active and past agent sessions"},gates:{label:"Gates",icon:Ys,tip:"Quality gates and approval checkpoints"},docs:{label:"Docs",icon:Mi,tip:"Project documentation and specs"},design:{label:"Design",icon:Oc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:wi,tip:"Captured ideas and suggestions"}};function hY({tabs:t=[],activeTab:e,onTabChange:r,onOpenPalette:n,badges:i={}}){return h.jsxs("div",{className:"flex items-center gap-0.5 h-full",role:"tablist","aria-label":"Main views",children:[t.map(s=>{const o=cY[s],a=s===e,l=o==null?void 0:o.icon,c=(o==null?void 0:o.label)||s,u=i[s];return h.jsxs("button",{role:"tab","aria-selected":a,title:o==null?void 0:o.tip,className:["flex items-center gap-1.5 px-3 h-full text-[11px] uppercase tracking-wider font-medium transition-colors","border-b-2 -mb-px",a?"border-blue-600 text-blue-600 dark:border-accent dark:text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>r==null?void 0:r(s),children:[l&&h.jsx(l,{style:{width:12,height:12}}),c,u>0&&h.jsx("span",{className:"text-[9px] min-w-[16px] h-4 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))"},children:u})]},s)}),h.jsx("div",{className:"flex-1"}),n&&h.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2.5 h-full text-[11px] text-muted-foreground hover:text-foreground transition-colors",title:"Search (⌘K)",children:[h.jsx(ei,{style:{width:12,height:12}}),h.jsx("kbd",{className:"text-[9px] font-mono opacity-50 bg-muted px-1 py-0.5 rounded",children:"⌘K"})]})]})}function uY(){const[t,e]=C.useState(py);function r(){const n=!t;G_(n),e(n)}return h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:r,title:t?"Hide verbose events":"Show verbose events","aria-label":"Toggle verbose stream",style:t?{background:"hsl(210 60% 60% / 0.15)",color:"hsl(210 60% 60%)",borderRadius:"3px",padding:"1px 4px",fontSize:"10px"}:{fontSize:"10px"},children:"{ }"})}const Ge={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},dY={[Ge.COLLAPSED]:Ge.EXPANDED,[Ge.EXPANDED]:Ge.MAXIMIZED,[Ge.MAXIMIZED]:Ge.COLLAPSED};function fY(t){return dY[t]??Ge.COLLAPSED}function pY(t){return Ge.COLLAPSED}function mY(t){return Ge.MAXIMIZED}const gY=new Set(Object.values(Ge));function xY(t){return gY.has(t)}function yY(t){switch(t){case Ge.COLLAPSED:return"h-7";case Ge.EXPANDED:return"h-[40vh]";case Ge.MAXIMIZED:return"flex-1";default:return"h-7"}}const ZT="compose:agentBarState";function bY(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(ZT);return xY(e)?e:Ge.COLLAPSED}catch{return Ge.COLLAPSED}}function kY(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(ZT,t)}catch{}}const L0="▾",vY="▴",wY="⤢";function SY({barState:t="collapsed",onStateChange:e}){const[r,n]=C.useState("ready"),[i,s]=C.useState(null);C.useEffect(()=>{function u(d){const{status:p,tool:f,category:m,parallelTasks:x}=d.detail??{};if(s(x??null),x){const{total:g,completed:y,failed:b,active:k}=x;n(`∥ ${y}/${g} tasks${b?` (${b} failed)`:""}${k?` • ${k} active`:""}`)}else n(p==="idle"?"ready":f?`${f} — ${m??p}`:m||(p==="idle"?"ready":p??"ready"))}return window.addEventListener("compose:agent-status",u),()=>window.removeEventListener("compose:agent-status",u)},[]);const o=C.useCallback(()=>{e==null||e(fY(t))},[t,e]),a=C.useCallback(()=>{e==null||e(pY())},[t,e]);C.useCallback(()=>{e==null||e(mY())},[t,e]);const l=t==="collapsed",c=t==="expanded";return h.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{borderTop:"1px solid hsl(var(--border))"},"data-agent-bar-state":t,children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 h-7 shrink-0 select-none",style:{borderBottom:l?"none":"1px solid hsl(var(--border) / 0.5)"},children:[h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:o,title:l?"Expand agent bar":c?"Maximize agent bar":"Collapse agent bar","aria-label":"Toggle agent bar",children:l?vY:c?wY:L0}),h.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold shrink-0",style:{color:"hsl(var(--accent))"},children:"Agent"}),h.jsx("span",{className:"flex-1 min-w-0 truncate text-[11px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:r}),h.jsx(uY,{}),i&&i.total>0&&h.jsx("div",{className:"shrink-0 flex items-center gap-1",title:`${i.completed}/${i.total} tasks complete`,children:h.jsx("div",{style:{width:48,height:4,borderRadius:2,background:"hsl(var(--muted))",overflow:"hidden"},children:h.jsx("div",{style:{width:`${i.completed/i.total*100}%`,height:"100%",borderRadius:2,background:i.failed?"hsl(var(--destructive))":"hsl(var(--accent))",transition:"width 300ms ease"}})})}),!l&&h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:a,title:"Collapse agent bar","aria-label":"Collapse agent bar",children:L0})]}),!l&&h.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:h.jsx(xy,{})})]})}const TY=280,_Y=.6;function EY({isOpen:t=!1,onToggle:e,widthPx:r=380,onResizePx:n,children:i,activeBuild:s,gates:o=[],agentErrors:a=[],items:l=[]}){const c=C.useRef(!1),u=C.useCallback(p=>{p.preventDefault(),c.current=!0;const f=x=>{if(!c.current)return;const g=window.innerWidth-x.clientX,y=window.innerWidth*_Y,b=Math.max(TY,Math.min(y,g));n==null||n(b)},m=()=>{c.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",m)},[n]),d=o.filter(p=>p.status==="pending"||p.status==="awaiting");return h.jsxs("div",{className:"flex shrink-0 h-full",style:{borderLeft:"1px solid hsl(var(--border))"},"data-context-panel-open":t,children:[t&&n&&h.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0",onMouseDown:u}),h.jsx("button",{className:["w-4 h-full flex items-center justify-center","text-[10px] text-muted-foreground hover:text-foreground","transition-colors select-none"].join(" "),onClick:e,title:t?"Close context panel":"Open context panel","aria-expanded":t,"aria-label":"Toggle context panel",style:{background:"hsl(var(--muted) / 0.3)"},children:t?"›":"‹"}),t&&h.jsx("div",{className:"flex flex-col h-full overflow-hidden",style:{width:`${r}px`},children:Yt.Children.toArray(i).length>0?h.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):h.jsx(jY,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const NY={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function B0(t){return NY[t]||"#6b7280"}function jY({activeBuild:t,pendingGates:e,agentErrors:r,items:n}){const i={};for(const a of n){const l=a.phase||"unknown";i[l]=(i[l]||0)+1}const s=n.length||1,o=r.slice(-5);return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"h-7 flex items-center px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:h.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-muted-foreground",children:"Project Overview"})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-3 space-y-4",children:[t?h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Active Build"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-xs text-accent font-mono",children:t.featureCode||"—"}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),h.jsx("span",{className:"text-[10px] text-foreground",children:t.currentStep||t.step||"—"})]})]}):h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Status"}),h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No active build"})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Pending Gates (",e.length,")"]}),e.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):h.jsx("div",{className:"space-y-0.5",children:e.slice(0,5).map((a,l)=>h.jsx("p",{className:"text-[10px] text-amber-400 truncate",children:Jo(a,n.find(c=>c.id===a.itemId))},l))})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Recent Errors (",o.length,")"]}),o.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):h.jsx("div",{className:"space-y-0.5",children:o.map((a,l)=>h.jsx("p",{className:"text-[10px] text-destructive truncate",children:a.message||a.error||"Error"},l))})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase Distribution"}),h.jsx("div",{className:"flex h-2 rounded overflow-hidden gap-px",children:Object.entries(i).map(([a,l])=>h.jsx("div",{className:"h-full",style:{width:`${l/s*100}%`,background:B0(a),opacity:.75,minWidth:"2px"},title:`${a}: ${l}`},a))}),h.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1",children:Object.entries(i).map(([a,l])=>h.jsxs("span",{className:"text-[9px] text-muted-foreground flex items-center gap-1",children:[h.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:B0(a)}}),a,": ",l]},a))})]})]})]})}const On=60,Dr=24,dl=80,_u=28,Eu=48,A0=8,ys=5,Lc=9;function LY(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function BY(t,e,r){const n=new Map(e.map(a=>[a.id,a])),i=[],s=[],o=new Map;for(const a of r){if(a.toId===t.id){const l=n.get(a.fromId);l&&i.push(l)}if(a.fromId===t.id){const l=n.get(a.toId);l&&s.push(l)}}for(const a of s){const l=[];for(const c of r)if(c.fromId===a.id&&c.toId!==t.id){const u=n.get(c.toId);u&&l.push(u)}l.length>0&&o.set(a.id,l)}return{parents:i,children:s,grandchildren:o}}function Nu(t,e,r,n,i){const s=Math.min(t,ys),o=s*n+(s-1)*A0,a=(r-o)/2,l=[];for(let c=0;c<s;c++)l.push({x:a+c*(n+A0),y:e,w:n,h:i});return{positions:l,overflow:t>ys?t-ys+1:0}}function fl({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:c}){const u=gr[t.type]||gr.task,d=s?.2:.08;return h.jsxs("g",{style:{cursor:"pointer"},onClick:()=>a(t.id),onMouseEnter:p=>l(t,p),onMouseLeave:c,children:[h.jsx("rect",{x:e,y:r,width:n,height:i,rx:4,fill:u,fillOpacity:d,stroke:u,strokeWidth:s?2:1.5,strokeDasharray:o?"4 2":void 0}),h.jsx("text",{x:e+n/2,y:r+i/2,textAnchor:"middle",dominantBaseline:"central",fontSize:s?Lc+1:Lc,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:LY(t.title,s?10:8)})]})}function AY({item:t,pos:e}){if(!t||!e)return null;const r=gr[t.type]||gr.task,n=Vn[t.status]||Vn.planned;return h.jsxs("div",{className:"absolute z-50 pointer-events-none px-2 py-1.5 rounded bg-popover border border-border shadow-md",style:{left:e.x,top:e.y,transform:"translate(-50%, -100%)"},children:[h.jsx("p",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:t.title}),h.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[h.jsx("span",{className:"text-[10px]",style:{color:r},children:t.type}),h.jsxs("span",{className:"text-[10px] flex items-center gap-1",children:[h.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:n}}),t.status]}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:lf[t.confidence||0]})]})]})}function MY({item:t,items:e,connections:r,onSelect:n}){const[i,s]=C.useState(null),[o,a]=C.useState(null),{parents:l,children:c,grandchildren:u}=C.useMemo(()=>BY(t,e,r),[t,e,r]),d=C.useCallback((I,F)=>{const D=F.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),R=F.currentTarget.getBoundingClientRect();s(I),a({x:R.x+R.width/2-D.x,y:R.y-D.y-4})},[]),p=C.useCallback(()=>{s(null),a(null)},[]);if(!(l.length>0||c.length>0))return null;const m=288,x=[];let g=12,y=[],b=0;if(l.length>0){const I=Nu(l.length,g,m,On,Dr);y=I.positions,b=I.overflow,g+=Dr+Eu}const k=(m-dl)/2,T=g;g+=_u+Eu;let _=[],w=0;if(c.length>0){const I=Nu(c.length,g,m,On,Dr);_=I.positions,w=I.overflow,g+=Dr}let E=new Map,L=new Map;const M=[...u.entries()];let N=[];if(M.length>0){g+=Eu;for(const[D,R]of M)for(const j of R)N.push({...j,_parentChildId:D});const I=Nu(N.length,g,m,On,Dr);let F=0;for(const[D,R]of M){const j=[];for(let S=0;S<R.length&&F<I.positions.length;S++,F++)j.push(I.positions[F]);E.set(D,j)}I.overflow>0&&L.set("all",I.overflow),g+=Dr}const P=g+12;for(let I=0;I<y.length;I++){const F=y[I];x.push({x1:F.x+F.w/2,y1:F.y+F.h,x2:k+dl/2,y2:T})}for(let I=0;I<_.length;I++){const F=_[I];x.push({x1:k+dl/2,y1:T+_u,x2:F.x+F.w/2,y2:F.y})}for(const[I,F]of E){const D=c.findIndex(R=>R.id===I);if(D>=0&&D<_.length){const R=_[D];for(const j of F)x.push({x1:R.x+R.w/2,y1:R.y+R.h,x2:j.x+j.w/2,y2:j.y})}}const $=l.slice(0,ys-(b>0?1:0)),q=c.slice(0,ys-(w>0?1:0)),O=N.slice(0,ys-(L.size>0?1:0));return h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Graph"}),h.jsxs("div",{className:"relative connection-graph-wrap",children:[h.jsxs("svg",{width:m,height:P,className:"w-full",viewBox:`0 0 ${m} ${P}`,children:[x.map((I,F)=>h.jsx("line",{x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},F)),$.map((I,F)=>h.jsx(fl,{item:I,x:y[F].x,y:y[F].y,w:On,h:Dr,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:p},I.id)),b>0&&h.jsxs("text",{x:y[y.length-1].x+On/2,y:y[0].y+Dr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:Lc,fill:"hsl(var(--muted-foreground))",children:["+",b," more"]}),h.jsx(fl,{item:t,x:k,y:T,w:dl,h:_u,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:p}),q.map((I,F)=>h.jsx(fl,{item:I,x:_[F].x,y:_[F].y,w:On,h:Dr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},I.id)),w>0&&h.jsxs("text",{x:_[_.length-1].x+On/2,y:_[0].y+Dr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:Lc,fill:"hsl(var(--muted-foreground))",children:["+",w," more"]}),O.map((I,F)=>{const R=[...E.values()].flat()[F];return R?h.jsx(fl,{item:I,x:R.x,y:R.y,w:On,h:Dr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},I.id):null})]}),h.jsx(AY,{item:i,pos:o})]})]})}const IY=["Untested","Low","Moderate","High","Crystallized"];function FY({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=IY[r]??"Untested",i=r===0?em[0]:em[r];return h.jsxs("span",{className:nt("inline-flex items-center gap-1",e),children:[h.jsx("span",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(s=>h.jsx("span",{className:nt("h-2.5 w-1.5 rounded-sm",s<=r?i:"bg-slate-600")},s))}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:n})]})}function PY(t,e=Date.now()){if(!t)return null;const r=Date.parse(t);if(Number.isNaN(r))return null;const n=e-r,i=Math.floor(n/36e5);return i<1?"<1h ago":i<48?`${i}h ago`:`${Math.floor(i/24)}d ago`}function M0(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function DY(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function OY(t){if(t==null)return"—";const e=Math.round(t/1e3);if(e<60)return`${e}s`;const r=Math.round(e/60);if(r<60)return`${r}m`;const n=Math.floor(r/60),i=r%60;return`${n}h${i?` ${i}m`:""}`}function RY(t,e=Date.now()){const r=(t||[]).filter(i=>i==null?void 0:i.started_at);if(!r.length)return null;let n=null;for(const i of r){const s=Date.parse(i.started_at);!Number.isNaN(s)&&(n==null||s>n)&&(n=s)}return n==null?null:PY(new Date(n).toISOString(),e)}function $Y(t,e=Date.now()){const r=(t==null?void 0:t.branches)||[],n=r.filter(c=>c.state==="complete"),i=r.filter(c=>c.state==="running"),s=r.length,o=RY(r,e),a=n.length>=2;return{summary:i.length>0&&n.length<2?`${n.length} of ${s} branches ready`:`${s} branch${s===1?"":"es"}${o?` · last fork ${o}`:""}`,canCompare:a,completeBranches:n,runningCount:i.length,totalCount:s}}function zY(t,e=[]){const r=new Map(t.map(s=>[s.branch_id,s])),n=e[0]&&r.has(e[0])?r.get(e[0]):t[0]||null,i=e[1]&&r.has(e[1])?r.get(e[1]):t[1]||null;return[n,i]}function I0({branch:t,extraRows:e=[]}){var o;const r=t.files_touched||[],n=t.tests||{},i=t.cost||{},s=[{label:"Files touched",value:r.length},{label:"Tests",value:`${n.passed??0} / ${n.failed??0} / ${n.skipped??0}`},{label:"Tokens in / out",value:`${M0(i.tokens_in)} / ${M0(i.tokens_out)}`},{label:"USD",value:DY(i.usd)},{label:"Wall clock",value:OY(i.wall_clock_ms)},{label:"Final artifact",value:((o=t.final_artifact)==null?void 0:o.path)||"—"},...e];return h.jsx("div",{className:"space-y-1",children:s.map((a,l)=>h.jsxs("div",{className:"flex justify-between gap-2 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:a.label}),h.jsx("span",{className:"font-mono text-right truncate",title:typeof a.value=="string"?a.value:void 0,children:a.value})]},l))})}function WY({lineage:t,selectedPair:e=[],onSelectPair:r=()=>{},extraMetricsForBranch:n=()=>[],now:i=Date.now()}){var g,y;const[s,o]=C.useState(!1),{summary:a,canCompare:l,completeBranches:c}=$Y(t,i),[u,d]=zY(c,e),p=()=>{l&&(o(b=>!b),!s&&u&&d&&r([u.branch_id,d.branch_id]))};if(!s)return h.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[h.jsx("span",{children:a}),h.jsx("button",{disabled:!l,onClick:p,className:"text-[10px] px-2 py-0.5 rounded border border-border "+(l?"hover:bg-muted/40 text-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),"data-testid":"branch-compare-toggle",children:"Compare"})]});const f=(g=u==null?void 0:u.final_artifact)==null?void 0:g.snapshot,m=(y=d==null?void 0:d.final_artifact)==null?void 0:y.snapshot,x=!!f&&!!m;return h.jsxs("div",{className:"space-y-2 rounded border border-border p-2 bg-muted/10",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:a}),h.jsx("button",{onClick:()=>o(!1),className:"text-[10px] text-muted-foreground hover:text-foreground",children:"Collapse"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-[10px] font-semibold mb-1 font-mono truncate",title:u==null?void 0:u.branch_id,children:u?`A: ${u.branch_id.slice(0,8)}…`:"A: (none)"}),u&&h.jsx(I0,{branch:u,extraRows:n(u)})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-[10px] font-semibold mb-1 font-mono truncate",title:d==null?void 0:d.branch_id,children:d?`B: ${d.branch_id.slice(0,8)}…`:"B: (none)"}),d&&h.jsx(I0,{branch:d,extraRows:n(d)})]})]}),h.jsx("div",{className:"col-span-2",children:x?h.jsx(Up,{oldText:f,newText:m}):h.jsxs("div",{className:"text-[10px] italic text-muted-foreground",children:["No artifact produced on ",!f&&!m?"either branch":f?"branch B":"branch A","."]})})]})}const qY={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function HY(t){return qY[t]??t}function F0(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function UY(t){var r,n;return(((n=(r=t==null?void 0:t.lifecycle)==null?void 0:r.lifecycle_ext)==null?void 0:n.drift_axes)??[]).filter(i=>i.breached===!0)}function GY({item:t}){const[e,r]=C.useState(!1),n=UY(t);if(n.length===0)return null;const i=n.length;return h.jsxs("div",{className:"drift-ribbon",style:{background:"hsl(var(--destructive) / 0.12)",borderLeft:"3px solid hsl(var(--destructive))",minHeight:"28px",padding:e?"6px 10px 8px":"0 10px",display:"flex",flexDirection:"column",justifyContent:"center",gap:0,borderRadius:"4px",marginBottom:"4px"},children:[h.jsxs("button",{onClick:()=>r(s=>!s),style:{display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",cursor:"pointer",padding:"4px 0",color:"hsl(var(--destructive))",fontSize:"12px",fontWeight:600,width:"100%",textAlign:"left"},"aria-expanded":e,"data-testid":"drift-ribbon-toggle",children:[h.jsx(Rc,{size:13}),h.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?h.jsx(Tb,{size:13,style:{marginLeft:"auto"}}):h.jsx(Ca,{size:13,style:{marginLeft:"auto"}})]}),e&&h.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse",marginTop:"4px"},"data-testid":"drift-ribbon-table",children:[h.jsx("thead",{children:h.jsxs("tr",{style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Axis"}),h.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Ratio"}),h.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Threshold"}),h.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Explanation"})]})}),h.jsx("tbody",{children:n.map(s=>h.jsxs("tr",{"data-testid":`drift-axis-row-${s.axis_id}`,children:[h.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--foreground))",fontWeight:500},children:HY(s.axis_id)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:F0(s.ratio)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:F0(s.threshold)}),h.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--muted-foreground))",maxWidth:"200px",wordBreak:"break-word"},children:s.explanation??""})]},s.axis_id))})]})]})}function VY({item:t,onClose:e}){var m;const r=((m=t==null?void 0:t.lifecycle)==null?void 0:m.featureCode)||(t==null?void 0:t.featureCode)||(t==null?void 0:t.id)||"",[n,i]=C.useState(r),[s,o]=C.useState((t==null?void 0:t.type)==="bug"?"bug":"feature"),[a,l]=C.useState(""),[c,u]=C.useState(!1),[d,p]=C.useState(null);async function f(x){x==null||x.preventDefault();const g=n.trim();if(!g){p("Feature code is required");return}u(!0),p(null);try{const y=await zt("/api/build/start",{method:"POST",headers:us({"Content-Type":"application/json"}),body:JSON.stringify({featureCode:g,mode:s,description:a.trim()})});if(!y.ok){let b=null;try{b=await y.json()}catch{}throw new Error(b&&b.error||`Failed to start build (HTTP ${y.status})`)}e==null||e()}catch(y){p(y.message||"Failed to start build"),u(!1)}}return h.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50","data-testid":"start-build-popover",children:h.jsxs("form",{className:"p-2 space-y-2",onSubmit:f,children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-feature",children:"Feature code"}),h.jsx("input",{id:"start-build-feature",type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none",value:n,onChange:x=>i(x.target.value),"data-testid":"start-build-feature-input",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Mode"}),h.jsxs("div",{className:"flex items-center gap-1.5",role:"radiogroup","aria-label":"Build mode",children:[h.jsx("button",{type:"button",role:"radio","aria-checked":s==="feature",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${s==="feature"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"start-build-mode-feature",onClick:()=>o("feature"),children:"Feature"}),h.jsx("button",{type:"button",role:"radio","aria-checked":s==="bug",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${s==="bug"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"start-build-mode-bug",onClick:()=>o("bug"),children:"Bug"})]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-desc",children:"Description (optional)"}),h.jsx("textarea",{id:"start-build-desc",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none resize-none",rows:3,value:a,onChange:x=>l(x.target.value),"data-testid":"start-build-description"})]}),d?h.jsx("div",{className:"text-[10px] text-destructive",role:"alert",children:d}):null,h.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[h.jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded border border-border text-muted-foreground hover:bg-muted/50",onClick:()=>e==null?void 0:e(),disabled:c,"data-testid":"start-build-cancel",children:"Cancel"}),h.jsx("button",{type:"submit",className:"text-[10px] px-2 py-1 rounded border border-accent bg-accent/10 text-foreground disabled:opacity-50",disabled:c||!n.trim(),"data-testid":"start-build-submit",children:c?"Starting…":"Start"})]})]})})}function YY({level:t,onChange:e}){const r=["hsl(var(--muted-foreground))","hsl(var(--destructive))","hsl(var(--accent))","hsl(var(--success))","hsl(var(--success))"],n=r[t]||r[0];return h.jsxs("button",{onClick:()=>e((t+1)%5),className:"flex items-center gap-2 px-2 py-1 rounded-md bg-muted hover:bg-muted/80 transition-colors",title:"Click to cycle confidence",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:lf[t]}),h.jsx("div",{className:"flex items-center gap-0.5",children:[0,1,2,3].map(i=>h.jsx("div",{className:"rounded-full transition-all",style:{width:6,height:6,background:i<t?n:"transparent",border:`1.5px solid ${i<t?n:"hsl(var(--border))"}`}},i))})]})}function XY({item:t,connections:e,items:r,onSelect:n,onDeleteConnection:i}){const s=new Map(r.map(l=>[l.id,l])),o=[];for(const l of e)if(l.type!=="contradicts"){if(l.fromId===t.id){const c=s.get(l.toId);c&&o.push({item:c,type:l.type,direction:"outgoing",connId:l.id})}if(l.toId===t.id){const c=s.get(l.fromId);c&&o.push({item:c,type:l.type,direction:"incoming",connId:l.id})}}if(o.length===0)return null;const a={};for(const l of o){const c=`${l.type}-${l.direction}`;a[c]||(a[c]={type:l.type,direction:l.direction,items:[]}),a[c].items.push({item:l.item,connId:l.connId})}return h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Connections"}),Object.values(a).map(l=>h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] text-muted-foreground mb-1",children:l.direction==="incoming"?`${l.type} from`:`${l.type} to`}),h.jsx("div",{className:"space-y-0.5",children:l.items.map(({item:c,connId:u})=>h.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors group/conn",children:[h.jsxs("button",{onClick:()=>n(c.id),className:"flex flex-1 items-center gap-2 min-w-0",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Vn[c.status]||Vn.planned}}),h.jsx("span",{className:"text-xs text-foreground truncate",children:c.title}),h.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:gr[c.type]},children:c.type})]}),i&&h.jsx("button",{onClick:()=>i(u),className:"opacity-0 group-hover/conn:opacity-100 p-0.5 rounded hover:bg-destructive/20 text-muted-foreground hover:text-destructive transition-all shrink-0",title:"Remove connection",children:h.jsx(hn,{className:"h-3 w-3"})})]},u))})]},`${l.type}-${l.direction}`))]})}function pl(t){if(!t)return"";const e=new Date(t);return e.toLocaleDateString("en-US",{month:"short",day:"numeric"})+" "+e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function KY({featureCode:t,lineage:e}){const r=mr(i=>i.selectedBranches),n=mr(i=>i.setSelectedBranches);return h.jsx(WY,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function ZY({featureCode:t}){const[e,r]=C.useState([]),[n,i]=C.useState(!0);return C.useEffect(()=>{const s=new AbortController;return i(!0),zt(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=10`,{signal:s.signal}).then(o=>o.json()).then(o=>{s.signal.aborted||r(o.sessions||[])}).catch(o=>{s.signal.aborted||r([])}).finally(()=>{s.signal.aborted||i(!1)}),()=>s.abort()},[t]),n||e.length===0?null:h.jsxs("div",{children:[h.jsxs("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Sessions (",e.length,")"]}),h.jsx("div",{className:"space-y-2",children:e.map(s=>{var o;return h.jsxs("div",{className:"text-xs text-muted-foreground border-l-2 border-border pl-2",children:[h.jsxs("div",{className:"font-medium text-foreground",children:[((o=s.phaseAtBind)==null?void 0:o.replace(/_/g," "))||"—",s.phaseAtEnd&&s.phaseAtEnd!==s.phaseAtBind&&` → ${s.phaseAtEnd.replace(/_/g," ")}`]}),h.jsxs("div",{children:[s.toolCount," tools · ",Math.round((new Date(s.endedAt)-new Date(s.startedAt))/6e4),"m"]})]},s.id)})})]})}const QY=["informs","supports","blocks","contradicts"];function JY({item:t,items:e,onCreateConnection:r,onDismiss:n}){const[i,s]=C.useState(""),[o,a]=C.useState("informs"),l=e.filter(u=>u.id===t.id?!1:i?u.title.toLowerCase().includes(i.toLowerCase()):!0).slice(0,8),c=C.useCallback(async u=>{await r({fromId:t.id,toId:u,type:o}),n()},[t.id,o,r,n]);return h.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50",children:h.jsxs("div",{className:"p-2 space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("select",{className:"text-[10px] px-1.5 py-1 rounded bg-muted text-foreground border border-border cursor-pointer",value:o,onChange:u=>a(u.target.value),children:QY.map(u=>h.jsx("option",{value:u,children:u},u))}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"to..."})]}),h.jsxs("div",{className:"relative",children:[h.jsx(ei,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),h.jsx("input",{className:"w-full text-xs bg-muted text-foreground pl-7 pr-2 py-1.5 rounded border border-border outline-none",placeholder:"Search items...",value:i,onChange:u=>s(u.target.value),autoFocus:!0})]}),h.jsx("div",{className:"max-h-40 overflow-auto space-y-0.5",children:l.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground text-center py-2",children:"No items found"}):l.map(u=>h.jsxs("button",{onClick:()=>c(u.id),className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Vn[u.status]||Vn.planned}}),h.jsx("span",{className:"text-xs text-foreground truncate",children:u.title}),h.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:gr[u.type]},children:u.type})]},u.id))})]})})}function tX({gate:t,onResolveGate:e}){const[r,n]=C.useState(null),[i,s]=C.useState(""),o=()=>{e(t.id,"revised",i||void 0),n(null),s("")},a=()=>{i.trim()&&(e(t.id,"killed",i),n(null),s(""))};return h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Wt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>e(t.id,"approved"),children:"Approve"}),h.jsx(Wt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",r==="revise"&&"bg-amber-400/10"),onClick:()=>{n(r==="revise"?null:"revise"),s("")},children:"Revise"}),h.jsx(Wt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",r==="kill"&&"bg-destructive/10"),onClick:()=>{n(r==="kill"?null:"kill"),s("")},children:"Kill"})]}),r&&h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none",placeholder:r==="revise"?"Feedback (optional)...":"Kill reason (required)...",value:i,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(r==="revise"?o():a()),l.key==="Escape"&&n(null)},autoFocus:!0}),h.jsx(Wt,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:r==="kill"&&!i.trim(),onClick:r==="revise"?o:a,children:r==="revise"?"Submit":"Confirm Kill"})]})]})}function eX({item:t,items:e,connections:r,gates:n,onUpdate:i,onDelete:s,onCreateConnection:o,onDeleteConnection:a,onSelect:l,onClose:c,onPressureTest:u,onResolveGate:d}){var D,R,j,S,U,Q;const[p,f]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[b,k]=C.useState(""),[T,_]=C.useState(!1),[w,E]=C.useState(!1),[L,M]=C.useState("");C.useEffect(()=>{M((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const N=C.useCallback(()=>{const A=L.trim(),rt=(t==null?void 0:t.group)||"";A!==rt&&i(t.id,{group:A||null})},[L,t==null?void 0:t.id,t==null?void 0:t.group,i]),P=C.useCallback(()=>{x(t.title),f(!0)},[t==null?void 0:t.title]),$=C.useCallback(()=>{m.trim()&&m!==t.title&&i(t.id,{title:m.trim()}),f(!1)},[m,t==null?void 0:t.id,t==null?void 0:t.title,i]),q=C.useCallback(()=>{k(t.description||""),y(!0)},[t==null?void 0:t.description]),O=C.useCallback(()=>{b!==(t.description||"")&&i(t.id,{description:b}),y(!1)},[b,t==null?void 0:t.id,t==null?void 0:t.description,i]),I=C.useMemo(()=>{if(!t)return 0;let A=0;for(const rt of r)rt.type==="contradicts"&&(rt.fromId===t.id||rt.toId===t.id)&&A++;return A},[t==null?void 0:t.id,r]);if(!t)return null;const F=gr[t.type]||gr.task;return h.jsxs("div",{className:"w-full bg-card flex flex-col h-full",children:[h.jsxs("div",{className:"p-3 pb-2 flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[h.jsx(nr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:F,borderColor:F},children:t.type}),t.phase&&h.jsx(nr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:Fl[t.phase]||t.phase})]}),p?h.jsx("input",{className:"w-full text-sm font-semibold bg-muted text-foreground px-1.5 py-0.5 rounded border border-ring outline-none",value:m,onChange:A=>x(A.target.value),onBlur:$,onKeyDown:A=>{A.key==="Enter"&&$(),A.key==="Escape"&&f(!1)},autoFocus:!0}):h.jsx("h3",{className:"text-sm font-semibold text-foreground cursor-pointer hover:text-accent transition-colors",onDoubleClick:P,title:"Double-click to edit",children:t.title})]}),h.jsx(Wt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:c,children:h.jsx(hn,{className:"h-3.5 w-3.5"})})]}),h.jsx(Vl,{}),h.jsx(Yn,{className:"flex-1",children:h.jsxs("div",{className:"p-3 space-y-4",children:[h.jsx(GY,{item:t}),((D=t.lifecycle)==null?void 0:D.featureCode)&&h.jsx(KY,{featureCode:t.lifecycle.featureCode,lineage:(R=t.lifecycle.lifecycle_ext)==null?void 0:R.branch_lineage}),h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("select",{className:"text-xs px-2 py-1 rounded-md bg-muted text-foreground border border-border cursor-pointer",value:t.status||"planned",onChange:A=>i(t.id,{status:A.target.value}),children:C_.map(A=>h.jsx("option",{value:A,children:A.replace("_"," ")},A))}),h.jsx(YY,{level:t.confidence||0,onChange:A=>i(t.id,{confidence:A})})]}),h.jsx(FY,{level:t.confidence||0}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase"}),h.jsxs("select",{className:"text-xs px-2 py-1 rounded-md bg-muted text-foreground border border-border cursor-pointer w-full",value:t.phase||"",onChange:A=>i(t.id,{phase:A.target.value||null}),children:[h.jsx("option",{value:"",children:"No phase"}),cy.map(A=>h.jsx("option",{value:A,children:Fl[A]},A))]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Group"}),h.jsx("input",{type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1 rounded-md border border-border outline-none focus:border-ring",value:L,placeholder:"(none)",onChange:A=>M(A.target.value),onBlur:N,onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(M(t.group||""),A.currentTarget.blur())},"data-testid":"item-detail-group-input"})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),g?h.jsx("textarea",{className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-ring outline-none resize-none",rows:4,value:b,onChange:A=>k(A.target.value),onBlur:O,onKeyDown:A=>{A.key==="Escape"&&y(!1)},autoFocus:!0}):h.jsx("p",{className:nt("text-xs leading-relaxed cursor-pointer rounded px-2 py-1.5 hover:bg-muted/50 transition-colors",t.description?"text-muted-foreground":"text-muted-foreground/50 italic"),onClick:q,children:t.description||"Click to add description..."})]}),h.jsx(XY,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),h.jsx(MY,{item:t,items:e,connections:r,onSelect:l}),((j=t.lifecycle)==null?void 0:j.featureCode)&&h.jsx(ZY,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(A=>A.itemId===t.id))&&(()=>{var It;const A=t.lifecycle,rt=n?n.filter(ht=>ht.itemId===t.id):[],ut=rt.filter(ht=>ht.status==="pending"),ot=rt.filter(ht=>ht.status!=="pending");return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Lifecycle"}),h.jsxs("div",{className:"space-y-1.5",children:[A&&h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Phase:"}),h.jsx("span",{className:"text-[10px] text-foreground font-medium",children:Te[A.currentPhase]??A.currentPhase}),A.featureCode&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:A.featureCode})]}),((It=A==null?void 0:A.phaseHistory)==null?void 0:It.length)>1&&h.jsxs("div",{className:"px-2 py-1 rounded bg-muted/30",children:[h.jsx("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"History"}),h.jsx("div",{className:"flex flex-wrap gap-x-1 gap-y-0.5",children:A.phaseHistory.map((ht,at)=>h.jsxs("span",{className:nt("text-[10px]",ht.phase===A.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[Te[ht.phase]??ht.phase,ht.outcome&&ht.outcome!=="approved"&&h.jsxs("span",{className:"text-amber-400",children:[" (",ht.outcome,")"]}),at<A.phaseHistory.length-1&&" → "]},at))})]}),ut.map(ht=>{var lt,yt;const at=ht.artifactAssessment,K=hy[ht.fromPhase];return h.jsxs("div",{className:"rounded bg-amber-400/10 border border-amber-400/20 px-2 py-1.5",children:[h.jsxs("p",{className:"text-[10px] text-amber-400 font-medium mb-1",children:["Pending: ",wn[ht.stepId]??`${Te[ht.fromPhase]??ht.fromPhase} → ${Te[ht.toPhase]??ht.toPhase}`]}),at&&at.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[K&&h.jsx("span",{className:"font-mono",children:K}),K&&": ",Math.round(at.completeness*100),"% complete"," · ",at.wordCount," words",((yt=(lt=at.sections)==null?void 0:lt.missing)==null?void 0:yt.length)>0&&h.jsxs("span",{className:"text-amber-400",children:[" (missing: ",at.sections.missing.join(", "),")"]}),!at.meetsMinWordCount&&h.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),at&&!at.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[K??"Artifact"," not found"]}),d&&h.jsx(tX,{gate:ht,onResolveGate:d})]},ht.id)}),ot.map(ht=>{const at={approved:"text-success",revised:"text-amber-400",killed:"text-destructive"};return h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:wn[ht.stepId]??`${Te[ht.fromPhase]??ht.fromPhase} → ${Te[ht.toPhase]??ht.toPhase}`}),h.jsx(nr,{variant:"outline",className:nt("text-[10px] px-1.5 py-0 h-4 ml-auto",at[ht.outcome]||""),children:ht.outcome})]},ht.id)})]})]})})(),((U=(S=t.evidence)==null?void 0:S.stratumViolations)==null?void 0:U.length)>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1.5",children:["Blocked — Ensure Violations",t.evidence.violatedAt&&h.jsx("span",{className:"ml-2 font-normal normal-case text-muted-foreground",children:pl(t.evidence.violatedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((A,rt)=>h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:A})]},rt))})]}),((Q=t.evidence)==null?void 0:Q.stratumTrace)&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Stratum Trace",t.evidence.tracedAt&&h.jsx("span",{className:"ml-2 font-normal normal-case",children:pl(t.evidence.tracedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(A=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--success))"}}),h.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:A.step_id}),A.attempts>1&&h.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[A.attempts,"x"]}),A.duration_ms!=null&&h.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:A.duration_ms<1e3?`${A.duration_ms}ms`:`${(A.duration_ms/1e3).toFixed(1)}s`})]},A.step_id))})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",pl(t.createdAt)]}),h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",pl(t.updatedAt)]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[!t.lifecycle&&t.status!=="killed"&&t.type!=="question"&&h.jsxs("div",{className:"relative",children:[h.jsxs(Wt,{variant:"outline",size:"sm",className:nt("h-7 text-xs gap-1",w&&"bg-accent/10 border-accent"),onClick:()=>E(!w),"data-testid":"item-start-build",title:"Start the build/bug-fix lifecycle for this item",children:[h.jsx(EM,{className:"h-3 w-3"})," Start"]}),w&&h.jsx(VY,{item:t,onClose:()=>E(!1)})]}),h.jsxs("div",{className:"relative",children:[h.jsxs(Wt,{variant:"outline",size:"sm",className:nt("h-7 text-xs gap-1",T&&"bg-accent/10 border-accent"),onClick:()=>_(!T),children:[h.jsx(gM,{className:"h-3 w-3"})," Connect"]}),T&&h.jsx(JY,{item:t,items:e,onCreateConnection:o,onDismiss:()=>_(!1)})]}),h.jsxs(Wt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:P,children:[h.jsx(Bb,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&h.jsxs(Wt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[h.jsx(Wl,{className:"h-3 w-3"})," Pressure Test",I>0&&h.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:I})]}),t.status!=="killed"&&h.jsxs(Wt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:async()=>{if(t.lifecycle)try{const A=await zt(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!A.ok){const rt=await A.json();console.error("[vision] Lifecycle kill failed:",rt.error)}}catch(A){console.error("[vision] Lifecycle kill failed:",A.message)}else i(t.id,{status:"killed"})},children:[h.jsx(Jm,{className:"h-3 w-3"})," Kill"]}),s&&h.jsxs(Wt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>{window.confirm(`Delete "${t.title}" permanently? This cannot be undone.`)&&s(t.id)},title:"Permanently delete this item",children:[h.jsx(Jm,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const QT=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];QT.map(t=>t.id);const rX={overview:Mi,pipeline:jb,sessions:Eb,errors:Rc,files:Bf};function nX({activeTab:t="overview",onTabChange:e,errorCount:r=0}){return h.jsx("div",{className:"flex items-center gap-0 shrink-0",style:{height:"28px",borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--muted) / 0.3)"},role:"tablist","aria-label":"Detail sections",children:QT.map(({id:n,label:i})=>{const s=rX[n],o=n===t,a=n==="errors"?r:0;return h.jsxs("button",{role:"tab","aria-selected":o,className:["flex items-center gap-1 px-2 h-full text-[10px] uppercase tracking-wider font-medium transition-colors","border-b-2 -mb-px",o?"border-accent text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>e==null?void 0:e(n),children:[h.jsx(s,{style:{width:10,height:10}}),i,a>0&&h.jsx("span",{className:"text-[8px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-0.5 tabular-nums",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))"},children:a})]},n)})})}const P0=[{id:"design",label:"Design"},{id:"blueprint",label:"Blueprint"},{id:"execute",label:"Execute"},{id:"review",label:"Review"},{id:"coverage",label:"Coverage"},{id:"ship",label:"Ship"}];function Zd(t,e,r,n){if(r&&r.featureCode===n&&r.currentStep===t)return"active";if(e&&Array.isArray(e)){const i=e.find(s=>s.phase===t||s.step===t);if(i)return i.status==="failed"?"failed":"complete"}return"pending"}function iX({item:t,activeBuild:e}){const[r,n]=C.useState(null),i=(t==null?void 0:t.phaseHistory)||[],s=(t==null?void 0:t.featureCode)||(t==null?void 0:t.text)||"";return h.jsxs("div",{className:"p-3",children:[h.jsx("div",{className:"flex items-center gap-0 mb-3",children:P0.map((o,a)=>{const l=Zd(o.id,i,e,s),c=tm[l],u=r===o.id;return h.jsxs(Yt.Fragment,{children:[a>0&&h.jsx("div",{className:"flex-1 h-px",style:{background:l==="pending"?"hsl(var(--muted-foreground) / 0.2)":c,minWidth:"8px"}}),h.jsxs("button",{onClick:()=>n(u?null:o.id),className:"relative flex flex-col items-center group",title:o.label,children:[h.jsx("div",{className:["w-3 h-3 rounded-full border-2 transition-all",l==="active"?"animate-pulse":"",u?"ring-2 ring-accent/30":""].join(" "),style:{borderColor:c,background:l==="complete"||l==="failed"?c:"transparent"}}),h.jsx("span",{className:"text-[8px] text-muted-foreground mt-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:o.label})]})]},o.id)})}),h.jsx("div",{className:"flex justify-between px-0.5",children:P0.map(o=>{const a=Zd(o.id,i,e,s);return h.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider",style:{color:a==="pending"?"hsl(var(--muted-foreground) / 0.4)":tm[a]},children:o.label},o.id)})}),r&&h.jsx("div",{className:"mt-3 p-2 rounded border border-border/50 bg-muted/20",children:h.jsx(sX,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function sX({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=Zd(t,e,r,n),s=e==null?void 0:e.find(a=>a.phase===t||a.step===t),o={complete:"text-success",active:"text-accent",failed:"text-destructive",pending:"text-muted-foreground"};return h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs font-semibold text-foreground capitalize",children:t}),h.jsx("span",{className:`text-[10px] font-medium ${o[i]}`,children:i})]}),(s==null?void 0:s.summary)&&h.jsx("p",{className:"text-[10px] text-muted-foreground",children:s.summary}),(s==null?void 0:s.durationMs)!=null&&h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Duration: ",s.durationMs<1e3?`${s.durationMs}ms`:`${(s.durationMs/1e3).toFixed(1)}s`]}),(s==null?void 0:s.agent)&&h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Agent: ",s.agent]}),i==="active"&&r&&h.jsx("p",{className:"text-[10px] text-accent",children:"Running..."}),i==="pending"&&h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Not started"})]})}function oX(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function aX(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function lX({featureCode:t,sessions:e=[],items:r=[]}){const[n,i]=C.useState(null),s=C.useMemo(()=>t?new Set(r.filter(a=>{var l;return((l=a.lifecycle)==null?void 0:l.featureCode)===t||a.featureCode===t||a.feature_code===t}).map(a=>a.id)):new Set,[t,r]),o=C.useMemo(()=>s.size===0?e.slice(0,20):e.filter(a=>!!(a.featureCode===t||a.itemsWorked&&a.itemsWorked.some(l=>s.has(l))||a.summary&&a.summary.includes(t))),[e,t,s]);return o.length===0?h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"No sessions for this feature."}):h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Sessions (",o.length,")"]}),o.map(a=>{const l=n===a.id;return h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>i(l?null:a.id),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left rounded hover:bg-muted/30 transition-colors",children:[h.jsx("span",{className:"text-[10px] font-mono text-accent shrink-0 w-12 truncate",children:a.source||"agent"}),h.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 w-16 truncate",children:a.classification||a.workType||"—"}),h.jsxs("span",{className:"text-[9px] text-muted-foreground tabular-nums flex gap-1.5 shrink-0",children:[h.jsxs("span",{title:"reads",children:[a.reads||0,"r"]}),h.jsxs("span",{title:"writes",children:[a.writes||0,"w"]}),h.jsxs("span",{title:"errors",style:a.errors>0?{color:"hsl(var(--destructive))"}:{},children:[a.errors||0,"e"]})]}),h.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:aX(a.durationMs)}),h.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:oX(a.startedAt||a.createdAt)})]}),l&&a.summary&&h.jsx("div",{className:"px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/10 rounded mx-1 mb-1",children:a.summary})]},a.id)})]})}function cX(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}const ju=10;function hX({featureCode:t,errors:e=[],items:r=[]}){const[n,i]=C.useState(null),[s,o]=C.useState(!1),a=C.useMemo(()=>t?new Set(r.filter(u=>{var d;return((d=u.lifecycle)==null?void 0:d.featureCode)===t||u.featureCode===t||u.feature_code===t}).map(u=>u.id)):new Set,[t,r]),l=C.useMemo(()=>!t&&a.size===0?[]:e.filter(u=>!!(t&&u.featureCode===t||u.itemId&&a.has(u.itemId)||t&&u.message&&u.message.includes(t))),[e,t,a]);if(l.length===0)return h.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[h.jsx(GA,{style:{width:20,height:20,color:"hsl(var(--success, 160 60% 45%))"}}),h.jsx("span",{className:"text-[11px] italic",children:"No errors for this feature."})]});const c=s?l:l.slice(0,ju);return h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Errors (",l.length,")"]}),c.map((u,d)=>{const p=n===d;return h.jsxs("button",{onClick:()=>i(p?null:d),className:"flex flex-col w-full px-2 py-1.5 text-left rounded hover:bg-destructive/5 transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-2 w-full",children:[h.jsx("span",{className:"text-[10px] text-destructive shrink-0",children:"✕"}),h.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0 w-16 truncate",children:u.tool||u.toolName||"unknown"}),h.jsx("span",{className:`text-[10px] text-foreground flex-1 ${p?"":"line-clamp-2"} truncate`,children:u.message||u.error||"Unknown error"}),h.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0 ml-auto",children:cX(u.timestamp||u.createdAt)})]}),p&&h.jsx("div",{className:"mt-1.5 px-5 py-1.5 text-[10px] text-foreground font-mono bg-muted/10 rounded whitespace-pre-wrap break-all",children:u.message||u.error||u.stack||"No additional details"})]},d)}),!s&&l.length>ju&&h.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-ju," more"]})]})}function uX(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function dX(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function fX({featureCode:t,onOpenFile:e}){const[r,n]=C.useState([]),[i,s]=C.useState(!0);C.useEffect(()=>{const l=new AbortController;return s(!0),zt("/api/files",{signal:l.signal}).then(c=>c.json()).then(c=>{l.signal.aborted||(n(Array.isArray(c)?c:c.files||[]),s(!1))}).catch(c=>{l.signal.aborted||(n([]),s(!1))}),()=>l.abort()},[t]);const o=`docs/features/${t}/`,a=C.useMemo(()=>r.filter(l=>(typeof l=="string"?l:l.path||l.name||"").startsWith(o)),[r,o]);return i?h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Loading files..."}):a.length===0?h.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[h.jsx(Bf,{style:{width:20,height:20,opacity:.5}}),h.jsx("span",{className:"text-[11px] italic",children:"No files in feature folder."})]}):h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Files (",a.length,")"]}),a.map((l,c)=>{const u=typeof l=="string"?l:l.path||l.name||"",d=u.split("/").pop(),p=typeof l=="object"?l.size:null,f=typeof l=="object"?l.modified||l.mtime:null;return h.jsxs("button",{onClick:()=>e==null?void 0:e(u),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left rounded hover:bg-accent/10 transition-colors",children:[h.jsx(Mi,{className:"h-3 w-3 shrink-0 text-accent"}),h.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:d}),p!=null&&h.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:uX(p)}),f&&h.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:dX(f)})]},c)})]})}function pX({itemId:t,onSelect:e,onClose:r,onOpenFile:n,onViewInGraph:i,onViewInTree:s}){var w;const{items:o,connections:a,gates:l,updateItem:c,deleteItem:u,createConnection:d,deleteConnection:p,resolveGate:f,activeBuild:m,sessions:x,agentErrors:g}=mr(Pi(E=>({items:E.items,connections:E.connections,gates:E.gates,updateItem:E.updateItem,deleteItem:E.deleteItem,createConnection:E.createConnection,deleteConnection:E.deleteConnection,resolveGate:E.resolveGate,activeBuild:E.activeBuild,sessions:E.sessions,agentErrors:E.agentErrors}))),y=o.find(E=>E.id===t)||null,[b,k]=C.useState("overview"),T=((w=y==null?void 0:y.lifecycle)==null?void 0:w.featureCode)||(y==null?void 0:y.featureCode)||(y==null?void 0:y.feature_code)||"",_=C.useMemo(()=>T?g.filter(E=>E.featureCode===T||T&&E.message&&E.message.includes(T)):[],[g,T]);return y?h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsx(nX,{activeTab:b,onTabChange:k,errorCount:_.length}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[b==="overview"&&h.jsxs(h.Fragment,{children:[h.jsx(eX,{item:y,items:o,connections:a,gates:l,onUpdate:(E,L)=>c(E,L),onDelete:E=>{u(E),r()},onCreateConnection:d,onDeleteConnection:p,onSelect:e,onClose:r,onPressureTest:()=>{},onResolveGate:f}),h.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 mt-1",style:{borderTop:"1px solid hsl(var(--border))"},children:[i&&h.jsxs("button",{onClick:()=>i(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx("span",{style:{fontSize:10},children:"↑"})," View in Graph"]}),s&&h.jsxs("button",{onClick:()=>s(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx("span",{style:{fontSize:10},children:"↓"})," View in Tree"]})]})]}),b==="pipeline"&&h.jsx(iX,{item:y,activeBuild:m}),b==="sessions"&&h.jsx(lX,{featureCode:T,sessions:x,items:o}),b==="errors"&&h.jsx(hX,{featureCode:T,errors:g,items:o}),b==="files"&&h.jsx(fX,{featureCode:T,onOpenFile:n})]})]}):h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function mX(t){if(!t)return null;const{retries:e}=t;return e==null?null:Array.isArray(e)?e.length===0?null:{count:e.length,isArray:!0,items:e}:typeof e=="number"&&e>0?{count:e,isArray:!1,items:[]}:null}function gX(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function xX(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function yX(t,e,r){var c;if(!t||t.status!=="running")return null;const n=t.startedAt?Date.parse(t.startedAt):r,i=r-n,s=t.wallClockTimeout!=null?t.wallClockTimeout*60*1e3:null,o=(c=e==null?void 0:e.per_loop_type)==null?void 0:c[t.loopType],a=(o==null?void 0:o.maxTotal)!=null?o.usedIterations:null,l=(o==null?void 0:o.maxTotal)??null;return{count:t.count??0,maxIterations:t.maxIterations??null,loopType:t.loopType,elapsedMs:i,timeoutMs:s,usedIterations:a,maxTotal:l}}function bX(t){if(!(t!=null&&t.per_loop_type))return"";const e={review:"r",coverage:"c"},r=[];for(const[n,i]of Object.entries(e)){const s=t.per_loop_type[n];!s||s.maxTotal==null||r.push(`${i} ${s.usedIterations}/${s.maxTotal}`)}return r.join(" · ")}function D0(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const O0=[{id:"T0",name:"schema",label:"T0"},{id:"T1",name:"lint",label:"T1"},{id:"T2",name:"tests",label:"T2"},{id:"T3",name:"review",label:"T3"},{id:"T4",name:"codex",label:"T4"}];function CX({tierMap:t,tierSummary:e}){const[r,n]=C.useState(null),i=s=>n(o=>o===s?null:s);return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Tier Pipeline"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[O0.map((s,o)=>{var d;const a=t[s.id],l=(d=e==null?void 0:e.tiersSkipped)==null?void 0:d.includes(s.id);let c,u;return l?(c="bg-muted-foreground/40",u=`${s.id} (${s.name}): skipped`):a===!0?(c="bg-success",u=`${s.id} (${s.name}): passed`):a===!1?(c="bg-destructive",u=`${s.id} (${s.name}): failed`):(c="bg-muted-foreground/20",u=`${s.id} (${s.name}): not run`),h.jsxs(Yt.Fragment,{children:[o>0&&h.jsx("div",{className:"h-px w-3 bg-muted-foreground/20 shrink-0"}),h.jsxs("button",{className:"flex flex-col items-center gap-0.5 group",onClick:()=>i(s.id),title:u,children:[h.jsx("div",{className:`w-2.5 h-2.5 rounded-full transition-all group-hover:scale-125 ${c} ${r===s.id?"ring-1 ring-foreground/40":""}`}),h.jsx("span",{className:"text-[8px] text-muted-foreground leading-none",children:s.label})]})]},s.id)}),(e==null?void 0:e.costSaved)>0&&h.jsxs("span",{className:"ml-2 text-[9px] text-success/80",children:["saved ~$",e.costSaved.toFixed(2)]})]}),r&&h.jsx("div",{className:"mt-1.5 px-2 py-1 rounded bg-muted/20 text-[9px] text-muted-foreground",children:(()=>{var l;const s=t[r],o=(l=e==null?void 0:e.tiersSkipped)==null?void 0:l.includes(r),a=O0.find(c=>c.id===r);return o?`${r} (${a==null?void 0:a.name}): skipped — short-circuited by earlier failure`:s===!0?`${r} (${a==null?void 0:a.name}): passed`:s===!1?`${r} (${a==null?void 0:a.name}): failed`:`${r} (${a==null?void 0:a.name}): not run this build`})()})]})}function Lu(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function kX(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const R0={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function $0(t){if(t==null)return"—";const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function vX({loopState:t,budget:e}){const[r,n]=C.useState(()=>Date.now());C.useEffect(()=>{if(!t||t.status!=="running")return;const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[t]);const i=yX(t,e,r);return i?h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Live Counters"}),h.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsxs("span",{className:"text-foreground font-mono font-medium",children:["attempt ",i.count,"/",i.maxIterations??"?"]}),h.jsx("span",{className:"text-muted-foreground",children:"·"}),h.jsxs("span",{className:"text-foreground font-mono",children:[$0(i.elapsedMs),i.timeoutMs!=null&&h.jsxs("span",{className:"text-muted-foreground",children:[" / ",$0(i.timeoutMs)]})]}),i.usedIterations!=null&&i.maxTotal!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground",children:"·"}),h.jsxs("span",{className:"text-foreground font-mono",children:["cumulative ",i.usedIterations,"/",i.maxTotal]})]})]}),h.jsxs("div",{className:"text-muted-foreground/70 text-[9px]",children:["loop: ",i.loopType]})]})]}):null}function wX({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=mr(Pi(M=>({activeBuild:M.activeBuild,iterationStates:M.iterationStates}))),[o,a]=C.useState(!1),[l,c]=C.useState(null),u=(i==null?void 0:i.featureCode)??null,d=C.useRef(null);C.useEffect(()=>{if(!u){c(null);return}u!==d.current&&(d.current=u,zt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(M=>M.json()).then(M=>c(M)).catch(()=>{}))},[u]);const{step:p,allSteps:f}=C.useMemo(()=>i!=null&&i.steps?{step:i.steps.find(N=>N.id===t||N.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=C.useMemo(()=>{if(!r||r.length===0)return null;for(let M=r.length-1;M>=0;M--){const N=r[M];if(N.subtype==="health_score"&&typeof N.score=="number")return N}return null},[r]),{tierMap:x,tierSummary:g}=C.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const M={};let N=null;for(const P of e)P.subtype==="gate_tier_result"?M[P.tierId]=P.passed:P.subtype==="gate_tier_summary"&&(N=P);return{tierMap:M,tierSummary:N}},[e]),y=Object.keys(x).length>0||g!==null,b=C.useMemo(()=>{const M=f.filter(N=>N.cost_usd!=null);return M.length===0?[]:[...M].sort((N,P)=>o?(N.cost_usd??0)-(P.cost_usd??0):(P.cost_usd??0)-(N.cost_usd??0))},[f,o]),k=b.length>0?b[0].id:null,T=C.useMemo(()=>mX(p),[p]),_=C.useMemo(()=>gX(p),[p]),w=C.useMemo(()=>xX(s,t),[s,t]),E=C.useMemo(()=>{if(!n||n.length===0)return null;const M=n.filter($=>$.stepId===t);if(M.length===0)return null;const N=M.filter($=>$.severity==="violation").length,P=M.filter($=>$.severity==="warning").length;return{total:M.length,hardViolations:N,warnings:P}},[n,t]);if(!p)return h.jsxs("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:["Step “",t,"” not found in active build."]});const L={done:"text-success",running:"text-accent",failed:"text-destructive",pending:"text-muted-foreground",skipped:"text-muted-foreground"};return h.jsxs("div",{className:"p-3 space-y-3",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Step"}),h.jsx("p",{className:"text-sm font-semibold text-foreground font-mono",children:p.id||p.step_id})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Status:"}),h.jsx("span",{className:`text-xs font-medium ${L[p.status]||"text-foreground"}`,children:p.status||"unknown"})]}),T&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Retries"}),h.jsxs("p",{className:"text-xs text-amber-400",children:["Retried ",T.count," ",T.count===1?"time":"times"]}),T.isArray&&T.items.length>0&&h.jsx("div",{className:"mt-1 space-y-0.5",children:T.items.map((M,N)=>h.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",N+1,M.reason?`: ${M.reason}`:""]},N))})]}),p.durationMs!=null&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Duration:"}),h.jsx("span",{className:"text-xs text-foreground",children:p.durationMs<1e3?`${p.durationMs}ms`:p.durationMs<6e4?`${(p.durationMs/1e3).toFixed(1)}s`:`${(p.durationMs/6e4).toFixed(1)}m`})]}),p.summary&&h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Summary:"}),h.jsx("p",{className:"text-xs text-foreground mt-0.5",children:p.summary})]}),p.artifact&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Artifact:"}),h.jsx("span",{className:"text-xs text-foreground font-mono truncate",children:p.artifact})]}),p.agent&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Agent:"}),h.jsx("span",{className:"text-xs text-foreground font-mono",children:p.agent})]}),p.filesChanged&&p.filesChanged.length>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Files Changed (",p.filesChanged.length,")"]}),h.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:p.filesChanged.map((M,N)=>h.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:M},N))})]}),(p.input_tokens>0||p.output_tokens>0||p.cost_usd>0)&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Tokens & Cost"}),h.jsxs("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:"Input"}),h.jsx("span",{className:"text-muted-foreground",children:"Output"}),h.jsx("span",{className:"text-muted-foreground",children:"Cost"}),h.jsx("span",{className:"text-foreground font-mono",children:(p.input_tokens??0).toLocaleString()}),h.jsx("span",{className:"text-foreground font-mono",children:(p.output_tokens??0).toLocaleString()}),h.jsx("span",{className:"text-foreground font-mono",children:D0(p.cost_usd)})]})]}),y&&h.jsx("div",{children:h.jsx(CX,{tierMap:x,tierSummary:g})}),_.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1",children:"Postcondition Violations"}),h.jsx("div",{className:"space-y-0.5",children:_.map((M,N)=>h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:typeof M=="string"?M:M.message||JSON.stringify(M)})]},N))})]}),E&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Capability Findings"}),h.jsxs("p",{className:"text-xs text-amber-400",children:[E.total," ",E.total===1?"finding":"findings"," ","(",E.hardViolations," ",E.hardViolations===1?"violation":"violations",","," ",E.warnings," ",E.warnings===1?"warning":"warnings",")"]})]}),(w==null?void 0:w.status)==="running"&&h.jsx(vX,{loopState:w,budget:l}),m!=null&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Health Score"}),h.jsxs("div",{className:"flex items-baseline gap-2 mb-2",children:[h.jsx("span",{className:`text-2xl font-bold font-mono tabular-nums ${Lu(m.score)}`,children:m.score}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"/100"}),m.trend&&h.jsxs("span",{className:`text-sm font-mono ${Lu(m.score)}`,children:[kX(m.trend.direction),m.trend.delta!=null&&h.jsxs("span",{className:"text-[10px] ml-0.5",children:[m.trend.delta>0?"+":"",Math.round(m.trend.delta)]})]})]}),m.breakdown&&Object.keys(m.breakdown).length>0&&h.jsxs("div",{className:"space-y-1",children:[Object.entries(m.breakdown).map(([M,N])=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:R0[M]??M}),h.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted-foreground/20 overflow-hidden",children:h.jsx("div",{className:`h-full rounded-full transition-all ${N>=80?"bg-success":N>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${N}%`}})}),h.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${Lu(N)}`,children:N})]},M)),m.missing&&m.missing.length>0&&h.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-0.5",children:["No data: ",m.missing.map(M=>R0[M]??M).join(", ")]})]})]}),b.length>1&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Build Cost Breakdown"}),h.jsx("button",{className:"text-[9px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>a(M=>!M),children:o?"cost asc":"cost desc"})]}),h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-[10px] border-collapse",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"text-muted-foreground",children:[h.jsx("th",{className:"text-left pr-2 pb-0.5 font-medium",children:"Step"}),h.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"In"}),h.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"Out"}),h.jsx("th",{className:"text-right pb-0.5 font-medium",children:"Cost"}),h.jsx("th",{className:"text-right pb-0.5 pl-2 font-medium",children:"Dur"})]})}),h.jsx("tbody",{children:b.map(M=>{const N=M.id===k,P=M.id===t,$=M.durationMs!=null?M.durationMs<1e3?`${M.durationMs}ms`:M.durationMs<6e4?`${(M.durationMs/1e3).toFixed(1)}s`:`${(M.durationMs/6e4).toFixed(1)}m`:"—";return h.jsxs("tr",{className:`${N?"text-amber-400":"text-foreground"} ${P?"font-semibold":""}`,children:[h.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:M.id}),h.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((M.input_tokens??0)/1e3).toFixed(1),"k"]}),h.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((M.output_tokens??0)/1e3).toFixed(1),"k"]}),h.jsx("td",{className:"text-right py-0.5 font-mono",children:D0(M.cost_usd)}),h.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:$})]},M.id)})})]})})]})]})}function JT(t){const e=[],r=/```decision\n([\s\S]*?)```/g;let n=0,i;for(;(i=r.exec(t))!==null;){i.index>n&&e.push({type:"text",content:t.slice(n,i.index)});const s=i[1].trim();try{e.push({type:"decision",content:JSON.parse(s)})}catch{e.push({type:"text",content:s})}n=i.index+i[0].length}return n<t.length&&e.push({type:"text",content:t.slice(n)}),e.length===0&&e.push({type:"text",content:t}),{parts:e}}function z0(t,e){var l;const r=(e||[]).filter(c=>!c.superseded);if(r.length===0)return"";let n=`# Design Document
723
+
724
+ `;const i=(t||[]).filter(c=>c.role==="human"&&c.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
725
+
726
+ `,n+=i.map(c=>c.content).join(`
727
+
728
+ `),n+=`
729
+
730
+ `);for(const c of r){const u=c.selectedOption||{};n+=`## ${c.question}
731
+
732
+ `,n+=`**Decision:** ${u.title||u.id||"Selected option"}
733
+
734
+ `,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
735
+ `),n+=`
736
+
737
+ `),c.comment&&(n+=`*Note: ${c.comment}*
738
+
739
+ `)}const s=(l=r[r.length-1])==null?void 0:l.timestamp,o=s?(t||[]).filter(c=>c.role==="assistant"&&c.timestamp>s):[],a=[];for(const c of o){if(typeof c.content!="string")continue;const u=c.content.split(`
740
+ `);for(const d of u){const p=d.trim();p.endsWith("?")&&p.length>10&&p.length<200&&a.push(p)}}return n+=`## Open Threads
741
+
742
+ `,a.length>0?(n+=a.map(c=>`- ${c}`).join(`
743
+ `),n+=`
744
+ `):n+=`_No open threads._
745
+ `,n}function SX(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const jo={es:null},Gn=If((t,e)=>({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:null,featureCode:null,designDocPath:null,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[],hydrate:async(r,n)=>{if(!r){const l=e().scope;if(l)r=l,n=e().featureCode||null;else try{const c=JSON.parse(localStorage.getItem("compose:designSession")||"{}");r=c.scope||"product",n=c.featureCode||null}catch{r="product"}}const i=e().docManuallyEdited,s=e().draftDoc,o=e().researchItems||[];t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,designDocPath:null,scope:r,featureCode:n,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]});const a=r==="feature"&&n?`?scope=feature&featureCode=${n}`:`?scope=${r}`;try{const l=await zt(`/api/design/session${a}`),{session:c}=await l.json();if(c){const u=c.messages||[],d=c.decisions||[],p=z0(u,d),f=SX(u,d);t({session:c,messages:u,decisions:d,status:c.status==="complete"?"complete":"active",scope:r,featureCode:n,draftDoc:i?s:p,docManuallyEdited:i,topicOutline:f,researchItems:o}),e().disconnectSSE(),e().connectSSE()}else t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:r,featureCode:n,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]}),e().disconnectSSE()}catch(l){t({error:l.message})}},startSession:async(r="product",n=null)=>{try{const i=await zt("/api/design/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:r,featureCode:n})});if(!i.ok){const{error:o}=await i.json();t({error:o});return}const{session:s}=await i.json();try{localStorage.setItem("compose:designSession",JSON.stringify({scope:r,featureCode:n}))}catch{}t({session:s,messages:s.messages||[],decisions:s.decisions||[],status:"active",error:null,scope:r,featureCode:n}),e().connectSSE()}catch(i){t({error:i.message})}},sendMessage:async r=>{const{session:n,messages:i}=e();if(!n)return;const s=n.scope,o=n.featureCode,a={role:"human",type:"text",content:r,timestamp:new Date().toISOString()};t(l=>({messages:[...l.messages,a],status:"streaming"}));try{const l=await zt("/api/design/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:s,featureCode:o,type:"text",content:r})});l.ok||t({messages:i,status:"active",error:`Failed to send message: ${l.status}`})}catch(l){t({messages:i,status:"active",error:l.message})}},selectCard:async(r,n=null,i=null)=>{const{session:s,messages:o}=e();if(!s)return;const a={role:"human",type:"card_select",content:{cardId:r,comment:n},timestamp:new Date().toISOString()};t(l=>({messages:[...l.messages,a],status:"streaming"}));try{const l=await zt("/api/design/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:s.scope,featureCode:s.featureCode,type:"card_select",cardId:r,comment:n,messageIndex:i})});l.ok||t({messages:o,status:"active",error:`Failed to select card: ${l.status}`})}catch(l){t({messages:o,status:"active",error:l.message})}},reviseDecision:async r=>{const{session:n}=e();if(!n)return;const i=e().decisions[r];if(!(!i||i.superseded))try{const s=await zt("/api/design/revise",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:n.scope,featureCode:n.featureCode,decisionIndex:r})});if(!s.ok){const{error:o}=await s.json().catch(()=>({error:"Revision failed"}));t({error:o});return}e().hydrate(n.scope,n.featureCode)}catch(s){t({error:s.message})}},completeDesign:async()=>{const{session:r,draftDoc:n}=e();if(r){t({status:"summarizing"});try{const i={scope:r.scope,featureCode:r.featureCode};n&&(i.draftDoc=n);const s=await zt("/api/design/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const{error:l}=await s.json().catch(()=>({error:"Unknown error"}));t({error:l,status:"active"});return}const o=await s.json(),a={session:o.session,status:"complete",designDocPath:o.designDocPath||null};o.error&&(a.error=o.error),t(a)}catch(i){t({error:i.message,status:"active"})}}},connectSSE:()=>{if(jo.es)return;const{scope:r,featureCode:n}=e(),i=new URLSearchParams({scope:r||"product"});n&&i.set("featureCode",n);const s=new EventSource(`/api/design/stream?${i}`);jo.es=s,s.addEventListener("ack",()=>{t(o=>o.status!=="streaming"?{status:"streaming"}:{})}),s.addEventListener("text",o=>{const a=JSON.parse(o.data);t(l=>l.streamingMessage?{streamingMessage:{...l.streamingMessage,content:l.streamingMessage.content+a.content}}:{status:"streaming",streamingMessage:{role:"assistant",type:"text",content:a.content,timestamp:new Date().toISOString()}})}),s.addEventListener("decision",o=>{const a=JSON.parse(o.data);t(l=>({status:"streaming",streamingMessage:l.streamingMessage?{...l.streamingMessage,type:"decision",decisionData:a}:{role:"assistant",type:"decision",content:"",decisionData:a,timestamp:new Date().toISOString()}}))}),s.addEventListener("done",()=>{t(o=>({messages:o.streamingMessage?[...o.messages,o.streamingMessage]:o.messages,streamingMessage:null,status:"active"})),e().hydrate()}),s.addEventListener("research",o=>{const a=JSON.parse(o.data);t(l=>({researchItems:[...l.researchItems,{id:a.id,tool:a.tool,input:a.input,timestamp:a.timestamp,summary:null}]}))}),s.addEventListener("research_result",o=>{const a=JSON.parse(o.data);t(l=>{const c=[...l.researchItems],u=a.id?c.findIndex(d=>d.id===a.id):-1;return u!==-1&&(c[u]={...c[u],summary:a.summary}),{researchItems:c}})}),s.addEventListener("error",o=>{try{const a=JSON.parse(o.data);t(l=>({status:"active",streamingMessage:null,error:a.message||"Agent error",messages:l.messages}))}catch{t({status:"active",streamingMessage:null})}}),s.onerror=()=>{t({status:"active"})}},disconnectSSE:()=>{jo.es&&(jo.es.close(),jo.es=null)},reset:()=>{try{localStorage.removeItem("compose:designSession")}catch{}t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:null,featureCode:null,designDocPath:null,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]})},updateDraftDoc:r=>{t({draftDoc:r,docManuallyEdited:!0})},resetDocEdited:()=>{const{messages:r,decisions:n}=e(),i=z0(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function TX(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=Gn(Pi(c=>({draftDoc:c.draftDoc,docManuallyEdited:c.docManuallyEdited,updateDraftDoc:c.updateDraftDoc,resetDocEdited:c.resetDocEdited}))),[i,s]=C.useState(!1),o=!t;let a="empty",l={color:"hsl(var(--muted-foreground))"};return e?(a="edited",l={color:"hsl(var(--primary))"}):o||(a="draft",l={color:"hsl(var(--muted-foreground))"}),h.jsxs("div",{className:"h-full flex flex-col",style:{fontFamily:"inherit"},children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[12px] font-semibold",style:{color:"hsl(var(--foreground))"},children:"Design Document"}),h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{...l,background:"hsl(var(--muted))"},children:a})]}),!o&&h.jsx("button",{onClick:()=>s(c=>!c),className:"text-[11px] px-2 py-1 rounded transition-colors",style:{color:"hsl(var(--muted-foreground))",background:i?"hsl(var(--accent))":"transparent"},onMouseEnter:c=>{c.currentTarget.style.color="hsl(var(--foreground))"},onMouseLeave:c=>{c.currentTarget.style.color="hsl(var(--muted-foreground))"},children:i?"Preview":"Edit"})]}),h.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o?h.jsx("div",{className:"p-4 text-[12px] italic",style:{color:"hsl(var(--muted-foreground))"},children:"Start the design conversation to see the document build here."}):i?h.jsxs("div",{className:"h-full flex flex-col p-2 gap-2",children:[h.jsx("textarea",{className:"flex-1 min-h-0 w-full resize-none rounded p-2 text-[12px]",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",background:"hsl(var(--background))",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",outline:"none"},value:t,onChange:c=>r(c.target.value),spellCheck:!1}),h.jsx("button",{onClick:()=>{n(),s(!1)},className:"shrink-0 text-[11px] px-3 py-1.5 rounded transition-colors self-start",style:{color:"hsl(var(--muted-foreground))",border:"1px solid hsl(var(--border))",background:"transparent"},onMouseEnter:c=>{c.currentTarget.style.color="hsl(var(--foreground))",c.currentTarget.style.borderColor="hsl(var(--foreground))"},onMouseLeave:c=>{c.currentTarget.style.color="hsl(var(--muted-foreground))",c.currentTarget.style.borderColor="hsl(var(--border))"},children:"Reset to auto-generated"})]}):h.jsx("div",{className:"p-4 prose prose-sm max-w-none",style:{color:"hsl(var(--foreground))","--tw-prose-body":"hsl(var(--foreground))","--tw-prose-headings":"hsl(var(--foreground))","--tw-prose-code":"hsl(var(--foreground))","--tw-prose-bold":"hsl(var(--foreground))","--tw-prose-links":"hsl(var(--primary))",fontSize:"12px"},children:h.jsx(Sf,{remarkPlugins:[Nf],children:t})})})]})}const _X=4e3,W0={info:{color:"hsl(var(--foreground))",bg:"hsl(var(--muted))"},warn:{color:"hsl(var(--warning, 32 95% 52%))",bg:"hsl(var(--muted))"},error:{color:"hsl(var(--destructive))",bg:"hsl(var(--destructive) / 0.08)"}};function EX(){const[t,e]=C.useState(null),r=C.useRef(null);if(C.useEffect(()=>{function i(s){const{message:o,level:a="info",ttl:l=_X}=s.detail??{};o&&(clearTimeout(r.current),e({message:o,level:a}),l>0&&(r.current=setTimeout(()=>e(null),l)))}return window.addEventListener("compose:notify",i),()=>{window.removeEventListener("compose:notify",i),clearTimeout(r.current)}},[]),!t)return null;const n=W0[t.level]??W0.info;return h.jsxs("div",{className:"h-6 flex items-center justify-between px-3 gap-2 shrink-0 text-[11px] font-mono",style:{background:n.bg,color:n.color,borderTop:"1px solid hsl(var(--border))"},role:"status","aria-live":"polite",children:[h.jsx("span",{className:"flex-1 min-w-0 truncate",children:t.message}),h.jsx("button",{className:"shrink-0 opacity-60 hover:opacity-100 text-[10px]",onClick:()=>{clearTimeout(r.current),e(null)},"aria-label":"Dismiss notification",children:"✕"})]})}const Bu={build:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(217 91% 60%)"},gate:{background:"hsl(38 92% 50% / 0.12)",borderColor:"hsl(38 92% 50% / 0.3)",color:"hsl(38 92% 50%)"},error:{background:"hsl(0 72% 51% / 0.12)",borderColor:"hsl(0 72% 51% / 0.3)",color:"hsl(0 72% 51%)"},done:{background:"hsl(160 60% 45% / 0.12)",borderColor:"hsl(160 60% 45% / 0.3)",color:"hsl(160 60% 45%)"},iteration:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(210 100% 66%)"}},q0={enter:{transform:"translateX(20px)",opacity:0},steady:{transform:"translateX(0)",opacity:1},flash:{transform:"translateX(0)",opacity:1},exit:{transform:"translateX(0)",opacity:0}};function NX({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?Bu.done:Bu[t])||Bu.build,l=q0[o]||q0.steady,c=o==="exit"?"200ms":o==="flash"?"300ms":"200ms";return h.jsxs("div",{className:"ops-strip-entry",style:{display:"inline-flex",alignItems:"center",gap:"4px",height:"24px",padding:"0 10px",borderRadius:"12px",border:`1px solid ${a.borderColor}`,background:a.background,color:a.color,fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",cursor:n?"pointer":"default",whiteSpace:"nowrap",transition:`transform ${c} ease, opacity ${c} ease, background 300ms ease, border-color 300ms ease, color 300ms ease`,...l},onClick:n,role:"button",tabIndex:0,onKeyDown:u=>{u.key==="Enter"&&n&&n()},children:[h.jsxs("span",{style:{fontSize:"12px",lineHeight:1},children:[t==="build"&&"▶",t==="gate"&&"⚠",t==="error"&&"✕",t==="done"&&"✓",t==="iteration"&&"↻"]}),h.jsx("span",{children:e}),r>0&&h.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:r}),t==="gate"&&i&&h.jsx("button",{className:"ops-strip-approve",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"9px",border:`1px solid ${a.borderColor}`,background:"transparent",color:a.color,fontSize:"11px",cursor:"pointer",padding:0,marginLeft:"2px",lineHeight:1},onClick:u=>{u.stopPropagation(),i()},title:"Approve gate",children:"✓"}),t==="error"&&s&&h.jsx("button",{className:"ops-strip-dismiss",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"9px",border:"none",background:"transparent",color:a.color,fontSize:"10px",cursor:"pointer",padding:0,marginLeft:"2px",opacity:.6,lineHeight:1},onClick:u=>{u.stopPropagation(),s()},title:"Dismiss error",children:"✕"})]})}function jX(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function LX(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function BX(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function AX({activeBuild:t,gates:e,items:r,recentErrors:n,iterationStates:i,now:s=Date.now()}){const o=[];if(t&&t.featureCode){const a=t.currentStep?`${t.currentStep}`:"building",l=t.totalSteps?` · step ${t.currentStepIndex??"?"}/${t.totalSteps}`:"",c=jX(t.cumulative_cost_usd),u=c?` · ${c}`:"",d=t.flowId||t.startedAt||t.featureCode;o.push({key:`build-${t.featureCode}-${d}`,type:t.status==="complete"?"done":"build",label:`${t.featureCode} · ${a}${l}${u}`,featureCode:t.featureCode,retries:t.retries??0})}if(Array.isArray(e)){for(const a of e)if(a.status==="pending"){const l=wn[a.stepId]??(a.fromPhase||a.toPhase||"Gate"),c=Array.isArray(r)?r.find(d=>d.id===a.itemId):null,u=(c==null?void 0:c.title)||a.featureCode||"";o.push({key:`gate-${a.id}`,type:"gate",label:u?`${l} — ${u}`:l,featureCode:a.featureCode||"",gateId:a.id})}}if(i){for(const[a,l]of i)if(l.status==="running"){const c=l.loopType==="review"?"review":"coverage",u=`${l.count}/${l.maxIterations}`;let d="";if(l.wallClockTimeout!=null&&l.startedAt){const p=s-new Date(l.startedAt).getTime();d=`, ${LX(p)}/${BX(l.wallClockTimeout)}`}o.push({key:`iter-${a}`,type:"iteration",label:`${c} ${u}${d}`})}}if(Array.isArray(n))for(const a of n){const l=a.featureCode||"system",c=(a.message||a.errorType||"error").substring(0,60);o.push({key:`error-${a.timestamp}-${c.substring(0,10)}`,type:"error",label:`${l} · ${c}`,featureCode:l,timestamp:a.timestamp})}return o}function MX({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=mr(Pi(O=>({activeBuild:O.activeBuild,gates:O.gates,items:O.items,recentErrors:O.recentErrors,resolveGate:O.resolveGate,iterationStates:O.iterationStates}))),[l,c]=C.useState(new Map),u=C.useRef([]),d=C.useRef(new Set),p=C.useRef(new Set),[f,m]=C.useState(null),x=C.useRef(null),g=(r==null?void 0:r.featureCode)??null;C.useEffect(()=>{if(!g){m(null),x.current=null;return}g!==x.current&&(x.current=g,zt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(O=>O.json()).then(O=>m(O)).catch(()=>{}))},[g]);const y=C.useRef(0);C.useEffect(()=>{if(!g)return;const O=a?[...a.values()].reduce((I,F)=>I+(F.count??0),0):0;O!==y.current&&(y.current=O,zt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(I=>I.json()).then(I=>m(I)).catch(()=>{}))},[a,g]);const b=C.useRef(r),[k,T]=C.useState(null);C.useEffect(()=>{const O=b.current;if(O&&O.featureCode&&!r){T({...O,status:"complete"});const I=setTimeout(()=>T(null),3e3);return b.current=r,()=>clearTimeout(I)}b.current=r},[r]);const _=r||k,[w,E]=C.useState(()=>Date.now()),L=a&&[...a.values()].some(O=>O.status==="running");C.useEffect(()=>{if(!L)return;const O=setInterval(()=>E(Date.now()),1e3);return()=>clearInterval(O)},[L]);const M=C.useMemo(()=>AX({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:w}),[_,n,i,s,a,w]),N=C.useMemo(()=>M.filter(O=>!d.current.has(O.key)),[M]);C.useEffect(()=>{const O=new Set(u.current.map(F=>F.key)),I=N.filter(F=>!O.has(F.key)).map(F=>F.key);I.length>0&&(c(F=>{const D=new Map(F);for(const R of I)D.set(R,"enter");return D}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{c(F=>{const D=new Map(F);for(const R of I)D.get(R)==="enter"&&D.set(R,"steady");return D})})}));for(const F of N)F.type==="done"&&!p.current.has(F.key)&&(p.current.add(F.key),c(D=>{const R=new Map(D);return R.set(F.key,"flash"),R}),setTimeout(()=>{c(D=>{const R=new Map(D);return R.set(F.key,"exit"),R}),setTimeout(()=>{d.current.add(F.key),c(D=>{const R=new Map(D);return R.delete(F.key),R})},500)},2e3));u.current=N},[N]);const P=C.useCallback(O=>{c(I=>{const F=new Map(I);return F.set(O,"exit"),F}),setTimeout(()=>{d.current.add(O),c(I=>{const F=new Map(I);return F.delete(O),F})},200)},[]),$=C.useCallback(O=>{o&&o(O,"approve","Approved from ops strip")},[o]);if(t==="docs"||N.length===0)return null;const q=bX(f);return h.jsxs("div",{className:"ops-strip",style:{height:"36px",display:"flex",alignItems:"center",gap:"6px",padding:"0 12px",overflowX:"auto",overflowY:"hidden",borderTop:"1px solid hsl(var(--border))",background:"hsl(var(--background))",flexShrink:0},children:[N.map(O=>h.jsx(NX,{type:O.type,label:O.label,retries:O.retries,animationState:l.get(O.key)||"steady",onClick:e?()=>e(O.featureCode):void 0,onApprove:O.type==="gate"&&O.gateId?()=>$(O.gateId):void 0,onDismiss:O.type==="error"?()=>P(O.key):void 0},O.key)),q&&h.jsx("span",{className:"ml-auto text-[9px] text-muted-foreground font-mono shrink-0 opacity-70",title:"Cumulative budget usage: review / coverage",children:q})]})}const Au=["dashboard","graph","tree","docs","design","gates","pipeline","sessions","ideabox"];function IX(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function FX(t){return(t==null?void 0:t[0])??null}const PX="compose:mainTabs",t_="compose:activeTab";function DX(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(PX);if(!e)return[...Au];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of Au)if(!n.includes(i)){const s=n.indexOf("docs");s>=0?n=[...n.slice(0,s+1),i,...n.slice(s+1)]:n=[...n,i]}return n}}catch{}return[...Au]}function OX(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(t_);if(r&&IX(t,r))return r}catch{}return FX(t)}function H0(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(t_,t)}catch{}}function e_(t,e){var r;try{const n=(r=globalThis.localStorage)==null?void 0:r.getItem(t);return n==null?e:n!=="false"}catch{return e}}function r_(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const n_="compose:sidebarOpen",i_="compose:contextPanelOpen";function RX(){return e_(n_,!0)}function $X(t){return r_(n_,t)}function zX(){return e_(i_,!1)}function U0(t){return r_(i_,t)}const Qd=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Qd.displayName="Card";const Jd=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("flex flex-col space-y-1.5 p-6",t),...e}));Jd.displayName="CardHeader";const tf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("font-semibold leading-none tracking-tight",t),...e}));tf.displayName="CardTitle";const WX=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("text-sm text-muted-foreground",t),...e}));WX.displayName="CardDescription";const ef=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("p-6 pt-0",t),...e}));ef.displayName="CardContent";const qX=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("flex items-center p-6 pt-0",t),...e}));qX.displayName="CardFooter";function HX(t){const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60);return r<60?`${r}m ${e%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function G0({agent:t,toolCount:e,errorCount:r,currentTool:n,currentCategory:i,onStop:s}){const o=t.status==="running",a=t.status==="killed",l=t.status==="failed"||t.status==="error"||a,c=!o&&!l,u=t.silent,[d,p]=C.useState(()=>{const m=t.startedAt?new Date(t.startedAt).getTime():Date.now();return(t.completedAt?new Date(t.completedAt).getTime():Date.now())-m});C.useEffect(()=>{if(!o)return;const m=t.startedAt?new Date(t.startedAt).getTime():Date.now(),x=()=>p(Date.now()-m);x();const g=setInterval(x,1e3);return()=>clearInterval(g)},[o,t.startedAt]);const f=t.agentType||t.type||t.agent||"agent";return h.jsxs("div",{className:"px-3 py-2 rounded border border-border bg-muted/20",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"text-[11px] text-foreground font-medium truncate",children:f}),h.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[h.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full inline-block",o&&!u&&"bg-green-400",o&&u&&"bg-yellow-400",c&&"bg-emerald-400",l&&"bg-red-400"),style:o&&!u?{animation:"phase-active-pulse 2s ease-in-out infinite"}:void 0}),h.jsx("span",{className:nt("text-[10px]",o&&!u&&"text-green-400",o&&u&&"text-yellow-400",c&&"text-emerald-400",l&&"text-red-400"),children:u?"silent":t.status}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:HX(d)}),o&&s&&h.jsx("button",{onClick:m=>{m.stopPropagation(),s(t.agentId||t.id)},className:"text-[10px] text-muted-foreground hover:text-destructive cursor-pointer ml-0.5",title:"Stop agent",children:"x"})]})]}),h.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:e!=null&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:[e," tools"]}),h.jsx("span",{className:"mx-1",children:"·"}),h.jsxs("span",{className:nt(r>0&&"text-red-400"),children:[r??0," err"]}),o&&n&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"mx-1",children:"·"}),h.jsxs("span",{children:[i||"working"," (",n,")"]})]})]})})]})}function UX(t,e,r){const n=new Array(t);return new Proxy(n,{get(i,s,o){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=57){const l=+s;if(Number.isInteger(l)&&l>=0&&l<t){let c=i[l];if(!c){const u=e[l*2];c=i[l]={index:l,key:r(l),start:u,size:e[l*2+1],end:u+e[l*2+1],lane:0}}return c}}if(s==="length")return t}return Reflect.get(i,s,o)}})}function es(t,e,r){let n=r.initialDeps??[],i,s=!0;function o(){const a=t();return(a.length!==n.length||a.some((c,u)=>n[u]!==c))&&(n=a,i=e(...a),r!=null&&r.onChange&&!(s&&r.skipInitialOnChange)&&r.onChange(i),s=!1),i}return o.updateDeps=a=>{n=a},o}function V0(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const Y0=(t,e)=>Math.abs(t-e)<1.01,GX=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}};let Lo;const X0=()=>{if(Lo!==void 0)return Lo;if(typeof navigator>"u")return Lo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Lo=!0;const t=navigator.maxTouchPoints;return Lo=navigator.platform==="MacIntel"&&t!==void 0&&t>0},K0=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},VX=t=>t,YX=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,i=new Array(n);for(let s=0;s<n;s++)i[s]=e+s;return i},XX=(t,e)=>{const r=t.scrollElement;if(!r)return;const n=t.targetWindow;if(!n)return;const i=o=>{const{width:a,height:l}=o;e({width:Math.round(a),height:Math.round(l)})};if(i(K0(r)),!n.ResizeObserver)return()=>{};const s=new n.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(K0(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},Bc={passive:!0},KX=typeof window>"u"?!0:"onscrollend"in window,ZX=(t,e,r)=>{const n=t.scrollElement;if(!n)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&KX;let o=0;const a=s?null:GX(i,()=>e(o,!1),t.options.isScrollingResetDelay),l=d=>()=>{o=r(n),a==null||a(),e(o,d)},c=l(!0),u=l(!1);return n.addEventListener("scroll",c,Bc),s&&n.addEventListener("scrollend",u,Bc),()=>{n.removeEventListener("scroll",c),s&&n.removeEventListener("scrollend",u)}},QX=(t,e)=>ZX(t,e,r=>{const{horizontal:n,isRtl:i}=t.options;return n?r.scrollLeft*(i&&-1||1):r.scrollTop}),JX=(t,e,r)=>{if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}return t[r.options.horizontal?"offsetWidth":"offsetHeight"]},tK=(t,{adjustments:e=0,behavior:r},n)=>{var i,s;(s=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[n.options.horizontal?"left":"top"]:t+e,behavior:r})},eK=tK;class rK{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,n,i;return((i=(n=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let r=null;const n=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const o=()=>{const a=s.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,u]of this.elementsCache)if(u===a){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(a,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),r=null},observe:i=>{var s;return(s=n())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=n())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=r=>{var n,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:VX,rangeExtractor:YX,onChange:()=>{},measureElement:JX,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const c in r){const u=r[c];u!==void 0&&(s[c]=u)}const o=this.options;let a=null,l=null;if(o!==void 0&&o.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const c=o.count,u=s.count,d=this.getMeasurements(),p=c>0?((n=d[0])==null?void 0:n.key)??o.getItemKey(0):null,f=c>0?((i=d[c-1])==null?void 0:i.key)??o.getItemKey(c-1):null;if(u!==c||c>0&&u>0&&(s.getItemKey(0)!==p||s.getItemKey(u-1)!==f)){const g=c>0?this.getVirtualItemForOffset(this.getScrollOffset())??d[0]:null;g&&(a=[g.key,this.getScrollOffset()-g.start]);const y=s.followOnAppend===!0?"auto":s.followOnAppend||null;y&&u>c&&this.isAtEnd(o.scrollEndThreshold)&&(c===0||s.getItemKey(u-1)!==f)&&(l=y)}}this.options=s,(a||l)&&(this.pendingScrollAnchor=[(a==null?void 0:a[0])??null,(a==null?void 0:a[1])??0,l])},this.notify=r=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,r)},this.maybeNotify=es(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}if(this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!X0()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,Bc),s.addEventListener("touchend",a,Bc),this.unsubs.push(()=>{s.removeEventListener("touchstart",o),s.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,o,a]=i;if(s!==null){const{count:l,getItemKey:c}=this.options;let u=0;for(;u<l&&c(u)!==s;)u++;const d=u<l?this.getMeasurements()[u]:void 0;if(d){const p=d.start+o-this.getScrollOffset();Y0(p,0)||this.applyScrollAdjustment(p)}}a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),n=this.getMaxScrollOffset();if(r<0||r>n)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,n)=>{const i=new Map,s=new Map;for(let o=n-1;o>=0;o--){const a=r[o];if(i.has(a.lane))continue;const l=s.get(a.lane);if(l==null||a.end>l.end?s.set(a.lane,a):a.end<l.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=es(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,n,i,s,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=es(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{const u=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const m of this.laneAssignments.keys())m>=r&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),a===1){const m=this.options.gap,x=r*2;let g=this._flatMeasurements;if(!g||g.length<x){const k=new Float64Array(x);g&&d>0&&k.set(g.subarray(0,d*2)),g=k,this._flatMeasurements=g}let y;if(d===0)y=n+i;else{const k=d-1;y=g[k*2]+g[k*2+1]+m}for(let k=d;k<r;k++){const T=s(k),_=u.get(T),w=typeof _=="number"?_:this.options.estimateSize(k);g[k*2]=y,g[k*2+1]=w,y+=w+m}const b=UX(r,g,s);return this.measurementsCache=b,b}const p=this.measurementsCache.slice(0,d),f=new Array(a).fill(void 0);for(let m=0;m<d;m++){const x=p[m];x&&(f[x.lane]=m)}for(let m=d;m<r;m++){const x=s(m),g=this.laneAssignments.get(m);let y,b;const k=l==="estimate"||u.has(x);if(g!==void 0&&this.options.lanes>1){y=g;const E=f[y],L=E!==void 0?p[E]:void 0;b=L?L.end+this.options.gap:n+i}else{const E=this.options.lanes===1?p[m-1]:this.getFurthestMeasurement(p,m);b=E?E.end+this.options.gap:n+i,y=E?E.lane:m%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(m,y)}const T=u.get(x),_=typeof T=="number"?T:this.options.estimateSize(m),w=b+_;p[m]={index:m,start:b,size:_,end:w,key:x,lane:y},f[y]=m}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=es(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?nK({measurements:r,outerSize:n,scrollOffset:i,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=es(()=>{let r=null,n=null;const i=this.calculateRange();return i&&(r=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,n]},(r,n,i,s,o)=>s===null||o===null?[]:r({startIndex:s,endIndex:o,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const n=this.options.indexAttribute,i=r.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-s),a=Math.min(this.options.count-1,i+s);return r>=o&&r<=a}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const n=this.indexFromElement(r),i=this.options.getItemKey(n),s=this.elementsCache.get(i);s!==r&&(s&&this.observer.unobserve(s),this.observer.observe(r),this.elementsCache.set(i,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,n)=>{var i,s;if(r<0||r>=this.options.count)return;let o,a,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(r),a=c[r*2],o=c[r*2+1];else{const p=this.measurementsCache[r];if(!p)return;l=p.key,a=p.start,o=p.size}const u=this.itemSizeCache.get(l)??o,d=n-u;if(d!==0){const p=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,f=p?this.getTotalSize():0,m=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:l,start:a,size:o,end:a+o,lane:0},d,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||r<this.pendingMin)&&(this.pendingMin=r),this.itemSizeCache.set(l,n),this.itemSizeCacheVersion++,p?this.applyScrollAdjustment(this.getTotalSize()-f):m&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=es(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,n)=>{const i=[];for(let s=0,o=r.length;s<o;s++){const a=r[s],l=n[a];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const n=this.getMeasurements();if(n.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,o=s_(0,n.length-1,s?a=>i[a*2]:a=>V0(n[a]).start,r);return V0(n[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,n,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=r>=o+s?"end":"start"),n==="center"?r+=(i-s)/2:n==="end"&&(r-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,r),0)},this.getOffsetForIndex=(r,n="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),o=this.measurementsCache[r];if(!o)return;if(n==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.scrollToOffset=(r,{align:n="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(r,n),o=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:n="auto",behavior:i="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const s=this.getOffsetForIndex(r,n);if(!s)return;const[o,a]=s,l=this.now();this.scrollState={index:r,align:a,behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:n="auto"}={})=>{const i=this.getScrollOffset()+r,s=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=n.length-1,o=this._flatMeasurements;o!=null?i=o[s*2]+o[s*2+1]:i=((r=n[s])==null?void 0:r.end)??0}else{const s=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&s.some(a=>a===null);){const a=n[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const n=this.getMeasurements();for(const i of n)i&&this.itemSizeCache.has(i.key)&&r.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return r},this._scrollToOffset=(r,{adjustments:n,behavior:i})=>{this._intendedScrollOffset=r+(n??0),this.options.scrollToFn(r,{behavior:i,adjustments:n},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,r){e!==0&&(X0()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,s=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&Y0(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(i-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=i,c||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const s_=(t,e,r,n)=>{for(;t<=e;){const i=(t+e)/2|0,s=r(i);if(s<n)t=i+1;else if(s>n)e=i-1;else return i}return t>0?t-1:0};function nK({measurements:t,outerSize:e,scrollOffset:r,lanes:n,flat:i}){const s=t.length-1,o=i?u=>i[u*2]:u=>t[u].start,a=i?u=>i[u*2]+i[u*2+1]:u=>t[u].end;if(t.length<=n)return{startIndex:0,endIndex:s};let l=s_(0,s,o,r),c=l;if(n===1)for(;c<s&&a(c)<r+e;)c++;else if(n>1){const u=Array(n).fill(0);for(;c<s&&u.some(p=>p<r+e);){const p=t[c];u[p.lane]=p.end,c++}const d=Array(n).fill(r+e);for(;l>=0&&d.some(p=>p>=r);){const p=t[l];d[p.lane]=p.start,l--}l=Math.max(0,l-l%n),c=Math.min(s,c+(n-1-c%n))}return{startIndex:l,endIndex:c}}const Z0=typeof document<"u"?C.useLayoutEffect:C.useEffect;function iK({useFlushSync:t=!0,...e}){const r=C.useReducer(s=>s+1,0)[1],n={...e,onChange:(s,o)=>{var a;t&&o?Df.flushSync(r):r(),(a=e.onChange)==null||a.call(e,s,o)}},[i]=C.useState(()=>new rK(n));return i.setOptions(n),Z0(()=>i._didMount(),[]),Z0(()=>i._willUpdate()),i}function sK(t){return iK({observeElementRect:XX,observeElementOffset:QX,scrollToFn:eK,...t})}function oK(t,e,r){var a,l;const n=[],i=(r==null?void 0:r.id)??null;if(Array.isArray(t))for(const c of t){if(n.push({id:`session-start-${c.id}`,timestamp:c.startedAt,category:"session",title:"Session started",detail:c.source?`Source: ${c.source}`:null,severity:"info",sessionId:c.id,meta:{toolCount:c.toolCount,source:c.source}}),c.endedAt&&n.push({id:`session-end-${c.id}`,timestamp:c.endedAt,category:"session",title:`Session ended (${c.toolCount??0} tools${(a=c.errors)!=null&&a.length?`, ${c.errors.length} error${c.errors.length>1?"s":""}`:""})`,detail:null,severity:"info",sessionId:c.id,meta:{toolCount:c.toolCount,errorCount:((l=c.errors)==null?void 0:l.length)??0}}),Array.isArray(c.errors))for(let u=0;u<c.errors.length;u++){const d=c.errors[u];n.push({id:`error-${c.id}-${u}`,timestamp:d.timestamp||c.startedAt,category:"error",title:d.message||`${d.type} error`,detail:d.tool?`Tool: ${d.tool}`:null,severity:d.severity==="error"?"error":"warning",sessionId:c.id,meta:{type:d.type,tool:d.tool}})}if(c.phaseAtBind&&c.phaseAtEnd&&c.phaseAtBind!==c.phaseAtEnd){const u=new Date(c.startedAt).getTime(),d=c.endedAt?new Date(c.endedAt).getTime():u,p=new Date(u+(d-u)*.8).toISOString();n.push({id:`phase-${c.id}`,timestamp:p,category:"phase",title:`Phase: ${c.phaseAtBind} → ${c.phaseAtEnd}`,detail:null,severity:"success",sessionId:c.id,meta:{from:c.phaseAtBind,to:c.phaseAtEnd}})}}if(Array.isArray(e)){const c=i?e.filter(u=>u.itemId===i):e;for(const u of c){if(u.createdAt){const d=wn[u.stepId]??(u.fromPhase&&u.toPhase?`${Te[u.fromPhase]??u.fromPhase} → ${Te[u.toPhase]??u.toPhase}`:"Gate created");n.push({id:`gate-created-${u.id}`,timestamp:u.createdAt,category:"gate",title:d,detail:null,severity:"info",sessionId:null,meta:{gateId:u.id,fromPhase:u.fromPhase,toPhase:u.toPhase}})}if(u.resolvedAt&&u.outcome){const p={approve:"approve",approved:"approve",revise:"revise",revised:"revise",kill:"kill",killed:"kill"}[u.outcome]||u.outcome,f={approve:"success",revise:"warning",kill:"error"},m={approve:"approved",revise:"revised",kill:"killed"};n.push({id:`gate-resolved-${u.id}`,timestamp:u.resolvedAt,category:"gate",title:`Gate ${m[p]||u.outcome}`,detail:u.comment||null,severity:f[p]||"info",sessionId:null,meta:{gateId:u.id,outcome:u.outcome,comment:u.comment}})}}}const s=new Set,o=[];for(const c of n)s.has(c.id)||(s.add(c.id),o.push(c));return o.sort((c,u)=>c.timestamp.localeCompare(u.timestamp)),o}const aK={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function lK(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"now";if(r<60)return`${r}m`;const n=Math.floor(r/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function cK({event:t,onSelectItem:e,style:r}){const n=aK[t.category]||"●",i=__[t.category]||"text-zinc-400",s=T_[t.severity]||"text-zinc-400";return h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded",style:r,children:[h.jsx("span",{className:nt("text-[11px] shrink-0 w-4 text-center leading-4",i),children:n}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:nt("text-[11px] truncate",s),children:t.title}),t.detail&&h.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.detail})]}),h.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0 leading-4",children:lK(t.timestamp)})]})}const hK=["all","phase","gate","session","iteration","error"],Q0={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function uK({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=C.useState("all"),[s,o]=C.useState([]),a=C.useRef(null),l=mr(m=>m.gates),c=mr(m=>m.featureTimeline),u=mr(m=>m.setFeatureTimeline);C.useEffect(()=>{if(!t)return;let m=!1;return zt(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=50`).then(x=>x.json()).then(x=>{if(m)return;const g=e?(l||[]).filter(b=>b.itemId===e):l||[],y=oK(x.sessions||[],g,{id:e});o(y)}).catch(()=>{m||o([])}),()=>{m=!0}},[t,e]);const d=C.useMemo(()=>{var g,y;const m=new Map;for(const b of s)m.set(b.id,b);for(const b of c){const k=(g=b.meta)==null?void 0:g.itemId,T=(y=b.meta)==null?void 0:y.featureCode;(!k&&!T||k===e||T===t)&&m.set(b.id,b)}const x=[...m.values()];return x.sort((b,k)=>b.timestamp.localeCompare(k.timestamp)),x},[s,c,e,t]),p=C.useMemo(()=>n==="all"?d:d.filter(m=>m.category===n),[d,n]),f=sK({count:p.length,getScrollElement:()=>a.current,estimateSize:()=>48,overscan:5});return C.useEffect(()=>{u&&u([])},[t]),t?h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsx("div",{className:"flex flex-wrap gap-1 px-2 py-2 border-b border-border",children:hK.map(m=>h.jsxs("button",{className:nt("px-2 py-0.5 rounded text-[10px] font-medium transition-colors",n===m?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:()=>i(m),children:[Q0[m],m!=="all"&&h.jsx("span",{className:"ml-1 text-[9px] opacity-60",children:d.filter(x=>x.category===m).length})]},m))}),h.jsx("div",{className:"px-2 py-1",children:h.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[p.length," event",p.length!==1?"s":""]})}),h.jsx("div",{ref:a,className:"flex-1 overflow-auto",children:p.length===0?h.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2 py-4 text-center",children:["No events",n!=="all"?` in "${Q0[n]}"`:"","."]}):h.jsx("div",{style:{height:`${f.getTotalSize()}px`,width:"100%",position:"relative"},children:f.getVirtualItems().map(m=>h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${m.size}px`,transform:`translateY(${m.start}px)`},children:h.jsx(cK,{event:p[m.index],onSelectItem:r})},m.key))})})]}):h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"Select a feature to see its timeline."})})}const Zo=["explore_design","prd","architecture","blueprint","plan","execute","report"];function dK(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function fK({currentPhase:t}){const e=Zo.indexOf(t);return h.jsx("div",{className:"space-y-1.5",children:Zo.map((r,n)=>{const i=e>n,s=e===n,o=Te[r]??r;return h.jsxs("div",{className:"flex items-center gap-2",style:{animation:`phase-slide-in 300ms ease-out ${n*50}ms both`},children:[i?h.jsx(_b,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?h.jsx(wb,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):h.jsx(ZA,{className:"w-3.5 h-3.5 text-muted-foreground/40 shrink-0"}),h.jsx("span",{className:nt("text-[11px] transition-colors duration-500",i&&"text-emerald-400",s&&"text-blue-400 font-medium",!i&&!s&&"text-muted-foreground/50"),children:o})]},r)})})}function pK({spawnedAgents:t,activeBuild:e,sessionState:r,agentActivity:n}){const i=(t||[]).filter(a=>a.status==="running"),s=(t||[]).filter(a=>a.status!=="running").slice(-3).reverse(),o=C.useMemo(()=>{const a=["design.md","blueprint.md","plan.md","prd.md","architecture.md"],l=new Set(((e==null?void 0:e.steps)||[]).filter(c=>c.status==="done"||c.status==="completed").map(c=>c.id||c.name));return a.map(c=>({name:c,done:l.has(c)||((e==null?void 0:e.steps)||[]).some(u=>{var d,p;return(u.status==="done"||u.status==="completed")&&(((d=u.id)==null?void 0:d.includes(c.replace(".md","")))||((p=u.name)==null?void 0:p.includes(c.replace(".md",""))))})}))},[e]);return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents"}),i.length===0&&s.length===0&&h.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-1",children:"No agents active"}),h.jsxs("div",{className:"mt-1 space-y-1.5",children:[i.map((a,l)=>h.jsx(G0,{agent:a,toolCount:(r==null?void 0:r.toolCount)||0,errorCount:(r==null?void 0:r.errorCount)||0,currentTool:n==null?void 0:n.tool,currentCategory:n==null?void 0:n.category},a.agentId||l)),s.map((a,l)=>h.jsx(G0,{agent:a},a.agentId||`r-${l}`))]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Artifacts"}),h.jsx("div",{className:"mt-1 space-y-1",children:o.map(a=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Mi,{className:nt("w-3 h-3",a.done?"text-emerald-400":"text-muted-foreground/40")}),h.jsx("span",{className:nt("text-[11px] font-mono",a.done?"text-foreground":"text-muted-foreground/50"),children:a.name})]},a.name))})]})]})}function mK({gates:t,allGates:e,items:r,onResolveGate:n}){const i=C.useMemo(()=>{const s=new Map,o=(e||[]).filter(a=>a.resolvedAt&&(a.outcome==="revised"||a.outcome==="revise")).sort((a,l)=>new Date(l.resolvedAt)-new Date(a.resolvedAt));for(const a of t||[]){const l=o.find(c=>c.stepId===a.stepId&&c.itemId===a.itemId);l!=null&&l.artifactSnapshot&&a.artifactSnapshot&&s.set(a.id,{priorSnapshot:l.artifactSnapshot,currentSnapshot:a.artifactSnapshot})}return s},[t,e]);return!t||t.length===0?h.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No gates pending."}):h.jsx("div",{className:"space-y-2",children:t.map(s=>{var l;const o=r.find(c=>c.id===s.itemId),a=(l=s.artifactAssessment)==null?void 0:l.completeness;return h.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/30",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-[11px] text-foreground truncate",children:(o==null?void 0:o.title)??"Unknown"}),h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[wn[s.stepId]??Te[s.fromPhase]??s.fromPhase??"Gate",a!=null&&` · ${Math.round(a*100)}% complete`]}),i.has(s.id)&&h.jsx("div",{className:"mt-1",children:h.jsx(Up,{oldText:i.get(s.id).priorSnapshot,newText:i.get(s.id).currentSnapshot})})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(Wt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>n(s.id,"approved"),children:"Approve"}),h.jsx(Wt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",onClick:()=>n(s.id,"revised"),children:"Revise"}),h.jsx(Wt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>n(s.id,"killed"),children:"Kill"})]})]})},s.id)})})}function gK({sessions:t,items:e,onSelect:r}){const n=(t||[]).slice(-5).reverse();return n.length===0?h.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No sessions yet."}):h.jsx("div",{className:"space-y-1",children:n.map(i=>{const s=i.featureCode||i.feature_code,o=s?e.find(l=>{var c;return l.featureCode===s||l.feature_code===s||((c=l.lifecycle)==null?void 0:c.featureCode)===s}):null,a=i.startedAt||i.created_date;return h.jsxs("div",{className:nt("flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 transition-colors",o&&"cursor-pointer"),onClick:()=>o&&r(o.id),children:[h.jsx(HM,{className:"w-3 h-3 text-muted-foreground shrink-0"}),h.jsx("span",{className:"text-[11px] text-foreground",children:i.agent||"agent"}),s&&h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:s}),h.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:dK(a)}),h.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full shrink-0",i.status==="active"?"bg-emerald-400":"bg-slate-600")})]},i.id)})})}function xK({items:t=[],gates:e=[],sessions:r=[],activeBuild:n,spawnedAgents:i=[],featureCode:s,sessionState:o,agentActivity:a,iterationStates:l,onSelect:c,onResolveGate:u,onOpenGate:d}){var T;const p=C.useMemo(()=>t.find(_=>{var w;return _.featureCode===s||((w=_.lifecycle)==null?void 0:w.featureCode)===s}),[t,s]),[f,m]=C.useState(()=>{try{return localStorage.getItem("compose:timeline-open")==="true"}catch{return!1}}),x=C.useCallback(()=>{m(_=>{const w=!_;try{localStorage.setItem("compose:timeline-open",String(w))}catch{}return w})},[]),g=((T=p==null?void 0:p.lifecycle)==null?void 0:T.currentPhase)||(p==null?void 0:p.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,y=Zo.indexOf(g),b=g?Math.max(0,(y+1)/Zo.length):0,k=C.useMemo(()=>{let _=e.filter(w=>w.status==="pending"||!w.resolvedAt);if(s){const w=new Set(t.filter(E=>{var L;return E.featureCode===s||((L=E.lifecycle)==null?void 0:L.featureCode)===s}).map(E=>E.id));_=_.filter(E=>w.has(E.itemId))}return _},[e,t,s]);if(!s){const _=t.filter(w=>w.type==="feature"&&(w.status==="complete"||w.status==="done")).slice(-5);return h.jsx("div",{className:"flex-1 overflow-auto p-4",children:h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No feature in progress."}),h.jsx("p",{className:"text-[11px] text-muted-foreground/70 font-mono",children:"Run /compose <feature-code> in the terminal to start."}),_.length>0&&h.jsxs("div",{className:"mt-6 w-full max-w-sm",children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recently completed"}),h.jsx("div",{className:"mt-2 space-y-1",children:_.map(w=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>c(w.id),children:[h.jsx(_b,{className:"w-3 h-3 text-emerald-400 shrink-0"}),h.jsx("span",{className:"text-[11px] text-foreground truncate",children:w.title}),w.featureCode&&h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:w.featureCode})]},w.id))})]})]})})}return h.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[h.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4 min-w-0",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-sm font-semibold text-foreground truncate",children:(p==null?void 0:p.title)??s}),h.jsx(nr,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),g&&h.jsx(nr,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:Te[g]??g}),h.jsxs("button",{className:nt("ml-auto flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition-colors shrink-0",f?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:x,children:[h.jsx(yM,{className:"w-3 h-3"}),"Timeline"]})]}),h.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-muted overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full bg-blue-500",style:{width:`${Math.round(b*100)}%`,transition:"width 800ms cubic-bezier(0.4, 0, 0.2, 1)"}})}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:y>=0?`${y+1} of ${Zo.length} phases`:"Phase unknown"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs(Qd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[h.jsx(Jd,{className:"p-3 pb-2",children:h.jsx(tf,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),h.jsx(ef,{className:"p-3 pt-0",children:h.jsx(fK,{currentPhase:g})})]}),h.jsxs(Qd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[h.jsx(Jd,{className:"p-3 pb-2",children:h.jsx(tf,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),h.jsx(ef,{className:"p-3 pt-0",children:h.jsx(pK,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),l&&l.size>0&&h.jsx("div",{className:"space-y-2",children:[...l.values()].map(_=>h.jsxs("div",{className:"px-3 py-2.5 rounded border border-blue-500/30 bg-blue-500/10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[h.jsxs("span",{className:"text-[11px] text-blue-400 font-medium",children:[_.status==="running"?"↻":_.outcome==="clean"?"✓":"✗"," ",_.loopType==="review"?"Review Loop":"Coverage Sweep"]}),h.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[_.count," of ",_.maxIterations]})]}),h.jsx("div",{className:"h-1.5 rounded-full bg-blue-500/20 overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.round(_.count/_.maxIterations*100)}%`,transition:"width 600ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:_.outcome==="clean"?"#22c55e":_.outcome==="max_reached"?"#ef4444":"#3b82f6"}})}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:_.status==="running"?_.loopType==="review"?"Waiting for clean review...":"Waiting for tests passing...":_.outcome==="clean"?"Clean!":_.outcome==="max_reached"?"Max iterations reached":"Aborted"})]},_.loopId))}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Pending Gates"}),k.length>0&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:k.length})]}),h.jsx(mK,{gates:k,allGates:e,items:t,onResolveGate:u})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recent Sessions"}),h.jsx("div",{className:"mt-2",children:h.jsx(gK,{sessions:r,items:t,onSelect:c})})]})]}),f&&h.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0",children:[h.jsx("div",{className:"px-3 py-2 border-b border-border",children:h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Event Timeline"})}),h.jsx(uK,{featureCode:s,itemId:p==null?void 0:p.id,onSelectItem:c})]})]})}function yK(t,e){var i,s;if(!((i=t.tags)!=null&&i.length)||!((s=e.tags)!=null&&s.length))return 0;const r=new Set(t.tags);return e.tags.filter(o=>r.has(o)).length/Math.max(t.tags.length,e.tags.length)}function bK(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:yK(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function CK({results:t,onClose:e}){const r=C.useMemo(()=>{const i={P0:0,P1:0,P2:0,killed:0,promoted:0,skipped:0};for(const s of t)s.action==="skip"?i.skipped++:s.action==="kill"?i.killed++:s.action==="promote"?i.promoted++:s.priority==="P0"?i.P0++:s.priority==="P1"?i.P1++:s.priority==="P2"&&i.P2++;return i},[t]),n=t.filter(i=>i.action!=="skip").length;return h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 text-center",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:h.jsx(wi,{className:"w-5 h-5 text-emerald-400"})}),h.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Triage complete"}),h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Triaged ",n," of ",t.length," ideas"]}),h.jsxs("div",{className:"flex gap-3 text-[11px]",children:[r.P0>0&&h.jsxs("span",{className:"text-red-400",children:[r.P0," P0"]}),r.P1>0&&h.jsxs("span",{className:"text-amber-400",children:[r.P1," P1"]}),r.P2>0&&h.jsxs("span",{className:"text-blue-400",children:[r.P2," P2"]}),r.promoted>0&&h.jsxs("span",{className:"text-emerald-400",children:[r.promoted," promoted"]}),r.killed>0&&h.jsxs("span",{className:"text-muted-foreground",children:[r.killed," killed"]}),r.skipped>0&&h.jsxs("span",{className:"text-muted-foreground/60",children:[r.skipped," skipped"]})]}),h.jsx(Wt,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function kK({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=Ds(),[o,a]=C.useState(()=>[...t]),[l,c]=C.useState(0),[u,d]=C.useState([]),[p,f]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[b,k]=C.useState(!1),T=o[l]??null;o.length-l;const _=C.useMemo(()=>T?bK(T,s.filter(P=>P.id!==T.id)):[],[T,s]),w=C.useCallback(()=>{const P=l+1;P>=o.length?f(!0):(c(P),y(!1),x(""))},[l,o.length]),E=C.useCallback(async P=>{if(!(!T||b)){k(!0);try{await r(T.id,P),d($=>[...$,{id:T.id,action:"priority",priority:P}]),w()}finally{k(!1)}}},[T,b,r,w]),L=C.useCallback(async()=>{if(!(!T||b)){k(!0);try{await n(T.id,m),d(P=>[...P,{id:T.id,action:"kill"}]),y(!1),x(""),w()}finally{k(!1)}}},[T,b,n,m,w]),M=C.useCallback(()=>{T&&(d(P=>[...P,{id:T.id,action:"skip"}]),w())},[T,w]),N=C.useCallback(async()=>{if(!(!T||b)){k(!0);try{await i(T.id),d(P=>[...P,{id:T.id,action:"promote"}]),w()}finally{k(!1)}}},[T,b,i,w]);return C.useEffect(()=>{const P=$=>{if($.key==="Escape"){e();return}g||($.key==="0"&&E("P0"),$.key==="1"&&E("P1"),$.key==="2"&&E("P2"),($.key==="s"||$.key==="ArrowRight")&&M(),$.key==="k"&&y(!0))};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[g,E,M,e]),h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"hsl(var(--background) / 0.8)",backdropFilter:"blur(4px)"},children:h.jsxs("div",{className:"w-full max-w-lg mx-4 rounded-xl border border-border bg-card shadow-2xl flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[h.jsx(wi,{className:"w-4 h-4 text-amber-400 shrink-0"}),h.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Triage"}),!p&&h.jsxs("span",{className:"text-[11px] text-muted-foreground ml-1",children:[l+1," of ",o.length," untriaged"]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:h.jsx(hn,{className:"w-4 h-4"})})]}),!p&&h.jsx("div",{className:"h-1 bg-muted",children:h.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${Math.round(l/o.length*100)}%`}})}),h.jsx("div",{className:"flex-1 p-4",children:p?h.jsx(CK,{results:u,onClose:e}):T?h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:T.id}),T.cluster&&h.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:T.cluster})]}),h.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:T.title}),T.description&&h.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:T.description}),h.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(T.tags||[]).map(P=>h.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:P},P))}),T.source&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",T.source]})]}),_.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Similar to:"}),h.jsx("div",{className:"space-y-1",children:_.map(P=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-muted/30 border border-border/40",children:[h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:P.id}),h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:P.title})]},P.id))})]}),g&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing (optional)…",value:m,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&L(),P.key==="Escape"&&y(!1)},className:"w-full text-[12px] bg-muted text-foreground px-3 py-2 rounded border border-border outline-none focus:border-ring"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(Wt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),h.jsx(Wt,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:L,disabled:b,children:"Confirm Kill"})]})]})]}):h.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-8",children:"No more untriaged ideas."})}),!p&&T&&!g&&h.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsxs(Wt,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>E("P0"),disabled:b,title:"Press 0",children:["P0 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),h.jsxs(Wt,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>E("P1"),disabled:b,title:"Press 1",children:["P1 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),h.jsxs(Wt,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>E("P2"),disabled:b,title:"Press 2",children:["P2 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"2"})]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsx(Wt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:N,disabled:b,children:"Promote"}),h.jsxs(Wt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>y(!0),title:"Press k",children:["Kill ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"k"})]}),h.jsxs(Wt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:M,title:"Press s or →",children:[h.jsx(Mb,{className:"w-3 h-3"}),"Skip ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function J0(t){var n;if(!t)return"";const r=(t.cluster||"").toUpperCase().replace(/[^A-Z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,8);if(!r){const i=(((n=t.tags)==null?void 0:n[0])||"").replace("#","").toUpperCase().slice(0,6);return i?`${i}-1`:"FEAT-1"}return`${r}-1`}function vK(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
746
+
747
+ **Date:** ${r}
748
+ **Promoted from:** ${t.id}
749
+ **Priority:** ${t.priority||"TBD"}
750
+ **Tags:** ${n}
751
+
752
+ ## Context
753
+
754
+ ${t.description||t.title}
755
+
756
+ ## Source
757
+
758
+ ${t.source||"Internal idea"}
759
+
760
+ ## Goals
761
+
762
+ - [ ] Define acceptance criteria
763
+ - [ ] Identify affected components
764
+ - [ ] Estimate effort
765
+
766
+ ## Related
767
+
768
+ ${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
769
+ `.trimStart()}function wK({step:t,current:e}){const r=e>t,n=e===t;return h.jsx("div",{className:"flex items-center gap-1.5",children:h.jsx("div",{className:nt("w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-semibold border transition-colors",r?"bg-emerald-400/20 border-emerald-400/60 text-emerald-400":n?"bg-accent/20 border-accent/60 text-accent":"bg-muted border-border/40 text-muted-foreground/40"),children:r?h.jsx(ba,{className:"w-3 h-3"}):t})})}function SK({idea:t,onClose:e}){var _;const{promoteIdea:r}=Ds(),[n,i]=C.useState(1),[s,o]=C.useState(()=>J0(t)),[a,l]=C.useState(""),[c,u]=C.useState(""),[d,p]=C.useState(!1),[f,m]=C.useState(null),x=C.useRef(null);C.useEffect(()=>{u(vK(t,s||"FEAT-?"))},[t,s]),C.useEffect(()=>{n===1&&setTimeout(()=>{var w;return(w=x.current)==null?void 0:w.focus()},50)},[n]);const g=()=>s.trim()?/^[A-Z0-9][A-Z0-9-]*[A-Z0-9]$/i.test(s.trim())?(l(""),!0):(l("Use format like FEAT-1 or COMP-UI-5"),!1):(l("Feature code is required"),!1),y=()=>{n===1&&!g()||i(w=>w+1)},b=()=>i(w=>w-1),k=async()=>{if(!d){p(!0);try{await r(t.id,s.trim().toUpperCase()),m({featureCode:s.trim().toUpperCase()}),i(4)}catch(w){l(w.message||"Failed to promote"),i(1)}finally{p(!1)}}},T=["Feature ID","Preview","Confirm"];return h.jsx(Xp,{open:!0,onOpenChange:w=>!w&&e(),children:h.jsxs(dh,{className:"max-w-lg",children:[h.jsx(fh,{children:h.jsxs(ph,{className:"flex items-center gap-2",children:[h.jsx(wi,{className:"w-4 h-4 text-amber-400"}),"Promote to Feature"]})}),n<4&&h.jsx("div",{className:"px-6 -mt-1 mb-1",children:h.jsx("div",{className:"flex items-center gap-2",children:[1,2,3].map((w,E)=>h.jsxs(Yt.Fragment,{children:[h.jsx(wK,{step:w,current:n}),h.jsx("span",{className:nt("text-[10px] transition-colors",n===w?"text-foreground font-medium":"text-muted-foreground/60"),children:T[E]}),E<2&&h.jsx(Is,{className:"w-3 h-3 text-muted-foreground/30 mx-0.5"})]},w))})}),h.jsxs("div",{className:"px-6 pb-2",children:[n<4&&h.jsxs("div",{className:"mb-4 px-3 py-2 rounded border border-border/50 bg-muted/20",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:t.id}),t.priority&&t.priority!=="—"&&h.jsx("span",{className:nt("text-[9px] px-1 py-0.5 rounded font-mono font-semibold",t.priority==="P0"?"text-red-400":t.priority==="P1"?"text-amber-400":"text-blue-400"),children:t.priority})]}),h.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug",children:t.title})]}),n===1&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Feature Code"}),h.jsx("input",{ref:x,type:"text",value:s,onChange:w=>{o(w.target.value.toUpperCase()),l("")},onKeyDown:w=>{w.key==="Enter"&&y()},placeholder:"e.g. COMP-UI-5",className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring font-mono"}),a&&h.jsx("p",{className:"text-[11px] text-destructive mt-1",children:a})]}),t.cluster&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Suggested from cluster: ",h.jsx("span",{className:"text-muted-foreground",children:t.cluster})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Suggestions"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:[J0(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((w,E,L)=>L.indexOf(w)===E).map(w=>h.jsx("button",{onClick:()=>{o(w),l("")},className:nt("text-[10px] px-2 py-1 rounded border font-mono transition-colors",s===w?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:w},w))})]})]}),n===2&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Generated plan.md stub"}),h.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground bg-muted/40 border border-border/40 rounded p-3 overflow-auto max-h-48 whitespace-pre-wrap leading-relaxed",children:c}),h.jsx("p",{className:"text-[10px] text-muted-foreground/60",children:"This stub will be created when you run the promote workflow from the CLI."})]}),n===3&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Promote ",h.jsx("span",{className:"text-foreground font-medium",children:t.id})," to feature"," ",h.jsx("span",{className:"font-mono text-accent font-semibold",children:s}),"?"]}),h.jsxs("p",{className:"text-[11px] text-muted-foreground/70",children:["The idea will be marked ",h.jsxs("span",{className:"font-mono",children:["PROMOTED (",s,")"]})," in the ideabox."]})]}),n===4&&f&&h.jsxs("div",{className:"flex flex-col items-center gap-3 py-4 text-center",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:h.jsx(ba,{className:"w-5 h-5 text-emerald-400"})}),h.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Promoted!"}),h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t.id," is now linked to feature"," ",h.jsx("span",{className:"font-mono text-accent font-semibold",children:f.featureCode})]}),h.jsx(Wt,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&h.jsxs(Kp,{children:[n>1&&h.jsxs(Wt,{variant:"ghost",size:"sm",onClick:b,disabled:d,children:[h.jsx(Sb,{className:"w-3 h-3 mr-1"}),"Back"]}),h.jsx(Wt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?h.jsxs(Wt,{size:"sm",onClick:y,children:["Next",h.jsx(Is,{className:"w-3 h-3 ml-1"})]}):h.jsx(Wt,{size:"sm",onClick:k,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const rf=["S","M","L"],TK=["high","medium","low"],_K={"high-S":"Quick Wins","high-M":"Quick Wins","high-L":"Big Bets","medium-S":"Fill-ins","medium-M":"Fill-ins","medium-L":"Money Pits","low-S":"Fill-ins","low-M":"Fill-ins","low-L":"Money Pits"},ty={"Quick Wins":"bg-emerald-400/8 border-emerald-400/20","Big Bets":"bg-blue-400/8 border-blue-400/20","Fill-ins":"bg-amber-400/8 border-amber-400/20","Money Pits":"bg-red-400/8 border-red-400/20"},ey=["bg-blue-400","bg-violet-400","bg-emerald-400","bg-amber-400","bg-rose-400","bg-cyan-400","bg-orange-400","bg-pink-400"];function EK({idea:t,onSubmit:e,onCancel:r}){const[n,i]=C.useState(t.effort||""),[s,o]=C.useState(t.impact||"");return h.jsxs("div",{className:"p-2 bg-card border border-border rounded-lg shadow-md w-52",children:[h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-2 truncate font-medium",children:[t.id,": ",t.title]}),h.jsxs("div",{className:"mb-2",children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Effort"}),h.jsx("div",{className:"flex gap-1",children:rf.map(a=>h.jsx("button",{onClick:()=>i(a),className:nt("flex-1 text-[10px] py-0.5 rounded border transition-colors",n===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),h.jsxs("div",{className:"mb-2.5",children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Impact"}),h.jsx("div",{className:"flex gap-1",children:["high","medium","low"].map(a=>h.jsx("button",{onClick:()=>o(a),className:nt("flex-1 text-[9px] py-0.5 rounded border transition-colors capitalize",s===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),h.jsxs("div",{className:"flex gap-1",children:[h.jsx("button",{onClick:r,className:"flex-1 text-[10px] py-1 rounded border border-border/40 text-muted-foreground hover:border-border transition-colors",children:"Cancel"}),h.jsx("button",{onClick:()=>n&&s&&e(t.id,{effort:n,impact:s}),disabled:!n||!s,className:"flex-1 text-[10px] py-1 rounded border border-primary/50 bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-40 transition-colors",children:"Save"})]})]})}function NK({ideas:t,selectedIdeaId:e,onSelectIdea:r,onUpdateIdea:n}){const[i,s]=C.useState(null),o=C.useMemo(()=>{const u=[...new Set(t.map(p=>p.cluster||"__none__"))],d={};return u.forEach((p,f)=>{d[p]=ey[f%ey.length]}),d},[t]),a=C.useMemo(()=>t.filter(u=>u.effort&&u.impact),[t]),l=C.useMemo(()=>t.filter(u=>!u.effort||!u.impact),[t]),c=C.useCallback(async(u,d)=>{await n(u,d),s(null)},[n]);return h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{children:[h.jsx("div",{className:"flex mb-1 ml-12",children:rf.map(u=>h.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),TK.map(u=>h.jsxs("div",{className:"flex mb-1",children:[h.jsx("div",{className:"w-12 shrink-0 flex items-center justify-end pr-2",children:h.jsx("span",{className:"text-[9px] text-muted-foreground capitalize",children:u})}),rf.map(d=>{const p=`${u}-${d}`,f=_K[p],m=a.filter(x=>x.impact===u&&x.effort===d);return h.jsxs("div",{className:nt("flex-1 min-h-[90px] rounded border p-1.5 mr-1 relative transition-colors",ty[f]||"border-border/30"),children:[h.jsx("span",{className:"absolute top-1 right-1 text-[8px] text-muted-foreground/50 italic",children:f}),h.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:m.map(x=>{const g=o[x.cluster||"__none__"]||"bg-muted-foreground",y=x.id===e;return h.jsx("button",{onClick:()=>r==null?void 0:r(x.id),title:`${x.id}: ${x.title}`,className:nt("w-5 h-5 rounded-full border-2 transition-all hover:scale-110 flex items-center justify-center",g,y?"border-foreground ring-1 ring-foreground":"border-transparent")},x.id)})})]},d)})]},u)),h.jsx("div",{className:"flex ml-12",children:h.jsx("div",{className:"flex-1 text-center text-[9px] text-muted-foreground/60 mt-0.5",children:"Effort (S = small, M = medium, L = large)"})})]}),h.jsx("div",{className:"flex flex-wrap gap-3 text-[10px]",children:Object.entries(ty).map(([u,d])=>h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:nt("w-2.5 h-2.5 rounded-sm border",d)}),h.jsx("span",{className:"text-muted-foreground",children:u})]},u))}),l.length>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-2",children:["Unassigned (",l.length,") — click to assign effort/impact"]}),h.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(u=>h.jsxs("div",{className:"relative",children:[h.jsxs("button",{onClick:()=>s((i==null?void 0:i.id)===u.id?null:u),className:nt("text-[10px] px-2 py-1 rounded border transition-colors",(i==null?void 0:i.id)===u.id?"border-accent bg-accent/10 text-foreground":"border-border/50 text-muted-foreground hover:border-border hover:text-foreground"),children:[h.jsx("span",{className:"font-mono text-[9px] mr-1 opacity-60",children:u.id}),u.title.slice(0,30),u.title.length>30?"…":""]}),(i==null?void 0:i.id)===u.id&&h.jsx("div",{className:"absolute left-0 top-full mt-1 z-10",children:h.jsx(EK,{idea:u,onSubmit:c,onCancel:()=>s(null)})})]},u.id))})]})]})}function Mu({value:t,max:e,color:r="bg-primary/60"}){const n=e>0?Math.round(t/e*100):0;return h.jsx("div",{className:"flex-1 h-1.5 bg-muted/50 rounded-full overflow-hidden",children:h.jsx("div",{className:nt("h-full rounded-full transition-all",r),style:{width:`${n}%`}})})}function jK({ideas:t,killed:e}){const[r,n]=C.useState(!1),i=C.useMemo(()=>{var b,k,T,_;const s=[...t,...e||[]],o={};for(const w of s){const E=((b=w.source)==null?void 0:b.trim())||"(no source)",L=E.length>30?E.slice(0,30)+"…":E;o[L]=(o[L]||0)+1}const a=Object.entries(o).sort((w,E)=>E[1]-w[1]).slice(0,6),l=((k=a[0])==null?void 0:k[1])||1,c=s.filter(w=>w.status==="NEW").length,u=s.filter(w=>w.status==="DISCUSSING").length,d=s.filter(w=>{var E;return(E=w.status)==null?void 0:E.startsWith("PROMOTED")}).length,p=(e||[]).length,f=t.length,m=s.length>0?Math.round(p/s.length*100):0,x={};for(const w of s){const E=w.cluster||"(unclustered)";x[E]||(x[E]={total:0,promoted:0}),x[E].total+=1,(T=w.status)!=null&&T.startsWith("PROMOTED")&&(x[E].promoted+=1)}const g=Object.entries(x).sort((w,E)=>E[1].total-w[1].total).slice(0,5),y=((_=g[0])==null?void 0:_[1].total)||1;return{sourceEntries:a,maxSourceCount:l,newCount:c,discussingCount:u,promotedCount:d,killedCount:p,killRate:m,totalActive:f,clusterEntries:g,maxClusterTotal:y}},[t,e]);return t.length===0&&(!e||e.length===0)?null:h.jsxs("div",{className:"mt-1.5",children:[h.jsxs("button",{onClick:()=>n(s=>!s),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/70 hover:text-muted-foreground transition-colors",children:[r?h.jsx(Ca,{className:"w-3 h-3"}):h.jsx(Is,{className:"w-3 h-3"}),h.jsx(RA,{className:"w-3 h-3"}),h.jsx("span",{children:"Analytics"})]}),r&&h.jsxs("div",{className:"mt-2 space-y-3 border border-border/30 rounded-lg p-3 bg-muted/10",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Status Funnel"}),h.jsx("div",{className:"space-y-1",children:[{label:"NEW",count:i.newCount,color:"bg-emerald-400/60"},{label:"DISCUSSING",count:i.discussingCount,color:"bg-amber-400/60"},{label:"PROMOTED",count:i.promotedCount,color:"bg-blue-400/60"},{label:"KILLED",count:i.killedCount,color:"bg-muted-foreground/40"}].map(({label:s,count:o,color:a})=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-16 text-[9px] text-muted-foreground shrink-0",children:s}),h.jsx(Mu,{value:o,max:Math.max(i.newCount,i.discussingCount,i.promotedCount,i.killedCount,1),color:a}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))}),i.killRate>0&&h.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-1",children:["Kill rate: ",i.killRate,"%"]})]}),i.sourceEntries.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"By Source"}),h.jsx("div",{className:"space-y-1",children:i.sourceEntries.map(([s,o])=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),h.jsx(Mu,{value:o,max:i.maxSourceCount,color:"bg-violet-400/50"}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))})]}),i.clusterEntries.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Cluster Health"}),h.jsx("div",{className:"space-y-1",children:i.clusterEntries.map(([s,{total:o,promoted:a}])=>{const l=o>0?Math.round(a/o*100):0;return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),h.jsx(Mu,{value:o,max:i.maxClusterTotal,color:"bg-cyan-400/50"}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o}),l>0&&h.jsxs("span",{className:"text-[9px] text-blue-400 shrink-0",children:[l,"%"]})]},s)})})]})]})]})}const LK=[{key:"—",label:"Untriaged",color:"text-muted-foreground",bg:"bg-muted/20",border:"border-border/50"},{key:"P0",label:"P0",color:"text-red-400",bg:"bg-red-400/10",border:"border-red-400/30"},{key:"P1",label:"P1",color:"text-amber-400",bg:"bg-amber-400/10",border:"border-amber-400/30"},{key:"P2",label:"P2",color:"text-blue-400",bg:"bg-blue-400/10",border:"border-blue-400/30"}];function ry(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function o_({status:t}){const e=t==="NEW"?"bg-emerald-400":t==="DISCUSSING"?"bg-amber-400":t!=null&&t.startsWith("PROMOTED")?"bg-blue-400":"bg-muted-foreground/40";return h.jsx("span",{className:nt("inline-block w-2 h-2 rounded-full shrink-0",e),title:t})}function BK({priority:t}){if(!t||t==="—")return h.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded border border-border/40 text-muted-foreground/60",children:"untriaged"});const e={P0:"bg-red-400/15 text-red-400 border-red-400/30",P1:"bg-amber-400/15 text-amber-400 border-amber-400/30",P2:"bg-blue-400/15 text-blue-400 border-blue-400/30"};return h.jsx("span",{className:nt("text-[9px] px-1.5 py-0.5 rounded border font-mono font-semibold",e[t]||"border-border/40 text-muted-foreground"),children:t})}function AK({idea:t,selected:e,onClick:r,onDragStart:n,onDragEnd:i}){var s;return h.jsxs("div",{draggable:!0,onDragStart:o=>n==null?void 0:n(o,t.id),onDragEnd:i,onClick:()=>r==null?void 0:r(t.id),className:nt("group px-3 py-2.5 rounded border cursor-pointer transition-colors select-none","hover:border-accent/50",e?"border-accent/60 bg-accent/5":"border-border/50 bg-card/60"),children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),h.jsx(o_,{status:t.status}),h.jsx("div",{className:"flex-1"}),h.jsx(BK,{priority:t.priority})]}),h.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug mb-1 line-clamp-2",children:t.title}),((s=t.tags)==null?void 0:s.length)>0&&h.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[t.tags.slice(0,4).map(o=>h.jsx("span",{className:"text-[9px] text-muted-foreground/70 font-mono",children:o},o)),t.tags.length>4&&h.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["+",t.tags.length-4]})]}),t.source&&h.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.source})]})}function MK({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,b,k,T;const[o,a]=C.useState(""),[l,c]=C.useState(!1),[u,d]=C.useState(!1),[p,f]=C.useState(""),[m,x]=C.useState(!1);if(!t)return null;const g=async()=>{const _=p.trim();if(_){x(!0);try{await s(t.id,"human",_),f("")}finally{x(!1)}}};return h.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0 overflow-hidden",children:[h.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),h.jsx(o_,{status:t.status}),h.jsx("span",{className:"text-[11px] text-muted-foreground flex-1 truncate",children:t.status}),h.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground text-xs px-1",children:"x"})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Title"}),h.jsx("p",{className:"text-[13px] text-foreground font-medium leading-snug",children:t.title})]}),t.description&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),h.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:t.description})]}),t.source&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Source"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.source})]}),t.cluster&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Cluster"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.cluster})]}),((y=t.tags)==null?void 0:y.length)>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Tags"}),h.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(_=>h.jsx("span",{className:"text-[10px] bg-muted/50 px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:_},_))})]}),t.mapsTo&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Maps To"}),h.jsx("p",{className:"text-[11px] text-muted-foreground font-mono",children:t.mapsTo})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5 flex items-center gap-1",children:[h.jsx(Oc,{className:"w-3 h-3"}),"Discussion",((b=t.discussion)==null?void 0:b.length)>0&&h.jsxs("span",{className:"text-muted-foreground/50",children:["(",t.discussion.length,")"]})]}),((k=t.discussion)==null?void 0:k.length)>0&&h.jsx("div",{className:"space-y-1.5 mb-2",children:t.discussion.map((_,w)=>h.jsxs("div",{className:"px-2 py-1.5 rounded bg-muted/30 border border-border/30",children:[h.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[h.jsx("span",{className:nt("text-[9px] font-mono font-semibold",_.author==="agent"?"text-blue-400":"text-emerald-400"),children:_.author}),h.jsx("span",{className:"text-[9px] text-muted-foreground/50",children:_.date})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground leading-relaxed",children:_.text})]},w))}),h.jsxs("div",{className:"flex gap-1.5 items-end",children:[h.jsx("input",{type:"text",placeholder:"Add comment…",value:p,onChange:_=>f(_.target.value),onKeyDown:_=>_.key==="Enter"&&!_.shiftKey&&g(),className:"flex-1 text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring",disabled:m}),h.jsx("button",{onClick:g,disabled:!p.trim()||m,className:"shrink-0 p-1.5 rounded border border-border/50 text-muted-foreground hover:text-foreground disabled:opacity-40 transition-colors",children:h.jsx(Af,{className:"w-3 h-3"})})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Priority"}),h.jsx("div",{className:"flex gap-1.5",children:["P0","P1","P2","—"].map(_=>h.jsx("button",{onClick:()=>i(t.id,_),className:nt("flex-1 text-[10px] px-1.5 py-1 rounded border transition-colors",t.priority===_?_==="P0"?"bg-red-400/20 text-red-400 border-red-400/50":_==="P1"?"bg-amber-400/20 text-amber-400 border-amber-400/50":_==="P2"?"bg-blue-400/20 text-blue-400 border-blue-400/50":"bg-muted text-muted-foreground border-border":"border-border/40 text-muted-foreground hover:border-border"),children:_==="—"?"none":_},_))})]})]}),!((T=t.status)!=null&&T.startsWith("PROMOTED"))&&t.status!=="KILLED"&&h.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[h.jsx(Wt,{size:"sm",className:"w-full h-7 text-[11px]",onClick:()=>r(t),children:"Promote to Feature"}),l?h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing…",value:o,onChange:_=>a(_.target.value),className:"w-full text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsx(Wt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{c(!1),a("")},children:"Cancel"}),h.jsx(Wt,{size:"sm",className:"flex-1 h-7 text-[10px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:()=>{n(t.id,o),c(!1),a("")},children:"Confirm Kill"})]})]}):h.jsx(Wt,{size:"sm",variant:"outline",className:"w-full h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>c(!0),children:"Kill"})]})]})}function IK({killed:t,onResurrect:e}){const[r,n]=C.useState(!1);return t.length===0?null:h.jsxs("div",{className:"mt-4 border border-border/40 rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>n(i=>!i),className:"w-full flex items-center gap-2 px-4 py-2.5 bg-muted/30 hover:bg-muted/50 transition-colors text-left",children:[r?h.jsx(Ca,{className:"w-3 h-3 text-muted-foreground"}):h.jsx(Is,{className:"w-3 h-3 text-muted-foreground"}),h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Graveyard"}),h.jsxs("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:["(",t.length,")"]})]}),r&&h.jsx("div",{className:"p-3 grid grid-cols-1 gap-2 bg-muted/10",children:t.map(i=>h.jsx("div",{className:"px-3 py-2 rounded border border-border/40 bg-card/40",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[h.jsx(nr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0 opacity-60",children:i.id}),h.jsx("p",{className:"text-[11px] text-muted-foreground/70 line-clamp-1 font-medium",children:i.title})]}),i.killedDate&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Killed ",i.killedDate,i.killedReason?` — ${i.killedReason}`:""]})]}),h.jsx("button",{onClick:()=>e(i.id),className:"shrink-0 text-[10px] text-muted-foreground/60 hover:text-foreground border border-border/40 px-1.5 py-0.5 rounded transition-colors",title:"Resurrect",children:"Resurrect"})]})},i.id))})]})}function FK(){const{ideas:t,killed:e,loading:r,error:n,selectedIdeaId:i,filters:s,hydrate:o,setPriority:a,killIdea:l,resurrectIdea:c,setSelectedIdea:u,updateFilters:d,addDiscussion:p,updateIdea:f}=Ds(),[m,x]=C.useState(!1),[g,y]=C.useState(null),[b,k]=C.useState(null),[T,_]=C.useState(null),[w,E]=C.useState("cards"),L=C.useMemo(()=>{var Q;const D=t.filter(A=>A.status==="NEW").length,R=t.filter(A=>!A.priority||A.priority==="—").length,j=t.filter(A=>A.priority==="P0").length,S={};t.filter(A=>A.priority==="P0"&&A.cluster).forEach(A=>{S[A.cluster]=(S[A.cluster]||0)+1});const U=((Q=Object.entries(S).sort((A,rt)=>rt[1]-A[1])[0])==null?void 0:Q[0])??null;return{newCount:D,untriaged:R,p0Count:j,topCluster:U}},[t]),M=C.useMemo(()=>{const D=new Set;return t.forEach(R=>(R.tags||[]).forEach(j=>D.add(j))),[...D].sort()},[t]),N=C.useMemo(()=>t.filter(D=>{var R;if(s.tag&&!((R=D.tags)!=null&&R.includes(s.tag))||s.status&&(D.status||"").split(/\s+/)[0]!==s.status||s.priority&&D.priority!==s.priority)return!1;if(s.search){const j=s.search.toLowerCase();if(!`${D.title} ${D.description} ${D.id} ${(D.tags||[]).join(" ")}`.toLowerCase().includes(j))return!1}return!0}),[t,s]),P=C.useMemo(()=>{const D=new Map,R=[];N.forEach(U=>{U.cluster?(D.has(U.cluster)||D.set(U.cluster,[]),D.get(U.cluster).push(U)):R.push(U)});const j=U=>[...U].sort((Q,A)=>ry(Q.priority)-ry(A.priority)),S=[];for(const[U,Q]of D)S.push({cluster:U,ideas:j(Q)});return R.length>0&&S.push({cluster:null,ideas:j(R)}),S},[N]),$=C.useMemo(()=>t.find(D=>D.id===i)||e.find(D=>D.id===i)||null,[t,e,i]),q=C.useCallback((D,R)=>{k(R),D.dataTransfer.effectAllowed="move"},[]),O=C.useCallback(()=>{k(null),_(null)},[]),I=C.useCallback((D,R)=>{D.preventDefault(),D.dataTransfer.dropEffect="move",_(R)},[]),F=C.useCallback(async(D,R)=>{D.preventDefault(),b&&await a(b,R),k(null),_(null)},[b,a]);return h.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[h.jsxs("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx(wi,{className:"w-4 h-4 text-amber-400 shrink-0"}),h.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Ideabox"}),r&&h.jsx(zl,{className:"w-3 h-3 text-muted-foreground animate-spin"}),h.jsx("div",{className:"flex-1"}),h.jsxs("div",{className:"flex items-center gap-0.5 border border-border/50 rounded-md p-0.5",children:[h.jsx("button",{onClick:()=>E("cards"),className:nt("text-[10px] px-2 py-0.5 rounded transition-colors",w==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Cards"}),h.jsx("button",{onClick:()=>E("matrix"),className:nt("text-[10px] px-2 py-0.5 rounded transition-colors",w==="matrix"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Matrix"})]}),h.jsx("button",{onClick:()=>o(),className:"text-[10px] text-muted-foreground/60 hover:text-muted-foreground transition-colors",title:"Refresh",children:h.jsx(zl,{className:"w-3 h-3"})}),h.jsxs(Wt,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:L.untriaged===0,children:["Triage (",L.untriaged,")"]})]}),h.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[L.newCount>0&&h.jsxs("span",{className:"text-emerald-400",children:[L.newCount," new"]}),h.jsxs("span",{children:[L.untriaged," untriaged"]}),L.p0Count>0&&h.jsxs("span",{className:"text-red-400",children:[L.p0Count," P0"]}),L.topCluster&&h.jsxs("span",{children:["top cluster: ",h.jsx("span",{className:"text-foreground",children:L.topCluster})]}),h.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),h.jsx(jK,{ideas:t,killed:e})]}),h.jsxs("div",{className:"px-4 py-2 border-b border-border shrink-0 flex items-center gap-2 flex-wrap",children:[h.jsx(oM,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsxs("select",{value:s.tag,onChange:D=>d({tag:D.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All tags"}),M.map(D=>h.jsx("option",{value:D,children:D},D))]}),h.jsxs("select",{value:s.status,onChange:D=>d({status:D.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All statuses"}),h.jsx("option",{value:"NEW",children:"New"}),h.jsx("option",{value:"DISCUSSING",children:"Discussing"}),h.jsx("option",{value:"PROMOTED",children:"Promoted"})]}),h.jsxs("select",{value:s.priority,onChange:D=>d({priority:D.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All priorities"}),h.jsx("option",{value:"P0",children:"P0"}),h.jsx("option",{value:"P1",children:"P1"}),h.jsx("option",{value:"P2",children:"P2"}),h.jsx("option",{value:"—",children:"Untriaged"})]}),h.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[120px]",children:[h.jsx(ei,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:D=>d({search:D.target.value}),className:"flex-1 text-[11px] bg-transparent text-foreground outline-none placeholder:text-muted-foreground/40 min-w-0"})]}),(s.tag||s.status||s.priority||s.search)&&h.jsx("button",{onClick:()=>Ds.getState().clearFilters(),className:"text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors",children:"Clear"})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&h.jsx("div",{className:"mb-4 px-3 py-2 rounded border border-destructive/30 bg-destructive/10",children:h.jsx("p",{className:"text-[11px] text-destructive",children:n})}),w==="matrix"&&h.jsx(NK,{ideas:N,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:f}),w==="cards"&&N.length===0&&!r&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-2",children:[h.jsx(wi,{className:"w-8 h-8 text-muted-foreground/30"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"No ideas yet."}),h.jsxs("p",{className:"text-[11px] text-muted-foreground/60",children:["Use the CLI: ",h.jsx("span",{className:"font-mono",children:'compose idea "Your idea title"'})]})]}),w==="cards"&&P.map(({cluster:D,ideas:R})=>h.jsxs("div",{className:"mb-6",children:[D&&h.jsxs("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold mb-3 flex items-center gap-2",children:[h.jsx("span",{children:D}),h.jsxs("span",{className:"text-muted-foreground/40 normal-case tracking-normal font-normal",children:["(",R.length,")"]})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3",children:LK.map(j=>{const S=R.filter(Q=>Q.priority===j.key),U=T===j.key&&b;return h.jsxs("div",{className:nt("rounded-lg border p-2 min-h-[80px] transition-colors",j.bg,j.border,U&&"ring-1 ring-accent"),onDragOver:Q=>I(Q,j.key),onDrop:Q=>F(Q,j.key),children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[h.jsx("span",{className:nt("text-[10px] font-semibold uppercase tracking-wider",j.color),children:j.label}),h.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["(",S.length,")"]})]}),h.jsxs("div",{className:"space-y-1.5",children:[S.map(Q=>h.jsx(AK,{idea:Q,selected:i===Q.id,onClick:u,onDragStart:q,onDragEnd:O},Q.id)),S.length===0&&h.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},j.key)})})]},D||"__unclustered__")),w==="cards"&&h.jsx(IK,{killed:e,onResurrect:c})]})]}),$&&h.jsx(MK,{idea:$,onClose:()=>u(null),onPromote:D=>y(D),onKill:l,onSetPriority:a,onAddDiscussion:p}),m&&h.jsx(kK,{ideas:t.filter(D=>!D.priority||D.priority==="—"),onClose:()=>x(!1)}),g&&h.jsx(SK,{idea:g,onClose:()=>y(null)})]})}const PK=["A","B","C","D","E","F","G","H"];function DK({card:t,recommended:e=!1,selected:r=!1,disabled:n=!1,onSelect:i}){var a;const s=parseInt(t.id,10),o=Number.isFinite(s)?PK[s]??t.id:t.id;return h.jsxs("button",{type:"button",disabled:n,onClick:()=>i==null?void 0:i(t.id),className:["relative w-full text-left rounded-lg border p-3 transition-colors cursor-pointer","bg-card",r?"border-accent":"border-border hover:border-foreground",n&&"opacity-50 pointer-events-none"].filter(Boolean).join(" "),children:[(r||e)&&h.jsx("span",{className:"absolute top-2 right-2 text-accent",children:r?h.jsx(ba,{style:{width:14,height:14}}):h.jsx($M,{style:{width:14,height:14}})}),h.jsxs("span",{className:"block text-[12px] font-bold text-foreground",children:[o,". ",t.title]}),((a=t.bullets)==null?void 0:a.length)>0&&h.jsx("ul",{className:"mt-1.5 space-y-0.5 list-none pl-0",children:t.bullets.map((l,c)=>h.jsxs("li",{className:"text-[11px] text-muted-foreground leading-snug",children:[h.jsx("span",{className:"mr-1",children:"•"}),l]},c))})]})}function OK(){var P;const{session:t,messages:e,decisions:r,status:n,error:i,streamingMessage:s,designDocPath:o,hydrate:a,startSession:l,sendMessage:c,selectCard:u,completeDesign:d,connectSSE:p,disconnectSSE:f,reset:m}=Gn(),[x,g]=C.useState(""),[y,b]=C.useState(null),[k,T]=C.useState(""),_=C.useRef(null);C.useEffect(()=>(Gn.setState({scope:null,featureCode:null}),a(),()=>f()),[]),C.useEffect(()=>{var $;($=_.current)==null||$.scrollIntoView({behavior:"smooth"})},[e,s]);const w=C.useCallback(()=>{x.trim()&&(c(x.trim()),g(""))},[x,c]),E=C.useCallback(($,q)=>{b({messageIndex:q,cardId:$})},[]),L=C.useCallback(()=>{y&&(u(y.cardId,k||null,y.messageIndex),b(null),T(""))},[y,k,u]),M=n==="streaming"||n==="summarizing",N=e.reduce(($,q,O)=>q.role==="assistant"&&q.content&&JT(q.content).parts.some(I=>I.type==="decision")?O:$,-1);return t?h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[i&&h.jsx("div",{className:"px-3 py-1.5 text-[11px] text-red-400 bg-red-500/10 border-b border-red-500/20 shrink-0",children:i}),n==="complete"&&h.jsxs("div",{className:"px-3 py-2 text-[11px] bg-green-500/10 border-b border-green-500/20 shrink-0 flex items-center gap-2",children:[h.jsx(Qm,{style:{width:12,height:12},className:"text-green-400"}),h.jsx("span",{className:"text-green-400 font-medium",children:"Design complete."}),o&&h.jsxs("span",{className:"text-muted-foreground",children:["Document written to ",h.jsx("code",{className:"text-foreground",children:o})]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:()=>{m()},className:"px-2 py-1 text-[10px] font-medium rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors",children:"New Session"})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.map(($,q)=>h.jsx(ny,{messageIndex:q,message:$,onCardSelect:E,selectedCard:y,isStreaming:M,cardsDisabled:M||q!==N},q)),s&&h.jsx(ny,{message:s,onCardSelect:E,selectedCard:y,isStreaming:M}),!i&&(n==="active"||n==="streaming")&&!s&&e.length>0&&((P=e[e.length-1])==null?void 0:P.role)==="human"&&h.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:h.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[h.jsx("div",{className:"w-3 h-3 rounded-full animate-spin",style:{border:"2px solid hsl(var(--muted-foreground) / 0.2)",borderTopColor:"hsl(var(--muted-foreground))"}}),h.jsx("span",{children:"Agent thinking..."})]})}),n==="summarizing"&&h.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:h.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[h.jsx("div",{className:"w-3 h-3 rounded-full animate-spin",style:{border:"2px solid hsl(var(--muted-foreground) / 0.2)",borderTopColor:"hsl(var(--muted-foreground))"}}),h.jsx("span",{children:"Generating design document..."})]})}),h.jsx("div",{ref:_})]}),n!=="complete"&&h.jsxs("div",{className:"border-t border-border p-3 shrink-0",children:[y?h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Selected: ",h.jsx("span",{className:"font-semibold text-foreground",children:y.cardId})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:k,onChange:$=>T($.target.value),onKeyDown:$=>$.key==="Enter"&&L(),placeholder:"Add a comment (optional)...",className:"flex-1 bg-muted border border-border rounded px-3 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent"}),h.jsx("button",{onClick:L,disabled:M,className:"px-3 py-1.5 text-[11px] font-medium rounded bg-accent text-accent-foreground hover:opacity-90 transition-opacity disabled:opacity-50",children:"Send"}),h.jsx("button",{onClick:()=>{b(null),T("")},className:"px-3 py-1.5 text-[11px] rounded border border-border text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}):h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:x,onChange:$=>g($.target.value),onKeyDown:$=>$.key==="Enter"&&!$.shiftKey&&w(),placeholder:M?"Waiting for response...":"Type a response...",disabled:M,className:"flex-1 bg-muted border border-border rounded px-3 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent disabled:opacity-50"}),h.jsx("button",{onClick:w,disabled:M||!x.trim(),className:"px-3 py-1.5 rounded bg-accent text-accent-foreground disabled:opacity-50 transition-opacity",children:h.jsx(Af,{style:{width:14,height:14}})})]}),n==="active"&&r.length>=2&&h.jsxs("button",{onClick:d,className:"mt-2 w-full py-1.5 text-[11px] font-medium rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors flex items-center justify-center gap-1.5",children:[h.jsx(Qm,{style:{width:12,height:12}}),"Complete Design"]})]})]}):h.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8",children:[h.jsx(Oc,{className:"text-muted-foreground",style:{width:48,height:48}}),h.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:"Start a Design Conversation"}),h.jsx("p",{className:"text-[12px] text-muted-foreground text-center max-w-md",children:"Have an interactive design conversation with the AI. It will ask questions, present options with trade-offs, and build a design document from your decisions."}),i&&h.jsx("p",{className:"text-[11px] text-red-400 text-center max-w-md",children:i}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>l("product"),className:"px-4 py-2 text-[11px] font-medium rounded bg-accent text-accent-foreground hover:opacity-90 transition-opacity",children:"Product Design"}),h.jsx("button",{onClick:()=>{const $=prompt("Feature code:");$&&l("feature",$)},className:"px-4 py-2 text-[11px] font-medium rounded border border-border text-foreground hover:bg-muted transition-colors",children:"Feature Design"})]})]})}function ny({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,c;const o=t.role==="human",a=!o&&t.content?JT(t.content):null;return h.jsx("div",{className:nt("flex",o?"justify-end":"justify-start"),children:h.jsx("div",{className:nt("max-w-[85%] rounded-lg px-3 py-2 text-[12px]",o?"bg-accent/20 text-foreground":"bg-muted text-foreground"),children:o?h.jsx("div",{children:t.type==="card_select"?h.jsxs("span",{children:["Selected ",h.jsx("strong",{children:(l=t.content)==null?void 0:l.cardId}),(c=t.content)!=null&&c.comment?`: ${t.content.comment}`:""]}):h.jsx("span",{children:t.content})}):a?h.jsx("div",{className:"space-y-3",children:a.parts.map((u,d)=>{var p,f;return u.type==="text"?h.jsx("div",{className:"whitespace-pre-wrap",children:u.content},d):h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"flex flex-col gap-2 mt-2",children:(p=u.content.options)==null?void 0:p.map(m=>{var x;return h.jsx(DK,{card:m,recommended:((x=u.content.recommendation)==null?void 0:x.id)===m.id,selected:(n==null?void 0:n.messageIndex)===e&&(n==null?void 0:n.cardId)===m.id,disabled:s,onSelect:g=>r(g,e)},m.id)})}),((f=u.content.recommendation)==null?void 0:f.rationale)&&h.jsx("div",{className:"text-[11px] text-muted-foreground italic mt-1",children:u.content.recommendation.rationale})]},d)})}):h.jsx("div",{className:"whitespace-pre-wrap",children:t.content})})})}const RK=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),$K=new Set(["WebSearch","web_search"]);function zK({expanded:t}){return h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 150ms ease",flexShrink:0},children:h.jsx("path",{d:"M3 2L7 5L3 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function WK(){return h.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:[h.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--accent))",strokeWidth:"1.2"}),h.jsx("path",{d:"M3 5l1.5 1.5L7 3.5",stroke:"hsl(var(--accent))",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function qK(){return h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:h.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.2"})})}function Iu({title:t,count:e,defaultExpanded:r,children:n}){const[i,s]=C.useState(r);return h.jsxs("div",{className:"border-b",style:{borderColor:"hsl(var(--sidebar-border))"},children:[h.jsxs("button",{onClick:()=>s(o=>!o),className:"flex items-center gap-1.5 w-full px-3 py-2 text-left transition-colors hover:bg-sidebar-accent/30",children:[h.jsx(zK,{expanded:i}),h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider flex-1",style:{color:"hsl(var(--muted-foreground))"},children:t}),e>0&&h.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.12)",color:"hsl(var(--accent))"},children:e})]}),i&&h.jsx("div",{className:"pb-1",children:n})]})}function ml(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function iy(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function HK({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>RK.has(o.tool)),n=t.filter(o=>$K.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return h.jsx(Yn,{className:"flex-1",children:h.jsxs("div",{children:[h.jsx(Iu,{title:"Topic Outline",count:e.length,defaultExpanded:e.length>0,children:e.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No topics yet"}):h.jsx("ul",{className:"px-3 space-y-1 pt-0.5",children:e.map((o,a)=>h.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[h.jsx("span",{className:"mt-0.5",children:o.decided?h.jsx(WK,{}):h.jsx(qK,{})}),h.jsx("span",{className:"text-[11px] leading-snug",style:{color:o.decided?"hsl(var(--foreground))":"hsl(var(--muted-foreground))"},children:o.title})]},a))})}),h.jsx(Iu,{title:"Codebase Refs",count:r.length,defaultExpanded:r.length>0,children:r.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No file references yet"}):h.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:i.map((o,a)=>h.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider px-1 rounded",style:{background:"hsl(var(--accent) / 0.12)",color:"hsl(var(--accent))"},children:o.tool}),h.jsx("span",{className:"text-[10px] font-mono leading-tight truncate flex-1",style:{color:"hsl(var(--foreground))"},title:typeof o.input=="string"?o.input:JSON.stringify(o.input),children:ml(iy(o.tool,o.input),50)})]}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:ml(o.summary,100)})]},a))})}),h.jsx(Iu,{title:"Web Searches",count:n.length,defaultExpanded:n.length>0,children:n.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No web searches yet"}):h.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:s.map((o,a)=>h.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[h.jsx("p",{className:"text-[10px] font-medium leading-snug",style:{color:"hsl(var(--foreground))"},children:ml(iy(o.tool,o.input),80)}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:ml(o.summary,100)})]},a))})})]})})}function UK({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=C.useState("decisions"),o=t.filter(c=>!c.superseded).length,a=Gn(c=>c.researchItems)||[],l=Gn(c=>c.topicOutline)||[];return h.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:n??208},children:[h.jsx("div",{className:"p-3 pb-0",children:h.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--foreground))"},children:"Design"})}),h.jsxs("div",{className:"flex px-2 pt-2 gap-1",style:{borderBottom:"1px solid hsl(var(--sidebar-border))"},children:[h.jsxs("button",{onClick:()=>s("decisions"),className:"flex items-center gap-1 px-2 py-1.5 text-[11px] font-medium transition-colors",style:{color:i==="decisions"?"hsl(var(--foreground))":"hsl(var(--muted-foreground))",borderBottom:i==="decisions"?"2px solid hsl(var(--accent))":"2px solid transparent",marginBottom:"-1px"},children:["Decisions",o>0&&h.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))"},children:o})]}),h.jsxs("button",{onClick:()=>s("research"),className:"flex items-center gap-1 px-2 py-1.5 text-[11px] font-medium transition-colors",style:{color:i==="research"?"hsl(var(--foreground))":"hsl(var(--muted-foreground))",borderBottom:i==="research"?"2px solid hsl(var(--accent))":"2px solid transparent",marginBottom:"-1px"},children:["Research",a.length>0&&h.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))"},children:a.length})]})]}),i==="decisions"&&h.jsx(Yn,{className:"flex-1",children:t.length===0?h.jsx("div",{className:"px-3 py-6 text-center text-[11px]",style:{color:"hsl(var(--muted-foreground))"},children:"No decisions yet"}):h.jsx("div",{className:"px-2 pb-2 pt-1",children:t.map((c,u)=>{var d;return h.jsxs("button",{disabled:c.superseded||r,onClick:()=>!c.superseded&&!r&&(e==null?void 0:e(u)),className:`flex flex-col w-full text-left rounded-md px-2 py-1.5 transition-colors ${c.superseded||r?"cursor-not-allowed opacity-40":"cursor-pointer hover:bg-sidebar-accent/50"}`,children:[h.jsx("span",{className:"text-[11px] font-medium leading-tight",style:{color:"hsl(var(--foreground))",textDecoration:c.superseded?"line-through":void 0},children:((d=c.selectedOption)==null?void 0:d.title)||c.question}),c.comment&&h.jsx("span",{className:"text-[10px] leading-snug mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:c.comment}),c.superseded&&h.jsx("span",{className:"text-[9px] mt-0.5 uppercase tracking-wider font-medium",style:{color:"hsl(var(--muted-foreground))"},children:"superseded"})]},u)})})}),i==="research"&&h.jsx(HK,{researchItems:a,topicOutline:l})]})}function GK(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function VK(t,e){const r=(e??Date.now())-Date.parse(t);if(r<0)return"0m";const n=Math.floor(r/6e4);if(n<60)return`${n}m`;const i=Math.floor(r/36e5);return i<24?`${i}h`:`${Math.floor(r/864e5)}d`}function YK(t,e){if(t.resolution)return!1;const r=t.ttl_days??90;return(e??Date.now())-Date.parse(t.created_at)>r*24*60*60*1e3}const XK=320,KK=40,ZK={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function a_(t){return t?`compose:${t}:openLoopsCollapsed`:null}function sy(t){const e=a_(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function QK(t,e){const r=a_(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function JK({onConfirm:t,onCancel:e}){const[r,n]=C.useState("deferred"),[i,s]=C.useState(""),[o,a]=C.useState(""),l=c=>{c.preventDefault(),i.trim()&&t({kind:r,summary:i.trim(),ttl_days:o?parseInt(o,10):void 0})};return h.jsx("div",{"data-testid":"add-loop-modal",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:c=>{c.target===c.currentTarget&&e()},children:h.jsxs("form",{onSubmit:l,style:{background:"#1e1e2e",borderRadius:8,padding:24,width:360,display:"flex",flexDirection:"column",gap:12},children:[h.jsx("h3",{style:{margin:0,color:"#cdd6f4",fontSize:14},children:"Add Open Loop"}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Kind",h.jsxs("select",{value:r,onChange:c=>n(c.target.value),style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px"},children:[h.jsx("option",{value:"deferred",children:"Deferred"}),h.jsx("option",{value:"blocked",children:"Blocked"}),h.jsx("option",{value:"open_question",children:"Open Question"})]})]}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Summary (max 280 chars)",h.jsx("textarea",{"data-testid":"add-loop-summary",value:i,onChange:c=>s(c.target.value),maxLength:280,rows:3,required:!0,style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",resize:"vertical",boxSizing:"border-box"}})]}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["TTL days (optional, default 90)",h.jsx("input",{type:"number",value:o,onChange:c=>a(c.target.value),min:1,style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",boxSizing:"border-box"}})]}),h.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[h.jsx("button",{type:"button",onClick:e,style:{padding:"6px 16px",background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,cursor:"pointer"},children:"Cancel"}),h.jsx("button",{type:"submit","data-testid":"add-loop-submit",style:{padding:"6px 16px",background:"#89b4fa",color:"#1e1e2e",border:"none",borderRadius:4,cursor:"pointer",fontWeight:600},children:"Add"})]})]})})}function tZ({loop:t,onResolve:e,nowMs:r}){const n=YK(t,r),i=!!t.resolution;return h.jsxs("div",{"data-testid":`loop-row-${t.id}`,style:{padding:"8px 12px",borderBottom:"1px solid #313244",opacity:i?.5:1},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx("span",{style:{fontSize:10,color:"#6c7086",background:"#313244",borderRadius:3,padding:"1px 5px"},children:ZK[t.kind]||t.kind}),n&&!i&&h.jsx("span",{"data-testid":`stale-badge-${t.id}`,style:{fontSize:10,color:"#f38ba8",background:"#3e1111",borderRadius:3,padding:"1px 5px"},children:">TTL"}),h.jsx("span",{style:{fontSize:10,color:"#6c7086",marginLeft:"auto"},children:VK(t.created_at,r)})]}),h.jsx("p",{style:{margin:"4px 0 6px",fontSize:12,color:n&&!i?"#f38ba8":"#cdd6f4",lineHeight:1.4},children:t.summary}),!i&&h.jsx("button",{"data-testid":`resolve-btn-${t.id}`,onClick:()=>e(t.id),style:{fontSize:11,padding:"3px 10px",background:"#313244",color:"#a6e3a1",border:"1px solid #a6e3a1",borderRadius:3,cursor:"pointer"},children:"Resolve"}),i&&h.jsx("span",{style:{fontSize:11,color:"#a6e3a1"},children:"Resolved"})]})}function eZ({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var g,y;const[i,s]=C.useState(()=>sy(t)),[o,a]=C.useState(!1),[l,c]=C.useState(()=>Date.now());C.useEffect(()=>{const b=setInterval(()=>c(Date.now()),6e4);return()=>clearInterval(b)},[]),C.useEffect(()=>{s(sy(t))},[t]);const u=C.useCallback(()=>{s(b=>{const k=!b;return QK(t,k),k})},[t]),d=C.useMemo(()=>!t||!e?null:e.find(b=>{var k;return((k=b.lifecycle)==null?void 0:k.featureCode)===t})??null,[t,e]),p=((y=(g=d==null?void 0:d.lifecycle)==null?void 0:g.lifecycle_ext)==null?void 0:y.open_loops)??[],f=C.useMemo(()=>GK(p.filter(b=>b.resolution==null)),[p]),m=C.useCallback(async b=>{if(a(!1),r)try{await r(t,b)}catch(k){console.error("[OpenLoopsPanel] addLoop failed:",k.message)}},[t,r]),x=C.useCallback(async b=>{if(n){const k=window.prompt("Resolve note (optional):")||"";try{await n(t,b,{note:k})}catch(T){console.error("[OpenLoopsPanel] resolveLoop failed:",T.message)}}},[t,n]);return t?i?h.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:KK,background:"#181825",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:12,borderLeft:"1px solid #313244",flexShrink:0},children:[h.jsx("button",{"data-testid":"open-loops-expand-btn",onClick:u,title:`Open loops (${f.length})`,style:{background:"none",border:"none",cursor:"pointer",color:"#a6adc8",fontSize:18},children:"↺"}),f.length>0&&h.jsx("span",{style:{fontSize:10,color:"#f5c2e7",marginTop:4},children:f.length})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"open-loops-panel",style:{width:XK,background:"#181825",display:"flex",flexDirection:"column",borderLeft:"1px solid #313244",flexShrink:0,overflow:"hidden"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid #313244",gap:8},children:[h.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#cdd6f4",flex:1},children:["Open Loops ",f.length>0&&h.jsxs("span",{style:{color:"#a6adc8"},children:["(",f.length,")"]})]}),h.jsx("button",{"data-testid":"add-loop-btn",onClick:()=>a(!0),title:"Add open loop",style:{background:"none",border:"1px solid #45475a",color:"#a6e3a1",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12},children:"+"}),h.jsx("button",{"data-testid":"open-loops-collapse-btn",onClick:u,title:"Collapse",style:{background:"none",border:"none",cursor:"pointer",color:"#6c7086",fontSize:16},children:"›"})]}),h.jsx("div",{style:{flex:1,overflowY:"auto"},children:f.length===0?h.jsxs("div",{"data-testid":"open-loops-empty",style:{padding:"16px 12px",color:"#6c7086",fontSize:12,textAlign:"center"},children:["No open loops for this feature",h.jsx("br",{}),h.jsx("button",{onClick:()=>a(!0),style:{marginTop:8,background:"none",border:"1px solid #45475a",color:"#a6adc8",borderRadius:4,padding:"3px 10px",cursor:"pointer",fontSize:11},children:"+ Add loop"})]}):f.map(b=>h.jsx(tZ,{loop:b,onResolve:x,nowMs:l},b.id))})]}),o&&h.jsx(JK,{onConfirm:m,onCancel:()=>a(!1)})]}):null}const rs={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},rZ=new Set(["blocks","informs"]);function oy(t,e){return t.find(r=>r.featureCode===e)||t.find(r=>r.title===e)||t.find(r=>r.title&&r.title.startsWith(e+":"))}function nZ(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function iZ(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=rs.error;else if(o==="running"){const c=a&&a.endsWith("_gate"),u=oy(e,s);c&&u&&n.some(p=>p.itemId===u.id&&!p.resolvedAt)?i[s]=rs.gate_pending:i[s]=rs.building}const l=oy(e,s);if(l&&(i[s]===rs.building||i[s]===rs.gate_pending)){const c=new Set([l.id]),u=sZ(c,r),d=new Map(e.map(p=>[p.id,nZ(p)]));for(const p of u){const f=d.get(p);f&&!i[f]&&(i[f]=rs.blocked_downstream)}}return i}function sZ(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)rZ.has(o.type)&&(r.has(o.fromId)||r.set(o.fromId,[]),r.get(o.fromId).push(o.toId));const n=new Set(t),i=[...t],s=new Set;for(;i.length>0;){const o=i.shift(),a=r.get(o)||[];for(const l of a)n.has(l)||(n.add(l),s.add(l),i.push(l))}return s}function oZ(t,e){if(!t||!t.length)return{nodes:[],edges:[],activeEdgeIds:new Set};const r=[],n=new Map;r.push({data:{id:"agent-topology",label:"Agent Topology",isAgentGroup:!0}}),r.push({data:{id:"agent-session",label:"Session",isAgentNode:!0,agentType:"session",agentStatus:"running",agentColor:"#64748b",parent:"agent-topology"}});const i=new Set(t.map(l=>l.agentId));for(const l of t){const c=l.agentType||"claude",u=E_[c]||"#3b82f6";r.push({data:{id:`agent-${l.agentId}`,label:`${c}
770
+ ${l.agentId.slice(0,6)}`,isAgentNode:!0,agentType:c,agentStatus:l.status||"running",agentColor:u,parent:"agent-topology"}});const p=l.parentSessionId&&i.has(l.parentSessionId)?`agent-${l.parentSessionId}`:"agent-session",f=`relay-${p}-agent-${l.agentId}`;n.has(f)||n.set(f,{data:{id:f,source:p,target:`agent-${l.agentId}`,isRelayEdge:!0}})}const s=Date.now()-3e4,o=new Set,a=l=>l==="session"?"agent-session":i.has(l)?`agent-${l}`:"agent-session";for(const l of e||[]){if(new Date(l.timestamp).getTime()<s)continue;const c=a(l.fromAgentId),u=a(l.toAgentId),d=l.direction==="dispatch"?`relay-${c}-${u}`:`relay-${u}-${c}`;o.add(d)}return{nodes:r,edges:[...n.values()],activeEdgeIds:o}}class kr extends Yt.Component{constructor(){super(...arguments);ie(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?h.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 p-4",style:{background:"hsl(var(--background))",color:"hsl(var(--muted-foreground))"},children:[h.jsx("div",{className:"text-xs uppercase tracking-wider font-semibold",style:{color:"hsl(var(--destructive))"},children:this.props.zone?`${this.props.zone} crashed`:"panel crashed"}),h.jsx("div",{className:"text-[11px] max-w-[300px] text-center opacity-70 font-mono",children:(n=(r=this.state.error)==null?void 0:r.message)==null?void 0:n.substring(0,120)}),h.jsx("button",{className:"mt-2 px-3 py-1 text-xs rounded border",style:{borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},onClick:()=>this.setState({error:null}),children:"retry"})]}):this.props.children}}class aZ extends Yt.Component{constructor(){super(...arguments);ie(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsxs("div",{className:"h-8 flex items-center justify-between px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--destructive) / 0.1)"},children:[h.jsxs("span",{className:"text-[10px] uppercase tracking-wider font-semibold",style:{color:"hsl(var(--destructive))"},children:["safe mode — UI crashed: ",(n=(r=this.state.error)==null?void 0:r.message)==null?void 0:n.substring(0,80)]}),h.jsx("button",{className:"px-2 py-0.5 text-[10px] rounded border",style:{borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},onClick:()=>this.setState({error:null}),children:"retry"})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(xy,{})})]}):this.props.children}}const nf="compose:fontSize",lZ="compose:theme",Qo=13,sf=10,of=20;function cZ(){try{const t=parseInt(localStorage.getItem(nf),10);return t>=sf&&t<=of?t:Qo}catch{return Qo}}const ay=new URLSearchParams(window.location.search).get("popout");function hZ(){return ay?h.jsx(JV,{path:ay}):h.jsx(aZ,{children:h.jsx(dZ,{})})}function uZ({activeView:t,items:e,filteredItems:r,phaseFilteredItems:n,phaseFilteredGates:i,connections:s,filteredConnections:o,sessions:a,activeBuild:l,pipelineDraft:c,gates:u,settings:d,selectedPhase:p,selectedItemId:f,buildStateMap:m,agentOverlay:x,spawnedAgents:g,agentRelays:y,docsSelectedFile:b,onDocsSelectedFileChange:k,docsPreviousView:T,onDocsBack:_,visibleTracks:w,hiddenGroups:E,onSelect:L,onUpdate:M,onCreate:N,onDelete:P,onOpenGate:$,onCreateConnection:q,onDeleteConnection:O,onRefreshBuild:I,onSelectStep:F,onResolveGate:D,onUpdateSettings:R,onResetSettings:j,projectRoot:S,featureCode:U,focusActive:Q,onToggleFocus:A,sessionState:rt,agentActivity:ut,iterationStates:ot}){switch(t){case"dashboard":return h.jsx(xK,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:g,featureCode:U,sessionState:rt,agentActivity:ut,iterationStates:ot,onSelect:L,onResolveGate:D,onOpenGate:$});case"tree":return h.jsx(k1,{items:r,connections:o,selectedItemId:f,onSelect:L,onCreate:N,featureCode:U,focusActive:Q,onToggleFocus:A});case"graph":return h.jsx(w1,{items:e,connections:s,selectedItemId:f,onSelect:L,visibleTracks:w,hiddenGroups:E,buildStateMap:m,resolveGate:D,gates:u,spawnedAgents:g,agentRelays:y,agentOverlay:x,featureCode:U,focusActive:Q,onToggleFocus:A});case"pipeline":return h.jsx(eT,{activeBuild:l,pipelineDraft:c,onSelectStep:F,onRefresh:I});case"sessions":return h.jsx(aT,{sessions:a,items:e,onSelectItem:L,featureCode:U,focusActive:Q,onToggleFocus:A});case"gates":return h.jsx(ZS,{gates:i,items:n,onResolve:D,onSelect:L,featureCode:U,focusActive:Q,onToggleFocus:A});case"docs":return h.jsx(XS,{items:n,selectedFile:b,onSelectedFileChange:k,previousView:T,onBack:_,featureCode:U,focusActive:Q,onToggleFocus:A});case"design":return h.jsx(OK,{},S);case"ideabox":return h.jsx(FK,{});case"settings":return h.jsx(tT,{settings:d,onSettingsChange:R,onReset:j});case"stratum":return h.jsx(aY,{});default:return h.jsxs("div",{className:"flex-1 flex items-center justify-center text-[12px] text-muted-foreground italic",children:["View “",t,"” not found."]})}}function dZ(){const{refresh:t}=y_(),e=Gn(W=>W.decisions),r=Gn(W=>W.status),[n,i]=C.useState(cZ),[s,o]=C.useState(()=>document.documentElement.classList.contains("dark")),[a]=C.useState(DX),[l,c]=C.useState(()=>OX(a)),[u,d]=C.useState(bY),[p,f]=C.useState(RX),[m,x]=C.useState(zX),[g,y]=C.useState(null),[b,k]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[T,_]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:w,connections:E,connected:L,uiCommand:M,clearUICommand:N,recentChanges:P,createItem:$,updateItem:q,deleteItem:O,createConnection:I,deleteConnection:F,agentActivity:D,agentErrors:R,spawnedAgents:j,agentRelays:S,sessionState:U,registerSnapshotProvider:Q,gates:A,gateEvent:rt,resolveGate:ut,settings:ot,updateSettings:It,resetSettings:ht,activeBuild:at,setActiveBuild:K,pipelineDraft:lt,sessions:yt,iterationStates:At,selectedPhase:Dt,setSelectedPhase:ue,statusSnapshots:ae,setStatusSnapshot:Pe}=mr(Pi(W=>({items:W.items,connections:W.connections,connected:W.connected,uiCommand:W.uiCommand,clearUICommand:W.clearUICommand,recentChanges:W.recentChanges,createItem:W.createItem,updateItem:W.updateItem,deleteItem:W.deleteItem,createConnection:W.createConnection,deleteConnection:W.deleteConnection,agentActivity:W.agentActivity,agentErrors:W.agentErrors,spawnedAgents:W.spawnedAgents,agentRelays:W.agentRelays,sessionState:W.sessionState,registerSnapshotProvider:W.registerSnapshotProvider,gates:W.gates,gateEvent:W.gateEvent,resolveGate:W.resolveGate,settings:W.settings,updateSettings:W.updateSettings,resetSettings:W.resetSettings,activeBuild:W.activeBuild,setActiveBuild:W.setActiveBuild,pipelineDraft:W.pipelineDraft,sessions:W.sessions,iterationStates:W.iterationStates,selectedPhase:W.selectedPhase,setSelectedPhase:W.setSelectedPhase,statusSnapshots:W.statusSnapshots,setStatusSnapshot:W.setStatusSnapshot}))),Zt=(U==null?void 0:U.featureCode)||null;C.useEffect(()=>{Zt&&(ae&&ae[Zt]||zt(`/api/lifecycle/status?featureCode=${encodeURIComponent(Zt)}`).then(W=>W.json()).then(W=>{W!=null&&W.snapshot&&Pe&&Pe(Zt,W.snapshot)}).catch(()=>{}))},[Zt,ae,Pe]);const[Be,V]=C.useState(null),it=C.useRef(!!localStorage.getItem("compose:activeView")),[dt,Nt]=C.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[et,kt]=C.useState(""),G=C.useCallback(W=>{k(W),localStorage.setItem("compose:contextWidthPx",String(Math.round(W)))},[]),st=C.useRef(!1),St=C.useCallback(W=>{W.preventDefault(),st.current=!0;const _t=ge=>{if(!st.current)return;const cr=ge.clientX-16,lo=Math.max(160,Math.min(window.innerWidth*.4,cr));_(lo),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(lo)))},Tt=()=>{st.current=!1,document.removeEventListener("mousemove",_t),document.removeEventListener("mouseup",Tt)};document.addEventListener("mousemove",_t),document.addEventListener("mouseup",Tt)},[]),[Ot,$t]=C.useState(null),[Se,ar]=C.useState(null),[fe,Er]=C.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[Oe,Ce]=C.useState(()=>{try{const W=localStorage.getItem("compose:visibleTracks");if(W){const _t=JSON.parse(W);return new Set(_t)}}catch{}return null}),[lr,ke]=C.useState(new Set),[Ln,Js]=C.useState(!1),to=C.useCallback(W=>{ke(_t=>{const Tt=new Set(_t);return Tt.has(W)?Tt.delete(W):Tt.add(W),Tt})},[]),[Aa,eo]=C.useState(null),[ro,si]=C.useState(!1),[oi,no]=C.useState(!1),[gh,pe]=C.useState(!1),[Bn,Ma]=C.useState(""),[io,Di]=C.useState("");C.useEffect(()=>{zt("/api/project").then(W=>W.json()).then(W=>{Ma(W.name||""),Di(W.targetRoot||"")}).catch(()=>{})},[]);const Ia=C.useCallback(async W=>{try{const Tt=await(await zt("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:W})})).json();return Tt.ok?(await t(),Ma(Tt.name),Di(Tt.targetRoot),!0):!1}catch{return!1}},[t]),so=u===Ge.MAXIMIZED,xh=C.useCallback(W=>{c(W),H0(W),Nt(W)},[]),me=C.useCallback(W=>{Nt(W),c(W),H0(W)},[]);C.useEffect(()=>{localStorage.setItem("compose:activeView",dt),dt!=="docs"&&(ar(null),$t(null))},[dt]),C.useEffect(()=>{fe?localStorage.setItem("compose:selectedTrack",fe):localStorage.removeItem("compose:selectedTrack")},[fe]),C.useEffect(()=>{Be?sessionStorage.setItem("vision-selectedItemId",Be):sessionStorage.removeItem("vision-selectedItemId")},[Be]),C.useEffect(()=>{try{Oe?localStorage.setItem("compose:visibleTracks",JSON.stringify([...Oe])):localStorage.removeItem("compose:visibleTracks")}catch{}},[Oe]);const Kr=C.useRef(!1);C.useEffect(()=>{var W;Kr.current||it.current||(W=ot==null?void 0:ot.ui)!=null&&W.defaultView&&(me(ot.ui.defaultView),Kr.current=!0)},[ot]),C.useEffect(()=>{M&&(M.view&&me(M.view),M.phase!==void 0&&ue(M.phase),M.select!==void 0&&Pr(M.select),N())},[M,N]),C.useEffect(()=>{const W=()=>{var Tt;return["INPUT","TEXTAREA","SELECT"].includes((Tt=document.activeElement)==null?void 0:Tt.tagName)},_t=Tt=>{(Tt.metaKey||Tt.ctrlKey)&&Tt.key==="k"&&(Tt.preventDefault(),si(ge=>!ge)),(Tt.metaKey||Tt.ctrlKey)&&Tt.key==="n"&&(Tt.preventDefault(),no(!0)),Tt.key===","&&!Tt.metaKey&&!Tt.ctrlKey&&!W()&&pe(!0)};return window.addEventListener("keydown",_t),()=>window.removeEventListener("keydown",_t)},[]);const An=C.useMemo(()=>{let W=w;if(Dt&&(W=W.filter(_t=>_t.phase===Dt)),fe&&(W=W.filter(_t=>{const Tt=(_t.description||"").match(/Track:\s*(\w+)/i);return Tt&&Tt[1].toLowerCase()===fe})),et){const _t=et.toLowerCase();W=W.filter(Tt=>Tt.title.toLowerCase().includes(_t)||(Tt.description||"").toLowerCase().includes(_t))}return W},[w,Dt,fe,et]),Oi=C.useMemo(()=>Dt?w.filter(W=>W.phase===Dt):w,[w,Dt]),oo=C.useMemo(()=>new Set(Oi.map(W=>W.id)),[Oi]),Ri=C.useMemo(()=>Dt?A.filter(W=>oo.has(W.itemId)):A,[A,oo,Dt]),ai=C.useMemo(()=>{if(!Dt&&!fe&&!et)return E;const W=new Set(An.map(_t=>_t.id));return E.filter(_t=>W.has(_t.fromId)&&W.has(_t.toId))},[E,An,Dt,fe,et]),$i=C.useMemo(()=>iZ(at,w,E,A),[at,w,E,A]),Fr=C.useMemo(()=>oZ(j,S),[j,S]),We=C.useCallback(W=>{y(W)},[]),Pr=C.useCallback(W=>{V(_t=>_t===W?(We(null),null):(We({type:"item",id:W}),W))},[We]),yh=C.useCallback(async W=>{try{await zt(`/api/agent/${W}/stop`,{method:"POST",headers:us({"Content-Type":"application/json"})})}catch(_t){console.error(`[App] Failed to stop agent ${W}:`,_t.message)}},[]),ao=C.useRef(at);C.useEffect(()=>{!ao.current&&at&&at.featureItemId&&Pr(at.featureItemId),ao.current=at},[at]);const zi=C.useCallback(W=>{if(!W)return;const _t=w.find(Tt=>{var ge,cr;return((ge=Tt.lifecycle)==null?void 0:ge.featureCode)===W||Tt.featureCode===W||Tt.feature_code===W||((cr=Tt.title)==null?void 0:cr.includes(W))});_t&&Pr(_t.id)},[w,Pr]);C.useEffect(()=>{const W=_t=>{const{featureCode:Tt}=_t.detail||{};Tt&&zi(Tt)};return window.addEventListener("compose:select-feature",W),()=>window.removeEventListener("compose:select-feature",W)},[zi]);const mn=C.useCallback(W=>w.find(_t=>{var Tt;return((Tt=_t.lifecycle)==null?void 0:Tt.featureCode)===W})||null,[w]),Mn=C.useCallback(async(W,_t)=>{const Tt=mn(W);if(!Tt)throw new Error(`No item found for feature ${W}`);const ge=await zt(`/api/vision/items/${Tt.id}/loops`,{method:"POST",headers:us({"Content-Type":"application/json"}),body:JSON.stringify(_t)});if(!ge.ok)throw new Error(`Add loop failed: ${ge.status}`)},[mn]),vt=C.useCallback(async(W,_t,{note:Tt})=>{const ge=mn(W);if(!ge)throw new Error(`No item found for feature ${W}`);const cr=await zt(`/api/vision/items/${ge.id}/loops/${_t}/resolve`,{method:"POST",headers:us({"Content-Type":"application/json"}),body:JSON.stringify({note:Tt})});if(!cr.ok)throw new Error(`Resolve loop failed: ${cr.status}`)},[mn]);C.useEffect(()=>{Q(()=>({activeView:dt,selectedPhase:Dt,searchQuery:et,selectedItemId:Be,totalItems:w.length,filteredCount:An.length,connected:L}))},[Q,dt,Dt,et,Be,w.length,An.length,L]),C.useEffect(()=>{const W=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return W.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>W.disconnect()},[]),C.useEffect(()=>{g&&!m&&(x(!0),U0(!0))},[g]),C.useEffect(()=>{dt==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[dt]);const z=C.useCallback(()=>{const W=s?"light":"dark";document.documentElement.classList.toggle("dark",W==="dark"),localStorage.setItem(lZ,W),zt("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:W}})}).catch(()=>{})},[s]),J=C.useCallback(W=>{i(_t=>{const Tt=Math.min(Math.max(_t+W,sf),of);return localStorage.setItem(nf,Tt),Tt})},[]),ft=C.useCallback(()=>{i(Qo),localStorage.setItem(nf,Qo)},[]),ee=C.useCallback(W=>{d(W),kY(W)},[]),Xt=C.useCallback(()=>{f(W=>($X(!W),!W))},[]),le=C.useCallback(()=>{x(W=>(U0(!W),!W))},[]),Ze=C.useCallback((W,_t)=>{q(W,_t)},[q]),Nr=C.useCallback(async()=>{const _t=await $({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Dt||"vision"});_t&&_t.id&&Pr(_t.id)},[$,Dt]),br=C.useCallback(async W=>{await O(W),Be===W&&(V(null),We(null))},[O,Be,We]),li=C.useCallback(W=>{const _t=A.find(Tt=>Tt.id===W);_t&&(V(_t.itemId),We({type:"item",id:_t.itemId}))},[A,We]),Ee=C.useCallback(async W=>I(W),[I]),Fa=C.useCallback(async W=>F(W),[F]),Pa=C.useCallback(()=>{zt("/api/build/state").then(W=>W.json()).then(W=>K(W.state??null)).catch(()=>{})},[K]),l_=C.useCallback(W=>{We({type:"step",id:W})},[We]),Da=C.useCallback(W=>{const _t=w.find(cr=>cr.id===W);if(!_t)return;const Tt=(_t.description||"").match(/Track:\s*(\w+)/i),ge=Tt?Tt[1].toLowerCase():null;fe&&ge&&fe!==ge&&Er(null),ge&&Oe&&!Oe.has(ge)&&Ce(cr=>{const lo=new Set(cr);return lo.add(ge),lo})},[w,fe,Oe]),c_=C.useCallback(W=>{Da(W),V(W),We({type:"item",id:W}),me("graph")},[me,We,Da]),h_=C.useCallback(W=>{Da(W),V(W),We({type:"item",id:W}),me("tree")},[me,We,Da]),u_=C.useCallback(W=>{ar(dt),$t(W),me("docs")},[dt,me]),d_=C.useCallback(()=>{Se&&(me(Se),ar(null),$t(null))},[Se,me]);return h.jsx($c.Provider,{value:P,children:h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[h.jsx(kr,{zone:"header",children:h.jsxs("header",{className:"h-9 flex items-center px-3 gap-3 shrink-0 justify-between",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsx(lY,{projectName:Bn,projectRoot:io,onSwitch:Ia}),h.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:h.jsx(hY,{tabs:a,activeTab:l,onTabChange:xh,onOpenPalette:()=>si(W=>!W),badges:{gates:A.filter(W=>!W.resolvedAt).length}})}),h.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!L&&h.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),h.jsx("button",{className:"compose-btn-icon",onClick:z,title:s?"Switch to light mode":"Switch to dark mode",children:s?"☀":"☾"}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{className:"compose-btn-icon",onClick:()=>J(-1),disabled:n<=sf,title:"Decrease font size",children:"A−"}),h.jsx("span",{className:"text-[10px] tabular-nums min-w-[20px] text-center text-muted-foreground",children:n}),h.jsx("button",{className:"compose-btn-icon",onClick:()=>J(1),disabled:n>=of,title:"Increase font size",children:"A+"})]}),h.jsx("button",{className:"compose-btn-icon",onClick:ft,disabled:n===Qo,title:"Reset to default size",children:"100%"})]})]})}),h.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!so&&h.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[h.jsx(kr,{zone:"sidebar",children:h.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[h.jsx("button",{className:"w-4 h-full flex items-center justify-center text-[10px] text-muted-foreground hover:text-foreground transition-colors select-none",onClick:Xt,title:p?"Collapse sidebar":"Expand sidebar","aria-expanded":p,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:p?"‹":"›"}),p&&h.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0 order-last",onMouseDown:St}),p&&(dt==="design"?h.jsx(UK,{decisions:e,sessionComplete:r==="complete",onReviseDecision:W=>Gn.getState().reviseDecision(W),widthPx:T}):h.jsx(b1,{items:w,gates:A,activeBuild:at,onViewChange:me,selectedPhase:Dt,onPhaseSelect:ue,selectedTrack:fe,onTrackSelect:Er,visibleTracks:Oe,onToggleVisibleTrack:(W,_t)=>Ce(Tt=>{if(!Tt){const cr=new Set(_t);return cr.delete(W),cr}const ge=new Set(Tt);return ge.has(W)?ge.delete(W):ge.add(W),_t&&ge.size>=_t.length?null:ge}),onShowAllTracks:()=>Ce(null),hiddenGroups:lr,onToggleGroup:to,searchQuery:et,onSearchChange:kt,connected:L,agentActivity:D,agentErrors:R,spawnedAgents:j,agentRelays:S,sessionState:U,onSelectItem:Pr,onStopAgent:yh,onThemeChange:It,onNewItem:()=>no(!0),widthPx:T}))]})}),h.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[h.jsx(YT,{featureCode:Zt,snapshot:Zt?(ae==null?void 0:ae[Zt])??null:null}),Zt&&h.jsx(VT,{currentFeatureCode:Zt}),h.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:h.jsx(kr,{children:h.jsx(uZ,{activeView:dt,items:w,filteredItems:An,phaseFilteredItems:Oi,phaseFilteredGates:Ri,connections:E,filteredConnections:ai,sessions:yt,activeBuild:at,pipelineDraft:lt,gates:A,settings:ot,selectedPhase:Dt,selectedItemId:Be,onSelect:Pr,onUpdate:Ze,onCreate:Nr,onDelete:br,onOpenGate:li,onCreateConnection:Ee,onDeleteConnection:Fa,onRefreshBuild:Pa,onSelectStep:l_,onResolveGate:ut,onUpdateSettings:It,onResetSettings:ht,visibleTracks:Oe,hiddenGroups:lr,buildStateMap:$i,agentOverlay:Fr,spawnedAgents:j,agentRelays:S,docsSelectedFile:Ot,onDocsSelectedFileChange:$t,docsPreviousView:Se,onDocsBack:d_,projectRoot:io,featureCode:Zt,focusActive:Ln,onToggleFocus:()=>Js(W=>!W),sessionState:U,agentActivity:D,iterationStates:At})})})]}),dt!=="docs"&&h.jsx(kr,{children:h.jsxs(EY,{isOpen:m,onToggle:le,widthPx:b,onResizePx:G,activeBuild:at,gates:A,agentErrors:R,items:w,children:[(g==null?void 0:g.type)==="item"&&h.jsx(pX,{itemId:g.id,onSelect:W=>{y({type:"item",id:W}),V(W)},onClose:()=>{y(null),V(null)},onOpenFile:u_,onViewInGraph:c_,onViewInTree:h_}),(g==null?void 0:g.type)==="step"&&h.jsx(wX,{stepId:g.id,tierEvents:at==null?void 0:at.tierEvents,healthEvents:(at==null?void 0:at.health_score)!=null?[{score:at.health_score,breakdown:at.health_breakdown,missing:at.health_missing}]:void 0,capabilityEvents:at==null?void 0:at.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&h.jsx(TX,{})]})}),Zt&&dt!=="docs"&&h.jsx(kr,{zone:"open loops panel",children:h.jsx(eZ,{featureCode:Zt,items:w,onAddLoop:Mn,onResolveLoop:vt})})]}),h.jsx(kr,{zone:"ops strip",children:h.jsx(MX,{activeView:dt,onSelectFeature:zi})}),h.jsx(kr,{zone:"agent bar",children:h.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",so?"flex-1 min-h-0":yY(u)].join(" "),children:h.jsx(SY,{barState:u,onStateChange:ee})})})]}),h.jsx(kr,{zone:"notifications",children:h.jsx(EX,{})}),h.jsx(kr,{zone:"gate notifications",children:h.jsx(GT,{onOpenGate:li})}),h.jsx(kr,{zone:"challenge modal",children:Aa&&(()=>{const W=w.find(_t=>_t.id===Aa);return W?h.jsx(JS,{item:W,items:w,connections:E,onUpdate:Ze,onClose:()=>eo(null)}):null})()}),h.jsx(QS,{event:rt,items:w,onNavigate:()=>me("gates")}),h.jsx(kr,{zone:"command palette",children:h.jsx(lT,{open:ro,onClose:()=>si(!1),onSelectItem:W=>{Pr(W),si(!1)},onSelectGate:W=>{li(W),si(!1)}})}),h.jsx(kr,{zone:"item form",children:h.jsx(HT,{open:oi,onClose:()=>no(!1)})}),h.jsx(kr,{zone:"settings",children:h.jsx(UT,{open:gh,onClose:()=>pe(!1),settings:ot,onSettingsChange:It})})]})})}const GZ=Object.freeze(Object.defineProperty({__proto__:null,default:hZ},Symbol.toStringTag,{value:"Module"}));export{y6 as $,GZ as A,rz as B,an as C,Co as D,Rv as E,G1 as F,Vi as G,Jf as H,SZ as I,X$ as J,Nn as K,dd as L,X as M,h6 as N,i6 as O,wF as P,Ni as Q,pr as R,CZ as S,F1 as T,Rt as U,Qf as V,t6 as W,rx as X,aC as Y,L6 as Z,SF as _,Ta as a,qR as a$,b6 as a0,O6 as a1,oP as a2,iP as a3,be as a4,re as a5,lP as a6,AZ as a7,or as a8,ja as a9,Y as aA,IR as aB,va as aC,K$ as aD,tt as aE,s6 as aF,j9 as aG,TZ as aH,_Z as aI,hC as aJ,_v as aK,c6 as aL,th as aM,Dg as aN,np as aO,Jz as aP,zZ as aQ,Os as aR,R6 as aS,r6 as aT,tz as aU,qZ as aV,U1 as aW,nO as aX,Hn as aY,Gr as aZ,Gt as a_,Z$ as aa,HZ as ab,Fv as ac,_p as ad,gp as ae,m4 as af,H4 as ag,xZ as ah,nx as ai,ra as aj,kZ as ak,Ez as al,i9 as am,Qz as an,z2 as ao,g6 as ap,x6 as aq,m6 as ar,zn as as,Kg as at,hO as au,Vr as av,$v as aw,yp as ax,_l as ay,Vz as az,v as b,sP as b0,nP as b1,bZ as b2,aP as b3,RZ as b4,o6 as b5,Q4 as b6,hP as b7,EZ as b8,NZ as b9,Tv as ba,Ct as bb,n6 as bc,jZ as bd,f6 as be,p6 as bf,u6 as bg,d6 as bh,J8 as bi,wt as bj,Wr as bk,LR as bl,W6 as bm,vZ as c,LZ as d,_1 as e,Nv as f,BR as g,l6 as h,a6 as i,BZ as j,Ie as k,xt as l,wZ as m,Ev as n,yZ as o,wp as p,Dv as q,Tn as r,Tp as s,rP as t,WZ as u,OZ as v,$Z as w,sa as x,V1 as y,wa as z};