@smartmemory/compose 0.2.36-beta → 0.2.37-beta

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 (58) hide show
  1. package/dist/assets/App-BD4lfyhF.js +686 -0
  2. package/dist/assets/{arc-DIXitrAQ.js → arc-fd_r6IIl.js} +1 -1
  3. package/dist/assets/{architectureDiagram-3BPJPVTR-Cj7dBJg7.js → architectureDiagram-3BPJPVTR-UehcfvE8.js} +1 -1
  4. package/dist/assets/{blockDiagram-GPEHLZMM-Cl9S3jDb.js → blockDiagram-GPEHLZMM-Dm-THFZ6.js} +1 -1
  5. package/dist/assets/{c4Diagram-AAUBKEIU-BhXknY2V.js → c4Diagram-AAUBKEIU-CIZ7QDGR.js} +1 -1
  6. package/dist/assets/channel-C0cFeemU.js +1 -0
  7. package/dist/assets/{chunk-2J33WTMH-D9br4z7_.js → chunk-2J33WTMH-COBZ5eyU.js} +1 -1
  8. package/dist/assets/{chunk-4BX2VUAB-BUm--OlR.js → chunk-4BX2VUAB-w3bqdoNF.js} +1 -1
  9. package/dist/assets/{chunk-55IACEB6-BPBvBDq8.js → chunk-55IACEB6-D18v8dR4.js} +1 -1
  10. package/dist/assets/{chunk-727SXJPM-D-k0AVv9.js → chunk-727SXJPM-2MAwFz_9.js} +1 -1
  11. package/dist/assets/{chunk-AQP2D5EJ-DbrnuPhd.js → chunk-AQP2D5EJ-Dp_jdVPB.js} +1 -1
  12. package/dist/assets/{chunk-FMBD7UC4-CArhG5bz.js → chunk-FMBD7UC4-mPSIpSeS.js} +1 -1
  13. package/dist/assets/{chunk-ND2GUHAM-BMqJF8Yq.js → chunk-ND2GUHAM-gkRIeuOg.js} +1 -1
  14. package/dist/assets/{chunk-QZHKN3VN-xEVO-BnU.js → chunk-QZHKN3VN-DJ7h7c2i.js} +1 -1
  15. package/dist/assets/classDiagram-4FO5ZUOK-7kNnlTD1.js +1 -0
  16. package/dist/assets/classDiagram-v2-Q7XG4LA2-7kNnlTD1.js +1 -0
  17. package/dist/assets/{cose-bilkent-S5V4N54A-D8YuuIpy.js → cose-bilkent-S5V4N54A-BC5rkVLI.js} +1 -1
  18. package/dist/assets/{dagre-BM42HDAG-DAFO7F2u.js → dagre-BM42HDAG-DBwRZbPz.js} +1 -1
  19. package/dist/assets/{diagram-2AECGRRQ-BwnnQC9d.js → diagram-2AECGRRQ-CmljsTYt.js} +1 -1
  20. package/dist/assets/{diagram-5GNKFQAL-DBEb2BhO.js → diagram-5GNKFQAL-Pcdh-Hev.js} +1 -1
  21. package/dist/assets/{diagram-KO2AKTUF-BMIv-hqj.js → diagram-KO2AKTUF-CrEqfa_s.js} +1 -1
  22. package/dist/assets/{diagram-LMA3HP47-B_BQfoht.js → diagram-LMA3HP47-pmYhkUAj.js} +1 -1
  23. package/dist/assets/{diagram-OG6HWLK6-CGX5WRJy.js → diagram-OG6HWLK6-1mWNdTnP.js} +1 -1
  24. package/dist/assets/{erDiagram-TEJ5UH35-BA3HXlzl.js → erDiagram-TEJ5UH35-BuNJLn2I.js} +1 -1
  25. package/dist/assets/{flowDiagram-I6XJVG4X-DqCc80Gc.js → flowDiagram-I6XJVG4X-D84i8zUb.js} +1 -1
  26. package/dist/assets/{ganttDiagram-6RSMTGT7-2JYlowTb.js → ganttDiagram-6RSMTGT7-DW_1tH7v.js} +1 -1
  27. package/dist/assets/{gitGraphDiagram-PVQCEYII-DeFaU-B5.js → gitGraphDiagram-PVQCEYII-Mo99IrfD.js} +1 -1
  28. package/dist/assets/{index-BUEdsF82.js → index-DfocQEE0.js} +2 -2
  29. package/dist/assets/index-vDKys15R.css +1 -0
  30. package/dist/assets/{infoDiagram-5YYISTIA-Denratb4.js → infoDiagram-5YYISTIA-BJvJda4j.js} +1 -1
  31. package/dist/assets/{ishikawaDiagram-YF4QCWOH-DmYnlEGM.js → ishikawaDiagram-YF4QCWOH-Dl7ib9vb.js} +1 -1
  32. package/dist/assets/{journeyDiagram-JHISSGLW-XCrNbncG.js → journeyDiagram-JHISSGLW-DmgxLRyA.js} +1 -1
  33. package/dist/assets/{kanban-definition-UN3LZRKU-tdCgL_BJ.js → kanban-definition-UN3LZRKU-DV6cN2Fc.js} +1 -1
  34. package/dist/assets/{linear-CQCcdMrA.js → linear-ChPnBFTg.js} +1 -1
  35. package/dist/assets/{mindmap-definition-RKZ34NQL-DtZJzpjH.js → mindmap-definition-RKZ34NQL-C0dgdrrD.js} +1 -1
  36. package/dist/assets/{pieDiagram-4H26LBE5-BFeercFA.js → pieDiagram-4H26LBE5-N-HzAPPi.js} +1 -1
  37. package/dist/assets/{quadrantDiagram-W4KKPZXB-BCX6XEvx.js → quadrantDiagram-W4KKPZXB-YEX6PyFG.js} +1 -1
  38. package/dist/assets/{requirementDiagram-4Y6WPE33-Cbby1ELs.js → requirementDiagram-4Y6WPE33-CCpgQqwO.js} +1 -1
  39. package/dist/assets/{sankeyDiagram-5OEKKPKP-CoGrYNGu.js → sankeyDiagram-5OEKKPKP-BSUvtggj.js} +1 -1
  40. package/dist/assets/{sequenceDiagram-3UESZ5HK-Ppn3RRuA.js → sequenceDiagram-3UESZ5HK-Dh8UHRBI.js} +1 -1
  41. package/dist/assets/{stateDiagram-AJRCARHV-z3isZwb4.js → stateDiagram-AJRCARHV-DKvZ4fLX.js} +1 -1
  42. package/dist/assets/stateDiagram-v2-BHNVJYJU-DF_adEfb.js +1 -0
  43. package/dist/assets/{timeline-definition-PNZ67QCA-MzpbvgHe.js → timeline-definition-PNZ67QCA-qunNDnlH.js} +1 -1
  44. package/dist/assets/{vennDiagram-CIIHVFJN-Bsvlh8Xw.js → vennDiagram-CIIHVFJN-D5a-gmIU.js} +1 -1
  45. package/dist/assets/{wardley-L42UT6IY-VWT3qdBy.js → wardley-L42UT6IY-akIUfw-F.js} +1 -1
  46. package/dist/assets/{wardleyDiagram-YWT4CUSO-DhsQvXBN.js → wardleyDiagram-YWT4CUSO-R1zmVC27.js} +1 -1
  47. package/dist/assets/{xychartDiagram-2RQKCTM6-DvmK5-UN.js → xychartDiagram-2RQKCTM6-Do2YVGeZ.js} +1 -1
  48. package/dist/index.html +2 -2
  49. package/lib/build-history.js +62 -0
  50. package/lib/build.js +27 -0
  51. package/package.json +1 -1
  52. package/server/build-routes.js +14 -0
  53. package/dist/assets/App-CpdZk3aa.js +0 -681
  54. package/dist/assets/channel-llllBK4h.js +0 -1
  55. package/dist/assets/classDiagram-4FO5ZUOK-BEiB5jyR.js +0 -1
  56. package/dist/assets/classDiagram-v2-Q7XG4LA2-BEiB5jyR.js +0 -1
  57. package/dist/assets/index-jqUffYBL.css +0 -1
  58. package/dist/assets/stateDiagram-v2-BHNVJYJU-CU-EnGpI.js +0 -1
@@ -1,681 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-BM42HDAG-DAFO7F2u.js","assets/graph-CAnANduQ.js","assets/layout-DGIYPm2g.js","assets/mobile-DAxPPzok.js","assets/mobile-5PV1E6OC.css","assets/index-BUEdsF82.js","assets/index-jqUffYBL.css","assets/graph-BqpC5g-G.js","assets/cose-bilkent-S5V4N54A-D8YuuIpy.js","assets/c4Diagram-AAUBKEIU-BhXknY2V.js","assets/chunk-ND2GUHAM-BMqJF8Yq.js","assets/flowDiagram-I6XJVG4X-DqCc80Gc.js","assets/chunk-FMBD7UC4-CArhG5bz.js","assets/chunk-55IACEB6-BPBvBDq8.js","assets/chunk-2J33WTMH-D9br4z7_.js","assets/channel-llllBK4h.js","assets/erDiagram-TEJ5UH35-BA3HXlzl.js","assets/gitGraphDiagram-PVQCEYII-DeFaU-B5.js","assets/chunk-4BX2VUAB-BUm--OlR.js","assets/chunk-QZHKN3VN-xEVO-BnU.js","assets/wardley-L42UT6IY-VWT3qdBy.js","assets/ganttDiagram-6RSMTGT7-2JYlowTb.js","assets/linear-CQCcdMrA.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-5YYISTIA-Denratb4.js","assets/pieDiagram-4H26LBE5-BFeercFA.js","assets/arc-DIXitrAQ.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-W4KKPZXB-BCX6XEvx.js","assets/xychartDiagram-2RQKCTM6-DvmK5-UN.js","assets/requirementDiagram-4Y6WPE33-Cbby1ELs.js","assets/sequenceDiagram-3UESZ5HK-Ppn3RRuA.js","assets/classDiagram-4FO5ZUOK-BEiB5jyR.js","assets/chunk-727SXJPM-D-k0AVv9.js","assets/classDiagram-v2-Q7XG4LA2-BEiB5jyR.js","assets/stateDiagram-AJRCARHV-z3isZwb4.js","assets/chunk-AQP2D5EJ-DbrnuPhd.js","assets/stateDiagram-v2-BHNVJYJU-CU-EnGpI.js","assets/journeyDiagram-JHISSGLW-XCrNbncG.js","assets/timeline-definition-PNZ67QCA-MzpbvgHe.js","assets/mindmap-definition-RKZ34NQL-DtZJzpjH.js","assets/kanban-definition-UN3LZRKU-tdCgL_BJ.js","assets/sankeyDiagram-5OEKKPKP-CoGrYNGu.js","assets/diagram-LMA3HP47-B_BQfoht.js","assets/diagram-2AECGRRQ-BwnnQC9d.js","assets/blockDiagram-GPEHLZMM-Cl9S3jDb.js","assets/diagram-5GNKFQAL-DBEb2BhO.js","assets/architectureDiagram-3BPJPVTR-Cj7dBJg7.js","assets/diagram-KO2AKTUF-BMIv-hqj.js","assets/ishikawaDiagram-YF4QCWOH-DmYnlEGM.js","assets/vennDiagram-CIIHVFJN-Bsvlh8Xw.js","assets/diagram-OG6HWLK6-CGX5WRJy.js","assets/wardleyDiagram-YWT4CUSO-DhsQvXBN.js"])))=>i.map(i=>d[i]);
2
- var Y2=Object.defineProperty;var G2=(t,e,r)=>e in t?Y2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ee=(t,e,r)=>G2(t,typeof e!="symbol"?e+"":e,r);import{a as v,j as c,b as Yt,d as V2,g as dd,w as Ft,e as X2,f as Vi,h as K2}from"./mobile-DAxPPzok.js";import{c as jt,a as st,b as Q2,u as _s,P as Es,d as rc,e as Z2,f as oi,g as ei,h as J2,I as pd,X as gn,_ as Kt,B as Ot,i as Rx,D as fd,j as md,k as gd,l as xd,m as zx,r as tS,n as eS,o as Wx,p as rS}from"./index-BUEdsF82.js";import{c as Vo,b as qx,f as nS}from"./graph-BqpC5g-G.js";/**
3
- * @license lucide-react v0.563.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const iS=[["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"}]],yd=jt("activity",iS);/**
8
- * @license lucide-react v0.563.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const sS=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],oS=jt("arrow-down-to-line",sS);/**
13
- * @license lucide-react v0.563.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const aS=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],lS=jt("arrow-left",aS);/**
18
- * @license lucide-react v0.563.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const cS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Hx=jt("arrow-right",cS);/**
23
- * @license lucide-react v0.563.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const hS=[["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"}]],uS=jt("bell",hS);/**
28
- * @license lucide-react v0.563.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const dS=[["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"}]],Xi=jt("bot",dS);/**
33
- * @license lucide-react v0.563.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */const pS=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],fS=jt("chart-no-axes-column",pS);/**
38
- * @license lucide-react v0.563.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const mS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Xo=jt("check",mS);/**
43
- * @license lucide-react v0.563.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */const gS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ko=jt("chevron-down",gS);/**
48
- * @license lucide-react v0.563.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const xS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ux=jt("chevron-left",xS);/**
53
- * @license lucide-react v0.563.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */const yS=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fs=jt("chevron-right",yS);/**
58
- * @license lucide-react v0.563.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const bS=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Yx=jt("chevron-up",bS);/**
63
- * @license lucide-react v0.563.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const CS=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],kS=jt("circle-check-big",CS);/**
68
- * @license lucide-react v0.563.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const vS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Gx=jt("circle-check",vS);/**
73
- * @license lucide-react v0.563.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const wS=[["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"}]],SS=jt("circle-x",wS);/**
78
- * @license lucide-react v0.563.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const TS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_S=jt("circle",TS);/**
83
- * @license lucide-react v0.563.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const ES=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Vx=jt("clock",ES);/**
88
- * @license lucide-react v0.563.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const jS=[["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"}]],bd=jt("cpu",jS);/**
93
- * @license lucide-react v0.563.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const NS=[["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"}]],Xx=jt("eye",NS);/**
98
- * @license lucide-react v0.563.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const BS=[["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"}]],bi=jt("file-text",BS);/**
103
- * @license lucide-react v0.563.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const LS=[["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"}]],AS=jt("folder-open",LS);/**
108
- * @license lucide-react v0.563.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const MS=[["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"}]],Cd=jt("folder",MS);/**
113
- * @license lucide-react v0.563.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const IS=[["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"}]],FS=jt("funnel",IS);/**
118
- * @license lucide-react v0.563.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const DS=[["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"}]],Kx=jt("git-branch",DS);/**
123
- * @license lucide-react v0.563.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const PS=[["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"}]],OS=jt("inbox",PS);/**
128
- * @license lucide-react v0.563.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const $S=[["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"}]],RS=jt("layers",$S);/**
133
- * @license lucide-react v0.563.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const zS=[["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"}]],WS=jt("layout-dashboard",zS);/**
138
- * @license lucide-react v0.563.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const qS=[["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"}]],hi=jt("lightbulb",qS);/**
143
- * @license lucide-react v0.563.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const HS=[["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"}]],US=jt("link-2",HS);/**
148
- * @license lucide-react v0.563.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const YS=[["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"}]],GS=jt("list",YS);/**
153
- * @license lucide-react v0.563.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const VS=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Qx=jt("loader-circle",VS);/**
158
- * @license lucide-react v0.563.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const XS=[["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"}]],nc=jt("message-square",XS);/**
163
- * @license lucide-react v0.563.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const KS=[["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"}]],QS=jt("moon",KS);/**
168
- * @license lucide-react v0.563.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const ZS=[["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"}]],JS=jt("network",ZS);/**
173
- * @license lucide-react v0.563.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const tT=[["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"}]],Zx=jt("pencil",tT);/**
178
- * @license lucide-react v0.563.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const eT=[["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"}]],rT=jt("play",eT);/**
183
- * @license lucide-react v0.563.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const nT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Jx=jt("plus",nT);/**
188
- * @license lucide-react v0.563.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const iT=[["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"}]],ll=jt("refresh-cw",iT);/**
193
- * @license lucide-react v0.563.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const sT=[["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"}]],oT=jt("save",sT);/**
198
- * @license lucide-react v0.563.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const aT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Wn=jt("search",aT);/**
203
- * @license lucide-react v0.563.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const lT=[["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"}]],kd=jt("send",lT);/**
208
- * @license lucide-react v0.563.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const cT=[["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"}]],js=jt("shield-check",cT);/**
213
- * @license lucide-react v0.563.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const hT=[["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"}]],uT=jt("shield",hT);/**
218
- * @license lucide-react v0.563.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const dT=[["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"}]],t0=jt("skip-forward",dT);/**
223
- * @license lucide-react v0.563.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const pT=[["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"}]],tf=jt("sparkles",pT);/**
228
- * @license lucide-react v0.563.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const fT=[["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"}]],mT=jt("star",fT);/**
233
- * @license lucide-react v0.563.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const gT=[["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"}]],xT=jt("sun",gT);/**
238
- * @license lucide-react v0.563.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const yT=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],bT=jt("terminal",yT);/**
243
- * @license lucide-react v0.563.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const CT=[["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"}]],ef=jt("trash-2",CT);/**
248
- * @license lucide-react v0.563.0 - ISC
249
- *
250
- * This source code is licensed under the ISC license.
251
- * See the LICENSE file in the root directory of this source tree.
252
- */const kT=[["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"}]],ic=jt("triangle-alert",kT);/**
253
- * @license lucide-react v0.563.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */const vT=[["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"}]],vd=jt("user",vT);/**
258
- * @license lucide-react v0.563.0 - ISC
259
- *
260
- * This source code is licensed under the ISC license.
261
- * See the LICENSE file in the root directory of this source tree.
262
- */const wT=[["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"}]],ST=jt("workflow",wT);/**
263
- * @license lucide-react v0.563.0 - ISC
264
- *
265
- * This source code is licensed under the ISC license.
266
- * See the LICENSE file in the root directory of this source tree.
267
- */const TT=[["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"}]],cl=jt("zap",TT),fr={feature:"#3b82f6",bug:"#ef4444",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},Fn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b",superseded:"#6b5b8a"},_T=["planned","ready","in_progress","review","complete","blocked","parked","killed","superseded"],e0=["vision","specification","planning","implementation","verification","release"],hl={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},wd=["Untested","Low","Moderate","High","Crystallized"],we={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"},r0={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},n0=["claude","codex","gemini","human","unassigned"],rf={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"},Fc=[{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}],pn={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 Ao(t,e){const r=pn[t.stepId]??(t.fromPhase&&t.toPhase?`${we[t.fromPhase]??t.fromPhase} → ${we[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const nf={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"}},ET={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%)"},sf={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},jT={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"},NT={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"}},BT={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},of=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],LT={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},AT={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},MT={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},af={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))"},i0={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 IT(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function FT(t){return`violations (${Array.isArray(t)?t.length:0})`}function DT(t){return t?"▾":"▸"}function PT({violations:t=[],expanded:e,onToggle:r}){const[n,i]=v.useState(!1),s=e!==void 0,o=s?e:n,a=IT(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const h=DT(o),u=FT(t);return c.jsxs("div",{style:{background:"hsl(38 90% 50% / 0.06)",borderLeft:"2px solid hsl(38 90% 50% / 0.3)",borderRadius:"3px",marginTop:"4px"},children:[c.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:[c.jsx("span",{style:{opacity:.7},children:h}),c.jsx("span",{children:u})]}),a==="expanded"&&c.jsx("ul",{style:{listStyle:"none",margin:0,padding:"0 8px 6px 16px"},children:t.map((d,f)=>c.jsx("li",{style:{color:"hsl(38 50% 60%)",fontSize:"10px",fontFamily:"monospace",lineHeight:"1.5"},children:d},f))})]})}function OT({msg:t,mode:e="stream"}){const[r,n]=v.useState(!1),i=t.retries??0,s=t.violations??[],o=s.length>0;return e==="strip"?i===0?null:c.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:i}):c.jsxs("div",{className:"text-[10px] py-0.5",children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsxs("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.7},children:["step complete -- ",t.stepId]}),i>0&&c.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?c.jsxs("span",{onClick:()=>n(a=>!a),style:{color:"hsl(38 90% 60%)",fontSize:"10px",cursor:"pointer"},children:[s.length," ",s.length===1?"violation":"violations"]}):c.jsx("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.4,fontSize:"10px"},children:"✓ checks passed"})]}),r&&o&&c.jsx(PT,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const $T=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,lf=20;function RT({summary:t,output:e}){const[r,n]=v.useState(!1),[i,s]=v.useState(!1),o=e?$T.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
268
- `):[],h=l.length>lf,u=r&&!i&&h?l.slice(0,lf):l,d=o?"hsl(var(--destructive, 0 84% 60%))":"hsl(215 20% 20%)";return a?c.jsxs("div",{style:{marginLeft:8,borderLeft:`1px solid ${d}`,paddingLeft:8,marginTop:2},children:[c.jsxs("div",{onClick:()=>n(f=>!f),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:[c.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),t]}),r&&c.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(`
269
- `),!i&&h&&c.jsxs(c.Fragment,{children:[`
270
- `,c.jsxs("span",{onClick:f=>{f.stopPropagation(),s(!0)},style:{color:"hsl(var(--accent))",cursor:"pointer",textDecoration:"underline",fontSize:"10px"},children:["Show all (",l.length," lines)"]})]})]})]}):c.jsx("div",{style:{marginLeft:8,opacity:.6,fontSize:"10px",padding:"2px 0",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:t})}const zT={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 WT(t){return ET[zT[t]||"thinking"]}function qT(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function HT(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function UT({input:t}){const[e,r]=v.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 c.jsxs("div",{className:"mt-1",children:[c.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:[c.jsx("span",{style:{opacity:.6},children:e?"▾":"▸"}),!e&&c.jsxs("span",{style:{opacity:.6},children:[n,": ",s]}),e&&c.jsx("span",{style:{opacity:.6},children:"collapse"})]}),e&&c.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 YT({block:t}){const e=WT(t.name);return c.jsxs("div",{className:"rounded px-2 py-1.5 my-1",style:{background:"hsl(var(--muted) / 0.3)",borderLeft:`2px solid ${e}`},children:[c.jsx("div",{className:"flex items-center gap-1.5",children:c.jsx("span",{className:"text-[11px] font-semibold font-mono",style:{color:e},children:t.name})}),c.jsx(UT,{input:t.input})]})}function GT({msg:t}){var r;const e=((r=t.message)==null?void 0:r.content)??[];return c.jsx("div",{className:"flex flex-col gap-1 py-1",children:e.map((n,i)=>{if(n.type==="text")return c.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 c.jsxs(Yt.Fragment,{children:[c.jsx(YT,{block:n}),s&&t._toolResult&&c.jsx(RT,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function VT({msg:t}){const e=t.subtype!=="success",r=e?"hsl(var(--destructive))":"hsl(var(--success, 142 60% 50%))";return c.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:[c.jsx("span",{children:e?"✗ error":"✓ done"}),!e&&t.num_turns!=null&&c.jsxs("span",{style:{color:"hsl(var(--muted-foreground))"},children:[t.num_turns," turn",t.num_turns!==1?"s":""]}),t.duration_ms!=null&&c.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:qT(t.duration_ms)}),t.total_cost_usd!=null&&c.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:HT(t.total_cost_usd)}),e&&t.errors&&c.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function XT({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:c.jsx("div",{className:"flex justify-end py-1",children:c.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 KT({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 c.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:[c.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 c.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-3 flex-wrap",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:[c.jsxs("span",{children:["session ",(e=t.session_id)==null?void 0:e.slice(0,8)]}),c.jsx("span",{children:t.model}),c.jsx("span",{children:t.permissionMode})]});if(t.type==="system"&&t.subtype==="connected")return c.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 c.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 c.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-2",style:{color:"hsl(var(--muted-foreground))"},children:[c.jsxs("span",{children:["step ",t.stepNum,"/",t.totalSteps]}),c.jsx("span",{className:"font-mono",children:t.stepId}),c.jsx("span",{style:{opacity:.5},children:t.agent})]});if(t.type==="system"&&t.subtype==="build_step_done")return c.jsx(OT,{msg:t,mode:"stream"});if(t.type==="system"&&t.subtype==="build_gate")return c.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 c.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 c.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:n},children:["build ",t.status," -- ",t.featureCode]})}return t.type==="assistant"?c.jsx(GT,{msg:t}):t.type==="user"?c.jsx(XT,{msg:t}):t.type==="result"?c.jsx(VT,{msg:t}):t.type==="error"?c.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 QT({onSend:t,disabled:e=!1,placeholder:r="Message Claude…"}){const n=v.useRef(null);v.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 c.jsxs("div",{className:"flex items-end gap-2 px-3 py-2",style:{borderTop:"1px solid hsl(var(--border))"},children:[c.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"}}),c.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 s0="compose:verboseStream",ul={verboseStream:!1};function o0(){return ul.verboseStream}function ZT(t,e){ul.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(s0,String(ul.verboseStream))}catch{}}function JT(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(s0);r!==null&&(ul.verboseStream=r==="true")}catch{}}function t_(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 e_(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(h=>h.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 a0=parseInt("4002",10),r_="compose-agent-session",cf=500,n_=8,i_=2e3,l0=3e4,hf={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"},s_={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};JT();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 o_(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=hf[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=hf[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 Dc(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>n_&&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 uf(){const t=Z.sourceStatus.build,e=Z.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?Dc(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?Dc(t.status,t.tool,t.category):Z._idleTimer=setTimeout(()=>{Z._idleTimer=null,Dc("idle",null,null)},i_)}function Hh(t){var i,s,o,a,l,h;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"&&((h=(l=Z.parallelTasks)==null?void 0:l.tasks)!=null&&h[t.stepId])&&(Z.parallelTasks.active=Math.max(0,Z.parallelTasks.active-1),Z.parallelTasks.failed++,Z.parallelTasks.tasks[t.stepId]="failed");const e=o_(t);if(e){const u=e._source==="build"?"build":"interactive";Z.sourceStatus[u]=e,e.status==="idle"?(Z.parallelTasks=null,uf()):(Z._idleTimer&&(clearTimeout(Z._idleTimer),Z._idleTimer=null),uf())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(Z.sessionId=t.session_id,sessionStorage.setItem(r_,t.session_id));const{include:r,msg:n}=t_(t,o0());r&&(Z.messages=[...Z.messages,n],Z.messages.length>cf&&(Z.messages=Z.messages.slice(-cf)),Z.onMessagesChange&&Z.onMessagesChange(Z.messages))}function Pc(){if(Z.es)return;const t=`${window.location.protocol}//${window.location.hostname}:${a0}/api/agent/stream`,e=V2({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)Hh(i);return}Hh(r)},maxBackoffMs:8e3,maxRetries:5,stallTimeoutMs:l0});Z.es=e}async function Oc(t,e){const r=await fetch(`${window.location.protocol}//${window.location.hostname}:${a0}${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 df(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 c0(){var L;const[t,e]=v.useState(Z.connected),[r,n]=v.useState(Z.messages),[i,s]=v.useState({status:Z.agentStatus,tool:Z.agentTool,category:Z.agentCategory,activityLog:Z.activityLog,currentActivity:Z.currentActivity}),[o,a]=v.useState(!1),[l,h]=v.useState(null),[u,d]=v.useState({error:Z.streamError,retryInfo:Z.retryInfo,stalled:Z.stalled}),f=v.useRef(null),p=v.useRef(null),m=v.useRef(!1),x=r.length===0||r.every(I=>I.type==="system"&&(I.subtype==="init"||I.subtype==="connected"));v.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}),[]),v.useEffect(()=>{Pc()},[]);const g=v.useCallback(()=>{const I=p.current;if(!I)return;const E=I.scrollHeight-I.scrollTop-I.clientHeight<48;m.current=!E},[]);v.useEffect(()=>{var I;m.current||(I=f.current)==null||I.scrollIntoView({behavior:"smooth"})},[r.length]),v.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){h(null);return}const I=i.currentActivity.startTime,E=()=>h(Date.now()-I);E();const F=setInterval(E,1e3);return()=>clearInterval(F)},[i.status,(L=i.currentActivity)==null?void 0:L.startTime]);const y=v.useCallback(async I=>{a(!0);const E=I.match(/[A-Z]+-\d+/);E&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:E[0]}}));try{x||!Z.sessionId?await Oc("/api/agent/session",{prompt:I}):await Oc("/api/agent/message",{prompt:I})}catch(F){Hh({type:"error",message:`Failed to send: ${F.message}`})}finally{a(!1)}},[x]),C=v.useCallback(async()=>{try{await Oc("/api/agent/interrupt",{})}catch{}},[]),b=t&&(i.status==="working"||o),S=t?b?"#fbbf24":"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))",_=i.category?s_[i.category]:null,w=t?b?_||"working":"ready":"offline",B=i.activityLog||[];return c.jsxs("div",{className:"relative w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[c.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:[c.jsx("div",{className:"flex items-center gap-0.5",children:t&&B.length>0&&B.slice(-5).map((I,E)=>c.jsx("div",{className:"h-1 rounded-full",title:`${I.tool||"thinking"} — ${df(I.duration)}`,style:{width:Math.max(6,Math.min(20,(I.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+E/5*.5}},E))}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[b&&c.jsx("button",{onClick:C,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"}),c.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:S,animation:b?"pulse 1.5s ease-in-out infinite":"none"}}),c.jsx("span",{className:"text-[10px] uppercase tracking-wider",style:{color:b?"#fbbf24":"hsl(var(--muted-foreground))"},children:w}),b&&i.tool&&c.jsx("span",{className:"text-[10px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:i.tool}),b&&l!=null&&c.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:df(l)})]})]}),c.jsxs("div",{ref:p,onScroll:g,className:"flex-1 min-h-0 overflow-y-auto px-3 py-2",style:{scrollBehavior:"smooth"},children:[r.length===0&&c.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 opacity-40",children:[c.jsx("span",{className:"text-2xl",children:"⬡"}),c.jsx("span",{className:"text-xs uppercase tracking-widest",style:{color:"hsl(var(--muted-foreground))"},children:t?"ready":"connecting…"})]}),e_(r).map((I,E)=>c.jsx(KT,{msg:I},I.uuid||E)),c.jsx("div",{ref:f})]}),!t&&c.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:c.jsxs("div",{className:"flex flex-col items-center gap-3",role:"status","aria-live":"polite",children:[c.jsx("div",{className:"w-5 h-5 rounded-full animate-spin",style:{border:"2px solid hsl(var(--accent) / 0.2)",borderTopColor:"hsl(var(--accent))"}}),c.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&&c.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--destructive))"},children:u.error}),!Z.es&&u.error&&c.jsx("button",{onClick:()=>{Z.streamError=null,Z.retryInfo=null,Z.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),Pc()},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)&&c.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?c.jsxs(c.Fragment,{children:[c.jsxs("span",{children:["No data received for ",l0/1e3,"s — connection may be stalled."]}),c.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}),Pc()},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"})]}):c.jsx("span",{children:u.error})}),c.jsx(QT,{onSend:y,disabled:b||!t,placeholder:b?"Working…":"Message Claude…"})]})}function a_(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const l_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h_={};function pf(t,e){return(h_.jsx?c_:l_).test(t)}const u_=/[ \t\n\f\r]/g;function d_(t){return typeof t=="object"?t.type==="text"?ff(t.value):!1:ff(t)}function ff(t){return t.replace(u_,"")===""}class Qo{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Qo.prototype.normal={};Qo.prototype.property={};Qo.prototype.space=void 0;function h0(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new Qo(r,n,e)}function Uh(t){return t.toLowerCase()}class mr{constructor(e,r){this.attribute=r,this.property=e}}mr.prototype.attribute="";mr.prototype.booleanish=!1;mr.prototype.boolean=!1;mr.prototype.commaOrSpaceSeparated=!1;mr.prototype.commaSeparated=!1;mr.prototype.defined=!1;mr.prototype.mustUseProperty=!1;mr.prototype.number=!1;mr.prototype.overloadedBoolean=!1;mr.prototype.property="";mr.prototype.spaceSeparated=!1;mr.prototype.space=void 0;let p_=0;const Dt=Ci(),_e=Ci(),Yh=Ci(),at=Ci(),oe=Ci(),ai=Ci(),br=Ci();function Ci(){return 2**++p_}const Gh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dt,booleanish:_e,commaOrSpaceSeparated:br,commaSeparated:ai,number:at,overloadedBoolean:Yh,spaceSeparated:oe},Symbol.toStringTag,{value:"Module"})),$c=Object.keys(Gh);class Sd extends mr{constructor(e,r,n,i){let s=-1;if(super(e,r),mf(this,"space",i),typeof n=="number")for(;++s<$c.length;){const o=$c[s];mf(this,$c[s],(n&Gh[o])===Gh[o])}}}Sd.prototype.defined=!0;function mf(t,e,r){r&&(t[e]=r)}function Ns(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new Sd(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Uh(n)]=n,r[Uh(s.attribute)]=n}return new Qo(e,r,t.space)}const u0=Ns({properties:{ariaActiveDescendant:null,ariaAtomic:_e,ariaAutoComplete:null,ariaBusy:_e,ariaChecked:_e,ariaColCount:at,ariaColIndex:at,ariaColSpan:at,ariaControls:oe,ariaCurrent:null,ariaDescribedBy:oe,ariaDetails:null,ariaDisabled:_e,ariaDropEffect:oe,ariaErrorMessage:null,ariaExpanded:_e,ariaFlowTo:oe,ariaGrabbed:_e,ariaHasPopup:null,ariaHidden:_e,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:oe,ariaLevel:at,ariaLive:null,ariaModal:_e,ariaMultiLine:_e,ariaMultiSelectable:_e,ariaOrientation:null,ariaOwns:oe,ariaPlaceholder:null,ariaPosInSet:at,ariaPressed:_e,ariaReadOnly:_e,ariaRelevant:null,ariaRequired:_e,ariaRoleDescription:oe,ariaRowCount:at,ariaRowIndex:at,ariaRowSpan:at,ariaSelected:_e,ariaSetSize:at,ariaSort:null,ariaValueMax:at,ariaValueMin:at,ariaValueNow:at,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function d0(t,e){return e in t?t[e]:e}function p0(t,e){return d0(t,e.toLowerCase())}const f_=Ns({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ai,acceptCharset:oe,accessKey:oe,action:null,allow:null,allowFullScreen:Dt,allowPaymentRequest:Dt,allowUserMedia:Dt,alpha:Dt,alt:null,as:null,async:Dt,autoCapitalize:null,autoComplete:oe,autoFocus:Dt,autoPlay:Dt,blocking:oe,capture:null,charSet:null,checked:Dt,cite:null,className:oe,closedBy:null,colorSpace:null,cols:at,colSpan:at,command:null,commandFor:null,content:null,contentEditable:_e,controls:Dt,controlsList:oe,coords:at|ai,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dt,defer:Dt,dir:null,dirName:null,disabled:Dt,download:Yh,draggable:_e,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dt,formTarget:null,headers:oe,height:at,hidden:Yh,high:at,href:null,hrefLang:null,htmlFor:oe,httpEquiv:oe,id:null,imageSizes:null,imageSrcSet:null,inert:Dt,inputMode:null,integrity:null,is:null,isMap:Dt,itemId:null,itemProp:oe,itemRef:oe,itemScope:Dt,itemType:oe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dt,low:at,manifest:null,max:null,maxLength:at,media:null,method:null,min:null,minLength:at,multiple:Dt,muted:Dt,name:null,nonce:null,noModule:Dt,noValidate:Dt,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:Dt,optimum:at,pattern:null,ping:oe,placeholder:null,playsInline:Dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dt,referrerPolicy:null,rel:oe,required:Dt,reversed:Dt,rows:at,rowSpan:at,sandbox:oe,scope:null,scoped:Dt,seamless:Dt,selected:Dt,shadowRootClonable:Dt,shadowRootCustomElementRegistry:Dt,shadowRootDelegatesFocus:Dt,shadowRootMode:null,shadowRootSerializable:Dt,shape:null,size:at,sizes:null,slot:null,span:at,spellCheck:_e,src:null,srcDoc:null,srcLang:null,srcSet:null,start:at,step:null,style:null,tabIndex:at,target:null,title:null,translate:null,type:null,typeMustMatch:Dt,useMap:null,value:_e,width:at,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:oe,axis:null,background:null,bgColor:null,border:at,borderColor:null,bottomMargin:at,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dt,declare:Dt,event:null,face:null,frame:null,frameBorder:null,hSpace:at,leftMargin:at,link:null,longDesc:null,lowSrc:null,marginHeight:at,marginWidth:at,noResize:Dt,noHref:Dt,noShade:Dt,noWrap:Dt,object:null,profile:null,prompt:null,rev:null,rightMargin:at,rules:null,scheme:null,scrolling:_e,standby:null,summary:null,text:null,topMargin:at,valueType:null,version:null,vAlign:null,vLink:null,vSpace:at,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Dt,disablePictureInPicture:Dt,disableRemotePlayback:Dt,exportParts:ai,part:oe,prefix:null,property:null,results:at,security:null,unselectable:null},space:"html",transform:p0}),m_=Ns({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",maskType:"mask-type",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:br,accentHeight:at,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:at,amplitude:at,arabicForm:null,ascent:at,attributeName:null,attributeType:null,azimuth:at,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:at,by:null,calcMode:null,capHeight:at,className:oe,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:at,diffuseConstant:at,direction:null,display:null,dur:null,divisor:at,dominantBaseline:null,download:Dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:at,enableBackground:null,end:null,event:null,exponent:at,externalResourcesRequired:null,fill:null,fillOpacity:at,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:ai,g2:ai,glyphName:ai,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:at,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:at,horizOriginX:at,horizOriginY:at,id:null,ideographic:at,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:at,k:at,k1:at,k2:at,k3:at,k4:at,kernelMatrix:br,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:at,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:at,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:at,overlineThickness:at,paintOrder:null,panose1:null,path:null,pathLength:at,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:oe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:at,pointsAtY:at,pointsAtZ:at,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:br,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:br,rev:br,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:br,requiredFeatures:br,requiredFonts:br,requiredFormats:br,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:at,specularExponent:at,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:at,strikethroughThickness:at,string:null,stroke:null,strokeDashArray:br,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:at,strokeOpacity:at,strokeWidth:null,style:null,surfaceScale:at,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:br,tabIndex:at,tableValues:null,target:null,targetX:at,targetY:at,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:br,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:at,underlineThickness:at,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:at,values:null,vAlphabetic:at,vMathematical:at,vectorEffect:null,vHanging:at,vIdeographic:at,version:null,vertAdvY:at,vertOriginX:at,vertOriginY:at,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:at,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:d0}),f0=Ns({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()}}),m0=Ns({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:p0}),g0=Ns({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),g_={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"},x_=/[A-Z]/g,gf=/-[a-z]/g,y_=/^data[-\w.:]+$/i;function b_(t,e){const r=Uh(e);let n=e,i=mr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&y_.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(gf,k_);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!gf.test(s)){let o=s.replace(x_,C_);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Sd}return new i(n,e)}function C_(t){return"-"+t.toLowerCase()}function k_(t){return t.charAt(1).toUpperCase()}const v_=h0([u0,f_,f0,m0,g0],"html"),Td=h0([u0,m_,f0,m0,g0],"svg");function w_(t){return t.join(" ").trim()}var ji={},Rc,xf;function S_(){if(xf)return Rc;xf=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=`
271
- `,h="/",u="*",d="",f="comment",p="declaration";function m(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var C=1,b=1;function S(O){var M=O.match(e);M&&(C+=M.length);var A=O.lastIndexOf(l);b=~A?O.length-A:b+O.length}function _(){var O={line:C,column:b};return function(M){return M.position=new w(O),I(),M}}function w(O){this.start=O,this.end={line:C,column:b},this.source=y.source}w.prototype.content=g;function B(O){var M=new Error(y.source+":"+C+":"+b+": "+O);if(M.reason=O,M.filename=y.source,M.line=C,M.column=b,M.source=g,!y.silent)throw M}function L(O){var M=O.exec(g);if(M){var A=M[0];return S(A),g=g.slice(A.length),M}}function I(){L(r)}function E(O){var M;for(O=O||[];M=F();)M!==!1&&O.push(M);return O}function F(){var O=_();if(!(h!=g.charAt(0)||u!=g.charAt(1))){for(var M=2;d!=g.charAt(M)&&(u!=g.charAt(M)||h!=g.charAt(M+1));)++M;if(M+=2,d===g.charAt(M-1))return B("End of comment missing");var A=g.slice(2,M-2);return b+=2,S(A),g=g.slice(M),b+=2,O({type:f,comment:A})}}function z(){var O=_(),M=L(n);if(M){if(F(),!L(i))return B("property missing ':'");var A=L(s),P=O({type:p,property:x(M[0].replace(t,d)),value:A?x(A[0].replace(t,d)):d});return L(o),P}}function W(){var O=[];E(O);for(var M;M=z();)M!==!1&&(O.push(M),E(O));return O}return I(),W()}function x(g){return g?g.replace(a,d):d}return Rc=m,Rc}var yf;function T_(){if(yf)return ji;yf=1;var t=ji&&ji.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ji,"__esModule",{value:!0}),ji.default=r;const e=t(S_());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:h,value:u}=l;a?i(h,u,l):u&&(s=s||{},s[h]=u)}),s}return ji}var Hs={},bf;function __(){if(bf)return Hs;bf=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(h){return!h||r.test(h)||t.test(h)},o=function(h,u){return u.toUpperCase()},a=function(h,u){return"".concat(u,"-")},l=function(h,u){return u===void 0&&(u={}),s(h)?h:(h=h.toLowerCase(),u.reactCompat?h=h.replace(i,a):h=h.replace(n,a),h.replace(e,o))};return Hs.camelCase=l,Hs}var Us,Cf;function E_(){if(Cf)return Us;Cf=1;var t=Us&&Us.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(T_()),r=__();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,Us=n,Us}var j_=E_();const N_=dd(j_),x0=y0("end"),_d=y0("start");function y0(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 B_(t){const e=_d(t),r=x0(t);if(e&&r)return{start:e,end:r}}function Co(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?kf(t.position):"start"in t||"end"in t?kf(t):"line"in t||"column"in t?Vh(t):""}function Vh(t){return vf(t&&t.line)+":"+vf(t&&t.column)}function kf(t){return Vh(t&&t.start)+"-"+Vh(t&&t.end)}function vf(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=Co(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 Ed={}.hasOwnProperty,L_=new Map,A_=/[A-Z]/g,M_=new Set(["table","tbody","thead","tfoot","tr"]),I_=new Set(["td","th"]),b0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function F_(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=q_(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=W_(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"?Td:v_,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=C0(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function C0(t,e,r){if(e.type==="element")return D_(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return P_(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return $_(t,e,r);if(e.type==="mdxjsEsm")return O_(t,e);if(e.type==="root")return R_(t,e,r);if(e.type==="text")return z_(t,e)}function D_(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Td,t.schema=i),t.ancestors.push(e);const s=v0(t,e.tagName,!1),o=H_(t,e);let a=Nd(t,e);return M_.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!d_(l):!0})),k0(t,o,s,e),jd(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function P_(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)}Mo(t,e.position)}function O_(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Mo(t,e.position)}function $_(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=Td,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:v0(t,e.name,!0),o=U_(t,e),a=Nd(t,e);return k0(t,o,s,e),jd(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function R_(t,e,r){const n={};return jd(n,Nd(t,e)),t.create(e,t.Fragment,n,r)}function z_(t,e){return e.value}function k0(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function jd(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function W_(t,e,r){return n;function n(i,s,o,a){const h=Array.isArray(o.children)?r:e;return a?h(s,o,a):h(s,o)}}function q_(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=_d(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 H_(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&Ed.call(e.properties,i)){const s=Y_(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&I_.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 U_(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 Mo(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 Mo(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Nd(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:L_;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 h=i.get(l)||0;o=l+"-"+h,i.set(l,h+1)}}const a=C0(t,s,o);a!==void 0&&r.push(a)}return r}function Y_(t,e,r){const n=b_(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?a_(r):w_(r)),n.property==="style"){let i=typeof r=="object"?r:G_(t,String(r));return t.stylePropertyNameCase==="css"&&(i=V_(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?g_[n.property]||n.property:n.attribute,r]}}function G_(t,e){try{return N_(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=b0+"#cannot-parse-style-attribute",i}}function v0(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=pf(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=pf(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return Ed.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Mo(t)}function Mo(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=b0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function V_(t){const e={};let r;for(r in t)Ed.call(t,r)&&(e[X_(r)]=t[r]);return e}function X_(t){let e=t.replace(A_,K_);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function K_(t){return"-"+t.toLowerCase()}const zc={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"]},Q_={};function Bd(t,e){const r=Q_,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return w0(t,n,i)}function w0(t,e,r){if(Z_(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 wf(t.children,e,r)}return Array.isArray(t)?wf(t,e,r):""}function wf(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=w0(t[i],e,r);return n.join("")}function Z_(t){return!!(t&&typeof t=="object")}const Sf=document.createElement("i");function Ld(t){const e="&"+t+";";Sf.innerHTML=e;const r=Sf.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function Cr(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 _r(t,e){return t.length>0?(Cr(t,t.length,0,e),t):e}const Tf={}.hasOwnProperty;function S0(t){const e={};let r=-1;for(;++r<t.length;)J_(e,t[r]);return e}function J_(t,e){let r;for(r in e){const i=(Tf.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Tf.call(i,o)||(i[o]=[]);const a=s[o];tE(i[o],Array.isArray(a)?a:a?[a]:[])}}}function tE(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);Cr(t,0,0,n)}function T0(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 Or(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const er=qn(/[A-Za-z]/),Ge=qn(/[\dA-Za-z]/),eE=qn(/[#-'*+\--9=?A-Z^-~]/);function dl(t){return t!==null&&(t<32||t===127)}const Xh=qn(/\d/),rE=qn(/[\dA-Fa-f]/),nE=qn(/[!-/:-@[-`{-~]/);function Nt(t){return t!==null&&t<-2}function le(t){return t!==null&&(t<0||t===32)}function Vt(t){return t===-2||t===-1||t===32}const sc=qn(new RegExp("\\p{P}|\\p{S}","u")),ui=qn(/\s/);function qn(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Bs(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&Ge(t.charCodeAt(r+1))&&Ge(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 Qt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Vt(l)?(t.enter(r),a(l)):e(l)}function a(l){return Vt(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const iE={tokenize:sE};function sE(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"),Qt(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 Nt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const oE={tokenize:aE},_f={tokenize:lE};function aE(t){const e=this,r=[];let n=0,i,s,o;return a;function a(b){if(n<r.length){const S=r[n];return e.containerState=S[1],t.attempt(S[0].continuation,l,h)(b)}return h(b)}function l(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&C();const S=e.events.length;let _=S,w;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){w=e.events[_][1].end;break}y(n);let B=S;for(;B<e.events.length;)e.events[B][1].end={...w},B++;return Cr(e.events,_+1,0,e.events.slice(S)),e.events.length=B,h(b)}return a(b)}function h(b){if(n===r.length){if(!i)return f(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(_f,u,d)(b)}function u(b){return i&&C(),y(n),f(b)}function d(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,m(b)}function f(b){return e.containerState={},t.attempt(_f,p,m)(b)}function p(b){return n++,r.push([e.currentConstruct,e.containerState]),f(b)}function m(b){if(b===null){i&&C(),y(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(b)}function x(b){if(b===null){g(t.exit("chunkFlow"),!0),y(0),t.consume(b);return}return Nt(b)?(t.consume(b),g(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(b),x)}function g(b,S){const _=e.sliceStream(b);if(S&&_.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(_),e.parser.lazy[b.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 B=e.events.length;let L=B,I,E;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(I){E=e.events[L][1].end;break}I=!0}for(y(n),w=B;w<e.events.length;)e.events[w][1].end={...E},w++;Cr(e.events,L+1,0,e.events.slice(B)),e.events.length=w}}function y(b){let S=r.length;for(;S-- >b;){const _=r[S];e.containerState=_[1],_[0].exit.call(e,t)}r.length=b}function C(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function lE(t,e,r){return Qt(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||le(t)||ui(t))return 1;if(sc(t))return 2}function oc(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 Kh={name:"attention",resolveAll:cE,tokenize:hE};function cE(t,e){let r=-1,n,i,s,o,a,l,h,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},f={...t[r][1].start};Ef(d,-l),Ef(f,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:f},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},h=[],t[n][1].end.offset-t[n][1].start.offset&&(h=_r(h,[["enter",t[n][1],e],["exit",t[n][1],e]])),h=_r(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=_r(h,oc(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),h=_r(h,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,h=_r(h,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,Cr(t,n-1,r-n+3,h),r=n+h.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function hE(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 h=t.exit("attentionSequence"),u=ms(l),d=!u||u===2&&i||r.includes(l),f=!i||i===2&&u||r.includes(n);return h._open=!!(s===42?d:d&&(i||!f)),h._close=!!(s===42?f:f&&(u||!d)),e(l)}}function Ef(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const uE={name:"autolink",tokenize:dE};function dE(t,e,r){let n=0;return i;function i(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(p){return er(p)?(t.consume(p),o):p===64?r(p):h(p)}function o(p){return p===43||p===45||p===46||Ge(p)?(n=1,a(p)):h(p)}function a(p){return p===58?(t.consume(p),n=0,l):(p===43||p===45||p===46||Ge(p))&&n++<32?(t.consume(p),a):(n=0,h(p))}function l(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||dl(p)?r(p):(t.consume(p),l)}function h(p){return p===64?(t.consume(p),u):eE(p)?(t.consume(p),h):r(p)}function u(p){return Ge(p)?d(p):r(p)}function d(p){return p===46?(t.consume(p),n=0,u):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):f(p)}function f(p){if((p===45||Ge(p))&&n++<63){const m=p===45?f:d;return t.consume(p),m}return r(p)}}const Zo={partial:!0,tokenize:pE};function pE(t,e,r){return n;function n(s){return Vt(s)?Qt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Nt(s)?e(s):r(s)}}const _0={continuation:{tokenize:mE},exit:gE,name:"blockQuote",tokenize:fE};function fE(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 Vt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function mE(t,e,r){const n=this;return i;function i(o){return Vt(o)?Qt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(_0,e,r)(o)}}function gE(t){t.exit("blockQuote")}const E0={name:"characterEscape",tokenize:xE};function xE(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 nE(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const j0={name:"characterReference",tokenize:yE};function yE(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"),h):(t.enter("characterReferenceValue"),s=31,o=Ge,u(d))}function h(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=rE,u):(t.enter("characterReferenceValue"),s=7,o=Xh,u(d))}function u(d){if(d===59&&i){const f=t.exit("characterReferenceValue");return o===Ge&&!Ld(n.sliceSerialize(f))?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 jf={partial:!0,tokenize:CE},Nf={concrete:!0,name:"codeFenced",tokenize:bE};function bE(t,e,r){const n=this,i={partial:!0,tokenize:_};let s=0,o=0,a;return l;function l(w){return h(w)}function h(w){const B=n.events[n.events.length-1];return s=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[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"),Vt(w)?Qt(t,d,"whitespace")(w):d(w))}function d(w){return w===null||Nt(w)?(t.exit("codeFencedFence"),n.interrupt?e(w):t.check(jf,x,S)(w)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||Nt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(w)):Vt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Qt(t,p,"whitespace")(w)):w===96&&w===a?r(w):(t.consume(w),f)}function p(w){return w===null||Nt(w)?d(w):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||Nt(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,S,g)(w)}function g(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),y}function y(w){return s>0&&Vt(w)?Qt(t,C,"linePrefix",s+1)(w):C(w)}function C(w){return w===null||Nt(w)?t.check(jf,x,S)(w):(t.enter("codeFlowValue"),b(w))}function b(w){return w===null||Nt(w)?(t.exit("codeFlowValue"),C(w)):(t.consume(w),b)}function S(w){return t.exit("codeFenced"),e(w)}function _(w,B,L){let I=0;return E;function E(M){return w.enter("lineEnding"),w.consume(M),w.exit("lineEnding"),F}function F(M){return w.enter("codeFencedFence"),Vt(M)?Qt(w,z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):z(M)}function z(M){return M===a?(w.enter("codeFencedFenceSequence"),W(M)):L(M)}function W(M){return M===a?(I++,w.consume(M),W):I>=o?(w.exit("codeFencedFenceSequence"),Vt(M)?Qt(w,O,"whitespace")(M):O(M)):L(M)}function O(M){return M===null||Nt(M)?(w.exit("codeFencedFence"),B(M)):L(M)}}}function CE(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 Wc={name:"codeIndented",tokenize:vE},kE={partial:!0,tokenize:wE};function vE(t,e,r){const n=this;return i;function i(h){return t.enter("codeIndented"),Qt(t,s,"linePrefix",5)(h)}function s(h){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(h):r(h)}function o(h){return h===null?l(h):Nt(h)?t.attempt(kE,o,l)(h):(t.enter("codeFlowValue"),a(h))}function a(h){return h===null||Nt(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),a)}function l(h){return t.exit("codeIndented"),e(h)}}function wE(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Nt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Qt(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):Nt(o)?i(o):r(o)}}const SE={name:"codeText",previous:_E,resolve:TE,tokenize:EE};function TE(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 _E(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function EE(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)):Nt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),h(d))}function h(d){return d===null||d===32||d===96||Nt(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),h)}function u(d){return d===96?(t.consume(d),i++,u):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",h(d))}}class jE{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&&Ys(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),Ys(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ys(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);Ys(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Ys(this.left,r.reverse())}}}function Ys(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 N0(t){const e={};let r=-1,n,i,s,o,a,l,h;const u=new jE(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,NE(u,r)),r=e[r],h=!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 Cr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!h}function NE(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=[],h={};let u,d,f=-1,p=r,m=0,x=0;const g=[x];for(;p;){for(;t.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=n.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=r;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(x=f+1,g.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){const y=a.slice(g[f],g[f+1]),C=s.pop();l.push([C,C+y.length-1]),t.splice(C,2,y)}for(l.reverse(),f=-1;++f<l.length;)h[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return h}const BE={resolve:AE,tokenize:ME},LE={partial:!0,tokenize:IE};function AE(t){return N0(t),t}function ME(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):Nt(a)?t.check(LE,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 IE(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Qt(t,s,"linePrefix")}function s(o){if(o===null||Nt(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 B0(t,e,r,n,i,s,o,a,l){const h=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),f):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 f(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"}),p(y))}function p(y){return y===62?(t.exit("chunkString"),t.exit(a),f(y)):y===null||y===60||Nt(y)?r(y):(t.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(t.consume(y),p):p(y)}function x(y){return!u&&(y===null||y===41||le(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(y)):u<h&&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 L0(t,e,r,n,i,s){const o=this;let a=0,l;return h;function h(p){return t.enter(n),t.enter(i),t.consume(p),t.exit(i),t.enter(s),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(s),t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):Nt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Nt(p)||a++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!Vt(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(t.consume(p),a++,d):d(p)}}function A0(t,e,r,n,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(t.enter(n),t.enter(i),t.consume(f),t.exit(i),o=f===40?41:f,l):r(f)}function l(f){return f===o?(t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):(t.enter(s),h(f))}function h(f){return f===o?(t.exit(s),l(o)):f===null?r(f):Nt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Qt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||Nt(f)?(t.exit("chunkString"),h(f)):(t.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(t.consume(f),u):u(f)}}function ko(t,e){let r;return n;function n(i){return Nt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Vt(i)?Qt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const FE={name:"definition",tokenize:PE},DE={partial:!0,tokenize:OE};function PE(t,e,r){const n=this;let i;return s;function s(p){return t.enter("definition"),o(p)}function o(p){return L0.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Or(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):r(p)}function l(p){return le(p)?ko(t,h)(p):h(p)}function h(p){return B0(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(DE,d,d)(p)}function d(p){return Vt(p)?Qt(t,f,"whitespace")(p):f(p)}function f(p){return p===null||Nt(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function OE(t,e,r){return n;function n(a){return le(a)?ko(t,i)(a):r(a)}function i(a){return A0(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Vt(a)?Qt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Nt(a)?e(a):r(a)}}const $E={name:"hardBreakEscape",tokenize:RE};function RE(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Nt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const zE={name:"headingAtx",resolve:WE,tokenize:qE};function WE(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"},Cr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function qE(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||le(u)?(t.exit("atxHeadingSequence"),a(u)):r(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Nt(u)?(t.exit("atxHeading"),e(u)):Vt(u)?Qt(t,a,"whitespace")(u):(t.enter("atxHeadingText"),h(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function h(u){return u===null||u===35||le(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),h)}}const HE=["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"],Bf=["pre","script","style","textarea"],UE={concrete:!0,name:"htmlFlow",resolveTo:VE,tokenize:XE},YE={partial:!0,tokenize:QE},GE={partial:!0,tokenize:KE};function VE(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 XE(t,e,r){const n=this;let i,s,o,a,l;return h;function h(D){return u(D)}function u(D){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(D),d}function d(D){return D===33?(t.consume(D),f):D===47?(t.consume(D),s=!0,x):D===63?(t.consume(D),i=3,n.interrupt?e:T):er(D)?(t.consume(D),o=String.fromCharCode(D),g):r(D)}function f(D){return D===45?(t.consume(D),i=2,p):D===91?(t.consume(D),i=5,a=0,m):er(D)?(t.consume(D),i=4,n.interrupt?e:T):r(D)}function p(D){return D===45?(t.consume(D),n.interrupt?e:T):r(D)}function m(D){const Q="CDATA[";return D===Q.charCodeAt(a++)?(t.consume(D),a===Q.length?n.interrupt?e:z:m):r(D)}function x(D){return er(D)?(t.consume(D),o=String.fromCharCode(D),g):r(D)}function g(D){if(D===null||D===47||D===62||le(D)){const Q=D===47,ut=o.toLowerCase();return!Q&&!s&&Bf.includes(ut)?(i=1,n.interrupt?e(D):z(D)):HE.includes(o.toLowerCase())?(i=6,Q?(t.consume(D),y):n.interrupt?e(D):z(D)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(D):s?C(D):b(D))}return D===45||Ge(D)?(t.consume(D),o+=String.fromCharCode(D),g):r(D)}function y(D){return D===62?(t.consume(D),n.interrupt?e:z):r(D)}function C(D){return Vt(D)?(t.consume(D),C):E(D)}function b(D){return D===47?(t.consume(D),E):D===58||D===95||er(D)?(t.consume(D),S):Vt(D)?(t.consume(D),b):E(D)}function S(D){return D===45||D===46||D===58||D===95||Ge(D)?(t.consume(D),S):_(D)}function _(D){return D===61?(t.consume(D),w):Vt(D)?(t.consume(D),_):b(D)}function w(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(t.consume(D),l=D,B):Vt(D)?(t.consume(D),w):L(D)}function B(D){return D===l?(t.consume(D),l=null,I):D===null||Nt(D)?r(D):(t.consume(D),B)}function L(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||le(D)?_(D):(t.consume(D),L)}function I(D){return D===47||D===62||Vt(D)?b(D):r(D)}function E(D){return D===62?(t.consume(D),F):r(D)}function F(D){return D===null||Nt(D)?z(D):Vt(D)?(t.consume(D),F):r(D)}function z(D){return D===45&&i===2?(t.consume(D),A):D===60&&i===1?(t.consume(D),P):D===62&&i===4?(t.consume(D),Y):D===63&&i===3?(t.consume(D),T):D===93&&i===5?(t.consume(D),j):Nt(D)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(YE,J,W)(D)):D===null||Nt(D)?(t.exit("htmlFlowData"),W(D)):(t.consume(D),z)}function W(D){return t.check(GE,O,J)(D)}function O(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),M}function M(D){return D===null||Nt(D)?W(D):(t.enter("htmlFlowData"),z(D))}function A(D){return D===45?(t.consume(D),T):z(D)}function P(D){return D===47?(t.consume(D),o="",$):z(D)}function $(D){if(D===62){const Q=o.toLowerCase();return Bf.includes(Q)?(t.consume(D),Y):z(D)}return er(D)&&o.length<8?(t.consume(D),o+=String.fromCharCode(D),$):z(D)}function j(D){return D===93?(t.consume(D),T):z(D)}function T(D){return D===62?(t.consume(D),Y):D===45&&i===2?(t.consume(D),T):z(D)}function Y(D){return D===null||Nt(D)?(t.exit("htmlFlowData"),J(D)):(t.consume(D),Y)}function J(D){return t.exit("htmlFlow"),e(D)}}function KE(t,e,r){const n=this;return i;function i(o){return Nt(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 QE(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Zo,e,r)}}const ZE={name:"htmlText",tokenize:JE};function JE(t,e,r){const n=this;let i,s,o;return a;function a(T){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(T),l}function l(T){return T===33?(t.consume(T),h):T===47?(t.consume(T),_):T===63?(t.consume(T),b):er(T)?(t.consume(T),L):r(T)}function h(T){return T===45?(t.consume(T),u):T===91?(t.consume(T),s=0,m):er(T)?(t.consume(T),C):r(T)}function u(T){return T===45?(t.consume(T),p):r(T)}function d(T){return T===null?r(T):T===45?(t.consume(T),f):Nt(T)?(o=d,P(T)):(t.consume(T),d)}function f(T){return T===45?(t.consume(T),p):d(T)}function p(T){return T===62?A(T):T===45?f(T):d(T)}function m(T){const Y="CDATA[";return T===Y.charCodeAt(s++)?(t.consume(T),s===Y.length?x:m):r(T)}function x(T){return T===null?r(T):T===93?(t.consume(T),g):Nt(T)?(o=x,P(T)):(t.consume(T),x)}function g(T){return T===93?(t.consume(T),y):x(T)}function y(T){return T===62?A(T):T===93?(t.consume(T),y):x(T)}function C(T){return T===null||T===62?A(T):Nt(T)?(o=C,P(T)):(t.consume(T),C)}function b(T){return T===null?r(T):T===63?(t.consume(T),S):Nt(T)?(o=b,P(T)):(t.consume(T),b)}function S(T){return T===62?A(T):b(T)}function _(T){return er(T)?(t.consume(T),w):r(T)}function w(T){return T===45||Ge(T)?(t.consume(T),w):B(T)}function B(T){return Nt(T)?(o=B,P(T)):Vt(T)?(t.consume(T),B):A(T)}function L(T){return T===45||Ge(T)?(t.consume(T),L):T===47||T===62||le(T)?I(T):r(T)}function I(T){return T===47?(t.consume(T),A):T===58||T===95||er(T)?(t.consume(T),E):Nt(T)?(o=I,P(T)):Vt(T)?(t.consume(T),I):A(T)}function E(T){return T===45||T===46||T===58||T===95||Ge(T)?(t.consume(T),E):F(T)}function F(T){return T===61?(t.consume(T),z):Nt(T)?(o=F,P(T)):Vt(T)?(t.consume(T),F):I(T)}function z(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),i=T,W):Nt(T)?(o=z,P(T)):Vt(T)?(t.consume(T),z):(t.consume(T),O)}function W(T){return T===i?(t.consume(T),i=void 0,M):T===null?r(T):Nt(T)?(o=W,P(T)):(t.consume(T),W)}function O(T){return T===null||T===34||T===39||T===60||T===61||T===96?r(T):T===47||T===62||le(T)?I(T):(t.consume(T),O)}function M(T){return T===47||T===62||le(T)?I(T):r(T)}function A(T){return T===62?(t.consume(T),t.exit("htmlTextData"),t.exit("htmlText"),e):r(T)}function P(T){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),$}function $(T){return Vt(T)?Qt(t,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):j(T)}function j(T){return t.enter("htmlTextData"),o(T)}}const Ad={name:"labelEnd",resolveAll:n5,resolveTo:i5,tokenize:s5},t5={tokenize:o5},e5={tokenize:a5},r5={tokenize:l5};function n5(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&&Cr(t,0,t.length,r),t}function i5(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}},h={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",h,e]],a=_r(a,t.slice(s+1,s+n+3)),a=_r(a,[["enter",u,e]]),a=_r(a,oc(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=_r(a,[["exit",u,e],t[o-2],t[o-1],["exit",h,e]]),a=_r(a,t.slice(o+1)),a=_r(a,[["exit",l,e]]),Cr(t,s,t.length,a),t}function s5(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(f){return s?s._inactive?d(f):(o=n.parser.defined.includes(Or(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),l):r(f)}function l(f){return f===40?t.attempt(t5,u,o?u:d)(f):f===91?t.attempt(e5,u,o?h:d)(f):o?u(f):d(f)}function h(f){return t.attempt(r5,u,d)(f)}function u(f){return e(f)}function d(f){return s._balanced=!0,r(f)}}function o5(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 le(d)?ko(t,s)(d):s(d)}function s(d){return d===41?u(d):B0(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return le(d)?ko(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?A0(t,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function h(d){return le(d)?ko(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 a5(t,e,r){const n=this;return i;function i(a){return L0.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(Or(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function l5(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 c5={name:"labelStartImage",resolveAll:Ad.resolveAll,tokenize:h5};function h5(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 u5={name:"labelStartLink",resolveAll:Ad.resolveAll,tokenize:d5};function d5(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 qc={name:"lineEnding",tokenize:p5};function p5(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Qt(t,e,"linePrefix")}}const Ya={name:"thematicBreak",tokenize:f5};function f5(t,e,r){let n=0,i;return s;function s(h){return t.enter("thematicBreak"),o(h)}function o(h){return i=h,a(h)}function a(h){return h===i?(t.enter("thematicBreakSequence"),l(h)):n>=3&&(h===null||Nt(h))?(t.exit("thematicBreak"),e(h)):r(h)}function l(h){return h===i?(t.consume(h),n++,l):(t.exit("thematicBreakSequence"),Vt(h)?Qt(t,a,"whitespace")(h):a(h))}}const cr={continuation:{tokenize:y5},exit:C5,name:"list",tokenize:x5},m5={partial:!0,tokenize:k5},g5={partial:!0,tokenize:b5};function x5(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(p){const m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Xh(p)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(Ya,r,h)(p):h(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return r(p)}function l(p){return Xh(p)&&++o<10?(t.consume(p),l):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),h(p)):r(p)}function h(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(Zo,n.interrupt?r:u,t.attempt(m5,f,d))}function u(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Vt(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function y5(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(Zo,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Qt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Vt(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(g5,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Qt(t,t.attempt(cr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function b5(t,e,r){const n=this;return Qt(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 C5(t){t.exit(this.containerState.type)}function k5(t,e,r){const n=this;return Qt(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!Vt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const Lf={name:"setextUnderline",resolveTo:v5,tokenize:w5};function v5(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 w5(t,e,r){const n=this;let i;return s;function s(h){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=h,o(h)):r(h)}function o(h){return t.enter("setextHeadingLineSequence"),a(h)}function a(h){return h===i?(t.consume(h),a):(t.exit("setextHeadingLineSequence"),Vt(h)?Qt(t,l,"lineSuffix")(h):l(h))}function l(h){return h===null||Nt(h)?(t.exit("setextHeadingLine"),e(h)):r(h)}}const S5={tokenize:T5};function T5(t){const e=this,r=t.attempt(Zo,n,t.attempt(this.parser.constructs.flowInitial,i,Qt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(BE,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 _5={resolveAll:I0()},E5=M0("string"),j5=M0("text");function M0(t){return{resolveAll:I0(t==="text"?N5: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 h(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 h(u)?(r.exit("data"),s(u)):(r.consume(u),l)}function h(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function I0(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 N5(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 h=i[s];if(typeof h=="string"){for(o=h.length;h.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(h===-2)l=!0,a++;else if(h!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const h={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={...h.start},n.start.offset===n.end.offset?Object.assign(n,h):(t.splice(r,0,["enter",h,e],["exit",h,e]),r+=2)}r++}return t}const B5={42:cr,43:cr,45:cr,48:cr,49:cr,50:cr,51:cr,52:cr,53:cr,54:cr,55:cr,56:cr,57:cr,62:_0},L5={91:FE},A5={[-2]:Wc,[-1]:Wc,32:Wc},M5={35:zE,42:Ya,45:[Lf,Ya],60:UE,61:Lf,95:Ya,96:Nf,126:Nf},I5={38:j0,92:E0},F5={[-5]:qc,[-4]:qc,[-3]:qc,33:c5,38:j0,42:Kh,60:[uE,ZE],91:u5,92:[$E,E0],93:Ad,95:Kh,96:SE},D5={null:[Kh,_5]},P5={null:[42,95]},O5={null:[]},$5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:P5,contentInitial:L5,disable:O5,document:B5,flow:M5,flowInitial:A5,insideSpan:D5,string:I5,text:F5},Symbol.toStringTag,{value:"Module"}));function R5(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:B(_),check:B(w),consume:C,enter:b,exit:S,interrupt:B(w,{interrupt:!0})},h={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:t,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=e.tokenize.call(h,l);return e.resolveAll&&s.push(e),h;function d(F){return o=_r(o,F),g(),o[o.length-1]!==null?[]:(L(e,0),h.events=oc(s,h.events,h),h.events)}function f(F,z){return W5(p(F),z)}function p(F){return z5(o,F)}function m(){const{_bufferIndex:F,_index:z,line:W,column:O,offset:M}=n;return{_bufferIndex:F,_index:z,line:W,column:O,offset:M}}function x(F){i[F.line]=F.column,E()}function g(){let F;for(;n._index<o.length;){const z=o[n._index];if(typeof z=="string")for(F=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===F&&n._bufferIndex<z.length;)y(z.charCodeAt(n._bufferIndex));else y(z)}}function y(F){u=u(F)}function C(F){Nt(F)?(n.line++,n.column=1,n.offset+=F===-3?2:1,E()):F!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),h.previous=F}function b(F,z){const W=z||{};return W.type=F,W.start=m(),h.events.push(["enter",W,h]),a.push(W),W}function S(F){const z=a.pop();return z.end=m(),h.events.push(["exit",z,h]),z}function _(F,z){L(F,z.from)}function w(F,z){z.restore()}function B(F,z){return W;function W(O,M,A){let P,$,j,T;return Array.isArray(O)?J(O):"tokenize"in O?J([O]):Y(O);function Y(ct){return $t;function $t(Et){const ot=Et!==null&&ct[Et],G=Et!==null&&ct.null,lt=[...Array.isArray(ot)?ot:ot?[ot]:[],...Array.isArray(G)?G:G?[G]:[]];return J(lt)(Et)}}function J(ct){return P=ct,$=0,ct.length===0?A:D(ct[$])}function D(ct){return $t;function $t(Et){return T=I(),j=ct,ct.partial||(h.currentConstruct=ct),ct.name&&h.parser.constructs.disable.null.includes(ct.name)?ut():ct.tokenize.call(z?Object.assign(Object.create(h),z):h,l,Q,ut)(Et)}}function Q(ct){return F(j,T),M}function ut(ct){return T.restore(),++$<P.length?D(P[$]):A}}}function L(F,z){F.resolveAll&&!s.includes(F)&&s.push(F),F.resolve&&Cr(h.events,z,h.events.length-z,F.resolve(h.events.slice(z),h)),F.resolveTo&&(h.events=F.resolveTo(h.events,h))}function I(){const F=m(),z=h.previous,W=h.currentConstruct,O=h.events.length,M=Array.from(a);return{from:O,restore:A};function A(){n=F,h.previous=z,h.currentConstruct=W,h.events.length=O,a=M,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function z5(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 W5(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=`
272
- `;break}case-3:{o=`\r
273
- `;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 q5(t){const n={constructs:S0([$5,...(t||{}).extensions||[]]),content:i(iE),defined:[],document:i(oE),flow:i(S5),lazy:{},string:i(E5),text:i(j5)};return n;function i(s){return o;function o(a){return R5(n,s,a)}}}function H5(t){for(;!N0(t););return t}const Af=/[\0\t\n\r]/g;function U5(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let h,u,d,f,p;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(Af.lastIndex=d,h=Af.exec(s),f=h&&h.index!==void 0?h.index:s.length,p=s.charCodeAt(f),!h){e=s.slice(d);break}if(p===10&&d===f&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<f&&(l.push(s.slice(d,f)),t+=f-d),p){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=f+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const Y5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function G5(t){return t.replace(Y5,V5)}function V5(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return T0(r.slice(s?2:1),s?16:10)}return Ld(r)||t}const F0={}.hasOwnProperty;function X5(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),K5(r)(H5(q5(r).document().write(U5()(t,e,!0))))}function K5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ce),autolinkProtocol:I,autolinkEmail:I,atxHeading:s(se),blockQuote:s(G),characterEscape:I,characterReference:I,codeFenced:s(lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(lt,o),codeText:s(kt,o),codeTextData:I,data:I,codeFlowValue:I,definition:s(_t),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Rt),hardBreakEscape:s(ge),hardBreakTrailing:s(ge),htmlFlow:s(Qe,o),htmlFlowData:I,htmlText:s(Qe,o),htmlTextData:I,image:s(Gt),label:o,link:s(Ce),listItem:s(it),listItemValue:f,listOrdered:s(V,d),listUnordered:s(V),paragraph:s(dt),reference:D,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(se),strong:s(wt),thematicBreak:s(mt)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:ot,autolinkProtocol:Et,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ut,characterReferenceMarkerNumeric:ut,characterReferenceValue:ct,characterReference:$t,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:l(y),codeText:l(M),codeTextData:E,data:E,definition:l(),definitionDestinationString:S,definitionLabelString:C,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(W),htmlFlowData:E,htmlText:l(O),htmlTextData:E,image:l(P),label:j,labelText:$,lineEnding:F,link:l(A),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Q,resourceDestinationString:T,resourceTitleString:Y,resource:J,setextHeading:l(L),setextHeadingLineSequence:B,setextHeadingText:w,strong:l(),thematicBreak:l()}};D0(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(U){let nt={type:"root",children:[]};const Tt={stack:[nt],tokenStack:[],config:e,enter:a,exit:h,buffer:o,resume:u,data:r},Pt=[];let qt=-1;for(;++qt<U.length;)if(U[qt][1].type==="listOrdered"||U[qt][1].type==="listUnordered")if(U[qt][0]==="enter")Pt.push(qt);else{const he=Pt.pop();qt=i(U,he,qt)}for(qt=-1;++qt<U.length;){const he=e[U[qt][0]];F0.call(he,U[qt][1].type)&&he[U[qt][1].type].call(Object.assign({sliceSerialize:U[qt][2].sliceSerialize},Tt),U[qt][1])}if(Tt.tokenStack.length>0){const he=Tt.tokenStack[Tt.tokenStack.length-1];(he[1]||Mf).call(Tt,void 0,he[0])}for(nt.position={start:Sn(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Sn(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},qt=-1;++qt<e.transforms.length;)nt=e.transforms[qt](nt)||nt;return nt}function i(U,nt,Tt){let Pt=nt-1,qt=-1,he=!1,xe,ce,Br,De;for(;++Pt<=Tt;){const ke=U[Pt];switch(ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ke[0]==="enter"?qt++:qt--,De=void 0;break}case"lineEndingBlank":{ke[0]==="enter"&&(xe&&!De&&!qt&&!Br&&(Br=Pt),De=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:De=void 0}if(!qt&&ke[0]==="enter"&&ke[1].type==="listItemPrefix"||qt===-1&&ke[0]==="exit"&&(ke[1].type==="listUnordered"||ke[1].type==="listOrdered")){if(xe){let wr=Pt;for(ce=void 0;wr--;){const ze=U[wr];if(ze[1].type==="lineEnding"||ze[1].type==="lineEndingBlank"){if(ze[0]==="exit")continue;ce&&(U[ce][1].type="lineEndingBlank",he=!0),ze[1].type="lineEnding",ce=wr}else if(!(ze[1].type==="linePrefix"||ze[1].type==="blockQuotePrefix"||ze[1].type==="blockQuotePrefixWhitespace"||ze[1].type==="blockQuoteMarker"||ze[1].type==="listItemIndent"))break}Br&&(!ce||Br<ce)&&(xe._spread=!0),xe.end=Object.assign({},ce?U[ce][1].start:ke[1].end),U.splice(ce||Pt,0,["exit",xe,ke[2]]),Pt++,Tt++}if(ke[1].type==="listItemPrefix"){const wr={type:"listItem",_spread:!1,start:Object.assign({},ke[1].start),end:void 0};xe=wr,U.splice(Pt,0,["enter",wr,ke[2]]),Pt++,Tt++,Br=void 0,De=!0}}}return U[nt][1]._spread=he,Tt}function s(U,nt){return Tt;function Tt(Pt){a.call(this,U(Pt),Pt),nt&&nt.call(this,Pt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(U,nt,Tt){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([nt,Tt||void 0]),U.position={start:Sn(nt.start),end:void 0}}function l(U){return nt;function nt(Tt){U&&U.call(this,Tt),h.call(this,Tt)}}function h(U,nt){const Tt=this.stack.pop(),Pt=this.tokenStack.pop();if(Pt)Pt[0].type!==U.type&&(nt?nt.call(this,U,Pt[0]):(Pt[1]||Mf).call(this,U,Pt[0]));else throw new Error("Cannot close `"+U.type+"` ("+Co({start:U.start,end:U.end})+"): it’s not open");Tt.position.end=Sn(U.end)}function u(){return Bd(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(U){if(this.data.expectingFirstListItemValue){const nt=this.stack[this.stack.length-2];nt.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function p(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.lang=U}function m(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.meta=U}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U.replace(/(\r?\n|\r)$/g,"")}function C(U){const nt=this.resume(),Tt=this.stack[this.stack.length-1];Tt.label=nt,Tt.identifier=Or(this.sliceSerialize(U)).toLowerCase()}function b(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.title=U}function S(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.url=U}function _(U){const nt=this.stack[this.stack.length-1];if(!nt.depth){const Tt=this.sliceSerialize(U).length;nt.depth=Tt}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function B(U){const nt=this.stack[this.stack.length-1];nt.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function I(U){const Tt=this.stack[this.stack.length-1].children;let Pt=Tt[Tt.length-1];(!Pt||Pt.type!=="text")&&(Pt=rt(),Pt.position={start:Sn(U.start),end:void 0},Tt.push(Pt)),this.stack.push(Pt)}function E(U){const nt=this.stack.pop();nt.value+=this.sliceSerialize(U),nt.position.end=Sn(U.end)}function F(U){const nt=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Tt=nt.children[nt.children.length-1];Tt.position.end=Sn(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(nt.type)&&(I.call(this,U),E.call(this,U))}function z(){this.data.atHardBreak=!0}function W(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U}function O(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U}function M(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.value=U}function A(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const nt=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=nt,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function P(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const nt=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=nt,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function $(U){const nt=this.sliceSerialize(U),Tt=this.stack[this.stack.length-2];Tt.label=G5(nt),Tt.identifier=Or(nt).toLowerCase()}function j(){const U=this.stack[this.stack.length-1],nt=this.resume(),Tt=this.stack[this.stack.length-1];if(this.data.inReference=!0,Tt.type==="link"){const Pt=U.children;Tt.children=Pt}else Tt.alt=nt}function T(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.url=U}function Y(){const U=this.resume(),nt=this.stack[this.stack.length-1];nt.title=U}function J(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function Q(U){const nt=this.resume(),Tt=this.stack[this.stack.length-1];Tt.label=nt,Tt.identifier=Or(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function ut(U){this.data.characterReferenceType=U.type}function ct(U){const nt=this.sliceSerialize(U),Tt=this.data.characterReferenceType;let Pt;Tt?(Pt=T0(nt,Tt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Pt=Ld(nt);const qt=this.stack[this.stack.length-1];qt.value+=Pt}function $t(U){const nt=this.stack.pop();nt.position.end=Sn(U.end)}function Et(U){E.call(this,U);const nt=this.stack[this.stack.length-1];nt.url=this.sliceSerialize(U)}function ot(U){E.call(this,U);const nt=this.stack[this.stack.length-1];nt.url="mailto:"+this.sliceSerialize(U)}function G(){return{type:"blockquote",children:[]}}function lt(){return{type:"code",lang:null,meta:null,value:""}}function kt(){return{type:"inlineCode",value:""}}function _t(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Rt(){return{type:"emphasis",children:[]}}function se(){return{type:"heading",depth:0,children:[]}}function ge(){return{type:"break"}}function Qe(){return{type:"html",value:""}}function Gt(){return{type:"image",title:null,url:"",alt:null}}function Ce(){return{type:"link",title:null,url:"",children:[]}}function V(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function it(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function dt(){return{type:"paragraph",children:[]}}function wt(){return{type:"strong",children:[]}}function rt(){return{type:"text",value:""}}function mt(){return{type:"thematicBreak"}}}function Sn(t){return{line:t.line,column:t.column,offset:t.offset}}function D0(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?D0(t,n):Q5(t,n)}}function Q5(t,e){let r;for(r in e)if(F0.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 Mf(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Co({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Co({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Co({start:e.start,end:e.end})+") is still open")}function Z5(t){const e=this;e.parser=r;function r(n){return X5(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function J5(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 tj(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
274
- `}]}function ej(t,e){const r=e.value?e.value+`
275
- `:"",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 rj(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function nj(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function ij(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Bs(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 h={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,h),t.applyData(e,h)}function sj(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 oj(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function P0(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 aj(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return P0(t,e);const i={src:Bs(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 lj(t,e){const r={src:Bs(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 cj(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 hj(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return P0(t,e);const i={href:Bs(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 uj(t,e){const r={href:Bs(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 dj(t,e,r){const n=t.all(e),i=r?pj(r):O0(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:`
276
- `}),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:`
277
- `});const h={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,h),t.applyData(e,h)}function pj(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=O0(r[n])}return e}function O0(t){const e=t.spread;return e??t.children.length>1}function fj(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 mj(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function gj(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function xj(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function yj(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=_d(e.children[1]),l=x0(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 bj(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 h=[];for(;++l<a;){const d=e.children[l],f={},p=o?o[l]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),h.push(m)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(h,!0)};return t.patch(e,u),t.applyData(e,u)}function Cj(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const If=9,Ff=32;function kj(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Df(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Df(e.slice(i),i>0,!1)),s.join("")}function Df(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===If||s===Ff;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===If||s===Ff;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function vj(t,e){const r={type:"text",value:kj(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function wj(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const Sj={blockquote:J5,break:tj,code:ej,delete:rj,emphasis:nj,footnoteReference:ij,heading:sj,html:oj,imageReference:aj,image:lj,inlineCode:cj,linkReference:hj,link:uj,listItem:dj,list:fj,paragraph:mj,root:gj,strong:xj,table:yj,tableCell:Cj,tableRow:bj,text:vj,thematicBreak:wj,toml:Ca,yaml:Ca,definition:Ca,footnoteDefinition:Ca};function Ca(){}const $0=-1,ac=0,vo=1,pl=2,Md=3,Id=4,Fd=5,Dd=6,R0=7,z0=8,Tj=typeof self=="object"?self:globalThis,Pf=(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 Tj[t](e)},_j=(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 ac:case $0:return r(o,i);case vo:{const a=r([],i);for(const l of o)a.push(n(l));return a}case pl:{const a=r({},i);for(const[l,h]of o)a[n(l)]=n(h);return a}case Md:return r(new Date(o),i);case Id:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case Fd:{const a=r(new Map,i);for(const[l,h]of o)a.set(n(l),n(h));return a}case Dd:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case R0:{const{name:a,message:l}=o;return r(Pf(a,l),i)}case z0: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(Pf(s,o),i)};return n},Of=t=>_j(new Map,t)(0),Ni="",{toString:Ej}={},{keys:jj}=Object,Gs=t=>{const e=typeof t;if(e!=="object"||!t)return[ac,e];const r=Ej.call(t).slice(8,-1);switch(r){case"Array":return[vo,Ni];case"Object":return[pl,Ni];case"Date":return[Md,Ni];case"RegExp":return[Id,Ni];case"Map":return[Fd,Ni];case"Set":return[Dd,Ni];case"DataView":return[vo,r]}return r.includes("Array")?[vo,r]:r.includes("Error")?[R0,r]:[pl,r]},ka=([t,e])=>t===ac&&(e==="function"||e==="symbol"),Nj=(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]=Gs(o);switch(a){case ac:{let u=o;switch(l){case"bigint":a=z0,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([$0],o)}return i([a,u],o)}case vo:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),i([l,[...f]],o)}const u=[],d=i([a,u],o);for(const f of o)u.push(s(f));return d}case pl:{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 f of jj(o))(t||!ka(Gs(o[f])))&&u.push([s(f),s(o[f])]);return d}case Md:return i([a,o.toISOString()],o);case Id:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case Fd:{const u=[],d=i([a,u],o);for(const[f,p]of o)(t||!(ka(Gs(f))||ka(Gs(p))))&&u.push([s(f),s(p)]);return d}case Dd:{const u=[],d=i([a,u],o);for(const f of o)(t||!ka(Gs(f)))&&u.push(s(f));return d}}const{message:h}=o;return i([a,{name:l,message:h}],o)};return s},$f=(t,{json:e,lossy:r}={})=>{const n=[];return Nj(!(e||r),!!e,new Map,n)(t),n},fl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Of($f(t,e)):structuredClone(t):(t,e)=>Of($f(t,e));function Bj(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 Lj(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Aj(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||Bj,n=t.options.footnoteBackLabel||Lj,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 h=t.footnoteById.get(t.footnoteOrder[l]);if(!h)continue;const u=t.all(h),d=String(h.identifier).toUpperCase(),f=Bs(d.toLowerCase());let p=0;const m=[],x=t.footnoteCounts.get(d);for(;x!==void 0&&++p<=x;){m.length>0&&m.push({type:"text",value:" "});let C=typeof r=="string"?r:r(l,p);typeof C=="string"&&(C={type:"text",value:C}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,p),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const C=g.children[g.children.length-1];C&&C.type==="text"?C.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-"+f},children:t.wrap(u,!0)};t.patch(h,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...fl(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
278
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
279
- `}]}}const lc=(function(t){if(t==null)return Dj;if(typeof t=="function")return cc(t);if(typeof t=="object")return Array.isArray(t)?Mj(t):Ij(t);if(typeof t=="string")return Fj(t);throw new Error("Expected function, string, or object as test")});function Mj(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=lc(t[r]);return cc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Ij(t){const e=t;return cc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function Fj(t){return cc(e);function e(r){return r&&r.type===t}}function cc(t){return e;function e(r,n,i){return!!(Pj(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function Dj(){return!0}function Pj(t){return t!==null&&typeof t=="object"&&"type"in t}const W0=[],Oj=!0,Qh=!1,$j="skip";function q0(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=lc(i),o=n?-1:1;a(t,void 0,[])();function a(l,h,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=W0,m,x,g;if((!e||s(l,h,u[u.length-1]||void 0))&&(p=Rj(r(l,u)),p[0]===Qh))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==$j)for(x=(n?y.children.length:-1)+o,g=u.concat(y);x>-1&&x<y.children.length;){const C=y.children[x];if(m=a(C,x,g)(),m[0]===Qh)return m;x=typeof m[1]=="number"?m[1]:x+o}}return p}}}function Rj(t){return Array.isArray(t)?t:typeof t=="number"?[Oj,t]:t==null?W0:[t]}function Pd(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),q0(t,s,a,i);function a(l,h){const u=h[h.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const Zh={}.hasOwnProperty,zj={};function Wj(t,e){const r=e||zj,n=new Map,i=new Map,s=new Map,o={...Sj,...r.handlers},a={all:h,applyData:Hj,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:qj,wrap:Yj};return Pd(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?n:i,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,p=a.handlers[f];if(Zh.call(a.handlers,f)&&p)return p(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:x,...g}=u,y=fl(g);return y.children=a.all(u),y}return fl(u)}return(a.options.unknownHandler||Uj)(a,u,d)}function h(u){const d=[];if("children"in u){const f=u.children;let p=-1;for(;++p<f.length;){const m=a.one(f[p],u);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Rf(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=Rf(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function qj(t,e){t.position&&(e.position=B_(t))}function Hj(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,fl(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function Uj(t,e){const r=e.data||{},n="value"in e&&!(Zh.call(r,"hProperties")||Zh.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 Yj(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
280
- `});++n<t.length;)n&&r.push({type:"text",value:`
281
- `}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
282
- `}),r}function Rf(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function zf(t,e){const r=Wj(t,e),n=r.one(t,void 0),i=Aj(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
283
- `},i),s}function Gj(t,e){return t&&"run"in t?async function(r,n){const i=zf(r,{file:n,...e});await t.run(i,n)}:function(r,n){return zf(r,{file:n,...t||e})}}function Wf(t){if(t)throw t}var Hc,qf;function Vj(){if(qf)return Hc;qf=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},s=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var u=t.call(h,"constructor"),d=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!u&&!d)return!1;var f;for(f in h);return typeof f>"u"||t.call(h,f)},o=function(h,u){r&&u.name==="__proto__"?r(h,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):h[u.name]=u.newValue},a=function(h,u){if(u==="__proto__")if(t.call(h,u)){if(n)return n(h,u).value}else return;return h[u]};return Hc=function l(){var h,u,d,f,p,m,x=arguments[0],g=1,y=arguments.length,C=!1;for(typeof x=="boolean"&&(C=x,x=arguments[1]||{},g=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});g<y;++g)if(h=arguments[g],h!=null)for(u in h)d=a(x,u),f=a(h,u),x!==f&&(C&&f&&(s(f)||(p=i(f)))?(p?(p=!1,m=d&&i(d)?d:[]):m=d&&s(d)?d:{},o(x,{name:u,newValue:l(C,m,f)})):typeof f<"u"&&o(x,{name:u,newValue:f}));return x},Hc}var Xj=Vj();const Uc=dd(Xj);function Jh(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 Kj(){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,...h){const u=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(h[d]===null||h[d]===void 0)&&(h[d]=i[d]);i=h,u?Qj(u,a)(...h):o(null,...h)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function Qj(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(h){const u=h;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 Vr={basename:Zj,dirname:Jj,extname:tN,join:eN,sep:"/"};function Zj(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Jo(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 Jj(t){if(Jo(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 tN(t){Jo(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 eN(...t){let e=-1,r;for(;++e<t.length;)Jo(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":rN(r)}function rN(t){Jo(t);const e=t.codePointAt(0)===47;let r=nN(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function nN(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 Jo(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const iN={cwd:sN};function sN(){return"/"}function tu(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function oN(t){if(typeof t=="string")t=new URL(t);else if(!tu(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 aN(t)}function aN(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 Yc=["history","path","basename","stem","extname","dirname"];class H0{constructor(e){let r;e?tu(e)?r={path:e}:typeof e=="string"||lN(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":iN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Yc.length;){const s=Yc[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)Yc.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Vr.basename(this.path):void 0}set basename(e){Vc(e,"basename"),Gc(e,"basename"),this.path=Vr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Vr.dirname(this.path):void 0}set dirname(e){Hf(this.basename,"dirname"),this.path=Vr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Vr.extname(this.path):void 0}set extname(e){if(Gc(e,"extname"),Hf(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=Vr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){tu(e)&&(e=oN(e)),Vc(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Vr.basename(this.path,this.extname):void 0}set stem(e){Vc(e,"stem"),Gc(e,"stem"),this.path=Vr.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 Gc(t,e){if(t&&t.includes(Vr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Vr.sep+"`")}function Vc(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Hf(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function lN(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const cN=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),hN={}.hasOwnProperty;class Od extends cN{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=Kj()}copy(){const e=new Od;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Uc(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Qc("data",this.frozen),this.namespace[e]=r,this):hN.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Qc("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=va(e),n=this.parser||this.Parser;return Xc("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Xc("process",this.parser||this.Parser),Kc("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=va(e),l=n.parse(a);n.run(l,a,function(u,d,f){if(u||!d||!f)return h(u);const p=d,m=n.stringify(p,f);pN(m)?f.value=m:f.result=m,h(u,f)});function h(u,d){u||!d?o(u):s?s(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),Xc("processSync",this.parser||this.Parser),Kc("processSync",this.compiler||this.Compiler),this.process(e,i),Yf("processSync","process",r),n;function i(s,o){r=!0,Wf(s),n=o}}run(e,r,n){Uf(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=va(r);i.run(e,l,h);function h(u,d,f){const p=d||e;u?a(u):o?o(p):n(void 0,p,f)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),Yf("runSync","run",n),i;function s(o,a){Wf(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=va(r),i=this.compiler||this.Compiler;return Kc("stringify",i),Uf(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(Qc("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(h){if(typeof h=="function")l(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[u,...d]=h;l(u,d)}else o(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function o(h){if(!("plugins"in h)&&!("settings"in h))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(h.plugins),h.settings&&(i.settings=Uc(!0,i.settings,h.settings))}function a(h){let u=-1;if(h!=null)if(Array.isArray(h))for(;++u<h.length;){const d=h[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function l(h,u){let d=-1,f=-1;for(;++d<n.length;)if(n[d][0]===h){f=d;break}if(f===-1)n.push([h,...u]);else if(u.length>0){let[p,...m]=u;const x=n[f][1];Jh(x)&&Jh(p)&&(p=Uc(!0,x,p)),n[f]=[h,p,...m]}}}}const uN=new Od().freeze();function Xc(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Kc(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Qc(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 Uf(t){if(!Jh(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Yf(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function va(t){return dN(t)?t:new H0(t)}function dN(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function pN(t){return typeof t=="string"||fN(t)}function fN(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const mN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Gf=[],Vf={allowDangerousHtml:!0},gN=/^(https?|ircs?|mailto|xmpp)$/i,xN=[{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 $d(t){const e=yN(t),r=bN(t);return CN(e.runSync(e.parse(r),r),t)}function yN(t){const e=t.rehypePlugins||Gf,r=t.remarkPlugins||Gf,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Vf}:Vf;return uN().use(Z5).use(r).use(Gj,n).use(e)}function bN(t){const e=t.children||"",r=new H0;return typeof e=="string"&&(r.value=e),r}function CN(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||kN;for(const u of xN)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+mN+u.id,void 0);return Pd(t,h),F_(t,{Fragment:c.Fragment,components:i,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function h(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let p;for(p in zc)if(Object.hasOwn(zc,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],x=zc[p];(x===null||x.includes(u.tagName))&&(u.properties[p]=l(String(m||""),p,u))}}if(u.type==="element"){let p=r?!r.includes(u.tagName):s?s.includes(u.tagName):!1;if(!p&&n&&typeof d=="number"&&(p=!n(u,d,f)),p&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function kN(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||gN.test(t.slice(0,e))?t:""}function Xf(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 vN(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wN(t,e,r){const i=lc((r||{}).ignore||[]),s=SN(e);let o=-1;for(;++o<s.length;)q0(t,"text",a);function a(h,u){let d=-1,f;for(;++d<u.length;){const p=u[d],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return l(h,u)}function l(h,u){const d=u[u.length-1],f=s[o][0],p=s[o][1];let m=0;const g=d.children.indexOf(h);let y=!1,C=[];f.lastIndex=0;let b=f.exec(h.value);for(;b;){const S=b.index,_={index:b.index,input:b.input,stack:[...u,h]};let w=p(...b,_);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?f.lastIndex=S+1:(m!==S&&C.push({type:"text",value:h.value.slice(m,S)}),Array.isArray(w)?C.push(...w):w&&C.push(w),m=S+b[0].length,y=!0),!f.global)break;b=f.exec(h.value)}return y?(m<h.value.length&&C.push({type:"text",value:h.value.slice(m)}),d.children.splice(g,1,...C)):C=[h],g+C.length}}function SN(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([TN(i[0]),_N(i[1])])}return e}function TN(t){return typeof t=="string"?new RegExp(vN(t),"g"):t}function _N(t){return typeof t=="function"?t:function(){return t}}const Zc="phrasing",Jc=["autolink","link","image","label"];function EN(){return{transforms:[IN],enter:{literalAutolink:NN,literalAutolinkEmail:th,literalAutolinkHttp:th,literalAutolinkWww:th},exit:{literalAutolink:MN,literalAutolinkEmail:AN,literalAutolinkHttp:BN,literalAutolinkWww:LN}}}function jN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Zc,notInConstruct:Jc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Zc,notInConstruct:Jc},{character:":",before:"[ps]",after:"\\/",inConstruct:Zc,notInConstruct:Jc}]}}function NN(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function th(t){this.config.enter.autolinkProtocol.call(this,t)}function BN(t){this.config.exit.autolinkProtocol.call(this,t)}function LN(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 AN(t){this.config.exit.autolinkEmail.call(this,t)}function MN(t){this.exit(t)}function IN(t){wN(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,FN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),DN]],{ignore:["link","linkReference"]})}function FN(t,e,r,n,i){let s="";if(!U0(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!PN(r)))return!1;const o=ON(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 DN(t,e,r,n){return!U0(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function PN(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 ON(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=Xf(t,"(");let s=Xf(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 U0(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||ui(r)||sc(r))&&(!e||r!==47)}Y0.peek=GN;function $N(){this.buffer()}function RN(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function zN(){this.buffer()}function WN(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function qN(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Or(this.sliceSerialize(t)).toLowerCase(),r.label=e}function HN(t){this.exit(t)}function UN(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Or(this.sliceSerialize(t)).toLowerCase(),r.label=e}function YN(t){this.exit(t)}function GN(){return"["}function Y0(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 VN(){return{enter:{gfmFootnoteCallString:$N,gfmFootnoteCall:RN,gfmFootnoteDefinitionLabelString:zN,gfmFootnoteDefinition:WN},exit:{gfmFootnoteCallString:qN,gfmFootnoteCall:HN,gfmFootnoteDefinitionLabelString:UN,gfmFootnoteDefinition:YN}}}function XN(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:Y0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const h=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?`
284
- `:" ")+s.indentLines(s.containerFlow(n,a.current()),e?G0:KN))),h(),l}}function KN(t,e,r){return e===0?t:G0(t,e,r)}function G0(t,e,r){return(r?"":" ")+t}const QN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];V0.peek=rB;function ZN(){return{canContainEols:["delete"],enter:{strikethrough:tB},exit:{strikethrough:eB}}}function JN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:QN}],handlers:{delete:V0}}}function tB(t){this.enter({type:"delete",children:[]},t)}function eB(t){this.exit(t)}function V0(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 rB(){return"~"}function nB(t){return t.length}function iB(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||nB,s=[],o=[],a=[],l=[];let h=0,u=-1;for(;++u<t.length;){const x=[],g=[];let y=-1;for(t[u].length>h&&(h=t[u].length);++y<t[u].length;){const C=sB(t[u][y]);if(r.alignDelimiters!==!1){const b=i(C);g[y]=b,(l[y]===void 0||b>l[y])&&(l[y]=b)}x.push(C)}o[u]=x,a[u]=g}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<h;)s[d]=Kf(n[d]);else{const x=Kf(n);for(;++d<h;)s[d]=x}d=-1;const f=[],p=[];for(;++d<h;){const x=s[d];let g="",y="";x===99?(g=":",y=":"):x===108?g=":":x===114&&(y=":");let C=r.alignDelimiters===!1?1:Math.max(1,l[d]-g.length-y.length);const b=g+"-".repeat(C)+y;r.alignDelimiters!==!1&&(C=g.length+C+y.length,C>l[d]&&(l[d]=C),p[d]=C),f[d]=b}o.splice(1,0,f),a.splice(1,0,p),u=-1;const m=[];for(;++u<o.length;){const x=o[u],g=a[u];d=-1;const y=[];for(;++d<h;){const C=x[d]||"";let b="",S="";if(r.alignDelimiters!==!1){const _=l[d]-(g[d]||0),w=s[d];w===114?b=" ".repeat(_):w===99?_%2?(b=" ".repeat(_/2+.5),S=" ".repeat(_/2-.5)):(b=" ".repeat(_/2),S=b):S=" ".repeat(_)}r.delimiterStart!==!1&&!d&&y.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&C==="")&&(r.delimiterStart!==!1||d)&&y.push(" "),r.alignDelimiters!==!1&&y.push(b),y.push(C),r.alignDelimiters!==!1&&y.push(S),r.padding!==!1&&y.push(" "),(r.delimiterEnd!==!1||d!==h-1)&&y.push("|")}m.push(r.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
285
- `)}function sB(t){return t==null?"":String(t)}function Kf(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 oB(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()),aB);return i(),o}function aB(t,e,r){return">"+(r?"":" ")+t}function lB(t,e){return Qf(t,e.inConstruct,!0)&&!Qf(t,e.notInConstruct,!1)}function Qf(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 Zf(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
286
- `&&lB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
287
- `}function cB(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 hB(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 uB(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 dB(t,e,r,n){const i=uB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(hB(t,r)){const d=r.enter("codeIndented"),f=r.indentLines(s,pB);return d(),f}const a=r.createTracker(n),l=i.repeat(Math.max(cB(s,i)+1,3)),h=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:`
288
- `,encode:["`"],...a.current()})),d()}return u+=a.move(`
289
- `),s&&(u+=a.move(s+`
290
- `)),u+=a.move(l),h(),u}function pB(t,e,r){return(r?"":" ")+t}function Rd(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 fB(t,e,r,n){const i=Rd(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const l=r.createTracker(n);let h=l.move("[");return h+=l.move(r.safe(r.associationId(t),{before:h,after:"]",...l.current()})),h+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(r.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(a=r.enter("destinationRaw"),h+=l.move(r.safe(t.url,{before:h,after:t.title?" ":`
291
- `,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),h+=l.move(" "+i),h+=l.move(r.safe(t.title,{before:h,after:i,...l.current()})),h+=l.move(i),a()),o(),h}function mB(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 Io(t){return"&#x"+t.toString(16).toUpperCase()+";"}function ml(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}}X0.peek=gB;function X0(t,e,r,n){const i=mB(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 h=l.charCodeAt(0),u=ml(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(l=Io(h)+l.slice(1));const d=l.charCodeAt(l.length-1),f=ml(n.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Io(d));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function gB(t,e,r){return r.options.emphasis||"*"}function xB(t,e){let r=!1;return Pd(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Qh}),!!((!t.depth||t.depth<3)&&Bd(t)&&(e.options.setext||r))}function yB(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(xB(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),f=r.containerPhrasing(t,{...s.current(),before:`
292
- `,after:`
293
- `});return d(),u(),f+`
294
- `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
295
- `))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let h=r.containerPhrasing(t,{before:"# ",after:`
296
- `,...s.current()});return/^[\t ]/.test(h)&&(h=Io(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,r.options.closeAtx&&(h+=" "+o),l(),a(),h}K0.peek=bB;function K0(t){return t.value||""}function bB(){return"<"}Q0.peek=CB;function Q0(t,e,r,n){const i=Rd(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const l=r.createTracker(n);let h=l.move("![");return h+=l.move(r.safe(t.alt,{before:h,after:"]",...l.current()})),h+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(r.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(a=r.enter("destinationRaw"),h+=l.move(r.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),h+=l.move(" "+i),h+=l.move(r.safe(t.title,{before:h,after:i,...l.current()})),h+=l.move(i),a()),h+=l.move(")"),o(),h}function CB(){return"!"}Z0.peek=kB;function Z0(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 h=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(h+"]["),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"||!h||h!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function kB(){return"!"}J0.peek=vB;function J0(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 h=l.index;n.charCodeAt(h)===10&&n.charCodeAt(h-1)===13&&h--,n=n.slice(0,h)+" "+n.slice(l.index+1)}}return i+n+i}function vB(){return"`"}function ty(t,e){const r=Bd(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))}ey.peek=wB;function ey(t,e,r,n){const i=Rd(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(ty(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 h=o.move("[");return h+=o.move(r.containerPhrasing(t,{before:h,after:"](",...o.current()})),h+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),h+=o.move("<"),h+=o.move(r.safe(t.url,{before:h,after:">",...o.current()})),h+=o.move(">")):(l=r.enter("destinationRaw"),h+=o.move(r.safe(t.url,{before:h,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=r.enter(`title${s}`),h+=o.move(" "+i),h+=o.move(r.safe(t.title,{before:h,after:i,...o.current()})),h+=o.move(i),l()),h+=o.move(")"),a(),h}function wB(t,e,r){return ty(t,r)?"<":"["}ry.peek=SB;function ry(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 h=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(h+"]["),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"||!h||h!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function SB(){return"["}function zd(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 TB(t){const e=zd(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 _B(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 ny(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 EB(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?_B(r):zd(r);const a=t.ordered?o==="."?")":".":TB(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),ny(r)===o&&u){let d=-1;for(;++d<t.children.length;){const f=t.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),r.bulletCurrent=o;const h=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),h}function jB(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 NB(t,e,r,n){const i=jB(r);let s=r.bulletCurrent||zd(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"),h=r.indentLines(r.containerFlow(t,a.current()),u);return l(),h;function u(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?s:s+" ".repeat(o-s.length))+d}}function BB(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const LB=lc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function AB(t,e,r,n){return(t.children.some(function(o){return LB(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function MB(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}iy.peek=IB;function iy(t,e,r,n){const i=MB(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 h=l.charCodeAt(0),u=ml(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(l=Io(h)+l.slice(1));const d=l.charCodeAt(l.length-1),f=ml(n.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Io(d));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function IB(t,e,r){return r.options.strong||"*"}function FB(t,e,r,n){return r.safe(t.value,n)}function DB(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 PB(t,e,r){const n=(ny(r)+(r.options.ruleSpaces?" ":"")).repeat(DB(r));return r.options.ruleSpaces?n.slice(0,-1):n}const sy={blockquote:oB,break:Zf,code:dB,definition:fB,emphasis:X0,hardBreak:Zf,heading:yB,html:K0,image:Q0,imageReference:Z0,inlineCode:J0,link:ey,linkReference:ry,list:EB,listItem:NB,paragraph:BB,root:AB,strong:iy,text:FB,thematicBreak:PB};function OB(){return{enter:{table:$B,tableData:Jf,tableHeader:Jf,tableRow:zB},exit:{codeText:WB,table:RB,tableData:eh,tableHeader:eh,tableRow:eh}}}function $B(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 RB(t){this.exit(t),this.data.inTable=void 0}function zB(t){this.enter({type:"tableRow",children:[]},t)}function eh(t){this.exit(t)}function Jf(t){this.enter({type:"tableCell",children:[]},t)}function WB(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,qB));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function qB(t,e){return e==="|"?e:t}function HB(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
297
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,m,x,g){return h(u(p,x,g),p.align)}function a(p,m,x,g){const y=d(p,x,g),C=h([y]);return C.slice(0,C.indexOf(`
298
- `))}function l(p,m,x,g){const y=x.enter("tableCell"),C=x.enter("phrasing"),b=x.containerPhrasing(p,{...g,before:s,after:s});return C(),y(),b}function h(p,m){return iB(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function u(p,m,x){const g=p.children;let y=-1;const C=[],b=m.enter("table");for(;++y<g.length;)C[y]=d(g[y],m,x);return b(),C}function d(p,m,x){const g=p.children;let y=-1;const C=[],b=m.enter("tableRow");for(;++y<g.length;)C[y]=l(g[y],p,m,x);return b(),C}function f(p,m,x){let g=sy.inlineCode(p,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function UB(){return{exit:{taskListCheckValueChecked:tm,taskListCheckValueUnchecked:tm,paragraph:GB}}}function YB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:VB}}}function tm(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function GB(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 VB(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=sy.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),l;function h(u){return u+o}}function XB(){return[EN(),VN(),ZN(),OB(),UB()]}function KB(t){return{extensions:[jN(),XN(t),JN(),HB(t),YB()]}}const QB={tokenize:nL,partial:!0},oy={tokenize:iL,partial:!0},ay={tokenize:sL,partial:!0},ly={tokenize:oL,partial:!0},ZB={tokenize:aL,partial:!0},cy={name:"wwwAutolink",tokenize:eL,previous:uy},hy={name:"protocolAutolink",tokenize:rL,previous:dy},xn={name:"emailAutolink",tokenize:tL,previous:py},Jr={};function JB(){return{text:Jr}}let Vn=48;for(;Vn<123;)Jr[Vn]=xn,Vn++,Vn===58?Vn=65:Vn===91&&(Vn=97);Jr[43]=xn;Jr[45]=xn;Jr[46]=xn;Jr[95]=xn;Jr[72]=[xn,hy];Jr[104]=[xn,hy];Jr[87]=[xn,cy];Jr[119]=[xn,cy];function tL(t,e,r){const n=this;let i,s;return o;function o(d){return!eu(d)||!py.call(n,n.previous)||Wd(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return eu(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(ZB,u,h)(d):d===45||d===95||Ge(d)?(s=!0,t.consume(d),l):u(d)}function h(d){return t.consume(d),i=!0,l}function u(d){return s&&i&&er(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function eL(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!uy.call(n,n.previous)||Wd(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(QB,t.attempt(oy,t.attempt(ay,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function rL(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&dy.call(n,n.previous)&&!Wd(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(er(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),s?h:(s=!0,l)):r(d)}function h(d){return d===null||dl(d)||le(d)||ui(d)||sc(d)?r(d):t.attempt(oy,t.attempt(ay,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function nL(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 iL(t,e,r){let n,i,s;return o;function o(h){return h===46||h===95?t.check(ly,l,a)(h):h===null||le(h)||ui(h)||h!==45&&sc(h)?l(h):(s=!0,t.consume(h),o)}function a(h){return h===95?n=!0:(i=n,n=void 0),t.consume(h),o}function l(h){return i||n||!s?r(h):e(h)}}function sL(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(ly,e,s)(o):o===null||le(o)||ui(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function oL(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||le(a)||ui(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||le(a)||ui(a)?e(a):n(a)}function s(a){return er(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):er(a)?(t.consume(a),o):r(a)}}function aL(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ge(s)?r(s):e(s)}}function uy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||le(t)}function dy(t){return!er(t)}function py(t){return!(t===47||eu(t))}function eu(t){return t===43||t===45||t===46||t===95||Ge(t)}function Wd(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 lL={tokenize:gL,partial:!0};function cL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:pL,continuation:{tokenize:fL},exit:mL}},text:{91:{name:"gfmFootnoteCall",tokenize:dL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hL,resolveTo:uL}}}}function hL(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 h=Or(n.sliceSerialize({start:o.end,end:n.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function uL(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 dL(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",h)}function h(d){if(s>999||d===93&&!o||d===null||d===91||le(d))return r(d);if(d===93){t.exit("chunkString");const f=t.exit("gfmFootnoteCallString");return i.includes(Or(n.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return le(d)||(o=!0),s++,t.consume(d),d===92?u:h}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,h):h(d)}}function pL(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"),h}function h(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||le(m))return r(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return s=Or(n.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return le(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 f(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(s)||i.push(s),Qt(t,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return e(m)}}function fL(t,e,r){return t.check(Zo,e,t.attempt(lL,e,r))}function mL(t){t.exit("gfmFootnoteDefinition")}function gL(t,e,r){const n=this;return Qt(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 xL(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 h=l;for(;h--;)if(o[h][0]==="exit"&&o[h][1].type==="strikethroughSequenceTemporary"&&o[h][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[h][1].end.offset-o[h][1].start.offset){o[l][1].type="strikethroughSequence",o[h][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[h][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[h][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[h][1],a],["exit",o[h][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&Cr(f,f.length,0,oc(p,o.slice(h+1,l),a)),Cr(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Cr(o,h-1,l-h+3,f),l=h+f.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 h=this.previous,u=this.events;let d=0;return f;function f(m){return h===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const x=ms(h);if(m===126)return d>1?l(m):(o.consume(m),d++,p);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 yL{constructor(){this.map=[]}add(e,r,n){bL(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 bL(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 CL(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 kL(){return{flow:{null:{name:"table",tokenize:vL,resolveAll:wL}}}}function vL(t,e,r){const n=this;let i=0,s=0,o;return a;function a(E){let F=n.events.length-1;for(;F>-1;){const O=n.events[F][1].type;if(O==="lineEnding"||O==="linePrefix")F--;else break}const z=F>-1?n.events[F][1].type:null,W=z==="tableHead"||z==="tableRow"?w:l;return W===w&&n.parser.lazy[n.now().line]?r(E):W(E)}function l(E){return t.enter("tableHead"),t.enter("tableRow"),h(E)}function h(E){return E===124||(o=!0,s+=1),u(E)}function u(E){return E===null?r(E):Nt(E)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),p):r(E):Vt(E)?Qt(t,u,"whitespace")(E):(s+=1,o&&(o=!1,i+=1),E===124?(t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(E)))}function d(E){return E===null||E===124||le(E)?(t.exit("data"),u(E)):(t.consume(E),E===92?f:d)}function f(E){return E===92||E===124?(t.consume(E),d):d(E)}function p(E){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(E):(t.enter("tableDelimiterRow"),o=!1,Vt(E)?Qt(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):m(E))}function m(E){return E===45||E===58?g(E):E===124?(o=!0,t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),x):_(E)}function x(E){return Vt(E)?Qt(t,g,"whitespace")(E):g(E)}function g(E){return E===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(E),t.exit("tableDelimiterMarker"),y):E===45?(s+=1,y(E)):E===null||Nt(E)?S(E):_(E)}function y(E){return E===45?(t.enter("tableDelimiterFiller"),C(E)):_(E)}function C(E){return E===45?(t.consume(E),C):E===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(E),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(E))}function b(E){return Vt(E)?Qt(t,S,"whitespace")(E):S(E)}function S(E){return E===124?m(E):E===null||Nt(E)?!o||i!==s?_(E):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(E)):_(E)}function _(E){return r(E)}function w(E){return t.enter("tableRow"),B(E)}function B(E){return E===124?(t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),B):E===null||Nt(E)?(t.exit("tableRow"),e(E)):Vt(E)?Qt(t,B,"whitespace")(E):(t.enter("data"),L(E))}function L(E){return E===null||E===124||le(E)?(t.exit("data"),B(E)):(t.consume(E),E===92?I:L)}function I(E){return E===92||E===124?(t.consume(E),L):L(E)}}function wL(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,h,u,d;const f=new yL;for(;++r<t.length;){const p=t[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(em(f,e,l,h,u),u=void 0,l=0),h={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",h,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)},f.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=wa(f,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=wa(f,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=wa(f,e,s,i,r,d)):o[1]!==0&&(d=wa(f,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&em(f,e,l,h,u),f.consume(e.events),r=-1;++r<e.events.length;){const p=e.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=CL(e.events,r))}return t}function wa(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Ri(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=Ri(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 h=Ri(e.events,r[2]),u=Ri(e.events,r[3]),d={type:a,start:Object.assign({},h),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){const f=e.events[r[2]],p=e.events[r[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[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({},Ri(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function em(t,e,r,n,i){const s=[],o=Ri(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 Ri(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const SL={name:"tasklistCheck",tokenize:_L};function TL(){return{text:{91:SL}}}function _L(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 le(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 Nt(l)?e(l):Vt(l)?t.check({tokenize:EL},e,r)(l):r(l)}}function EL(t,e,r){return Qt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function jL(t){return S0([JB(),cL(),xL(t),kL(),TL()])}const NL={};function qd(t){const e=this,r=t||NL,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(jL(r)),s.push(XB()),o.push(KB(r))}const hc=v.createContext({newIds:new Set,changedIds:new Set}),rm=t=>{let e;const r=new Set,n=(h,u)=>{const d=typeof h=="function"?h(e):h;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(p=>p(e,f))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:h=>(r.add(h),()=>r.delete(h))},l=e=t(n,i,a);return a},BL=(t=>t?rm(t):rm),LL=t=>t;function AL(t,e=LL){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 nm=t=>{const e=BL(t),r=n=>AL(e,n);return Object.assign(r,e),r},Hd=(t=>t?nm(t):nm),Vs=new Map;function ML(t,e,r){var P,$;const{prevItemMapRef:n,snapshotProviderRef:i,gatesRef:s,pendingResolveIdsRef:o,changeTimerRef:a,sessionEndTimerRef:l,wsRef:h}=e,{setItems:u,setConnections:d,setGates:f,setGateEvent:p,setRecentChanges:m,setUICommand:x,setAgentActivity:g,setAgentErrors:y,setSessionState:C,setSpawnedAgents:b,setAgentRelays:S,setSettings:_,setPipelineDraft:w,setActiveBuild:B,setSessions:L,setIterationStates:I,setFeatureTimeline:E,EMPTY_CHANGES:F,appendDecisionEvent:z,setDecisionEventsSnapshot:W,setStatusSnapshot:O,clearStatusSnapshots:M}=r,A=E?j=>{E(T=>T.some(Y=>Y.id===j.id)?T:[...T,j])}:null;if(t.type==="visionState"||t.type==="hydrate"){const j=t.items||[];if(n.current){const T=n.current,Y=new Set,J=new Set;for(const D of j){const Q=T.get(D.id);Q?(Q.status!==D.status||Q.confidence!==D.confidence||Q.title!==D.title)&&J.add(D.id):Y.add(D.id)}(Y.size>0||J.size>0)&&(m({newIds:Y,changedIds:J}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(F),800))}n.current=new Map(j.map(T=>[T.id,T])),u(j),d(t.connections||[]),f(t.gates||[]),L&&L(t.sessions||[]),W&&Array.isArray(t.decisionEventsSnapshot)&&W(t.decisionEventsSnapshot),M&&M()}else if(t.type==="decisionEvent")z&&t.event&&z(t.event);else if(t.type==="decisionEventsSnapshot")W&&Array.isArray(t.events)&&W(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 T=[...j,{tool:t.tool,category:t.category||null,detail:t.detail,items:t.items||[],error:t.error||null,timestamp:t.timestamp}];return T.length>20?T.slice(-20):T}),C(j=>j!=null&&j.active?{...j,toolCount:(j.toolCount||0)+1}:j);else if(t.type==="agentSpawned")b(j=>[...j,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")b(j=>j.map(T=>T.agentId===t.agentId?{...T,silent:!0,silentSinceMs:t.silentSinceMs}:T));else if(t.type==="agentKilled")b(j=>j.map(T=>T.agentId===t.agentId?{...T,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:T));else if(t.type==="agentGC")((P=t.removed)==null?void 0:P.length)>0&&g(j=>{const T=[...j,{tool:"gc",category:"executing",detail:`Cleaned ${t.removed.length} orphan worktree(s)`,items:[],timestamp:t.timestamp}];return T.length>20?T.slice(-20):T});else if(t.type==="agentComplete")b(j=>j.map(T=>T.agentId===t.agentId?T.status==="killed"?T:{...T,status:t.status,completedAt:new Date().toISOString()}:T));else if(t.type==="agentRelay")S(j=>[...j,t].slice(-50));else if(t.type==="sessionStart")l.current&&(clearTimeout(l.current),l.current=null),b(()=>[]),S(()=>[]),C(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}),A&&A({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),C(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(()=>{C(null),l.current=null},3e3),A&&A({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")C(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")C(j=>j&&{...j,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(j=>{const T=[...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 T.length>10?T.slice(-10):T}),C(j=>j!=null&&j.active?{...j,errorCount:(j.errorCount||0)+1}:j),A&&A({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")p({type:"pending",gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}),A&&A({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(f(Y=>Y.map(J=>J.id===t.gateId?{...J,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:J)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const Y=t.itemId??(($=s.current.find(J=>J.id===t.gateId))==null?void 0:$.itemId)??t.gateId;p({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:Y})}const j=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,T={approve:"success",revise:"warning",kill:"error"};A&&A({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${j}`,detail:null,severity:T[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 T;t.type==="iterationStarted"?T=`${t.loopType} loop started (0/${t.maxIterations})`:t.type==="iterationComplete"?T=`${t.loopType??"loop"} loop complete (${t.outcome} after ${t.finalCount} iterations)`:T=`${t.loopType??"loop"} iteration ${t.count}/${t.maxIterations}`;const Y=[...j,{tool:"iteration",category:t.loopType||"iteration",detail:T,items:[],timestamp:t.timestamp}];return Y.length>20?Y.slice(-20):Y}),t.type==="iterationStarted")Vs.has(t.loopId)&&(clearTimeout(Vs.get(t.loopId)),Vs.delete(t.loopId)),I(j=>{const T=new Map(j);return T.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}),T});else if(t.type==="iterationUpdate")I(j=>{const T=j.get(t.loopId);if(!T)return j;const Y=new Map(j);return Y.set(t.loopId,{...T,count:t.count,maxIterations:t.maxIterations}),Y});else if(t.type==="iterationComplete"){I(T=>{const Y=T.get(t.loopId);if(!Y)return T;const J=new Map(T);return J.set(t.loopId,{...Y,status:"complete",outcome:t.outcome,count:t.finalCount??Y.count}),J});const j=setTimeout(()=>{I(T=>{const Y=new Map(T);return Y.delete(t.loopId),Y}),Vs.delete(t.loopId)},5e3);Vs.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(T=>{const Y=[...T,{errorType:"iteration_limit",severity:"warning",message:j[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return Y.length>10?Y.slice(-10):Y}),C(T=>T!=null&&T.active?{...T,errorCount:(T.errorCount||0)+1}:T)}if(A&&(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)`;A({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")A&&A({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)":"",T=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";A&&A({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${j}`,detail:null,severity:T,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(T=>{if(T.id!==t.itemId)return T;const Y=T.lifecycle?{...T.lifecycle}:{};return Y.lifecycle_ext={...Y.lifecycle_ext||{},open_loops:t.loops},{...T,lifecycle:Y}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(j=>j.map(T=>{if(T.id!==t.itemId)return T;const Y=T.lifecycle?{...T.lifecycle}:{};return Y.lifecycle_ext={...Y.lifecycle_ext||{},drift_axes:t.drift_axes},{...T,lifecycle:Y}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:j,itemId:T,...Y}=t;u(J=>J.map(D=>{if(D.id!==T)return D;const Q=D.lifecycle?{...D.lifecycle}:{};return Q.lifecycle_ext={...Q.lifecycle_ext||{},branch_lineage:Y},{...D,lifecycle:Q}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")_&&_(t.settings||null);else if(t.type==="buildState")B&&B(j=>{const T=(j==null?void 0:j.flowId)&&t.flowId&&j.flowId===t.flowId;return{...t,tierEvents:T?j.tierEvents??[]:[],capabilityEvents:T?j.capabilityEvents??[]:[],...T&&(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")B&&B(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"))B&&B(j=>j&&{...j,tierEvents:[...j.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")B&&B(j=>j&&{...j,capabilityEvents:[...j.capabilityEvents||[],t].slice(-200)});else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:j}=e,T=i.current?i.current():{},Y=j?j():{},J=h.current;J&&J.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...T,dom:Y,timestamp:new Date().toISOString()}}))}}function IL(){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 f=s.textContent.trim();return f?f.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={},h=s.getAttribute("role")||s.getAttribute("aria-label"),u=s.tagName.toLowerCase();if(h?l.role=h:l.tag=u,s.className&&typeof s.className=="string"){const f=s.className.trim();f.length<80&&(l.class=f)}const d=[];for(const f of s.childNodes){const p=n(f,o+1);p&&d.push(p)}return d.length===1&&typeof d[0]=="string"?l.text=d[0]:d.length>0&&(l.children=d),!h&&(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 fe={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},im={newIds:new Set,changedIds:new Set},pr=Hd((t,e)=>{async function r(o,a){const l=await Ft(o,a),h=await l.json();return l.ok?h:(console.error(`[vision] API error ${l.status}:`,h.error||h),{error:h.error||`HTTP ${l.status}`})}function n(){t({connected:!0}),Ft("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),Ft("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),Ft("/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);ML(a,{prevItemMapRef:{get current(){return fe.prevItemMap},set current(l){fe.prevItemMap=l}},snapshotProviderRef:{get current(){return fe.snapshotProvider},set current(l){fe.snapshotProvider=l}},gatesRef:{get current(){return fe.gates},set current(l){fe.gates=l}},pendingResolveIdsRef:{get current(){return fe.pendingResolveIds},set current(l){fe.pendingResolveIds=l}},changeTimerRef:{get current(){return fe.changeTimer},set current(l){fe.changeTimer=l}},sessionEndTimerRef:{get current(){return fe.sessionEndTimer},set current(l){fe.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=fe.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:IL},{setItems:l=>t(h=>({items:typeof l=="function"?l(h.items):l})),setConnections:l=>t(h=>({connections:typeof l=="function"?l(h.connections):l})),setGates:l=>{t(h=>{const u=typeof l=="function"?l(h.gates):l;return fe.gates=u,{gates:u}})},setGateEvent:l=>t({gateEvent:l}),setRecentChanges:l=>t(h=>({recentChanges:typeof l=="function"?l(h.recentChanges):l})),setUICommand:l=>t({uiCommand:l}),setAgentActivity:l=>t(h=>({agentActivity:typeof l=="function"?l(h.agentActivity):l})),setAgentErrors:l=>{t(h=>{const u=typeof l=="function"?l(h.agentErrors):l,d=Date.now()-6e4,f=u.filter(p=>new Date(p.timestamp).getTime()>d).slice(-5);return{agentErrors:u,recentErrors:f}})},setSessionState:l=>t(h=>({sessionState:typeof l=="function"?l(h.sessionState):l})),setSpawnedAgents:l=>t(h=>({spawnedAgents:typeof l=="function"?l(h.spawnedAgents):l})),setAgentRelays:l=>t(h=>({agentRelays:typeof l=="function"?l(h.agentRelays):l})),setSettings:l=>t({settings:l}),setPipelineDraft:l=>t({pipelineDraft:l}),setActiveBuild:l=>t(h=>({activeBuild:typeof l=="function"?l(h.activeBuild):l})),setSessions:l=>t(h=>({sessions:typeof l=="function"?l(h.sessions):l})),setFeatureTimeline:l=>t(h=>({featureTimeline:typeof l=="function"?l(h.featureTimeline):l})),setIterationStates:l=>t(h=>({iterationStates:typeof l=="function"?l(h.iterationStates):l})),appendDecisionEvent:l=>t(h=>!(l!=null&&l.id)||h.decisionEvents.some(u=>u.id===l.id)?h:{decisionEvents:[...h.decisionEvents,l]}),setDecisionEventsSnapshot:l=>t({decisionEvents:Array.isArray(l)?l:[]}),setStatusSnapshot:(l,h)=>t(u=>({statusSnapshots:{...u.statusSnapshots,[l]:h}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),EMPTY_CHANGES:im})}catch{}}function s(){if(fe.disposed||fe.ws)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/vision`;fe.ws=X2({url:a,onOpen:n,onMessage:i,onClose:()=>t({connected:!1})})}return Ft("/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")),fe.buildPollInterval=setInterval(()=>{Ft("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),fe.recentErrorsInterval=setInterval(()=>{const{agentErrors:o}=e(),a=Date.now()-6e4,l=o.filter(h=>new Date(h.timestamp).getTime()>a).slice(-5);t({recentErrors:l})},1e4),s(),{items:[],connections:[],connected:!1,uiCommand:null,recentChanges:im,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=>{fe.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(h=>h.id===o?{...h,position:a}:h)}))},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)=>{fe.pendingResolveIds.add(o);try{const h=await r(`/api/vision/gates/${o}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({outcome:a,comment:l})});return h.error&&fe.pendingResolveIds.delete(o),h}catch{return fe.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}:{})})}}),FL=Q2("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 ir({className:t,variant:e,...r}){return c.jsx("div",{className:st(FL({variant:e}),t),...r})}var DL=v.createContext(void 0);function PL(t){const e=v.useContext(DL);return t||e||"ltr"}function OL(t,[e,r]){return Math.min(r,Math.max(e,t))}function $L(t,e){return v.useReducer((r,n)=>e[r][n]??r,t)}var Ud="ScrollArea",[fy]=Z2(Ud),[RL,Nr]=fy(Ud),my=v.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=v.useState(null),[h,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[x,g]=v.useState(null),[y,C]=v.useState(0),[b,S]=v.useState(0),[_,w]=v.useState(!1),[B,L]=v.useState(!1),I=_s(e,F=>l(F)),E=PL(i);return c.jsx(RL,{scope:r,type:n,dir:E,scrollHideDelay:s,scrollArea:a,viewport:h,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:w,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:B,onScrollbarYEnabledChange:L,onCornerWidthChange:C,onCornerHeightChange:S,children:c.jsx(Es.div,{dir:E,...o,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...t.style}})})});my.displayName=Ud;var gy="ScrollAreaViewport",xy=v.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Nr(gy,r),a=v.useRef(null),l=_s(e,a,o.onViewportChange);return c.jsxs(c.Fragment,{children:[c.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}),c.jsx(Es.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:c.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});xy.displayName=gy;var tn="ScrollAreaScrollbar",Yd=v.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Nr(tn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return v.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?c.jsx(zL,{...n,ref:e,forceMount:r}):i.type==="scroll"?c.jsx(WL,{...n,ref:e,forceMount:r}):i.type==="auto"?c.jsx(yy,{...n,ref:e,forceMount:r}):i.type==="always"?c.jsx(Gd,{...n,ref:e,"data-state":"visible"}):null});Yd.displayName=tn;var zL=v.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Nr(tn,t.__scopeScrollArea),[s,o]=v.useState(!1);return v.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const h=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),c.jsx(rc,{present:r||s,children:c.jsx(yy,{"data-state":s?"visible":"hidden",...n,ref:e})})}),WL=v.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Nr(tn,t.__scopeScrollArea),s=t.orientation==="horizontal",o=dc(()=>l("SCROLL_END"),100),[a,l]=$L("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 v.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,i.scrollHideDelay,l]),v.useEffect(()=>{const h=i.viewport,u=s?"scrollLeft":"scrollTop";if(h){let d=h[u];const f=()=>{const p=h[u];d!==p&&(l("SCROLL"),o()),d=p};return h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[i.viewport,s,l,o]),c.jsx(rc,{present:r||a!=="hidden",children:c.jsx(Gd,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:oi(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:oi(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),yy=v.forwardRef((t,e)=>{const r=Nr(tn,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=v.useState(!1),a=t.orientation==="horizontal",l=dc(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?h:u)}},10);return gs(r.viewport,l),gs(r.content,l),c.jsx(rc,{present:n||s,children:c.jsx(Gd,{"data-state":s?"visible":"hidden",...i,ref:e})})}),Gd=v.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Nr(tn,t.__scopeScrollArea),s=v.useRef(null),o=v.useRef(0),[a,l]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=wy(a.viewport,a.content),u={...n,sizes:a,onSizesChange:l,hasThumb:h>0&&h<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:f=>o.current=f};function d(f,p){return VL(f,o.current,a,p)}return r==="horizontal"?c.jsx(qL,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollLeft,p=sm(f,a,i.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{i.viewport&&(i.viewport.scrollLeft=f)},onDragScroll:f=>{i.viewport&&(i.viewport.scrollLeft=d(f,i.dir))}}):r==="vertical"?c.jsx(HL,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollTop,p=sm(f,a);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{i.viewport&&(i.viewport.scrollTop=f)},onDragScroll:f=>{i.viewport&&(i.viewport.scrollTop=d(f))}}):null}),qL=v.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Nr(tn,t.__scopeScrollArea),[o,a]=v.useState(),l=v.useRef(null),h=_s(e,l,s.onScrollbarXChange);return v.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Cy,{"data-orientation":"horizontal",...i,ref:h,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":uc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const f=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),Ty(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:xl(o.paddingLeft),paddingEnd:xl(o.paddingRight)}})}})}),HL=v.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Nr(tn,t.__scopeScrollArea),[o,a]=v.useState(),l=v.useRef(null),h=_s(e,l,s.onScrollbarYChange);return v.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Cy,{"data-orientation":"vertical",...i,ref:h,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":uc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const f=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),Ty(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:xl(o.paddingTop),paddingEnd:xl(o.paddingBottom)}})}})}),[UL,by]=fy(tn),Cy=v.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:h,onWheelScroll:u,onResize:d,...f}=t,p=Nr(tn,r),[m,x]=v.useState(null),g=_s(e,I=>x(I)),y=v.useRef(null),C=v.useRef(""),b=p.viewport,S=n.content-n.viewport,_=ei(u),w=ei(l),B=dc(d,10);function L(I){if(y.current){const E=I.clientX-y.current.left,F=I.clientY-y.current.top;h({x:E,y:F})}}return v.useEffect(()=>{const I=E=>{const F=E.target;(m==null?void 0:m.contains(F))&&_(E,S)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[b,m,S,_]),v.useEffect(w,[n,w]),gs(m,B),gs(p.content,B),c.jsx(UL,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:ei(s),onThumbPointerUp:ei(o),onThumbPositionChange:w,onThumbPointerDown:ei(a),children:c.jsx(Es.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:oi(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),y.current=m.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),L(I))}),onPointerMove:oi(t.onPointerMove,L),onPointerUp:oi(t.onPointerUp,I=>{const E=I.target;E.hasPointerCapture(I.pointerId)&&E.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=C.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),gl="ScrollAreaThumb",ky=v.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=by(gl,t.__scopeScrollArea);return c.jsx(rc,{present:r||i.hasThumb,children:c.jsx(YL,{ref:e,...n})})}),YL=v.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Nr(gl,r),o=by(gl,r),{onThumbPositionChange:a}=o,l=_s(e,d=>o.onThumbChange(d)),h=v.useRef(void 0),u=dc(()=>{h.current&&(h.current(),h.current=void 0)},100);return v.useEffect(()=>{const d=s.viewport;if(d){const f=()=>{if(u(),!h.current){const p=XL(d,a);h.current=p,a()}};return a(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[s.viewport,u,a]),c.jsx(Es.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:oi(t.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),m=d.clientX-p.left,x=d.clientY-p.top;o.onThumbPointerDown({x:m,y:x})}),onPointerUp:oi(t.onPointerUp,o.onThumbPointerUp)})});ky.displayName=gl;var Vd="ScrollAreaCorner",vy=v.forwardRef((t,e)=>{const r=Nr(Vd,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?c.jsx(GL,{...t,ref:e}):null});vy.displayName=Vd;var GL=v.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Nr(Vd,r),[s,o]=v.useState(0),[a,l]=v.useState(0),h=!!(s&&a);return gs(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),l(u)}),gs(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),h?c.jsx(Es.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 xl(t){return t?parseInt(t,10):0}function wy(t,e){const r=t/e;return isNaN(r)?0:r}function uc(t){const e=wy(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function VL(t,e,r,n="ltr"){const i=uc(r),s=i/2,o=e||s,a=i-o,l=r.scrollbar.paddingStart+o,h=r.scrollbar.size-r.scrollbar.paddingEnd-a,u=r.content-r.viewport,d=n==="ltr"?[0,u]:[u*-1,0];return Sy([l,h],d)(t)}function sm(t,e,r="ltr"){const n=uc(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],h=OL(t,l);return Sy([0,o],[0,a])(h)}function Sy(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 Ty(t,e){return t>0&&t<e}var XL=(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 dc(t,e){const r=ei(t),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function gs(t,e){const r=ei(e);J2(()=>{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 _y=my,KL=xy,QL=vy;const Dn=v.forwardRef(({className:t,children:e,...r},n)=>c.jsxs(_y,{ref:n,className:st("relative overflow-hidden",t),...r,children:[c.jsx(KL,{className:"h-full w-full rounded-[inherit]",children:e}),c.jsx(Ey,{}),c.jsx(QL,{})]}));Dn.displayName=_y.displayName;const Ey=v.forwardRef(({className:t,orientation:e="vertical",...r},n)=>c.jsx(Yd,{ref:n,orientation:e,className:st("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:c.jsx(ky,{className:"relative flex-1 rounded-full bg-border"})}));Ey.displayName=Yd.displayName;var ZL="Separator",om="horizontal",JL=["horizontal","vertical"],jy=v.forwardRef((t,e)=>{const{decorative:r,orientation:n=om,...i}=t,s=tA(n)?n:om,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return c.jsx(Es.div,{"data-orientation":s,...a,...i,ref:e})});jy.displayName=ZL;function tA(t){return JL.includes(t)}var Ny=jy;const yl=v.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>c.jsx(Ny,{ref:i,decorative:r,orientation:e,className:st("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));yl.displayName=Ny.displayName;function eA({agentId:t,status:e}){const[r,n]=v.useState(""),[i,s]=v.useState(""),o=v.useRef(null),a=v.useRef(!1),l=v.useCallback(()=>{const d=o.current;d&&(a.current=d.scrollTop+d.clientHeight<d.scrollHeight-20)},[]);v.useEffect(()=>{const d=o.current;d&&!a.current&&(d.scrollTop=d.scrollHeight)},[r,i]),v.useEffect(()=>{if(!t)return;const d=async()=>{try{const f=await Ft(`/api/agent/${t}`);if(!f.ok)return;const p=await f.json();p.output!=null&&n(p.output),p.stderr!=null&&s(p.stderr)}catch{}};if(d(),e==="running"){const f=setInterval(d,2e3);return()=>clearInterval(f)}},[t,e]);const h=!r&&!i,u=e==="running";return c.jsx("div",{children:c.jsx("div",{ref:o,onScroll:l,className:"overflow-auto max-h-[300px] rounded bg-muted/30 p-2",children:h?c.jsx("p",{className:"text-[10px] font-mono text-muted-foreground italic",children:u?"Waiting for output...":"No output"}):c.jsxs(c.Fragment,{children:[r&&c.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground whitespace-pre-wrap break-all m-0",children:r}),i&&c.jsxs("div",{className:"mt-2",children:[c.jsx("span",{className:"text-[10px] font-mono font-medium text-destructive",children:"stderr"}),c.jsx("pre",{className:"text-[10px] font-mono text-destructive whitespace-pre-wrap break-all m-0 mt-0.5",children:i})]})]})})})}const rA=Yt.memo(eA);function nA(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 iA({agentId:t,relays:e}){const r=v.useMemo(()=>!e||!t?[]:e.filter(n=>n.fromAgentId===t||n.toAgentId===t),[e,t]);return r.length===0?null:c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Relays"}),c.jsx("div",{className:"space-y-0.5",children:r.map((n,i)=>{const s=n.direction==="result";return c.jsxs("div",{className:"flex items-start gap-1 text-[10px] font-mono",children:[c.jsx("span",{className:s?"text-foreground shrink-0":"text-muted-foreground shrink-0",children:s?"→":"←"}),c.jsx("span",{className:s?"text-foreground truncate":"text-muted-foreground truncate",title:n.messagePreview,children:n.messagePreview}),c.jsx("span",{className:"text-muted-foreground opacity-50 ml-auto shrink-0 tabular-nums",children:nA(n.timestamp)})]},n.id||i)})})]})}const sA=Yt.memo(iA),oA={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},am={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function rh(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 aA=Yt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Yt.useState(0);Yt.useEffect(()=>{if(!r)return;const l=setInterval(()=>i(h=>h+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 c.jsxs("span",{className:"tabular-nums",children:[o,"m ",String(a).padStart(2,"0"),"s"]})});function lA({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,C;const[a,l]=Yt.useState(null),[h,u]=Yt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Yt.useState(0),[f,p]=Yt.useState([]),m=Yt.useRef(null);return Yt.useEffect(()=>{const b=S=>u(S.detail);return window.addEventListener("compose:agent-status",b),()=>window.removeEventListener("compose:agent-status",b)},[]),Yt.useEffect(()=>{if(h.status!=="working")return;const b=setInterval(()=>d(S=>S+1),1e3);return()=>clearInterval(b)},[h.status]),Yt.useEffect(()=>{if(!t||t.length===0)return;const b=t[t.length-1];Array.isArray(b.items)&&b.items.length>0&&(p(b.items),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p([]),3e4))},[t]),Yt.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),c.jsxs(c.Fragment,{children:[i&&i.length>0&&c.jsxs("div",{className:"flex items-center gap-0.5 mb-1.5 overflow-x-auto px-3",children:[c.jsx("button",{onClick:()=>l(null),className:st("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(b=>c.jsxs("span",{className:"flex items-center gap-0 shrink-0",children:[c.jsxs("button",{onClick:()=>l(b.agentId),className:st("text-[10px] px-2 py-0.5 rounded-l cursor-pointer transition-colors border flex items-center gap-1 shrink-0",a===b.agentId?"bg-primary text-primary-foreground border-primary":"bg-transparent text-muted-foreground border-border hover:text-foreground"),children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:b.status==="killed"?"hsl(var(--destructive))":b.silent?"hsl(45 93% 47%)":b.status==="running"?"hsl(var(--success))":b.status==="complete"?"hsl(142 71% 45%)":"hsl(var(--destructive))",animation:b.status==="running"&&!b.silent?"phase-active-pulse 2s ease-in-out infinite":"none"}}),b.agentType,b.silent&&c.jsx("span",{className:"text-[8px] text-yellow-500 ml-0.5",title:"Agent silent",children:"!"})]}),b.status==="running"&&o&&c.jsx("button",{onClick:S=>{S.stopPropagation(),o(b.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"})]},b.agentId))]}),a?c.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[c.jsx(rA,{agentId:a,status:(x=i.find(b=>b.agentId===a))==null?void 0:x.status}),c.jsx(sA,{agentId:a,relays:s})]}):c.jsxs(c.Fragment,{children:[(r==null?void 0:r.featureCode)&&c.jsxs("div",{className:"px-3 py-1.5 mb-1 rounded bg-muted/50",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground",children:"Working on"}),c.jsx("button",{className:"font-medium text-foreground hover:underline",onClick:()=>r.featureItemId&&(n==null?void 0:n(r.featureItemId)),children:r.featureCode})]}),r.phaseAtBind&&c.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Phase: ",r.phaseAtBind.replace(/_/g," ")]})]}),r&&c.jsxs("div",{className:"px-3 pb-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:r.active?"hsl(var(--primary))":"hsl(var(--success))"}}),c.jsx(aA,{startedAt:r.startedAt,active:r.active,duration:r.duration}),c.jsxs("span",{className:"tabular-nums",children:[r.toolCount||0," tools"]}),r.errorCount>0&&c.jsxs("span",{style:{color:"hsl(var(--destructive))"},children:[r.errorCount," err"]}),!r.active&&r.journalSpawned&&c.jsx("span",{style:{color:"hsl(var(--primary))"},children:"journal"})]}),((g=r.summaries)==null?void 0:g.length)>0&&c.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:(C=r.summaries[r.summaries.length-1])==null?void 0:C.summary})]}),c.jsx("div",{className:"px-3 pb-2",children:c.jsxs("div",{className:"rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:h.status==="working"?"var(--color-category-writing)":"hsl(var(--success))",animation:h.status==="working"?"pulse 1.5s ease-in-out infinite":"none"}}),c.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider",style:{color:h.status==="working"?"var(--color-category-writing)":"hsl(var(--muted-foreground))"},children:h.status==="working"?oA[h.category]||"Working":"Idle"}),h.status==="working"&&h.tool&&c.jsx("span",{className:"text-[10px] tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:h.tool}),h.status==="working"&&h.currentActivity&&c.jsx("span",{className:"text-[10px] tabular-nums ml-auto",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:rh(Date.now()-h.currentActivity.startTime)})]}),h.activityLog&&h.activityLog.length>0&&c.jsx("div",{className:"flex items-center gap-0.5 mt-1",children:h.activityLog.slice(-6).map((b,S,_)=>c.jsx("div",{className:"h-1 rounded-full",title:`${b.tool||"thinking"} — ${rh(b.duration)}`,style:{width:Math.max(4,Math.min(16,(b.duration||0)/1e3*2)),background:af[b.category]||(h.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+S/_.length*.6}},S))}),t&&t.length>0&&c.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((b,S)=>c.jsxs("div",{className:"flex items-center gap-1 text-[10px]",style:{color:b.error?"hsl(var(--destructive))":"hsl(var(--muted-foreground))"},children:[b.error&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--destructive))"}}),c.jsx("span",{className:"font-medium shrink-0",children:b.tool}),b.category&&!b.error&&c.jsx("span",{className:"shrink-0 opacity-50",style:{color:af[b.category]},children:b.category}),b.error?c.jsx("span",{className:"truncate",title:b.error.type,children:am[b.error.type]||b.error.type}):b.detail?c.jsx("span",{className:"truncate opacity-60",title:b.detail,children:b.detail.split("/").pop()}):null]},S))}),f.length>0&&c.jsxs("div",{className:"mt-1.5",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Working on"}),f.slice(0,3).map(b=>c.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[c.jsx("span",{children:b.status==="in_progress"?"◆":"◇"}),c.jsx("span",{className:"truncate",children:b.title})]},b.id))]}),e&&e.length>0&&c.jsxs("div",{className:"mt-1.5",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--destructive))"},children:"Errors"}),e.slice(-3).map((b,S)=>c.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--destructive))"},children:[c.jsx("span",{className:"font-medium shrink-0",children:am[b.errorType]||b.errorType}),c.jsx("span",{className:"truncate opacity-70",title:b.message,children:b.message})]},S))]}),i&&i.length>0&&c.jsxs("div",{className:"mt-1.5",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Subagents"}),i.map(b=>c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:b.status==="running"?"var(--color-category-executing)":b.status==="complete"?"hsl(var(--success))":"hsl(var(--destructive))",animation:b.status==="running"?"pulse 1.5s ease-in-out infinite":"none"}}),c.jsx("span",{className:"font-medium shrink-0",children:b.agentType}),c.jsx("span",{className:"truncate opacity-60",children:b.status}),c.jsx("span",{className:"tabular-nums ml-auto opacity-50",children:rh(Date.now()-new Date(b.startedAt).getTime())})]},b.agentId))]})]})})]})]})}const cA=Yt.memo(lA),wo={DECISION:1,PENDING_GATE:2,BLOCKED:3};function By(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,wo.BLOCKED,"Blocked"),r.has(s.id)&&i(s,wo.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,wo.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function hA(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))),h=e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," "):"";return{isRunning:o,pct:l,stepLabel:h,featureCode:s||"",stepNum:r??0,totalSteps:n??0,status:i||""}}function Ly(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=By(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function uA(t,e){return t&&t===e?null:e}const dA={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"}},pA={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function Xd({status:t,className:e}){const r=dA[t]||pA,n=t?t.replace(/_/g," "):"—";return c.jsxs("span",{className:st("inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",r.bg,r.text,e),children:[c.jsx("span",{className:st("w-1 h-1 rounded-full shrink-0",r.dot)}),n]})}const fA={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"},mA="text-slate-400 bg-slate-500/10 border-slate-500/20";function gA({phase:t,className:e}){const r=fA[t]||mA;return c.jsx("span",{className:st("inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-mono",r,e),children:t||"—"})}async function Tn(t,e={}){const r=await Ft(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let nh=null;function Ay(t){if(nh)return;const e=window.location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${e}//${window.location.host}/ws/vision`);nh=r,r.onmessage=n=>{try{const i=JSON.parse(n.data);i.type==="ideaboxUpdated"&&t(i)}catch{}},r.onclose=()=>{nh=null,setTimeout(()=>{Ay(t)},3e3)},r.onerror=()=>{}}const xs=Hd((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{Ay(()=>{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 Tn("/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 Tn("/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 Tn(`/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 Tn(`/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 Tn(`/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 Tn(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await Tn(`/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 Tn(`/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 xA({activeBuild:t}){const e=hA(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 c.jsxs("div",{className:"mx-3 mb-2 rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(cl,{className:"h-3 w-3 shrink-0",style:{color:r}}),c.jsx("span",{className:"text-[10px] font-medium truncate max-w-[100px]",style:{color:"hsl(var(--foreground))"},children:e.featureCode||"Build"})]}),c.jsxs("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))"},children:[e.stepNum,"/",e.totalSteps]})]}),c.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${e.pct}%`,background:r}})}),c.jsxs("div",{className:"flex items-center justify-between mt-1",children:[c.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:e.stepLabel}),e.isRunning&&c.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 yA({items:t,gates:e,onSelectItem:r,onViewChange:n}){const i=Yt.useMemo(()=>By(t,e),[t,e]);if(i.length===0)return null;const s=i.slice(0,5),o=i.length-s.length,a=l=>l===wo.BLOCKED?c.jsx(ic,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):l===wo.PENDING_GATE?c.jsx(uT,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):c.jsx(uS,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--muted-foreground))"}});return c.jsxs("div",{className:"px-2 mb-2",children:[c.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:h,reason:u})=>c.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(h),c.jsx("span",{className:"truncate flex-1 text-left",children:l.title}),l.phase&&c.jsx(gA,{phase:l.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),c.jsx(Xd,{status:l.status,className:"shrink-0"})]},l.id)),o>0&&c.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 bA({items:t,gates:e}){const r=Yt.useMemo(()=>Ly(t,e),[t,e]);return r.total===0?null:c.jsxs("div",{className:"flex items-center gap-2 flex-wrap px-3 pb-1",children:[c.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.total," items"]}),r.inProgress>0&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--primary))"},children:[r.inProgress," active"]}),r.blocked>0&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--destructive))"},children:[r.blocked," blocked"]}),r.pendingGates>0&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--warning))"},children:[r.pendingGates," ",r.pendingGates===1?"gate":"gates"]})]})}const CA=new Set(["planned","ready","in_progress","review","blocked","parked"]);function kA({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/")||!CA.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:c.jsx(c.Fragment,{children:n.map(({group:i,count:s,active:o})=>{const a=e==null?void 0:e.has(i);return c.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:[c.jsx("span",{className:"truncate flex-1 text-left",children:i}),o>0&&c.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--primary))"},children:o}),c.jsx("span",{className:"text-[10px] tabular-nums shrink-0",style:{color:"hsl(var(--muted-foreground))"},children:s})]},i)})})}function vA({onViewChange:t}){const e=xs(n=>n.ideas),r=Yt.useMemo(()=>e.filter(n=>!n.priority||n.priority==="—").length,[e]);return r===0?null:c.jsxs("div",{className:"px-2 mb-2",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Ideas"}),c.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:[c.jsx(hi,{className:"h-3 w-3 shrink-0 text-amber-400"}),c.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function My({items:t,gates:e,activeBuild:r,onViewChange:n,selectedPhase:i,onPhaseSelect:s,selectedTrack:o,onTrackSelect:a,visibleTracks:l,onToggleVisibleTrack:h,onShowAllTracks:u,hiddenGroups:d,onToggleGroup:f,searchQuery:p,onSearchChange:m,connected:x,agentActivity:g,agentErrors:y,spawnedAgents:C,agentRelays:b,sessionState:S,onSelectItem:_,onStopAgent:w,onThemeChange:B,onNewItem:L,widthPx:I}){const E=t||[],F=e||[],z=Yt.useMemo(()=>Ly(E,F),[E,F]),[W,O]=Yt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Yt.useEffect(()=>{if(typeof document>"u")return;const A=new MutationObserver(()=>{O(document.documentElement.classList.contains("dark"))});return A.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>A.disconnect()},[]);const M=Yt.useCallback(()=>{const A=!W,P=A?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",A);try{localStorage.setItem("compose:theme",P)}catch{}B&&B({ui:{theme:P}})},[W,B]);return Yt.useCallback(A=>{s&&s(uA(i,A))},[s,i]),c.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:I??208},children:[c.jsxs("div",{className:"p-3 pb-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"Compose"}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[!x&&c.jsx("span",{className:"text-[10px] text-destructive",children:"disconnected"}),L&&c.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:[c.jsx(Jx,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"New"})]}),c.jsx("button",{onClick:M,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:W?"Switch to light mode":"Switch to dark mode",children:W?c.jsx(xT,{className:"h-3.5 w-3.5"}):c.jsx(QS,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(bA,{items:E,gates:F})]}),c.jsx(xA,{activeBuild:r}),c.jsx(cA,{agentActivity:g,agentErrors:y,sessionState:S,onSelectItem:_,onStopAgent:w,spawnedAgents:C,agentRelays:b}),z.attentionCount>0&&c.jsxs(c.Fragment,{children:[c.jsx(yl,{className:"bg-sidebar-border"}),c.jsx(yA,{items:E,gates:F,onSelectItem:_,onViewChange:n})]}),c.jsx(vA,{onViewChange:n}),c.jsx("div",{className:"px-3 pb-2",children:c.jsxs("div",{className:"relative",children:[c.jsx(Wn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(pd,{placeholder:"Search...",value:p,onChange:A=>m(A.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),c.jsx(yl,{className:"bg-sidebar-border"}),c.jsx(Dn,{className:"flex-1",children:c.jsxs("div",{className:"p-2",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Groups"}),c.jsx(kA,{items:E,hiddenGroups:d,onToggleGroup:f})]})})]})}function wA({level:t,size:e=4}){return c.jsx("div",{className:"flex items-center gap-px",children:[0,1,2,3].map(r=>c.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 ta({featureCode:t,active:e,onToggle:r}){return t?c.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 lm=[{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"]}],SA=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function cm({active:t,onClick:e,children:r}){return c.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 Iy({item:t,children:e,depth:r,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o}){const a=e.length>0,l=o.has(t.id),h=n===t.id,u=fr[t.type]||fr.task,d=Fn[t.status]||Fn.planned,{newIds:f,changedIds:p}=v.useContext(hc),m=f.has(t.id),x=p.has(t.id);return c.jsxs("div",{children:[c.jsxs("div",{"data-item-id":t.id,onClick:()=>i(t.id),className:st("flex items-center gap-1.5 py-1 px-2 cursor-pointer transition-colors rounded-md","hover:bg-accent/5",h&&"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:[c.jsx("button",{onClick:g=>{g.stopPropagation(),a&&s(t.id)},className:st("shrink-0 w-4 h-4 flex items-center justify-center rounded",a?"text-muted-foreground hover:text-foreground":"invisible"),children:a&&(l?c.jsx(Ko,{className:"h-3.5 w-3.5"}):c.jsx(fs,{className:"h-3.5 w-3.5"}))}),c.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:d}}),c.jsx("span",{className:"text-[9px] uppercase tracking-wider shrink-0 w-12",style:{color:u},children:t.type}),c.jsx("span",{className:st("text-sm text-foreground truncate flex-1",t.status==="killed"&&"line-through opacity-50"),children:t.title}),c.jsx(wA,{level:t.confidence||0}),t.phase&&c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-3.5 shrink-0",children:t.phase})]}),a&&l&&c.jsx("div",{children:e.map(g=>c.jsx(Iy,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function Fy({items:t,connections:e,selectedItemId:r,onSelect:n,onCreate:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,h]=v.useState(()=>new Set),[u,d]=v.useState(""),[f,p]=v.useState("all"),[m,x]=v.useState("all"),g=v.useCallback(_=>{h(w=>{const B=new Set(w);return B.has(_)?B.delete(_):B.add(_),B})},[]),y=v.useMemo(()=>{let _=t;const w=lm.find(B=>B.key===f);if(w!=null&&w.statuses&&(_=_.filter(B=>w.statuses.includes(B.status||"planned"))),m!=="all"&&(_=_.filter(B=>B.type===m)),u){const B=u.toLowerCase();_=_.filter(L=>(L.title||"").toLowerCase().includes(B)||(L.description||"").toLowerCase().includes(B)||(L.type||"").toLowerCase().includes(B)||(L.phase||"").toLowerCase().includes(B))}return o&&s&&(_=_.filter(B=>{var L;return B.featureCode===s||((L=B.lifecycle)==null?void 0:L.featureCode)===s||(B.title||"").includes(s)})),_},[t,u,f,m,o,s]),C=v.useMemo(()=>{const _=new Set(y.map(E=>E.id)),w=new Map;for(const E of y)w.set(E.id,{...E,_children:[]});const B=new Map;for(const E of e)!_.has(E.fromId)||!_.has(E.toId)||(E.type==="informs"?B.has(E.toId)||B.set(E.toId,E.fromId):(E.type==="supports"||E.type==="blocks")&&(B.has(E.fromId)||B.set(E.fromId,E.toId)));for(const E of t)E.parentId&&w.has(E.parentId)&&B.set(E.id,E.parentId);for(const[E]of B){const F=new Set;let z=E;for(;z&&B.has(z);){if(F.has(z)){B.delete(z);break}F.add(z),z=B.get(z)}}const L=[];for(const E of w.values()){const F=B.get(E.id);F&&w.has(F)?w.get(F)._children.push(E):L.push(E)}const I=E=>{E.sort((F,z)=>(F.confidence||0)-(z.confidence||0));for(const F of E)F._children.length>0&&I(F._children)};return I(L),L},[y,e]);Yt.useEffect(()=>{if(u){const _=new Set,w=B=>{for(const L of B)L._children.length>0&&(_.add(L.id),w(L._children))};w(C),h(_)}else l.size===0&&C.length>0&&h(new Set(C.map(_=>_.id)))},[C,u]),Yt.useEffect(()=>{if(!r||C.length===0)return;const _=[],w=(B,L)=>{for(const I of B){if(I.id===L)return!0;if(I._children.length>0&&w(I._children,L))return _.push(I.id),!0}return!1};w(C,r),_.length>0&&h(B=>{const L=new Set(B);for(const I of _)L.add(I);return L}),requestAnimationFrame(()=>{const B=document.querySelector(`[data-item-id="${r}"]`);B&&B.scrollIntoView({block:"center",behavior:"smooth"})})},[r,C]);const b=v.useCallback(()=>{const _=new Set,w=B=>{for(const L of B)L._children.length>0&&(_.add(L.id),w(L._children))};w(C),h(_)},[C]),S=v.useCallback(()=>{h(new Set)},[]);return C.filter(_=>_._children.length>0).length,c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[c.jsx(ta,{featureCode:s,active:o,onToggle:a}),c.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[c.jsx(Wn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(pd,{placeholder:"Search items...",value:u,onChange:_=>d(_.target.value),className:"h-7 pl-7 pr-7 text-xs"}),u&&c.jsx("button",{onClick:()=>d(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c.jsx(gn,{className:"h-3 w-3"})})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Status:"}),lm.map(_=>c.jsx(cm,{active:f===_.key,onClick:()=>p(_.key),children:_.label},_.key))]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Type:"}),SA.map(_=>c.jsx(cm,{active:m===_.key,onClick:()=>x(_.key),children:_.label},_.key))]}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[y.length,u||f!=="all"||m!=="all"?`/${t.length}`:""]}),c.jsx("div",{className:"flex-1"}),c.jsx("button",{onClick:b,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Expand"}),c.jsx("button",{onClick:S,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&&c.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:c.jsx(Jx,{className:"h-3.5 w-3.5"})})]}),c.jsx(Dn,{className:"flex-1",children:c.jsx("div",{className:"py-1",children:C.length===0?c.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No items to display"}):C.map(_=>c.jsx(Iy,{item:_,children:_._children,depth:0,selectedItemId:r,onSelect:n,onToggle:g,expandedIds:l},_.id))})})]})}try{Vo.use(qx)}catch{}try{Vo.use(nS)}catch{}const bl={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},TA=Object.fromEntries(Object.entries(fr).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("")}`]})),_A=[1,1.5,2,2.5,3],ru={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"}},hm=[{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 co(t){return t.group||"other"}const um=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,ih=24;function EA(t){if(!t||t.length<=ih)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>ih-1)break;r=i}return(r||t.slice(0,ih-1))+"…"}function jA(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&um.test(e))return e;if(t.id&&um.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?EA(t.slug):t.id?t.id.slice(0,12):"item"}function dm(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(`
299
- `)}function NA(t,e,r,n,i){var h;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(f=>co(f)).filter(Boolean))].map(f=>{const p=t.filter(y=>co(y)===f),m=p.filter(y=>["blocked","parked"].includes(y.status)).length,x=p.filter(y=>["in_progress","review","ready"].includes(y.status)).length,g=p.filter(y=>y.status==="planned").length;return{group:f,blocked:m,active:x,planned:g,total:p.length}});d.sort((f,p)=>p.active-f.active||p.blocked-f.blocked||p.planned-f.planned||f.group.localeCompare(p.group));for(const{group:f,active:p,total:m}of d){if(m<2)continue;l.add(f);const x=a&&t.some(g=>co(g)===f&&a.has(g.id));s.push({data:{id:`group-${f}`,label:`${dm(f)}
300
- (${p} active, ${m} total)`,isGroup:!0,groupType:f},...a&&!x?{classes:"focus-dimmed"}:{}})}}for(const u of t){const d=u.slug||u.id.slice(0,8),f=dm(jA(u),14),p=co(u),m=a&&!a.has(u.id);s.push({data:{id:u.id,label:f,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:((h=u.lifecycle)==null?void 0:h.featureCode)||u.featureCode||null,group:p||null,...r&&p&&l.has(p)?{parent:`group-${p}`}:{}},...m?{classes:"focus-dimmed"}:{}})}for(const u of e){if(!o.has(u.fromId)||!o.has(u.toId))continue;let d,f;u.type==="supports"||u.type==="blocks"?(d=u.toId,f=u.fromId):(d=u.fromId,f=u.toId);const p=ru[u.type]||ru.informs;s.push({data:{id:u.id||`${u.fromId}-${u.toId}`,source:d,target:f,edgeType:u.type,edgeColor:p.color,edgeStyle:p.style}})}return s}function BA(){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(bl).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(TA).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),..._A.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 LA({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=bl[n.status]||bl.planned,s=fr[n.itemType]||"#94a3b8",o=e+300>window.innerWidth?e-294:e+14,a=Math.min(r-10,window.innerHeight-200);return c.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:[c.jsx("div",{style:{fontWeight:700,fontSize:13,color:"#f8fafc",marginBottom:3},children:n.slug}),c.jsx("div",{style:{color:"#94a3b8",marginBottom:6,lineHeight:1.4},children:n.title}),c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[c.jsx(sh,{color:i,children:(n.status||"planned").replace("_"," ")}),c.jsx(sh,{color:s,children:n.itemType}),n.phase&&c.jsx(sh,{color:"#94a3b8",children:hl[n.phase]||n.phase})]}),n.description&&c.jsx("div",{style:{marginTop:8,color:"#94a3b8",fontSize:11,lineHeight:1.4},children:n.description.length>140?n.description.slice(0,140)+"…":n.description}),c.jsxs("div",{style:{marginTop:6,color:"#64748b",fontSize:10},children:[wd[n.confidence||0]," confidence"]})]})}function AA({data:t,onApply:e,onClose:r}){const{x:n,y:i,currentGroup:s}=t,[o,a]=v.useState(s||""),l=v.useRef(null);v.useEffect(()=>{var f,p;(f=l.current)==null||f.focus(),(p=l.current)==null||p.select()},[]),v.useEffect(()=>{const f=p=>{p.key==="Escape"&&r()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[r]),v.useEffect(()=>{const f=m=>{const x=document.getElementById("group-change-popover-root");x&&!x.contains(m.target)&&r()},p=setTimeout(()=>window.addEventListener("mousedown",f),0);return()=>{clearTimeout(p),window.removeEventListener("mousedown",f)}},[r]);const h=n+240>window.innerWidth?n-234:n+14,u=Math.min(i-10,window.innerHeight-120),d=()=>e(o.trim());return c.jsxs("div",{id:"group-change-popover-root","data-testid":"group-change-popover",style:{position:"fixed",left:h,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:[c.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Change group"}),c.jsx("input",{ref:l,type:"text",value:o,onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.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"}}),c.jsxs("div",{style:{display:"flex",gap:6,marginTop:8,justifyContent:"flex-end"},children:[c.jsx("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"transparent",color:"#94a3b8",border:"1px solid #334155"},children:"Cancel"}),c.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 sh({color:t,children:e}){return c.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 Dy={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function Xs({active:t,onClick:e,children:r}){return c.jsx("button",{onClick:e,style:{...Dy,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function oh({onClick:t,children:e,title:r}){return c.jsx("button",{onClick:t,title:r,style:{...Dy,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function Sa(){return c.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const MA=["build-building","build-gate-pending","build-blocked-downstream","build-error"],IA={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 FA({badge:t,onClick:e}){const r=IA[t.state];return r?c.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 DA({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 h=l.stepId?l.stepId.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):"Gate";return c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{position:"fixed",inset:0,zIndex:199},onClick:s}),c.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:[c.jsx("div",{style:{fontSize:10,color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:4},children:h}),c.jsx("div",{style:{fontSize:12,color:"#f8fafc",fontWeight:600,marginBottom:8},children:t}),c.jsxs("div",{style:{display:"flex",gap:4},children:[c.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"}),c.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"}),c.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 Py({items:t,connections:e,selectedItemId:r,onSelect:n,visibleTracks:i,hiddenGroups:s,buildStateMap:o,resolveGate:a,gates:l,spawnedAgents:h,agentRelays:u,agentOverlay:d,featureCode:f,focusActive:p,onToggleFocus:m}){const x=v.useRef(null),g=v.useRef(null),y=v.useRef({}),C=v.useRef(!1),b=v.useRef({}),S=v.useRef(null),[_,w]=v.useState(null),[B,L]=v.useState("active"),[I,E]=v.useState(!0),[F,z]=v.useState(!1),[W,O]=v.useState(null),[M,A]=v.useState(null),[P,$]=v.useState([]),[j,T]=v.useState(!1),[Y,J]=v.useState(!1),D=xs(V=>V.ideas);v.useEffect(()=>{let V=!1;return Ft("/api/graph/layout").then(it=>it.ok?it.json():{positions:{}}).then(it=>{if(V)return;y.current=it.positions||{},C.current=!0;const dt=g.current;dt&&ct(dt)}).catch(()=>{C.current=!0}),()=>{V=!0}},[]);const Q=v.useCallback(()=>{const V=b.current;b.current={},S.current=null,Object.keys(V).length&&Ft("/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=v.useCallback(V=>{Object.assign(b.current,V),Object.assign(y.current,V),S.current&&clearTimeout(S.current),S.current=setTimeout(Q,500)},[Q]),ct=v.useCallback(V=>{const it=y.current,dt={};V.nodes("node[status]").forEach(wt=>{const rt=wt.data();if(rt.isAgentNode||rt.isIdeaNode)return;const mt=wt.id(),U=it[mt];if(U&&Number.isFinite(U.x)&&Number.isFinite(U.y))wt.position({x:U.x,y:U.y});else{const nt=wt.position();Number.isFinite(nt.x)&&Number.isFinite(nt.y)&&(dt[mt]={x:nt.x,y:nt.y})}}),Object.keys(dt).length&&ut(dt)},[ut]),$t=v.useRef(!1);v.useEffect(()=>{const V=h==null?void 0:h.some(it=>it.status==="running");V&&!$t.current?T(!0):!V&&$t.current&&(h==null?void 0:h.length)>0&&T(!1),$t.current=!!V},[h]);const Et=v.useMemo(()=>t.filter(V=>{const it=V.title||"";return!it.startsWith("`docs/")&&!it.startsWith("docs/")}),[t]),ot=v.useMemo(()=>{let V=Et;const it=hm.find(dt=>dt.key===B);if(it!=null&&it.statuses&&(V=V.filter(dt=>it.statuses.includes(dt.status||"planned"))),i){const dt=wt=>{const rt=(wt.description||"").match(/Track:\s*(\w+)/i);return rt?rt[1].toLowerCase():wt.type||"other"};V=V.filter(wt=>i.has(dt(wt)))}return(s==null?void 0:s.size)>0&&(V=V.filter(dt=>!s.has(co(dt)))),V},[Et,B,i,s]),G=v.useMemo(()=>{const V=new Set(ot.map(it=>it.id));return e.filter(it=>V.has(it.fromId)&&V.has(it.toId))},[e,ot]),lt=v.useMemo(()=>!d||!d.nodes.length?[]:[...d.nodes,...d.edges],[h]),kt=v.useMemo(()=>{if(!Y)return[];new Set(ot.map(it=>it.id));const V=[];for(const it of D){if(!it.mapsTo)continue;const dt=`idea-${it.id}`;V.push({data:{id:dt,label:`${it.id}
301
- ${it.title.slice(0,20)}${it.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:it.id},classes:"idea-node"});const wt=it.mapsTo.split(",").map(rt=>rt.trim()).filter(Boolean);for(const rt of wt){const mt=ot.find(U=>{var nt;return((nt=U.lifecycle)==null?void 0:nt.featureCode)===rt||U.featureCode===rt||(U.title||"").startsWith(rt)});mt&&V.push({data:{id:`idea-edge-${it.id}-${mt.id}`,source:dt,target:mt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return V},[Y,D,ot]),_t=v.useMemo(()=>{let it=NA(ot,G,I,p,f);return j&&lt.length>0&&(it=[...it,...lt]),Y&&kt.length>0&&(it=[...it,...kt]),it},[ot,G,I,j,lt,Y,kt,p,f]),Rt=v.useMemo(()=>BA(),[]);v.useEffect(()=>{if(!x.current)return;g.current&&(g.current.destroy(),g.current=null);const V=Vo({container:x.current,elements:_t,style:Rt,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",()=>{C.current&&ct(V),V.fit(void 0,30)}),V.fit(void 0,30),V.on("dragfree","node[status]",it=>{const dt=it.target,wt=dt.data();if(wt.isAgentNode||wt.isIdeaNode)return;const rt=dt.position();!Number.isFinite(rt.x)||!Number.isFinite(rt.y)||ut({[dt.id()]:{x:rt.x,y:rt.y}})}),r){const it=V.$id(r);it.length&&ah(V,it)}return V.on("mouseover","node[status]",it=>{const dt=it.renderedPosition||it.position,wt=V.container().getBoundingClientRect();w({x:wt.left+dt.x,y:wt.top+dt.y,item:it.target.data()})}),V.on("mousemove","node[status]",it=>{const dt=it.renderedPosition||it.position,wt=V.container().getBoundingClientRect();w(rt=>rt?{x:wt.left+dt.x,y:wt.top+dt.y,item:rt.item}:null)}),V.on("mouseout","node[status]",()=>w(null)),V.on("tap","node[status]",it=>{se.current=!0,ah(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 mt;const dt=it.target.data();if(dt.isAgentNode||dt.isIdeaNode||dt.isGroup)return;try{(mt=it.originalEvent)==null||mt.preventDefault()}catch{}const wt=it.renderedPosition||it.position,rt=V.container().getBoundingClientRect();A({x:rt.left+wt.x,y:rt.top+wt.y,itemId:it.target.id(),currentGroup:dt.group||""}),w(null)}),V.container().addEventListener("contextmenu",it=>it.preventDefault()),()=>{S.current&&(clearTimeout(S.current),Q()),V.destroy(),g.current=null}},[_t,Rt]);const se=v.useRef(!1);v.useEffect(()=>{const V=g.current;if(!V||!r)return;const it=V.$id(r);it.length&&(V.elements().removeClass("dimmed highlighted"),ah(V,it),se.current||V.animate({center:{eles:it},duration:200}),se.current=!1)},[r]),v.useEffect(()=>{const V=g.current;if(V&&(V.nodes().removeClass(MA.join(" ")),!(!o||Object.keys(o).length===0)))for(const[it,dt]of Object.entries(o)){const wt=`build-${dt.replace(/_/g,"-")}`,rt=V.nodes().filter(mt=>{const U=mt.data();return U.slug===it||U.title===it||U.featureCode===it});rt.length&&rt.addClass(wt)}},[o]),v.useEffect(()=>{const V=g.current;if(!V||!o||!Object.values(o).includes("building"))return;let dt=!0;const wt=setInterval(()=>{const rt=V.nodes(".build-building");rt.length&&(dt=!dt,rt.style("shadow-blur",dt?12:4),rt.style("shadow-opacity",dt?.6:.2))},800);return()=>clearInterval(wt)},[o]),v.useEffect(()=>{var rt;const V=g.current;if(!V||(V.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!j||!((rt=d==null?void 0:d.activeEdgeIds)!=null&&rt.size)))return;const it=new Set((h||[]).map(mt=>mt.agentId)),dt=mt=>mt==="session"?"agent-session":it.has(mt)?`agent-${mt}`:"agent-session";for(const mt of d.activeEdgeIds){const U=V.getElementById(mt);if(U.length){const nt=u==null?void 0:u.findLast(Tt=>{const Pt=dt(Tt.fromAgentId),qt=dt(Tt.toAgentId);return(Tt.direction==="dispatch"?`relay-${Pt}-${qt}`:`relay-${qt}-${Pt}`)===mt});U.addClass((nt==null?void 0:nt.direction)==="result"?"relay-result":"relay-active")}}const wt=setInterval(()=>{const mt=V.edges(".relay-active, .relay-result");if(!mt.length)return;const U=Date.now()/20%100;mt.style("line-dash-offset",-U)},50);return()=>clearInterval(wt)},[j,d==null?void 0:d.activeEdgeIds,u]);const ge=v.useCallback(()=>{const V=g.current;if(!V||!o||Object.keys(o).length===0){$([]);return}const it=[];for(const[dt,wt]of Object.entries(o)){if(wt!=="gate_pending"&&wt!=="error"&&wt!=="building")continue;const rt=V.nodes().filter(nt=>{const Tt=nt.data();return Tt.slug===dt||Tt.title===dt||Tt.featureCode===dt});if(!rt.length)continue;const mt=rt.renderedPosition(),U=rt.renderedOuterWidth();it.push({featureCode:dt,state:wt,x:mt.x+U/2-6,y:mt.y-rt.renderedOuterHeight()/2-6,nodeId:rt.id()})}$(it)},[o]);v.useEffect(()=>{const V=g.current;if(V)return V.on("render pan zoom",ge),ge(),()=>{V.removeListener("render pan zoom",ge)}},[ge]);const Qe=v.useCallback(()=>{var V;return(V=g.current)==null?void 0:V.fit(void 0,40)},[]),Gt=v.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()*1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]),Ce=v.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()/1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]);return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",style:{background:"#0f172a"},children:[c.jsx("div",{className:"shrink-0",style:{background:"#1e293b",borderBottom:"1px solid #334155"},children:c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ta,{featureCode:f,active:p,onToggle:m}),f&&c.jsx(Sa,{}),c.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),hm.map(V=>c.jsx(Xs,{active:B===V.key,onClick:()=>L(V.key),children:V.label},V.key)),c.jsx(Sa,{}),c.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[ot.length," items · ",G.length," edges"]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Xs,{active:I,onClick:()=>E(!I),children:"Group"}),c.jsx(Xs,{active:j,onClick:()=>T(V=>!V),title:"Show/hide agent topology",children:"Agents"}),c.jsx(Xs,{active:Y,onClick:()=>J(V=>!V),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),c.jsx(Sa,{}),c.jsx(oh,{onClick:Ce,title:"Zoom out",children:"−"}),c.jsx(oh,{onClick:Qe,title:"Fit to view",children:"Fit"}),c.jsx(oh,{onClick:Gt,title:"Zoom in",children:"+"}),c.jsx(Sa,{}),c.jsx(Xs,{active:F,onClick:()=>z(!F),children:"Legend"})]})]})}),ot.length===0&&!j?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{style:{textAlign:"center"},children:[c.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items match the current filters"}),c.jsx("div",{style:{fontSize:11,color:"#475569"},children:"Try adjusting the status or group filters"})]})}):c.jsxs("div",{className:"flex-1 relative min-h-0",children:[c.jsx("div",{ref:x,className:"w-full h-full"}),F&&c.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:[c.jsx(lh,{title:"Types",children:Object.entries(fr).map(([V,it])=>c.jsxs(hh,{children:[c.jsx(pm,{color:it}),V]},V))}),c.jsx(ch,{}),c.jsx(lh,{title:"Status",children:Object.entries(bl).map(([V,it])=>c.jsxs(hh,{children:[c.jsx(pm,{color:it}),V.replace("_"," ")]},V))}),c.jsx(ch,{}),c.jsx(lh,{title:"Edges",children:Object.entries(ru).map(([V,it])=>c.jsxs(hh,{children:[c.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:c.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))}),c.jsx(ch,{}),c.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",c.jsx("br",{}),"Click node to trace deps"]})]}),c.jsx(LA,{data:_}),M&&c.jsx(AA,{data:M,onClose:()=>A(null),onApply:V=>{const it=M.itemId;A(null),Ft(`/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))}}),P.map(V=>c.jsx(FA,{badge:V,onClick:V.state==="gate_pending"?()=>O(W===V.featureCode?null:V.featureCode):V.state==="error"?()=>n(V.nodeId):void 0},V.featureCode)),W&&c.jsx(DA,{featureCode:W,gates:l,items:t,badgePositions:P,onResolve:(V,it)=>{a&&a(V,it),O(null)},onClose:()=>O(null)})]})]})}function ah(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 lh({title:t,children:e}){return c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:5,fontWeight:700},children:t}),e]})}function ch(){return c.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function hh({children:t}){return c.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function pm({color:t}){return c.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var Ga={exports:{}},PA=Ga.exports,fm;function OA(){return fm||(fm=1,(function(t,e){(function(r,n){t.exports=n()})(PA,(function(){var r=1e3,n=6e4,i=36e5,s="millisecond",o="second",a="minute",l="hour",h="day",u="week",d="month",f="quarter",p="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,C={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 M=["th","st","nd","rd"],A=O%100;return"["+O+(M[(A-20)%10]||M[A]||M[0])+"]"}},b=function(O,M,A){var P=String(O);return!P||P.length>=M?O:""+Array(M+1-P.length).join(A)+O},S={s:b,z:function(O){var M=-O.utcOffset(),A=Math.abs(M),P=Math.floor(A/60),$=A%60;return(M<=0?"+":"-")+b(P,2,"0")+":"+b($,2,"0")},m:function O(M,A){if(M.date()<A.date())return-O(A,M);var P=12*(A.year()-M.year())+(A.month()-M.month()),$=M.clone().add(P,d),j=A-$<0,T=M.clone().add(P+(j?-1:1),d);return+(-(P+(A-$)/(j?$-T:T-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:d,y:p,w:u,d:h,D:m,h:l,m:a,s:o,ms:s,Q:f}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},_="en",w={};w[_]=C;var B="$isDayjsObject",L=function(O){return O instanceof z||!(!O||!O[B])},I=function O(M,A,P){var $;if(!M)return _;if(typeof M=="string"){var j=M.toLowerCase();w[j]&&($=j),A&&(w[j]=A,$=j);var T=M.split("-");if(!$&&T.length>1)return O(T[0])}else{var Y=M.name;w[Y]=M,$=Y}return!P&&$&&(_=$),$||!P&&_},E=function(O,M){if(L(O))return O.clone();var A=typeof M=="object"?M:{};return A.date=O,A.args=arguments,new z(A)},F=S;F.l=I,F.i=L,F.w=function(O,M){return E(O,{locale:M.$L,utc:M.$u,x:M.$x,$offset:M.$offset})};var z=(function(){function O(A){this.$L=I(A.locale,null,!0),this.parse(A),this.$x=this.$x||A.x||{},this[B]=!0}var M=O.prototype;return M.parse=function(A){this.$d=(function(P){var $=P.date,j=P.utc;if($===null)return new Date(NaN);if(F.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var T=$.match(g);if(T){var Y=T[2]-1||0,J=(T[7]||"0").substring(0,3);return j?new Date(Date.UTC(T[1],Y,T[3]||1,T[4]||0,T[5]||0,T[6]||0,J)):new Date(T[1],Y,T[3]||1,T[4]||0,T[5]||0,T[6]||0,J)}}return new Date($)})(A),this.init()},M.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},M.$utils=function(){return F},M.isValid=function(){return this.$d.toString()!==x},M.isSame=function(A,P){var $=E(A);return this.startOf(P)<=$&&$<=this.endOf(P)},M.isAfter=function(A,P){return E(A)<this.startOf(P)},M.isBefore=function(A,P){return this.endOf(P)<E(A)},M.$g=function(A,P,$){return F.u(A)?this[P]:this.set($,A)},M.unix=function(){return Math.floor(this.valueOf()/1e3)},M.valueOf=function(){return this.$d.getTime()},M.startOf=function(A,P){var $=this,j=!!F.u(P)||P,T=F.p(A),Y=function(ot,G){var lt=F.w($.$u?Date.UTC($.$y,G,ot):new Date($.$y,G,ot),$);return j?lt:lt.endOf(h)},J=function(ot,G){return F.w($.toDate()[ot].apply($.toDate("s"),(j?[0,0,0,0]:[23,59,59,999]).slice(G)),$)},D=this.$W,Q=this.$M,ut=this.$D,ct="set"+(this.$u?"UTC":"");switch(T){case p:return j?Y(1,0):Y(31,11);case d:return j?Y(1,Q):Y(0,Q+1);case u:var $t=this.$locale().weekStart||0,Et=(D<$t?D+7:D)-$t;return Y(j?ut-Et:ut+(6-Et),Q);case h:case m:return J(ct+"Hours",0);case l:return J(ct+"Minutes",1);case a:return J(ct+"Seconds",2);case o:return J(ct+"Milliseconds",3);default:return this.clone()}},M.endOf=function(A){return this.startOf(A,!1)},M.$set=function(A,P){var $,j=F.p(A),T="set"+(this.$u?"UTC":""),Y=($={},$[h]=T+"Date",$[m]=T+"Date",$[d]=T+"Month",$[p]=T+"FullYear",$[l]=T+"Hours",$[a]=T+"Minutes",$[o]=T+"Seconds",$[s]=T+"Milliseconds",$)[j],J=j===h?this.$D+(P-this.$W):P;if(j===d||j===p){var D=this.clone().set(m,1);D.$d[Y](J),D.init(),this.$d=D.set(m,Math.min(this.$D,D.daysInMonth())).$d}else Y&&this.$d[Y](J);return this.init(),this},M.set=function(A,P){return this.clone().$set(A,P)},M.get=function(A){return this[F.p(A)]()},M.add=function(A,P){var $,j=this;A=Number(A);var T=F.p(P),Y=function(Q){var ut=E(j);return F.w(ut.date(ut.date()+Math.round(Q*A)),j)};if(T===d)return this.set(d,this.$M+A);if(T===p)return this.set(p,this.$y+A);if(T===h)return Y(1);if(T===u)return Y(7);var J=($={},$[a]=n,$[l]=i,$[o]=r,$)[T]||1,D=this.$d.getTime()+A*J;return F.w(D,this)},M.subtract=function(A,P){return this.add(-1*A,P)},M.format=function(A){var P=this,$=this.$locale();if(!this.isValid())return $.invalidDate||x;var j=A||"YYYY-MM-DDTHH:mm:ssZ",T=F.z(this),Y=this.$H,J=this.$m,D=this.$M,Q=$.weekdays,ut=$.months,ct=$.meridiem,$t=function(G,lt,kt,_t){return G&&(G[lt]||G(P,j))||kt[lt].slice(0,_t)},Et=function(G){return F.s(Y%12||12,G,"0")},ot=ct||function(G,lt,kt){var _t=G<12?"AM":"PM";return kt?_t.toLowerCase():_t};return j.replace(y,(function(G,lt){return lt||(function(kt){switch(kt){case"YY":return String(P.$y).slice(-2);case"YYYY":return F.s(P.$y,4,"0");case"M":return D+1;case"MM":return F.s(D+1,2,"0");case"MMM":return $t($.monthsShort,D,ut,3);case"MMMM":return $t(ut,D);case"D":return P.$D;case"DD":return F.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return $t($.weekdaysMin,P.$W,Q,2);case"ddd":return $t($.weekdaysShort,P.$W,Q,3);case"dddd":return Q[P.$W];case"H":return String(Y);case"HH":return F.s(Y,2,"0");case"h":return Et(1);case"hh":return Et(2);case"a":return ot(Y,J,!0);case"A":return ot(Y,J,!1);case"m":return String(J);case"mm":return F.s(J,2,"0");case"s":return String(P.$s);case"ss":return F.s(P.$s,2,"0");case"SSS":return F.s(P.$ms,3,"0");case"Z":return T}return null})(G)||T.replace(":","")}))},M.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},M.diff=function(A,P,$){var j,T=this,Y=F.p(P),J=E(A),D=(J.utcOffset()-this.utcOffset())*n,Q=this-J,ut=function(){return F.m(T,J)};switch(Y){case p:j=ut()/12;break;case d:j=ut();break;case f:j=ut()/3;break;case u:j=(Q-D)/6048e5;break;case h:j=(Q-D)/864e5;break;case l:j=Q/i;break;case a:j=Q/n;break;case o:j=Q/r;break;default:j=Q}return $?j:F.a(j)},M.daysInMonth=function(){return this.endOf(d).$D},M.$locale=function(){return w[this.$L]},M.locale=function(A,P){if(!A)return this.$L;var $=this.clone(),j=I(A,P,!0);return j&&($.$L=j),$},M.clone=function(){return F.w(this.$d,this)},M.toDate=function(){return new Date(this.valueOf())},M.toJSON=function(){return this.isValid()?this.toISOString():null},M.toISOString=function(){return this.$d.toISOString()},M.toString=function(){return this.$d.toUTCString()},O})(),W=z.prototype;return E.prototype=W,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",h],["$M",d],["$y",p],["$D",m]].forEach((function(O){W[O[1]]=function(M){return this.$g(M,O[0],O[1])}})),E.extend=function(O,M){return O.$i||(O(M,z,E),O.$i=!0),E},E.locale=I,E.isDayjs=L,E.unix=function(O){return E(1e3*O)},E.en=w[_],E.Ls=w,E.p={},E}))})(Ga)),Ga.exports}var $A=OA();const RA=dd($A);var Oy=Object.defineProperty,k=(t,e)=>Oy(t,"name",{value:e,configurable:!0}),zA=(t,e)=>{for(var r in e)Oy(t,r,{get:e[r],enumerable:!0})},an={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},et={trace:k((...t)=>{},"trace"),debug:k((...t)=>{},"debug"),info:k((...t)=>{},"info"),warn:k((...t)=>{},"warn"),error:k((...t)=>{},"error"),fatal:k((...t)=>{},"fatal")},Kd=k(function(t="fatal"){let e=an.fatal;typeof t=="string"?t.toLowerCase()in an&&(e=an[t]):typeof t=="number"&&(e=t),et.trace=()=>{},et.debug=()=>{},et.info=()=>{},et.warn=()=>{},et.error=()=>{},et.fatal=()=>{},e<=an.fatal&&(et.fatal=console.error?console.error.bind(console,Tr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Tr("FATAL"))),e<=an.error&&(et.error=console.error?console.error.bind(console,Tr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Tr("ERROR"))),e<=an.warn&&(et.warn=console.warn?console.warn.bind(console,Tr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Tr("WARN"))),e<=an.info&&(et.info=console.info?console.info.bind(console,Tr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Tr("INFO"))),e<=an.debug&&(et.debug=console.debug?console.debug.bind(console,Tr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Tr("DEBUG"))),e<=an.trace&&(et.trace=console.debug?console.debug.bind(console,Tr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Tr("TRACE")))},"setLogLevel"),Tr=k(t=>`%c${RA().format("ss.SSS")} : ${t} : `,"format");const Va={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 Va.hue2rgb(s,i,t+1/3)*255;case"g":return Va.hue2rgb(s,i,t)*255;case"b":return Va.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}}},WA={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},qA={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},It={channel:Va,lang:WA,unit:qA},jn={};for(let t=0;t<=255;t++)jn[t]=It.unit.dec2hex(t);const He={ALL:0,RGB:1,HSL:2};class HA{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 UA{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new HA}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=It.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=It.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=It.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=It.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=It.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=It.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(),It.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(),It.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(),It.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(),It.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(),It.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(),It.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 pc=new UA({r:0,g:0,b:0,a:0},"transparent"),Ki={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(Ki.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,h=s?0:-1,u=o?255:15;return pc.set({r:(n>>l*(h+3)&u)*a,g:(n>>l*(h+2)&u)*a,b:(n>>l*(h+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?`#${jn[Math.round(e)]}${jn[Math.round(r)]}${jn[Math.round(n)]}${jn[Math.round(i*255)]}`:`#${jn[Math.round(e)]}${jn[Math.round(r)]}${jn[Math.round(n)]}`}},ri={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(ri.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return It.channel.clamp.h(parseFloat(r)*.9);case"rad":return It.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return It.channel.clamp.h(parseFloat(r)*360)}}return It.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(ri.re);if(!r)return;const[,n,i,s,o,a]=r;return pc.set({h:ri._hue2deg(n),s:It.channel.clamp.s(parseFloat(i)),l:It.channel.clamp.l(parseFloat(s)),a:o?It.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(${It.lang.round(e)}, ${It.lang.round(r)}%, ${It.lang.round(n)}%, ${i})`:`hsl(${It.lang.round(e)}, ${It.lang.round(r)}%, ${It.lang.round(n)}%)`}},So={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=So.colors[t];if(e)return Ki.parse(e)},stringify:t=>{const e=Ki.stringify(t);for(const r in So.colors)if(So.colors[r]===e)return r}},ho={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(ho.re);if(!r)return;const[,n,i,s,o,a,l,h,u]=r;return pc.set({r:It.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:It.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:It.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:h?It.channel.clamp.a(u?parseFloat(h)/100:parseFloat(h)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${It.lang.round(e)}, ${It.lang.round(r)}, ${It.lang.round(n)}, ${It.lang.round(i)})`:`rgb(${It.lang.round(e)}, ${It.lang.round(r)}, ${It.lang.round(n)})`}},Qr={format:{keyword:So,hex:Ki,rgb:ho,rgba:ho,hsl:ri,hsla:ri},parse:t=>{if(typeof t!="string")return t;const e=Ki.parse(t)||ho.parse(t)||ri.parse(t)||So.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?ri.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?ho.stringify(t):Ki.stringify(t)},$y=(t,e)=>{const r=Qr.parse(t);for(const n in e)r[n]=It.channel.clamp[n](e[n]);return Qr.stringify(r)},An=(t,e,r=0,n=1)=>{if(typeof t!="number")return $y(t,{a:e});const i=pc.set({r:It.channel.clamp.r(t),g:It.channel.clamp.g(e),b:It.channel.clamp.b(r),a:It.channel.clamp.a(n)});return Qr.stringify(i)},YA=t=>{const{r:e,g:r,b:n}=Qr.parse(t),i=.2126*It.channel.toLinear(e)+.7152*It.channel.toLinear(r)+.0722*It.channel.toLinear(n);return It.lang.round(i)},GA=t=>YA(t)>=.5,Wr=t=>!GA(t),Ry=(t,e,r)=>{const n=Qr.parse(t),i=n[e],s=It.channel.clamp[e](i+r);return i!==s&&(n[e]=s),Qr.stringify(n)},X=(t,e)=>Ry(t,"l",e),K=(t,e)=>Ry(t,"l",-e),N=(t,e)=>{const r=Qr.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return $y(t,n)},VA=(t,e,r=50)=>{const{r:n,g:i,b:s,a:o}=Qr.parse(t),{r:a,g:l,b:h,a:u}=Qr.parse(e),d=r/100,f=d*2-1,p=o-u,x=((f*p===-1?f:(f+p)/(1+f*p))+1)/2,g=1-x,y=n*x+a*g,C=i*x+l*g,b=s*x+h*g,S=o*d+u*(1-d);return An(y,C,b,S)},H=(t,e=100)=>{const r=Qr.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,VA(r,t,e)};/*! @license DOMPurify 3.4.8 | (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.8/LICENSE */function mm(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 XA(t){if(Array.isArray(t))return t}function KA(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,h=!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){h=!0,i=u}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(h)throw i}}return a}}function QA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
302
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZA(t,e){return XA(t)||KA(t,e)||JA(t,e)||QA()}function JA(t,e){if(t){if(typeof t=="string")return mm(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)?mm(t,e):void 0}}const zy=Object.entries,gm=Object.setPrototypeOf,tM=Object.isFrozen,eM=Object.getPrototypeOf,rM=Object.getOwnPropertyDescriptor;let sr=Object.freeze,Er=Object.seal,zi=Object.create,Wy=typeof Reflect<"u"&&Reflect,nu=Wy.apply,iu=Wy.construct;sr||(sr=function(e){return e});Er||(Er=function(e){return e});nu||(nu=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)});iu||(iu=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 Xn=Ne(Array.prototype.forEach),nM=Ne(Array.prototype.lastIndexOf),xm=Ne(Array.prototype.pop),Bi=Ne(Array.prototype.push),iM=Ne(Array.prototype.splice),tr=Array.isArray,uo=Ne(String.prototype.toLowerCase),uh=Ne(String.prototype.toString),ym=Ne(String.prototype.match),Li=Ne(String.prototype.replace),bm=Ne(String.prototype.indexOf),sM=Ne(String.prototype.trim),oM=Ne(Number.prototype.toString),aM=Ne(Boolean.prototype.toString),Cm=typeof BigInt>"u"?null:Ne(BigInt.prototype.toString),km=typeof Symbol>"u"?null:Ne(Symbol.prototype.toString),be=Ne(Object.prototype.hasOwnProperty),Ks=Ne(Object.prototype.toString),Oe=Ne(RegExp.prototype.test),Ai=lM(TypeError);function Ne(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 nu(t,e,n)}}function lM(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return iu(t,r)}}function Ht(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:uo;if(gm&&gm(t,null),!tr(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(tM(e)||(e[n]=s),i=s)}t[i]=!0}return t}function cM(t){for(let e=0;e<t.length;e++)be(t,e)||(t[e]=null);return t}function qe(t){const e=zi(null);for(const n of zy(t)){var r=ZA(n,2);const i=r[0],s=r[1];be(t,i)&&(tr(s)?e[i]=cM(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=qe(s):e[i]=s)}return e}function hM(t){switch(typeof t){case"string":return t;case"number":return oM(t);case"boolean":return aM(t);case"bigint":return Cm?Cm(t):"0";case"symbol":return km?km(t):"Symbol()";case"undefined":return Ks(t);case"function":case"object":{if(t===null)return Ks(t);const e=t,r=Ur(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:Ks(n)}return Ks(t)}default:return Ks(t)}}function Ur(t,e){for(;t!==null;){const n=rM(t,e);if(n){if(n.get)return Ne(n.get);if(typeof n.value=="function")return Ne(n.value)}t=eM(t)}function r(){return null}return r}function uM(t){try{return Oe(t,""),!0}catch{return!1}}const vm=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"]),dh=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"]),ph=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"]),dM=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"]),fh=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"]),pM=sr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wm=sr(["#text"]),Sm=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"]),mh=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"]),Tm=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"]),Ta=sr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fM=Er(/{{[\w\W]*|^[\w\W]*}}/g),mM=Er(/<%[\w\W]*|^[\w\W]*%>/g),gM=Er(/\${[\w\W]*/g),xM=Er(/^data-[\-\w.\u00B7-\uFFFF]+$/),yM=Er(/^aria-[\-\w]+$/),_m=Er(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bM=Er(/^(?:\w+script|data):/i),CM=Er(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kM=Er(/^html$/i),vM=Er(/^[a-z][.\w]*(-[.\w]+)+$/i),Hr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},wM=function(){return typeof window>"u"?null:window},SM=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}},Em=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function qy(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wM();const e=gt=>qy(gt);if(e.version="3.4.8",e.removed=[],!t||!t.document||t.document.nodeType!==Hr.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,h=t.NamedNodeMap;h===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,d=t.trustedTypes,f=a.prototype,p=Ur(f,"cloneNode"),m=Ur(f,"remove"),x=Ur(f,"nextSibling"),g=Ur(f,"childNodes"),y=Ur(f,"parentNode"),C=Ur(f,"shadowRoot"),b=Ur(f,"attributes"),S=o&&o.prototype?Ur(o.prototype,"nodeType"):null,_=o&&o.prototype?Ur(o.prototype,"nodeName"):null;if(typeof s=="function"){const gt=r.createElement("template");gt.content&&gt.content.ownerDocument&&(r=gt.content.ownerDocument)}let w,B="",L=0;const I=function(R){if(L>0)throw Ai('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');L++;try{return w.createHTML(R)}finally{L--}},E=r,F=E.implementation,z=E.createNodeIterator,W=E.createDocumentFragment,O=E.getElementsByTagName,M=n.importNode;let A=Em();e.isSupported=typeof zy=="function"&&typeof y=="function"&&F&&F.createHTMLDocument!==void 0;const P=fM,$=mM,j=gM,T=xM,Y=yM,J=bM,D=CM,Q=vM;let ut=_m,ct=null;const $t=Ht({},[...vm,...dh,...ph,...fh,...wm]);let Et=null;const ot=Ht({},[...Sm,...mh,...Tm,...Ta]);let G=Object.seal(zi(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}})),lt=null,kt=null;const _t=Object.seal(zi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Rt=!0,se=!0,ge=!1,Qe=!0,Gt=!1,Ce=!0,V=!1,it=!1,dt=!1,wt=!1,rt=!1,mt=!1,U=!0,nt=!1;const Tt="user-content-";let Pt=!0,qt=!1,he={},xe=null;const ce=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 Br=null;const De=Ht({},["audio","video","img","source","image","track"]);let ke=null;const wr=Ht({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ze="http://www.w3.org/1998/Math/MathML",wi="http://www.w3.org/2000/svg",Sr="http://www.w3.org/1999/xhtml";let kn=Sr,Si=!1,Fs=null;const Mc=Ht({},[ze,wi,Sr],uh);let sn=Ht({},["mi","mo","mn","ms","mtext"]),Ds=Ht({},["annotation-xml"]);const Ps=Ht({},["title","style","font","a","script"]);let Un=null;const ua=["application/xhtml+xml","text/html"],Ic="text/html";let ue=null,on=null;const da=r.createElement("form"),pa=function(R){return R instanceof RegExp||R instanceof Function},Ti=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(on&&on===R)return;(!R||typeof R!="object")&&(R={}),R=qe(R),Un=ua.indexOf(R.PARSER_MEDIA_TYPE)===-1?Ic:R.PARSER_MEDIA_TYPE,ue=Un==="application/xhtml+xml"?uh:uo,ct=be(R,"ALLOWED_TAGS")&&tr(R.ALLOWED_TAGS)?Ht({},R.ALLOWED_TAGS,ue):$t,Et=be(R,"ALLOWED_ATTR")&&tr(R.ALLOWED_ATTR)?Ht({},R.ALLOWED_ATTR,ue):ot,Fs=be(R,"ALLOWED_NAMESPACES")&&tr(R.ALLOWED_NAMESPACES)?Ht({},R.ALLOWED_NAMESPACES,uh):Mc,ke=be(R,"ADD_URI_SAFE_ATTR")&&tr(R.ADD_URI_SAFE_ATTR)?Ht(qe(wr),R.ADD_URI_SAFE_ATTR,ue):wr,Br=be(R,"ADD_DATA_URI_TAGS")&&tr(R.ADD_DATA_URI_TAGS)?Ht(qe(De),R.ADD_DATA_URI_TAGS,ue):De,xe=be(R,"FORBID_CONTENTS")&&tr(R.FORBID_CONTENTS)?Ht({},R.FORBID_CONTENTS,ue):ce,lt=be(R,"FORBID_TAGS")&&tr(R.FORBID_TAGS)?Ht({},R.FORBID_TAGS,ue):qe({}),kt=be(R,"FORBID_ATTR")&&tr(R.FORBID_ATTR)?Ht({},R.FORBID_ATTR,ue):qe({}),he=be(R,"USE_PROFILES")?R.USE_PROFILES&&typeof R.USE_PROFILES=="object"?qe(R.USE_PROFILES):R.USE_PROFILES:!1,Rt=R.ALLOW_ARIA_ATTR!==!1,se=R.ALLOW_DATA_ATTR!==!1,ge=R.ALLOW_UNKNOWN_PROTOCOLS||!1,Qe=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Gt=R.SAFE_FOR_TEMPLATES||!1,Ce=R.SAFE_FOR_XML!==!1,V=R.WHOLE_DOCUMENT||!1,wt=R.RETURN_DOM||!1,rt=R.RETURN_DOM_FRAGMENT||!1,mt=R.RETURN_TRUSTED_TYPE||!1,dt=R.FORCE_BODY||!1,U=R.SANITIZE_DOM!==!1,nt=R.SANITIZE_NAMED_PROPS||!1,Pt=R.KEEP_CONTENT!==!1,qt=R.IN_PLACE||!1,ut=uM(R.ALLOWED_URI_REGEXP)?R.ALLOWED_URI_REGEXP:_m,kn=typeof R.NAMESPACE=="string"?R.NAMESPACE:Sr,sn=be(R,"MATHML_TEXT_INTEGRATION_POINTS")&&R.MATHML_TEXT_INTEGRATION_POINTS&&typeof R.MATHML_TEXT_INTEGRATION_POINTS=="object"?qe(R.MATHML_TEXT_INTEGRATION_POINTS):Ht({},["mi","mo","mn","ms","mtext"]),Ds=be(R,"HTML_INTEGRATION_POINTS")&&R.HTML_INTEGRATION_POINTS&&typeof R.HTML_INTEGRATION_POINTS=="object"?qe(R.HTML_INTEGRATION_POINTS):Ht({},["annotation-xml"]);const tt=be(R,"CUSTOM_ELEMENT_HANDLING")&&R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING=="object"?qe(R.CUSTOM_ELEMENT_HANDLING):zi(null);if(G=zi(null),be(tt,"tagNameCheck")&&pa(tt.tagNameCheck)&&(G.tagNameCheck=tt.tagNameCheck),be(tt,"attributeNameCheck")&&pa(tt.attributeNameCheck)&&(G.attributeNameCheck=tt.attributeNameCheck),be(tt,"allowCustomizedBuiltInElements")&&typeof tt.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=tt.allowCustomizedBuiltInElements),Gt&&(se=!1),rt&&(wt=!0),he&&(ct=Ht({},wm),Et=zi(null),he.html===!0&&(Ht(ct,vm),Ht(Et,Sm)),he.svg===!0&&(Ht(ct,dh),Ht(Et,mh),Ht(Et,Ta)),he.svgFilters===!0&&(Ht(ct,ph),Ht(Et,mh),Ht(Et,Ta)),he.mathMl===!0&&(Ht(ct,fh),Ht(Et,Tm),Ht(Et,Ta))),_t.tagCheck=null,_t.attributeCheck=null,be(R,"ADD_TAGS")&&(typeof R.ADD_TAGS=="function"?_t.tagCheck=R.ADD_TAGS:tr(R.ADD_TAGS)&&(ct===$t&&(ct=qe(ct)),Ht(ct,R.ADD_TAGS,ue))),be(R,"ADD_ATTR")&&(typeof R.ADD_ATTR=="function"?_t.attributeCheck=R.ADD_ATTR:tr(R.ADD_ATTR)&&(Et===ot&&(Et=qe(Et)),Ht(Et,R.ADD_ATTR,ue))),be(R,"ADD_URI_SAFE_ATTR")&&tr(R.ADD_URI_SAFE_ATTR)&&Ht(ke,R.ADD_URI_SAFE_ATTR,ue),be(R,"FORBID_CONTENTS")&&tr(R.FORBID_CONTENTS)&&(xe===ce&&(xe=qe(xe)),Ht(xe,R.FORBID_CONTENTS,ue)),be(R,"ADD_FORBID_CONTENTS")&&tr(R.ADD_FORBID_CONTENTS)&&(xe===ce&&(xe=qe(xe)),Ht(xe,R.ADD_FORBID_CONTENTS,ue)),Pt&&(ct["#text"]=!0),V&&Ht(ct,["html","head","body"]),ct.table&&(Ht(ct,["tbody"]),delete lt.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ai('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ai('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ht=w;w=R.TRUSTED_TYPES_POLICY;try{B=I("")}catch(Zt){throw w=ht,Zt}}else w===void 0&&R.TRUSTED_TYPES_POLICY!==null&&(w=SM(d,i)),w&&typeof B=="string"&&(B=I(""));(A.uponSanitizeElement.length>0||A.uponSanitizeAttribute.length>0)&&ct===$t&&(ct=qe(ct)),A.uponSanitizeAttribute.length>0&&Et===ot&&(Et=qe(Et)),sr&&sr(R),on=R},fa=Ht({},[...dh,...ph,...dM]),Ze=Ht({},[...fh,...pM]),ma=function(R){let tt=y(R);(!tt||!tt.tagName)&&(tt={namespaceURI:kn,tagName:"template"});const ht=uo(R.tagName),Zt=uo(tt.tagName);return Fs[R.namespaceURI]?R.namespaceURI===wi?tt.namespaceURI===Sr?ht==="svg":tt.namespaceURI===ze?ht==="svg"&&(Zt==="annotation-xml"||sn[Zt]):!!fa[ht]:R.namespaceURI===ze?tt.namespaceURI===Sr?ht==="math":tt.namespaceURI===wi?ht==="math"&&Ds[Zt]:!!Ze[ht]:R.namespaceURI===Sr?tt.namespaceURI===wi&&!Ds[Zt]||tt.namespaceURI===ze&&!sn[Zt]?!1:!Ze[ht]&&(Ps[ht]||!fa[ht]):!!(Un==="application/xhtml+xml"&&Fs[R.namespaceURI]):!1},Pe=function(R){Bi(e.removed,{element:R});try{y(R).removeChild(R)}catch{m(R)}},Lr=function(R,tt){try{Bi(e.removed,{attribute:tt.getAttributeNode(R),from:tt})}catch{Bi(e.removed,{attribute:null,from:tt})}if(tt.removeAttribute(R),R==="is")if(wt||rt)try{Pe(tt)}catch{}else try{tt.setAttribute(R,"")}catch{}},Os=function(R){let tt=null,ht=null;if(dt)R="<remove></remove>"+R;else{const ne=ym(R,/^[\r\n\t ]+/);ht=ne&&ne[0]}Un==="application/xhtml+xml"&&kn===Sr&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Zt=w?I(R):R;if(kn===Sr)try{tt=new u().parseFromString(Zt,Un)}catch{}if(!tt||!tt.documentElement){tt=F.createDocument(kn,"template",null);try{tt.documentElement.innerHTML=Si?B:Zt}catch{}}const Wt=tt.body||tt.documentElement;return R&&ht&&Wt.insertBefore(r.createTextNode(ht),Wt.childNodes[0]||null),kn===Sr?O.call(tt,V?"html":"body")[0]:V?tt.documentElement:Wt},ga=function(R){return z.call(R.ownerDocument||R,R,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},$s=function(R){var tt,ht;R.normalize();const Zt=z.call(R.ownerDocument||R,R,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let Wt=Zt.nextNode();for(;Wt;){let ve=Wt.data;Xn([P,$,j],We=>{ve=Li(ve,We," ")}),Wt.data=ve,Wt=Zt.nextNode()}const ne=(tt=(ht=R.querySelectorAll)===null||ht===void 0?void 0:ht.call(R,"template"))!==null&&tt!==void 0?tt:[];Xn(Array.from(ne),ve=>{vn(ve.content)&&$s(ve.content)})},_i=function(R){const tt=_?_(R):null;return typeof tt!="string"||ue(tt)!=="form"?!1:typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||R.attributes!==b(R)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function"||R.nodeType!==S(R)||R.childNodes!==g(R)},vn=function(R){if(!S||typeof R!="object"||R===null)return!1;try{return S(R)===Hr.documentFragment}catch{return!1}},Me=function(R){if(!S||typeof R!="object"||R===null)return!1;try{return typeof S(R)=="number"}catch{return!1}};function Ie(gt,R,tt){Xn(gt,ht=>{ht.call(e,R,tt,on)})}const xa=function(R){let tt=null;if(Ie(A.beforeSanitizeElements,R,null),_i(R))return Pe(R),!0;const ht=ue(_?_(R):R.nodeName);if(Ie(A.uponSanitizeElement,R,{tagName:ht,allowedTags:ct}),Ce&&R.hasChildNodes()&&!Me(R.firstElementChild)&&Oe(/<[/\w!]/g,R.innerHTML)&&Oe(/<[/\w!]/g,R.textContent)||Ce&&R.namespaceURI===Sr&&ht==="style"&&Me(R.firstElementChild)||R.nodeType===Hr.progressingInstruction||Ce&&R.nodeType===Hr.comment&&Oe(/<[/\w]/g,R.data))return Pe(R),!0;if(lt[ht]||!(_t.tagCheck instanceof Function&&_t.tagCheck(ht))&&!ct[ht]){if(!lt[ht]&&Yn(ht)&&(G.tagNameCheck instanceof RegExp&&Oe(G.tagNameCheck,ht)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ht)))return!1;if(Pt&&!xe[ht]){const Wt=y(R),ne=g(R);if(ne&&Wt){const ve=ne.length;for(let We=ve-1;We>=0;--We){const gr=p(ne[We],!0);Wt.insertBefore(gr,x(R))}}}return Pe(R),!0}return(S?S(R):R.nodeType)===Hr.element&&!ma(R)||(ht==="noscript"||ht==="noembed"||ht==="noframes")&&Oe(/<\/no(script|embed|frames)/i,R.innerHTML)?(Pe(R),!0):(Gt&&R.nodeType===Hr.text&&(tt=R.textContent,Xn([P,$,j],Wt=>{tt=Li(tt,Wt," ")}),R.textContent!==tt&&(Bi(e.removed,{element:R.cloneNode()}),R.textContent=tt)),Ie(A.afterSanitizeElements,R,null),!1)},Rs=function(R,tt,ht){if(kt[tt]||U&&(tt==="id"||tt==="name")&&(ht in r||ht in da))return!1;const Zt=Et[tt]||_t.attributeCheck instanceof Function&&_t.attributeCheck(tt,R);if(!(se&&!kt[tt]&&Oe(T,tt))){if(!(Rt&&Oe(Y,tt))){if(!Zt||kt[tt]){if(!(Yn(R)&&(G.tagNameCheck instanceof RegExp&&Oe(G.tagNameCheck,R)||G.tagNameCheck instanceof Function&&G.tagNameCheck(R))&&(G.attributeNameCheck instanceof RegExp&&Oe(G.attributeNameCheck,tt)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(tt,R))||tt==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&Oe(G.tagNameCheck,ht)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ht))))return!1}else if(!ke[tt]){if(!Oe(ut,Li(ht,D,""))){if(!((tt==="src"||tt==="xlink:href"||tt==="href")&&R!=="script"&&bm(ht,"data:")===0&&Br[R])){if(!(ge&&!Oe(J,Li(ht,D,"")))){if(ht)return!1}}}}}}return!0},zs=Ht({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Yn=function(R){return!zs[uo(R)]&&Oe(Q,R)},ya=function(R){Ie(A.beforeSanitizeAttributes,R,null);const tt=R.attributes;if(!tt||_i(R))return;const ht={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Et,forceKeepAttr:void 0};let Zt=tt.length;for(;Zt--;){const Wt=tt[Zt],ne=Wt.name,ve=Wt.namespaceURI,We=Wt.value,gr=ue(ne),Ws=We;let Te=ne==="value"?Ws:sM(Ws);if(ht.attrName=gr,ht.attrValue=Te,ht.keepAttr=!0,ht.forceKeepAttr=void 0,Ie(A.uponSanitizeAttribute,R,ht),Te=ht.attrValue,nt&&(gr==="id"||gr==="name")&&bm(Te,Tt)!==0&&(Lr(ne,R),Te=Tt+Te),Ce&&Oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Te)){Lr(ne,R);continue}if(gr==="attributename"&&ym(Te,"href")){Lr(ne,R);continue}if(ht.forceKeepAttr)continue;if(!ht.keepAttr){Lr(ne,R);continue}if(!Qe&&Oe(/\/>/i,Te)){Lr(ne,R);continue}Gt&&Xn([P,$,j],Gn=>{Te=Li(Te,Gn," ")});const ba=ue(R.nodeName);if(!Rs(ba,gr,Te)){Lr(ne,R);continue}if(w&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!ve)switch(d.getAttributeType(ba,gr)){case"TrustedHTML":{Te=I(Te);break}case"TrustedScriptURL":{Te=w.createScriptURL(Te);break}}if(Te!==Ws)try{ve?R.setAttributeNS(ve,ne,Te):R.setAttribute(ne,Te),_i(R)?Pe(R):xm(e.removed)}catch{Lr(ne,R)}}Ie(A.afterSanitizeAttributes,R,null)},Ei=function(R){let tt=null;const ht=ga(R);for(Ie(A.beforeSanitizeShadowDOM,R,null);tt=ht.nextNode();)if(Ie(A.uponSanitizeShadowNode,tt,null),xa(tt),ya(tt),vn(tt.content)&&Ei(tt.content),(S?S(tt):tt.nodeType)===Hr.element){const Wt=C?C(tt):tt.shadowRoot;vn(Wt)&&(wn(Wt),Ei(Wt))}Ie(A.afterSanitizeShadowDOM,R,null)},wn=function(R){const tt=S?S(R):R.nodeType;if(tt===Hr.element){const Wt=C?C(R):R.shadowRoot;vn(Wt)&&(wn(Wt),Ei(Wt))}const ht=g?g(R):R.childNodes;if(!ht)return;const Zt=[];Xn(ht,Wt=>{Bi(Zt,Wt)});for(const Wt of Zt)wn(Wt);if(tt===Hr.element){const Wt=_?_(R):null;if(typeof Wt=="string"&&ue(Wt)==="template"){const ne=R.content;vn(ne)&&wn(ne)}}};return e.sanitize=function(gt){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},tt=null,ht=null,Zt=null,Wt=null;if(Si=!gt,Si&&(gt="<!-->"),typeof gt!="string"&&!Me(gt)&&(gt=hM(gt),typeof gt!="string"))throw Ai("dirty is not a string, aborting");if(!e.isSupported)return gt;if(it||Ti(R),e.removed=[],typeof gt=="string"&&(qt=!1),qt){const We=_?_(gt):gt.nodeName;if(typeof We=="string"){const gr=ue(We);if(!ct[gr]||lt[gr])throw Ai("root node is forbidden and cannot be sanitized in-place")}if(_i(gt))throw Ai("root node is clobbered and cannot be sanitized in-place");wn(gt)}else if(Me(gt))tt=Os("<!---->"),ht=tt.ownerDocument.importNode(gt,!0),ht.nodeType===Hr.element&&ht.nodeName==="BODY"||ht.nodeName==="HTML"?tt=ht:tt.appendChild(ht),wn(ht);else{if(!wt&&!Gt&&!V&&gt.indexOf("<")===-1)return w&&mt?I(gt):gt;if(tt=Os(gt),!tt)return wt?null:mt?B:""}tt&&dt&&Pe(tt.firstChild);const ne=ga(qt?gt:tt);for(;Zt=ne.nextNode();)xa(Zt),ya(Zt),vn(Zt.content)&&Ei(Zt.content);if(qt)return Gt&&$s(gt),gt;if(wt){if(Gt&&$s(tt),rt)for(Wt=W.call(tt.ownerDocument);tt.firstChild;)Wt.appendChild(tt.firstChild);else Wt=tt;return(Et.shadowroot||Et.shadowrootmode)&&(Wt=M.call(n,Wt,!0)),Wt}let ve=V?tt.outerHTML:tt.innerHTML;return V&&ct["!doctype"]&&tt.ownerDocument&&tt.ownerDocument.doctype&&tt.ownerDocument.doctype.name&&Oe(kM,tt.ownerDocument.doctype.name)&&(ve="<!DOCTYPE "+tt.ownerDocument.doctype.name+`>
303
- `+ve),Gt&&Xn([P,$,j],We=>{ve=Li(ve,We," ")}),w&&mt?I(ve):ve},e.setConfig=function(){let gt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ti(gt),it=!0},e.clearConfig=function(){on=null,it=!1},e.isValidAttribute=function(gt,R,tt){on||Ti({});const ht=ue(gt),Zt=ue(R);return Rs(ht,Zt,tt)},e.addHook=function(gt,R){typeof R=="function"&&Bi(A[gt],R)},e.removeHook=function(gt,R){if(R!==void 0){const tt=nM(A[gt],R);return tt===-1?void 0:iM(A[gt],tt,1)[0]}return xm(A[gt])},e.removeHooks=function(gt){A[gt]=[]},e.removeAllHooks=function(){A=Em()},e}var ys=qy(),Hy=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,To=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,TM=/\s*%%.*\n/gm,ts,Uy=(ts=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},k(ts,"UnknownDiagramError"),ts),di={},Qd=k(function(t,e){t=t.replace(Hy,"").replace(To,"").replace(TM,`
304
- `);for(const[r,{detector:n}]of Object.entries(di))if(n(t,e))return r;throw new Uy(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),su=k((...t)=>{for(const{id:e,detector:r,loader:n}of t)Yy(e,r,n)},"registerLazyLoadedDiagrams"),Yy=k((t,e,r)=>{di[t]&&et.warn(`Detector with key ${t} already exists. Overwriting.`),di[t]={detector:e,loader:r},et.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),_M=k(t=>di[t].loader,"getDiagramLoader"),ou=k((t,e,{depth:r=2,clobber:n=!1}={})=>{const i={depth:r,clobber:n};return Array.isArray(e)&&!Array.isArray(t)?(e.forEach(s=>ou(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]=ou(t[s],e[s],{depth:r-1,clobber:n})):(n||typeof t[s]!="object"&&typeof e[s]!="object")&&(t[s]=e[s])}),t)},"assignWithDepth"),Le=ou,en="#ffffff",rn="#f2f2f2",Mt=k((t,e)=>e?N(t,{s:-40,l:10}):N(t,{s:-40,l:-10}),"mkBorder"),es,EM=(es=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,h,u,d,f,p,m,x,g,y,C,b,S,_,w,B,L,I,E,F,z,W,O,M,A,P,$,j;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||N(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||N(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Mt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Mt(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?K(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||K(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||X(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||K(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||K(this.mainBkg,10)):(this.rowOdd=this.rowOdd||X(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||X(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||N(this.primaryColor,{h:30}),this.cScale4=this.cScale4||N(this.primaryColor,{h:60}),this.cScale5=this.cScale5||N(this.primaryColor,{h:90}),this.cScale6=this.cScale6||N(this.primaryColor,{h:120}),this.cScale7=this.cScale7||N(this.primaryColor,{h:150}),this.cScale8=this.cScale8||N(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||N(this.primaryColor,{h:270}),this.cScale10=this.cScale10||N(this.primaryColor,{h:300}),this.cScale11=this.cScale11||N(this.primaryColor,{h:330}),this.darkMode)for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=K(this["cScale"+T],75);else for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=K(this["cScale"+T],25);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleInv"+T]=this["cScaleInv"+T]||H(this["cScale"+T]);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this.darkMode?this["cScalePeer"+T]=this["cScalePeer"+T]||X(this["cScale"+T],10):this["cScalePeer"+T]=this["cScalePeer"+T]||K(this["cScale"+T],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleLabel"+T]=this["cScaleLabel"+T]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let T=0;T<5;T++)this["surface"+T]=this["surface"+T]||N(this.mainBkg,{h:180,s:-15,l:e*(5+T*3)}),this["surfacePeer"+T]=this["surfacePeer"+T]||N(this.mainBkg,{h:180,s:-15,l:e*(8+T*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||N(this.primaryColor,{h:64}),this.fillType3=this.fillType3||N(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||N(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||N(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||N(this.primaryColor,{h:128}),this.fillType7=this.fillType7||N(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||N(this.primaryColor,{l:-10}),this.pie5=this.pie5||N(this.secondaryColor,{l:-10}),this.pie6=this.pie6||N(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||N(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||N(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||N(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||N(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||N(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||N(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??N(this.primaryColor,{l:-30}),this.venn2=this.venn2??N(this.secondaryColor,{l:-30}),this.venn3=this.venn3??N(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??N(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??N(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??N(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??N(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??N(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:((h=this.radar)==null?void 0:h.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:((f=this.wardley)==null?void 0:f.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.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:((C=this.wardley)==null?void 0:C.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((S=this.wardley)==null?void 0:S.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((_=this.wardley)==null?void 0:_.annotationStroke)||this.lineColor,annotationTextColor:((w=this.wardley)==null?void 0:w.annotationTextColor)||this.primaryTextColor,annotationFill:((B=this.wardley)==null?void 0:B.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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((I=this.xyChart)==null?void 0:I.titleColor)||this.primaryTextColor,dataLabelColor:((E=this.xyChart)==null?void 0:E.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((F=this.xyChart)==null?void 0:F.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((z=this.xyChart)==null?void 0:z.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((W=this.xyChart)==null?void 0:W.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((O=this.xyChart)==null?void 0:O.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((M=this.xyChart)==null?void 0:M.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((A=this.xyChart)==null?void 0:A.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((P=this.xyChart)==null?void 0:P.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:(($=this.xyChart)==null?void 0:$.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?K(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||N(this.primaryColor,{h:-30}),this.git4=this.git4||N(this.primaryColor,{h:-60}),this.git5=this.git5||N(this.primaryColor,{h:-90}),this.git6=this.git6||N(this.primaryColor,{h:60}),this.git7=this.git7||N(this.primaryColor,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn,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]})}},k(es,"Theme"),es),jM=k(t=>{const e=new EM;return e.calculate(t),e},"getThemeVariables"),rs,NM=(rs=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=N(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Mt(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=X(H("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=An(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=K("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=K(this.sectionBkgColor,10),this.taskBorderColor=An(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=An(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||X(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||K(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,h,u,d,f,p,m,x,g,y,C,b,S,_,w,B,L,I,E,F,z,W,O,M,A,P,$;this.secondBkg=X(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=X(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=X(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=N(this.primaryColor,{h:64}),this.fillType3=N(this.secondaryColor,{h:64}),this.fillType4=N(this.primaryColor,{h:-64}),this.fillType5=N(this.secondaryColor,{h:-64}),this.fillType6=N(this.primaryColor,{h:128}),this.fillType7=N(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||N(this.primaryColor,{h:30}),this.cScale4=this.cScale4||N(this.primaryColor,{h:60}),this.cScale5=this.cScale5||N(this.primaryColor,{h:90}),this.cScale6=this.cScale6||N(this.primaryColor,{h:120}),this.cScale7=this.cScale7||N(this.primaryColor,{h:150}),this.cScale8=this.cScale8||N(this.primaryColor,{h:210}),this.cScale9=this.cScale9||N(this.primaryColor,{h:270}),this.cScale10=this.cScale10||N(this.primaryColor,{h:300}),this.cScale11=this.cScale11||N(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]||X(this["cScale"+j],10);for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||N(this.mainBkg,{h:30,s:-30,l:-(-10+j*4)}),this["surfacePeer"+j]=this["surfacePeer"+j]||N(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)]??X(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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.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:((p=this.radar)==null?void 0:p.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:((C=this.radar)==null?void 0:C.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((b=this.radar)==null?void 0:b.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.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:((B=this.wardley)==null?void 0:B.backgroundColor)||this.background,axisColor:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((I=this.wardley)==null?void 0:I.axisTextColor)||this.primaryTextColor,gridColor:((E=this.wardley)==null?void 0:E.gridColor)||this.gridColor,componentFill:((F=this.wardley)==null?void 0:F.componentFill)||this.mainBkg,componentStroke:((z=this.wardley)==null?void 0:z.componentStroke)||this.lineColor,componentLabelColor:((W=this.wardley)==null?void 0:W.componentLabelColor)||this.primaryTextColor,linkStroke:((O=this.wardley)==null?void 0:O.linkStroke)||this.lineColor,evolutionStroke:((M=this.wardley)==null?void 0:M.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((A=this.wardley)==null?void 0:A.annotationStroke)||this.lineColor,annotationTextColor:((P=this.wardley)==null?void 0:P.annotationTextColor)||this.primaryTextColor,annotationFill:(($=this.wardley)==null?void 0:$.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?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=X(this.secondaryColor,20),this.git1=X(this.pie2||this.secondaryColor,20),this.git2=X(this.pie3||this.tertiaryColor,20),this.git3=X(this.pie4||N(this.primaryColor,{h:-30}),20),this.git4=X(this.pie5||N(this.primaryColor,{h:-60}),20),this.git5=X(this.pie6||N(this.primaryColor,{h:-90}),10),this.git6=X(this.pie7||N(this.primaryColor,{h:60}),10),this.git7=X(this.pie8||N(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||X("#5a3d5c",10),this.emProcessorStroke=this.emProcessorStroke||"#8a6d8c",this.emReadModelFill=this.emReadModelFill||X("#3d5a2d",10),this.emReadModelStroke=this.emReadModelStroke||"#6d8c5c",this.emCommandFill=this.emCommandFill||X("#2d3d5a",10),this.emCommandStroke=this.emCommandStroke||"#5c6d8c",this.emEventFill=this.emEventFill||X("#5a452d",10),this.emEventStroke=this.emEventStroke||"#8c755c",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||X(this.background,5),this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||X(this.background,12),this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||X(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||X(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]})}},k(rs,"Theme"),rs),BM=k(t=>{const e=new NM;return e.calculate(t),e},"getThemeVariables"),ns,LM=(ns=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=N(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=N(this.primaryColor,{h:-160}),this.primaryBorderColor=Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Mt(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=Mt(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=An(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,h,u,d,f,p,m,x,g,y,C,b,S,_,w,B,L,I,E,F,z,W,O,M,A,P,$;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||N(this.primaryColor,{h:30}),this.cScale4=this.cScale4||N(this.primaryColor,{h:60}),this.cScale5=this.cScale5||N(this.primaryColor,{h:90}),this.cScale6=this.cScale6||N(this.primaryColor,{h:120}),this.cScale7=this.cScale7||N(this.primaryColor,{h:150}),this.cScale8=this.cScale8||N(this.primaryColor,{h:210}),this.cScale9=this.cScale9||N(this.primaryColor,{h:270}),this.cScale10=this.cScale10||N(this.primaryColor,{h:300}),this.cScale11=this.cScale11||N(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||K(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||K(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=K(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||K(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||N(this["cScale"+j],{h:180});for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||N(this.mainBkg,{h:30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||N(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||X(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||X(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=N(this.primaryColor,{h:64}),this.fillType3=N(this.secondaryColor,{h:64}),this.fillType4=N(this.primaryColor,{h:-64}),this.fillType5=N(this.secondaryColor,{h:-64}),this.fillType6=N(this.primaryColor,{h:128}),this.fillType7=N(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||N(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||N(this.primaryColor,{l:-10}),this.pie5=this.pie5||N(this.secondaryColor,{l:-30}),this.pie6=this.pie6||N(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||N(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||N(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||N(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||N(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||N(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||N(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??N(this.primaryColor,{l:-30}),this.venn2=this.venn2??N(this.secondaryColor,{l:-30}),this.venn3=this.venn3??N(this.tertiaryColor,{l:-40}),this.venn4=this.venn4??N(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??N(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??N(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??N(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??N(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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.radar)==null?void 0:h.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:((f=this.wardley)==null?void 0:f.axisColor)||this.lineColor,axisTextColor:((p=this.wardley)==null?void 0:p.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:((C=this.wardley)==null?void 0:C.linkStroke)||this.lineColor,evolutionStroke:((b=this.wardley)==null?void 0:b.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((S=this.wardley)==null?void 0:S.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:((B=this.xyChart)==null?void 0:B.backgroundColor)||this.background,titleColor:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((I=this.xyChart)==null?void 0:I.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((E=this.xyChart)==null?void 0:E.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((F=this.xyChart)==null?void 0:F.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((z=this.xyChart)==null?void 0:z.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((W=this.xyChart)==null?void 0:W.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((O=this.xyChart)==null?void 0:O.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((A=this.xyChart)==null?void 0:A.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((P=this.xyChart)==null?void 0:P.yAxisLineColor)||this.primaryTextColor,plotColorPalette:(($=this.xyChart)==null?void 0:$.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||N(this.primaryColor,{h:-30}),this.git4=this.git4||N(this.primaryColor,{h:-60}),this.git5=this.git5||N(this.primaryColor,{h:-90}),this.git6=this.git6||N(this.primaryColor,{h:60}),this.git7=this.git7||N(this.primaryColor,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(ns,"Theme"),ns),AM=k(t=>{const e=new LM;return e.calculate(t),e},"getThemeVariables"),is,MM=(is=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=X("#cde498",10),this.primaryBorderColor=Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Mt(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,h,u,d,f,p,m,x,g,y,C,b,S,_,w,B,L,I,E,F,z,W,O,M,A,P,$;this.actorBorder=K(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||N(this.primaryColor,{h:30}),this.cScale4=this.cScale4||N(this.primaryColor,{h:60}),this.cScale5=this.cScale5||N(this.primaryColor,{h:90}),this.cScale6=this.cScale6||N(this.primaryColor,{h:120}),this.cScale7=this.cScale7||N(this.primaryColor,{h:150}),this.cScale8=this.cScale8||N(this.primaryColor,{h:210}),this.cScale9=this.cScale9||N(this.primaryColor,{h:270}),this.cScale10=this.cScale10||N(this.primaryColor,{h:300}),this.cScale11=this.cScale11||N(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||K(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||K(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=K(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||K(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||N(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]||N(this.mainBkg,{h:30,s:-30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||N(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||X(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||X(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=N(this.primaryColor,{h:64}),this.fillType3=N(this.secondaryColor,{h:64}),this.fillType4=N(this.primaryColor,{h:-64}),this.fillType5=N(this.secondaryColor,{h:-64}),this.fillType6=N(this.primaryColor,{h:128}),this.fillType7=N(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||N(this.primaryColor,{l:-30}),this.pie5=this.pie5||N(this.secondaryColor,{l:-30}),this.pie6=this.pie6||N(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||N(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||N(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||N(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||N(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||N(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||N(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??N(this.primaryColor,{l:-30}),this.venn2=this.venn2??N(this.secondaryColor,{l:-30}),this.venn3=this.venn3??N(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??N(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??N(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??N(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??N(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??N(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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.radar)==null?void 0:h.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:((f=this.wardley)==null?void 0:f.axisColor)||this.lineColor,axisTextColor:((p=this.wardley)==null?void 0:p.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:((C=this.wardley)==null?void 0:C.linkStroke)||this.lineColor,evolutionStroke:((b=this.wardley)==null?void 0:b.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((S=this.wardley)==null?void 0:S.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:((B=this.xyChart)==null?void 0:B.backgroundColor)||this.background,titleColor:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((I=this.xyChart)==null?void 0:I.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((E=this.xyChart)==null?void 0:E.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((F=this.xyChart)==null?void 0:F.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((z=this.xyChart)==null?void 0:z.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((W=this.xyChart)==null?void 0:W.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((O=this.xyChart)==null?void 0:O.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((A=this.xyChart)==null?void 0:A.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((P=this.xyChart)==null?void 0:P.yAxisLineColor)||this.primaryTextColor,plotColorPalette:(($=this.xyChart)==null?void 0:$.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||N(this.primaryColor,{h:-30}),this.git4=this.git4||N(this.primaryColor,{h:-60}),this.git5=this.git5||N(this.primaryColor,{h:-90}),this.git6=this.git6||N(this.primaryColor,{h:60}),this.git7=this.git7||N(this.primaryColor,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(is,"Theme"),is),IM=k(t=>{const e=new MM;return e.calculate(t),e},"getThemeVariables"),ss,FM=(ss=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=X(this.contrast,55),this.background="#ffffff",this.tertiaryColor=N(this.primaryColor,{h:-160}),this.primaryBorderColor=Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Mt(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||X(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,h,u,d,f,p,m,x,g,y,C,b,S,_,w,B,L,I,E,F,z,W,O,M,A,P,$;this.secondBkg=X(this.contrast,55),this.border2=this.contrast,this.actorBorder=X(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]||X(this["cScale"+j],10):this["cScalePeer"+j]=this["cScalePeer"+j]||K(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]||N(this.mainBkg,{l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||N(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=X(this.contrast,30),this.sectionBkgColor2=X(this.contrast,30),this.taskBorderColor=K(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=X(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=K(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=N(this.primaryColor,{h:64}),this.fillType3=N(this.secondaryColor,{h:64}),this.fillType4=N(this.primaryColor,{h:-64}),this.fillType5=N(this.secondaryColor,{h:-64}),this.fillType6=N(this.primaryColor,{h:128}),this.fillType7=N(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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((p=this.radar)==null?void 0:p.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:((C=this.radar)==null?void 0:C.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((b=this.radar)==null?void 0:b.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.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:((B=this.wardley)==null?void 0:B.backgroundColor)||this.background,axisColor:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((I=this.wardley)==null?void 0:I.axisTextColor)||this.primaryTextColor,gridColor:((E=this.wardley)==null?void 0:E.gridColor)||this.gridColor,componentFill:((F=this.wardley)==null?void 0:F.componentFill)||this.background,componentStroke:((z=this.wardley)==null?void 0:z.componentStroke)||this.lineColor,componentLabelColor:((W=this.wardley)==null?void 0:W.componentLabelColor)||this.primaryTextColor,linkStroke:((O=this.wardley)==null?void 0:O.linkStroke)||this.lineColor,evolutionStroke:((M=this.wardley)==null?void 0:M.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((A=this.wardley)==null?void 0:A.annotationStroke)||this.lineColor,annotationTextColor:((P=this.wardley)==null?void 0:P.annotationTextColor)||this.primaryTextColor,annotationFill:(($=this.wardley)==null?void 0:$.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=K(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||N(this.primaryColor,{h:-30}),this.git4=this.pie5||N(this.primaryColor,{h:-60}),this.git5=this.pie6||N(this.primaryColor,{h:-90}),this.git6=this.pie7||N(this.primaryColor,{h:60}),this.git7=this.pie8||N(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(ss,"Theme"),ss),DM=k(t=>{const e=new FM;return e.calculate(t),e},"getThemeVariables"),os,PM=(os=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=Mt(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,h,u,d,f,p,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||N(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||N(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Mt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Mt(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?K(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||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=N(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||X(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||N(e,{h:30}),this.cScale4=this.cScale4||N(e,{h:60}),this.cScale5=this.cScale5||N(e,{h:90}),this.cScale6=this.cScale6||N(e,{h:120}),this.cScale7=this.cScale7||N(e,{h:150}),this.cScale8=this.cScale8||N(e,{h:210,l:150}),this.cScale9=this.cScale9||N(e,{h:270}),this.cScale10=this.cScale10||N(e,{h:300}),this.cScale11=this.cScale11||N(e,{h:330}),this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(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]||X(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(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]||N(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||N(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||N(e,{h:64}),this.fillType3=this.fillType3||N(r,{h:64}),this.fillType4=this.fillType4||N(e,{h:-64}),this.fillType5=this.fillType5||N(r,{h:-64}),this.fillType6=this.fillType6||N(e,{h:128}),this.fillType7=this.fillType7||N(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||N(e,{l:-10}),this.pie5=this.pie5||N(r,{l:-10}),this.pie6=this.pie6||N(n,{l:-10}),this.pie7=this.pie7||N(e,{h:60,l:-10}),this.pie8=this.pie8||N(e,{h:-60,l:-10}),this.pie9=this.pie9||N(e,{h:120,l:0}),this.pie10=this.pie10||N(e,{h:60,l:-20}),this.pie11=this.pie11||N(e,{h:-60,l:-20}),this.pie12=this.pie12||N(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||N(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((p=this.xyChart)==null?void 0:p.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?K(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||N(e,{h:-30}),this.git4=this.git4||N(e,{h:-60}),this.git5=this.git5||N(e,{h:-90}),this.git6=this.git6||N(e,{h:60}),this.git7=this.git7||N(e,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(os,"Theme"),os),OM=k(t=>{const e=new PM;return e.calculate(t),e},"getThemeVariables"),as,$M=(as=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=N(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Mt(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=X(H("#323D47"),10),this.border1="#ccc",this.border2=An(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,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||N(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||N(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Mt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Mt(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?K(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||K(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||X(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||N(this.primaryColor,{h:30}),this.cScale4=this.cScale4||N(this.primaryColor,{h:60}),this.cScale5=this.cScale5||N(this.primaryColor,{h:90}),this.cScale6=this.cScale6||N(this.primaryColor,{h:120}),this.cScale7=this.cScale7||N(this.primaryColor,{h:150}),this.cScale8=this.cScale8||N(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||N(this.primaryColor,{h:270}),this.cScale10=this.cScale10||N(this.primaryColor,{h:300}),this.cScale11=this.cScale11||N(this.primaryColor,{h:330}),this.darkMode)for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||H(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||X(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=this["cScaleLabel"+p]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let p=0;p<5;p++)this["surface"+p]=this["surface"+p]||N(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||N(this.mainBkg,{h:180,s:-15,l:e*(8+p*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||N(this.primaryColor,{h:64}),this.fillType3=this.fillType3||N(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||N(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||N(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||N(this.primaryColor,{h:128}),this.fillType7=this.fillType7||N(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||N(this.primaryColor,{l:-10}),this.pie5=this.pie5||N(this.secondaryColor,{l:-10}),this.pie6=this.pie6||N(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||N(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||N(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||N(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||N(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||N(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||N(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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.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?K(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=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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(as,"Theme"),as),RM=k(t=>{const e=new $M;return e.calculate(t),e},"getThemeVariables"),ls,zM=(ls=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=Mt("#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,h,u,d,f,p,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||N(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||N(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Mt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Mt(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?K(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||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=N(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||X(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]=K(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(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]||X(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(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]||N(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||N(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||N(e,{h:64}),this.fillType3=this.fillType3||N(r,{h:64}),this.fillType4=this.fillType4||N(e,{h:-64}),this.fillType5=this.fillType5||N(r,{h:-64}),this.fillType6=this.fillType6||N(e,{h:128}),this.fillType7=this.fillType7||N(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||N(e,{l:-10}),this.pie5=this.pie5||N(r,{l:-10}),this.pie6=this.pie6||N(n,{l:-10}),this.pie7=this.pie7||N(e,{h:60,l:-10}),this.pie8=this.pie8||N(e,{h:-60,l:-10}),this.pie9=this.pie9||N(e,{h:120,l:0}),this.pie10=this.pie10||N(e,{h:60,l:-20}),this.pie11=this.pie11||N(e,{h:-60,l:-20}),this.pie12=this.pie12||N(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||N(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((p=this.xyChart)==null?void 0:p.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?K(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||N(e,{h:-30}),this.git4=this.git4||N(e,{h:-60}),this.git5=this.git5||N(e,{h:-90}),this.git6=this.git6||N(e,{h:60}),this.git7=this.git7||N(e,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(ls,"Theme"),ls),WM=k(t=>{const e=new zM;return e.calculate(t),e},"getThemeVariables"),cs,qM=(cs=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=N(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Mt(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=X(H("#323D47"),10),this.border1="#ccc",this.border2=An(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,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||N(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||N(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Mt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Mt(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?K(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||K(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||X(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||N(this.primaryColor,{h:30}),this.cScale4=this.cScale4||N(this.primaryColor,{h:60}),this.cScale5=this.cScale5||N(this.primaryColor,{h:90}),this.cScale6=this.cScale6||N(this.primaryColor,{h:120}),this.cScale7=this.cScale7||N(this.primaryColor,{h:150}),this.cScale8=this.cScale8||N(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||N(this.primaryColor,{h:270}),this.cScale10=this.cScale10||N(this.primaryColor,{h:300}),this.cScale11=this.cScale11||N(this.primaryColor,{h:330}),this.darkMode)for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||H(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||X(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=this["cScaleLabel"+p]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let p=0;p<5;p++)this["surface"+p]=this["surface"+p]||N(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||N(this.mainBkg,{h:180,s:-15,l:e*(8+p*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||N(this.primaryColor,{h:64}),this.fillType3=this.fillType3||N(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||N(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||N(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||N(this.primaryColor,{h:128}),this.fillType7=this.fillType7||N(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||N(this.primaryColor,{l:-10}),this.pie5=this.pie5||N(this.secondaryColor,{l:-10}),this.pie6=this.pie6||N(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||N(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||N(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||N(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||N(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||N(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||N(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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.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?K(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||N(this.primaryColor,{h:-30}),this.git4=this.git4||N(this.primaryColor,{h:-60}),this.git5=this.git5||N(this.primaryColor,{h:-90}),this.git6=this.git6||N(this.primaryColor,{h:60}),this.git7=this.git7||N(this.primaryColor,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(cs,"Theme"),cs),HM=k(t=>{const e=new qM;return e.calculate(t),e},"getThemeVariables"),hs,UM=(hs=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=Mt(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,h,u,d,f,p,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||N(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||N(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Mt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Mt(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?K(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||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=N(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||X(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]||X(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(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]||N(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||N(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||N(e,{h:64}),this.fillType3=this.fillType3||N(r,{h:64}),this.fillType4=this.fillType4||N(e,{h:-64}),this.fillType5=this.fillType5||N(r,{h:-64}),this.fillType6=this.fillType6||N(e,{h:128}),this.fillType7=this.fillType7||N(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||N(e,{l:-10}),this.pie5=this.pie5||N(r,{l:-10}),this.pie6=this.pie6||N(n,{l:-10}),this.pie7=this.pie7||N(e,{h:60,l:-10}),this.pie8=this.pie8||N(e,{h:-60,l:-10}),this.pie9=this.pie9||N(e,{h:120,l:0}),this.pie10=this.pie10||N(e,{h:60,l:-20}),this.pie11=this.pie11||N(e,{h:-60,l:-20}),this.pie12=this.pie12||N(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||N(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((p=this.xyChart)==null?void 0:p.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?K(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||N(e,{h:-30}),this.git4=this.git4||N(e,{h:-60}),this.git5=this.git5||N(e,{h:-90}),this.git6=this.git6||N(e,{h:60}),this.git7=this.git7||N(e,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(hs,"Theme"),hs),YM=k(t=>{const e=new UM;return e.calculate(t),e},"getThemeVariables"),us,GM=(us=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=X(this.primaryColor,16),this.tertiaryColor=N(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Mt(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=X(H("#323D47"),10),this.border1="#ccc",this.border2=An(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,h,u,d,f;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||N(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||N(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Mt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Mt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Mt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Mt(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?K(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||K(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||X(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 p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||H(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||X(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=K(this["cScale"+p],75);const e=this.darkMode?-4:-1;for(let p=0;p<5;p++)this["surface"+p]=this["surface"+p]||N(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||N(this.mainBkg,{h:180,s:-15,l:e*(8+p*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||N(this.primaryColor,{h:64}),this.fillType3=this.fillType3||N(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||N(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||N(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||N(this.primaryColor,{h:128}),this.fillType7=this.fillType7||N(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||N(this.primaryColor,{l:-10}),this.pie5=this.pie5||N(this.secondaryColor,{l:-10}),this.pie6=this.pie6||N(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||N(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||N(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||N(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||N(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||N(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||N(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||N(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||N(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||N(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||N(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||N(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||N(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?X(this.quadrant1Fill):K(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:((h=this.xyChart)==null?void 0:h.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:((f=this.xyChart)==null?void 0:f.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?K(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||N(this.primaryColor,{h:-30}),this.git4=this.git4||N(this.primaryColor,{h:-60}),this.git5=this.git5||N(this.primaryColor,{h:-90}),this.git6=this.git6||N(this.primaryColor,{h:60}),this.git7=this.git7||N(this.primaryColor,{h:120}),this.darkMode?(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.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(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||en,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||rn}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]})}},k(us,"Theme"),us),VM=k(t=>{const e=new GM;return e.calculate(t),e},"getThemeVariables"),un={base:{getThemeVariables:jM},dark:{getThemeVariables:BM},default:{getThemeVariables:AM},forest:{getThemeVariables:IM},neutral:{getThemeVariables:DM},neo:{getThemeVariables:OM},"neo-dark":{getThemeVariables:RM},redux:{getThemeVariables:WM},"redux-dark":{getThemeVariables:HM},"redux-color":{getThemeVariables:YM},"redux-dark-color":{getThemeVariables:VM}},Je={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},Gy={...Je,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:un.default.getThemeVariables(),sequence:{...Je.sequence,messageFont:k(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:k(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:k(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Je.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Je.c4,useWidth:void 0,personFont:k(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Je.flowchart,inheritDir:!1},external_personFont:k(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:k(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:k(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:k(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:k(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:k(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:k(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:k(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:k(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:k(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:k(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:k(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:k(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:k(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:k(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:k(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:k(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:k(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:k(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:k(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:k(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Je.pie,useWidth:984},xyChart:{...Je.xyChart,useWidth:void 0},requirement:{...Je.requirement,useWidth:void 0},packet:{...Je.packet},eventmodeling:{...Je.eventmodeling},treeView:{...Je.treeView,useWidth:void 0},radar:{...Je.radar},ishikawa:{...Je.ishikawa},sankey:{...Je.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:{...Je.venn}},Vy=k((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...Vy(t[n],"")]:[...r,e+n],[]),"keyify"),XM=new Set(Vy(Gy,"")),Xy=Gy,Cl=k(t=>{if(et.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>Cl(e));return}for(const e of Object.keys(t)){if(et.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!XM.has(e)||t[e]==null){et.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]))&&(et.debug("sanitize deleting invalid color:",i,t[e][i]),delete t[e][i])}else et.debug("sanitizing object",e),Cl(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(et.debug("sanitizing css option",e),t[e]=Ky(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]="")}et.debug("After sanitization",t)}},"sanitizeDirective"),Ky=k(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"),bs=Object.freeze(Xy),yn=k(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),hr=Le({},bs),kl,pi=[],_o=Le({},bs),fc=k((t,e)=>{let r=Le({},t),n={};for(const i of e)Jy(i),n=Le(n,i);if(r=Le(r,n),n.theme&&n.theme in un){const i=Le({},kl),s=Le(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in un&&(r.themeVariables=un[r.theme].getThemeVariables(s))}return _o=r,eb(_o),_o},"updateCurrentConfig"),KM=k(t=>(hr=Le({},bs),hr=Le(hr,t),t.theme&&un[t.theme]&&(hr.themeVariables=un[t.theme].getThemeVariables(t.themeVariables)),fc(hr,pi),hr),"setSiteConfig"),QM=k(t=>{kl=Le({},t)},"saveConfigFromInitialize"),ZM=k(t=>(hr=Le(hr,t),fc(hr,pi),hr),"updateSiteConfig"),Qy=k(()=>Le({},hr),"getSiteConfig"),Zy=k(t=>(eb(t),Le(_o,t),me()),"setConfig"),me=k(()=>Le({},_o),"getConfig"),Jy=k(t=>{t&&(["secure",...hr.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(et.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"&&Jy(t[e])}))},"sanitize"),JM=k(t=>{var e;Cl(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),pi.push(t),fc(hr,pi)},"addDirective"),vl=k((t=hr)=>{pi=[],fc(t,pi)},"reset"),t3={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."},jm={},tb=k(t=>{jm[t]||(et.warn(t3[t]),jm[t]=!0)},"issueWarning"),eb=k(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&tb("LAZY_LOAD_DEPRECATED")},"checkConfig"),rY=k(()=>{let t={};kl&&(t=Le(t,kl));for(const e of pi)t=Le(t,e);return t},"getUserDefinedConfig"),or=k(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&tb("FLOWCHART_HTML_LABELS_DEPRECATED"),yn(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),ea=/<br\s*\/?>/gi,e3=k(t=>t?ib(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),r3=(()=>{let t=!1;return()=>{t||(rb(),t=!0)}})();function rb(){const t="data-temp-href-target";ys.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),ys.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"))})}k(rb,"setupDompurifyHooks");var nb=k(t=>(r3(),ys.sanitize(t)),"removeScript"),Nm=k((t,e)=>{if(or(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=nb(t):r!=="loose"&&(t=ib(t),t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=t.replace(/=/g,"&equals;"),t=o3(t))}return t},"sanitizeMore"),zr=k((t,e)=>t&&(e.dompurifyConfig?t=ys.sanitize(Nm(t,e),e.dompurifyConfig).toString():t=ys.sanitize(Nm(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),n3=k((t,e)=>typeof t=="string"?zr(t,e):t.flat().map(r=>zr(r,e)),"sanitizeTextOrArray"),i3=k(t=>ea.test(t),"hasBreaks"),s3=k(t=>t.split(ea),"splitBreaks"),o3=k(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),ib=k(t=>t.replace(ea,"#br#"),"breakToPlaceholder"),a3=k(t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=CSS.escape(e)),e},"getUrl"),l3=k(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),c3=k(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),Bm=k(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];h3(s,o)&&(i=s+","+o,n++,r.pop())}r.push(u3(i))}return r.join("")},"parseGenericTypes"),au=k((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),h3=k((t,e)=>{const r=au(t,"~"),n=au(e,"~");return r===1&&n===1},"shouldCombineSets"),u3=k(t=>{const e=au(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"),Lm=k(()=>window.MathMLElement!==void 0,"isMathMLSupported"),lu=/\$\$(.*)\$\$/g,Fo=k(t=>{var e;return(((e=t.match(lu))==null?void 0:e.length)??0)>0},"hasKatex"),nY=k(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await sb(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"),d3=k(async(t,e)=>{if(!Fo(t))return t;if(!(Lm()||e.legacyMathML||e.forceLegacyMathML))return t.replace(lu,"MathML is unsupported in this environment.");{const{default:r}=await Kt(async()=>{const{default:i}=await import("./katex-C5jXJg4s.js");return{default:i}},[]),n=e.forceLegacyMathML||!Lm()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(ea).map(i=>Fo(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(lu,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),sb=k(async(t,e)=>zr(await d3(t,e),e),"renderKatexSanitized"),ra={getRows:e3,sanitizeText:zr,sanitizeTextOrArray:n3,hasBreaks:i3,splitBreaks:s3,lineBreakRegex:ea,removeScript:nb,getUrl:a3,evaluate:yn,getMax:l3,getMin:c3},p3=k(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),f3=k(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"),ob=k(function(t,e,r,n){const i=f3(e,r,n);p3(t,i)},"configureSvgSize"),m3=k(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;et.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;et.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,et.info(`Calculated bounds: ${a}x${l}`),ob(e,l,a,n);const h=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;e.attr("viewBox",h)},"setupGraphViewbox"),Xa={};function cu(t){return[...t.cssRules].map(e=>e.cssText).join(`
305
- `)}k(cu,"cssStyleSheetToString");var g3=k((t,e,r,n)=>{let i="";return t in Xa&&Xa[t]?i=Xa[t]({...r,svgId:n}):et.warn(`No theme found for ${t}`),` & {
306
- font-family: ${r.fontFamily};
307
- font-size: ${r.fontSize};
308
- fill: ${r.textColor}
309
- }
310
- @keyframes edge-animation-frame {
311
- from {
312
- stroke-dashoffset: 0;
313
- }
314
- }
315
- @keyframes dash {
316
- to {
317
- stroke-dashoffset: 0;
318
- }
319
- }
320
- & .edge-animation-slow {
321
- stroke-dasharray: 9,5 !important;
322
- stroke-dashoffset: 900;
323
- animation: dash 50s linear infinite;
324
- stroke-linecap: round;
325
- }
326
- & .edge-animation-fast {
327
- stroke-dasharray: 9,5 !important;
328
- stroke-dashoffset: 900;
329
- animation: dash 20s linear infinite;
330
- stroke-linecap: round;
331
- }
332
- /* Classes common for multiple diagrams */
333
-
334
- & .error-icon {
335
- fill: ${r.errorBkgColor};
336
- }
337
- & .error-text {
338
- fill: ${r.errorTextColor};
339
- stroke: ${r.errorTextColor};
340
- }
341
-
342
- & .edge-thickness-normal {
343
- stroke-width: ${r.strokeWidth??1}px;
344
- }
345
- & .edge-thickness-thick {
346
- stroke-width: 3.5px
347
- }
348
- & .edge-pattern-solid {
349
- stroke-dasharray: 0;
350
- }
351
- & .edge-thickness-invisible {
352
- stroke-width: 0;
353
- fill: none;
354
- }
355
- & .edge-pattern-dashed{
356
- stroke-dasharray: 3;
357
- }
358
- .edge-pattern-dotted {
359
- stroke-dasharray: 2;
360
- }
361
-
362
- & .marker {
363
- fill: ${r.lineColor};
364
- stroke: ${r.lineColor};
365
- }
366
- & .marker.cross {
367
- stroke: ${r.lineColor};
368
- }
369
-
370
- & svg {
371
- font-family: ${r.fontFamily};
372
- font-size: ${r.fontSize};
373
- }
374
- & p {
375
- margin: 0
376
- }
377
-
378
- ${i}
379
- .node .neo-node {
380
- stroke: ${r.nodeBorder};
381
- }
382
-
383
- [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
384
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
385
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
386
- }
387
-
388
-
389
- [data-look="neo"].node path {
390
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
391
- stroke-width: ${r.strokeWidth??1}px;
392
- }
393
-
394
- [data-look="neo"].node .outer-path {
395
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
396
- }
397
-
398
- [data-look="neo"].node .neo-line path {
399
- stroke: ${r.nodeBorder};
400
- filter: none;
401
- }
402
-
403
- [data-look="neo"].node circle{
404
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
405
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
406
- }
407
-
408
- [data-look="neo"].node circle .state-start{
409
- fill: #000000;
410
- }
411
-
412
- [data-look="neo"].icon-shape .icon {
413
- fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
414
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
415
- }
416
-
417
- [data-look="neo"].icon-shape .icon-neo path {
418
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
419
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
420
- }
421
-
422
- ${e}
423
- `},"getStyles"),x3=k((t,e)=>{e!==void 0&&(Xa[t]=e)},"addStylesForDiagram"),y3=g3,ab={};zA(ab,{clear:()=>b3,getAccDescription:()=>w3,getAccTitle:()=>k3,getDiagramTitle:()=>T3,setAccDescription:()=>v3,setAccTitle:()=>C3,setDiagramTitle:()=>S3});var Zd="",Jd="",tp="",ep=k(t=>zr(t,me()),"sanitizeText"),b3=k(()=>{Zd="",tp="",Jd=""},"clear"),C3=k(t=>{Zd=ep(t).replace(/^\s+/g,"")},"setAccTitle"),k3=k(()=>Zd,"getAccTitle"),v3=k(t=>{tp=ep(t).replace(/\n\s+/g,`
424
- `)},"setAccDescription"),w3=k(()=>tp,"getAccDescription"),S3=k(t=>{Jd=ep(t)},"setDiagramTitle"),T3=k(()=>Jd,"getDiagramTitle"),Am=et,_3=Kd,Jt=me,iY=Zy,sY=bs,rp=k(t=>zr(t,Jt()),"sanitizeText"),E3=m3,j3=k(()=>ab,"getCommonDb"),wl={},Sl=k((t,e,r)=>{var n;wl[t]&&Am.warn(`Diagram with id ${t} already registered. Overwriting.`),wl[t]=e,r&&Yy(t,r),x3(t,e.styles),(n=e.injectUtils)==null||n.call(e,Am,_3,Jt,rp,E3,j3(),()=>{})},"registerDiagram"),hu=k(t=>{if(t in wl)return wl[t];throw new N3(t)},"getDiagram"),ds,N3=(ds=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},k(ds,"DiagramNotFoundError"),ds),B3={value:()=>{}};function lb(){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 Ka(r)}function Ka(t){this._=t}function L3(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}})}Ka.prototype=lb.prototype={constructor:Ka,on:function(t,e){var r=this._,n=L3(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=A3(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]=Mm(r[i],t.name,e);else if(e==null)for(i in r)r[i]=Mm(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 Ka(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 A3(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function Mm(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=B3,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var uu="http://www.w3.org/1999/xhtml";const Im={svg:"http://www.w3.org/2000/svg",xhtml:uu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function mc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),Im.hasOwnProperty(e)?{space:Im[e],local:t}:t}function M3(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===uu&&e.documentElement.namespaceURI===uu?e.createElement(t):e.createElementNS(r,t)}}function I3(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function cb(t){var e=mc(t);return(e.local?I3:M3)(e)}function F3(){}function np(t){return t==null?F3:function(){return this.querySelector(t)}}function D3(t){typeof t!="function"&&(t=np(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,h,u=0;u<o;++u)(l=s[u])&&(h=t.call(l,l.__data__,u,s))&&("__data__"in l&&(h.__data__=l.__data__),a[u]=h);return new vr(n,this._parents)}function P3(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function O3(){return[]}function hb(t){return t==null?O3:function(){return this.querySelectorAll(t)}}function $3(t){return function(){return P3(t.apply(this,arguments))}}function R3(t){typeof t=="function"?t=$3(t):t=hb(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,h=0;h<a;++h)(l=o[h])&&(n.push(t.call(l,l.__data__,h,o)),i.push(l));return new vr(n,i)}function ub(t){return function(){return this.matches(t)}}function db(t){return function(e){return e.matches(t)}}var z3=Array.prototype.find;function W3(t){return function(){return z3.call(this.children,t)}}function q3(){return this.firstElementChild}function H3(t){return this.select(t==null?q3:W3(typeof t=="function"?t:db(t)))}var U3=Array.prototype.filter;function Y3(){return Array.from(this.children)}function G3(t){return function(){return U3.call(this.children,t)}}function V3(t){return this.selectAll(t==null?Y3:G3(typeof t=="function"?t:db(t)))}function X3(t){typeof t!="function"&&(t=ub(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,h=0;h<o;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&a.push(l);return new vr(n,this._parents)}function pb(t){return new Array(t.length)}function K3(){return new vr(this._enter||this._groups.map(pb),this._parents)}function Tl(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Tl.prototype={constructor:Tl,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 Q3(t){return function(){return t}}function Z3(t,e,r,n,i,s){for(var o=0,a,l=e.length,h=s.length;o<h;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new Tl(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function J3(t,e,r,n,i,s,o){var a,l,h=new Map,u=e.length,d=s.length,f=new Array(u),p;for(a=0;a<u;++a)(l=e[a])&&(f[a]=p=o.call(l,l.__data__,a,e)+"",h.has(p)?i[a]=l:h.set(p,l));for(a=0;a<d;++a)p=o.call(t,s[a],a,s)+"",(l=h.get(p))?(n[a]=l,l.__data__=s[a],h.delete(p)):r[a]=new Tl(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&h.get(f[a])===l&&(i[a]=l)}function tI(t){return t.__data__}function eI(t,e){if(!arguments.length)return Array.from(this,tI);var r=e?J3:Z3,n=this._parents,i=this._groups;typeof t!="function"&&(t=Q3(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),h=0;h<s;++h){var u=n[h],d=i[h],f=d.length,p=rI(t.call(u,u&&u.__data__,h,n)),m=p.length,x=a[h]=new Array(m),g=o[h]=new Array(m),y=l[h]=new Array(f);r(u,d,x,g,y,p,e);for(var C=0,b=0,S,_;C<m;++C)if(S=x[C]){for(C>=b&&(b=C+1);!(_=g[b])&&++b<m;);S._next=_||null}}return o=new vr(o,n),o._enter=a,o._exit=l,o}function rI(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function nI(){return new vr(this._exit||this._groups.map(pb),this._parents)}function iI(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 sI(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 h=r[l],u=n[l],d=h.length,f=a[l]=new Array(d),p,m=0;m<d;++m)(p=h[m]||u[m])&&(f[m]=p);for(;l<i;++l)a[l]=r[l];return new vr(a,this._parents)}function oI(){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 aI(t){t||(t=lI);function e(d,f){return d&&f?t(d.__data__,f.__data__):!d-!f}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),h,u=0;u<a;++u)(h=o[u])&&(l[u]=h);l.sort(e)}return new vr(i,this._parents).order()}function lI(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function cI(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function hI(){return Array.from(this)}function uI(){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 dI(){let t=0;for(const e of this)++t;return t}function pI(){return!this.node()}function fI(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 mI(t){return function(){this.removeAttribute(t)}}function gI(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xI(t,e){return function(){this.setAttribute(t,e)}}function yI(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function bI(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function CI(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 kI(t,e){var r=mc(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?gI:mI:typeof e=="function"?r.local?CI:bI:r.local?yI:xI)(r,e))}function fb(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function vI(t){return function(){this.style.removeProperty(t)}}function wI(t,e,r){return function(){this.style.setProperty(t,e,r)}}function SI(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function TI(t,e,r){return arguments.length>1?this.each((e==null?vI:typeof e=="function"?SI:wI)(t,e,r??"")):Cs(this.node(),t)}function Cs(t,e){return t.style.getPropertyValue(e)||fb(t).getComputedStyle(t,null).getPropertyValue(e)}function _I(t){return function(){delete this[t]}}function EI(t,e){return function(){this[t]=e}}function jI(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function NI(t,e){return arguments.length>1?this.each((e==null?_I:typeof e=="function"?jI:EI)(t,e)):this.node()[t]}function mb(t){return t.trim().split(/^|\s+/)}function ip(t){return t.classList||new gb(t)}function gb(t){this._node=t,this._names=mb(t.getAttribute("class")||"")}gb.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 xb(t,e){for(var r=ip(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function yb(t,e){for(var r=ip(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function BI(t){return function(){xb(this,t)}}function LI(t){return function(){yb(this,t)}}function AI(t,e){return function(){(e.apply(this,arguments)?xb:yb)(this,t)}}function MI(t,e){var r=mb(t+"");if(arguments.length<2){for(var n=ip(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?AI:e?BI:LI)(r,e))}function II(){this.textContent=""}function FI(t){return function(){this.textContent=t}}function DI(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function PI(t){return arguments.length?this.each(t==null?II:(typeof t=="function"?DI:FI)(t)):this.node().textContent}function OI(){this.innerHTML=""}function $I(t){return function(){this.innerHTML=t}}function RI(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function zI(t){return arguments.length?this.each(t==null?OI:(typeof t=="function"?RI:$I)(t)):this.node().innerHTML}function WI(){this.nextSibling&&this.parentNode.appendChild(this)}function qI(){return this.each(WI)}function HI(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function UI(){return this.each(HI)}function YI(t){var e=typeof t=="function"?t:cb(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function GI(){return null}function VI(t,e){var r=typeof t=="function"?t:cb(t),n=e==null?GI:typeof e=="function"?e:np(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function XI(){var t=this.parentNode;t&&t.removeChild(this)}function KI(){return this.each(XI)}function QI(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ZI(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function JI(t){return this.select(t?ZI:QI)}function tF(t){return arguments.length?this.property("__data__",t):this.node().__data__}function eF(t){return function(e){t.call(this,e,this.__data__)}}function rF(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 nF(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 iF(t,e,r){return function(){var n=this.__on,i,s=eF(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 sF(t,e,r){var n=rF(t+""),i,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,h=a.length,u;l<h;++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?iF:nF,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function bb(t,e,r){var n=fb(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 oF(t,e){return function(){return bb(this,t,e)}}function aF(t,e){return function(){return bb(this,t,e.apply(this,arguments))}}function lF(t,e){return this.each((typeof e=="function"?aF:oF)(t,e))}function*cF(){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 Cb=[null];function vr(t,e){this._groups=t,this._parents=e}function na(){return new vr([[document.documentElement]],Cb)}function hF(){return this}vr.prototype=na.prototype={constructor:vr,select:D3,selectAll:R3,selectChild:H3,selectChildren:V3,filter:X3,data:eI,enter:K3,exit:nI,join:iI,merge:sI,selection:hF,order:oI,sort:aI,call:cI,nodes:hI,node:uI,size:dI,empty:pI,each:fI,attr:kI,style:TI,property:NI,classed:MI,text:PI,html:zI,raise:qI,lower:UI,append:YI,insert:VI,remove:KI,clone:JI,datum:tF,on:sF,dispatch:lF,[Symbol.iterator]:cF};function Ut(t){return typeof t=="string"?new vr([[document.querySelector(t)]],[document.documentElement]):new vr([[t]],Cb)}function sp(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function kb(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function ia(){}var Do=.7,_l=1/Do,Qi="\\s*([+-]?\\d+)\\s*",Po="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Kr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",uF=/^#([0-9a-f]{3,8})$/,dF=new RegExp(`^rgb\\(${Qi},${Qi},${Qi}\\)$`),pF=new RegExp(`^rgb\\(${Kr},${Kr},${Kr}\\)$`),fF=new RegExp(`^rgba\\(${Qi},${Qi},${Qi},${Po}\\)$`),mF=new RegExp(`^rgba\\(${Kr},${Kr},${Kr},${Po}\\)$`),gF=new RegExp(`^hsl\\(${Po},${Kr},${Kr}\\)$`),xF=new RegExp(`^hsla\\(${Po},${Kr},${Kr},${Po}\\)$`),Fm={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};sp(ia,Oo,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Dm,formatHex:Dm,formatHex8:yF,formatHsl:bF,formatRgb:Pm,toString:Pm});function Dm(){return this.rgb().formatHex()}function yF(){return this.rgb().formatHex8()}function bF(){return vb(this).formatHsl()}function Pm(){return this.rgb().formatRgb()}function Oo(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=uF.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?Om(e):r===3?new dr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?_a(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?_a(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=dF.exec(t))?new dr(e[1],e[2],e[3],1):(e=pF.exec(t))?new dr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fF.exec(t))?_a(e[1],e[2],e[3],e[4]):(e=mF.exec(t))?_a(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=gF.exec(t))?zm(e[1],e[2]/100,e[3]/100,1):(e=xF.exec(t))?zm(e[1],e[2]/100,e[3]/100,e[4]):Fm.hasOwnProperty(t)?Om(Fm[t]):t==="transparent"?new dr(NaN,NaN,NaN,0):null}function Om(t){return new dr(t>>16&255,t>>8&255,t&255,1)}function _a(t,e,r,n){return n<=0&&(t=e=r=NaN),new dr(t,e,r,n)}function CF(t){return t instanceof ia||(t=Oo(t)),t?(t=t.rgb(),new dr(t.r,t.g,t.b,t.opacity)):new dr}function du(t,e,r,n){return arguments.length===1?CF(t):new dr(t,e,r,n??1)}function dr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}sp(dr,du,kb(ia,{brighter(t){return t=t==null?_l:Math.pow(_l,t),new dr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Do:Math.pow(Do,t),new dr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new dr(li(this.r),li(this.g),li(this.b),El(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:$m,formatHex:$m,formatHex8:kF,formatRgb:Rm,toString:Rm}));function $m(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}`}function kF(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}${ni((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rm(){const t=El(this.opacity);return`${t===1?"rgb(":"rgba("}${li(this.r)}, ${li(this.g)}, ${li(this.b)}${t===1?")":`, ${t})`}`}function El(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function li(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ni(t){return t=li(t),(t<16?"0":"")+t.toString(16)}function zm(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Dr(t,e,r,n)}function vb(t){if(t instanceof Dr)return new Dr(t.h,t.s,t.l,t.opacity);if(t instanceof ia||(t=Oo(t)),!t)return new Dr;if(t instanceof Dr)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 Dr(o,a,l,t.opacity)}function vF(t,e,r,n){return arguments.length===1?vb(t):new Dr(t,e,r,n??1)}function Dr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}sp(Dr,vF,kb(ia,{brighter(t){return t=t==null?_l:Math.pow(_l,t),new Dr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Do:Math.pow(Do,t),new Dr(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 dr(gh(t>=240?t-240:t+120,i,n),gh(t,i,n),gh(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Dr(Wm(this.h),Ea(this.s),Ea(this.l),El(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=El(this.opacity);return`${t===1?"hsl(":"hsla("}${Wm(this.h)}, ${Ea(this.s)*100}%, ${Ea(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Wm(t){return t=(t||0)%360,t<0?t+360:t}function Ea(t){return Math.max(0,Math.min(1,t||0))}function gh(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 op=t=>()=>t;function wb(t,e){return function(r){return t+r*e}}function wF(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 oY(t,e){var r=e-t;return r?wb(t,r>180||r<-180?r-360*Math.round(r/360):r):op(isNaN(t)?e:t)}function SF(t){return(t=+t)==1?Sb:function(e,r){return r-e?wF(e,r,t):op(isNaN(e)?r:e)}}function Sb(t,e){var r=e-t;return r?wb(t,r):op(isNaN(t)?e:t)}const qm=(function t(e){var r=SF(e);function n(i,s){var o=r((i=du(i)).r,(s=du(s)).r),a=r(i.g,s.g),l=r(i.b,s.b),h=Sb(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=h(u),i+""}}return n.gamma=t,n})(1);function Nn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var pu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xh=new RegExp(pu.source,"g");function TF(t){return function(){return t}}function _F(t){return function(e){return t(e)+""}}function EF(t,e){var r=pu.lastIndex=xh.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=pu.exec(t))&&(i=xh.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:Nn(n,i)})),r=xh.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?_F(l[0].x):TF(e):(e=l.length,function(h){for(var u=0,d;u<e;++u)a[(d=l[u]).i]=d.x(h);return a.join("")})}var Hm=180/Math.PI,fu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Tb(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)*Hm,skewX:Math.atan(l)*Hm,scaleX:o,scaleY:a}}var ja;function jF(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?fu:Tb(e.a,e.b,e.c,e.d,e.e,e.f)}function NF(t){return t==null||(ja||(ja=document.createElementNS("http://www.w3.org/2000/svg","g")),ja.setAttribute("transform",t),!(t=ja.transform.baseVal.consolidate()))?fu:(t=t.matrix,Tb(t.a,t.b,t.c,t.d,t.e,t.f))}function _b(t,e,r,n){function i(h){return h.length?h.pop()+" ":""}function s(h,u,d,f,p,m){if(h!==d||u!==f){var x=p.push("translate(",null,e,null,r);m.push({i:x-4,x:Nn(h,d)},{i:x-2,x:Nn(u,f)})}else(d||f)&&p.push("translate("+d+e+f+r)}function o(h,u,d,f){h!==u?(h-u>180?u+=360:u-h>180&&(h+=360),f.push({i:d.push(i(d)+"rotate(",null,n)-2,x:Nn(h,u)})):u&&d.push(i(d)+"rotate("+u+n)}function a(h,u,d,f){h!==u?f.push({i:d.push(i(d)+"skewX(",null,n)-2,x:Nn(h,u)}):u&&d.push(i(d)+"skewX("+u+n)}function l(h,u,d,f,p,m){if(h!==d||u!==f){var x=p.push(i(p)+"scale(",null,",",null,")");m.push({i:x-4,x:Nn(h,d)},{i:x-2,x:Nn(u,f)})}else(d!==1||f!==1)&&p.push(i(p)+"scale("+d+","+f+")")}return function(h,u){var d=[],f=[];return h=t(h),u=t(u),s(h.translateX,h.translateY,u.translateX,u.translateY,d,f),o(h.rotate,u.rotate,d,f),a(h.skewX,u.skewX,d,f),l(h.scaleX,h.scaleY,u.scaleX,u.scaleY,d,f),h=u=null,function(p){for(var m=-1,x=f.length,g;++m<x;)d[(g=f[m]).i]=g.x(p);return d.join("")}}}var BF=_b(jF,"px, ","px)","deg)"),LF=_b(NF,", ",")",")"),ks=0,po=0,Qs=0,Eb=1e3,jl,fo,Nl=0,fi=0,gc=0,$o=typeof performance=="object"&&performance.now?performance:Date,jb=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ap(){return fi||(jb(AF),fi=$o.now()+gc)}function AF(){fi=0}function Bl(){this._call=this._time=this._next=null}Bl.prototype=Nb.prototype={constructor:Bl,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?ap():+r)+(e==null?0:+e),!this._next&&fo!==this&&(fo?fo._next=this:jl=this,fo=this),this._call=t,this._time=r,mu()},stop:function(){this._call&&(this._call=null,this._time=1/0,mu())}};function Nb(t,e,r){var n=new Bl;return n.restart(t,e,r),n}function MF(){ap(),++ks;for(var t=jl,e;t;)(e=fi-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ks}function Um(){fi=(Nl=$o.now())+gc,ks=po=0;try{MF()}finally{ks=0,FF(),fi=0}}function IF(){var t=$o.now(),e=t-Nl;e>Eb&&(gc-=e,Nl=t)}function FF(){for(var t,e=jl,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:jl=r);fo=t,mu(n)}function mu(t){if(!ks){po&&(po=clearTimeout(po));var e=t-fi;e>24?(t<1/0&&(po=setTimeout(Um,t-$o.now()-gc)),Qs&&(Qs=clearInterval(Qs))):(Qs||(Nl=$o.now(),Qs=setInterval(IF,Eb)),ks=1,jb(Um))}}function Ym(t,e,r){var n=new Bl;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var DF=lb("start","end","cancel","interrupt"),PF=[],Bb=0,Gm=1,gu=2,Qa=3,Vm=4,xu=5,Za=6;function xc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;OF(t,r,{name:e,index:n,group:i,on:DF,tween:PF,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Bb})}function lp(t,e){var r=qr(t,e);if(r.state>Bb)throw new Error("too late; already scheduled");return r}function nn(t,e){var r=qr(t,e);if(r.state>Qa)throw new Error("too late; already running");return r}function qr(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function OF(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=Nb(s,0,r.time);function s(h){r.state=Gm,r.timer.restart(o,r.delay,r.time),r.delay<=h&&o(h-r.delay)}function o(h){var u,d,f,p;if(r.state!==Gm)return l();for(u in n)if(p=n[u],p.name===r.name){if(p.state===Qa)return Ym(o);p.state===Vm?(p.state=Za,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete n[u]):+u<e&&(p.state=Za,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete n[u])}if(Ym(function(){r.state===Qa&&(r.state=Vm,r.timer.restart(a,r.delay,r.time),a(h))}),r.state=gu,r.on.call("start",t,t.__data__,r.index,r.group),r.state===gu){for(r.state=Qa,i=new Array(f=r.tween.length),u=0,d=-1;u<f;++u)(p=r.tween[u].value.call(t,t.__data__,r.index,r.group))&&(i[++d]=p);i.length=d+1}}function a(h){for(var u=h<r.duration?r.ease.call(null,h/r.duration):(r.timer.restart(l),r.state=xu,1),d=-1,f=i.length;++d<f;)i[d].call(t,u);r.state===xu&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=Za,r.timer.stop(),delete n[e];for(var h in n)return;delete t.__transition}}function $F(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>gu&&n.state<xu,n.state=Za,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function RF(t){return this.each(function(){$F(this,t)})}function zF(t,e){var r,n;return function(){var i=nn(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 WF(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var s=nn(this,t),o=s.tween;if(o!==n){i=(n=o).slice();for(var a={name:e,value:r},l=0,h=i.length;l<h;++l)if(i[l].name===e){i[l]=a;break}l===h&&i.push(a)}s.tween=i}}function qF(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=qr(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?zF:WF)(r,t,e))}function cp(t,e,r){var n=t._id;return t.each(function(){var i=nn(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return qr(i,n).value[e]}}function Lb(t,e){var r;return(typeof e=="number"?Nn:e instanceof Oo?qm:(r=Oo(e))?(e=r,qm):EF)(t,e)}function HF(t){return function(){this.removeAttribute(t)}}function UF(t){return function(){this.removeAttributeNS(t.space,t.local)}}function YF(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 GF(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 VF(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 XF(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 KF(t,e){var r=mc(t),n=r==="transform"?LF:Lb;return this.attrTween(t,typeof e=="function"?(r.local?XF:VF)(r,n,cp(this,"attr."+t,e)):e==null?(r.local?UF:HF)(r):(r.local?GF:YF)(r,n,e))}function QF(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function ZF(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function JF(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&ZF(t,s)),r}return i._value=e,i}function t4(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&QF(t,s)),r}return i._value=e,i}function e4(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=mc(t);return this.tween(r,(n.local?JF:t4)(n,e))}function r4(t,e){return function(){lp(this,t).delay=+e.apply(this,arguments)}}function n4(t,e){return e=+e,function(){lp(this,t).delay=e}}function i4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?r4:n4)(e,t)):qr(this.node(),e).delay}function s4(t,e){return function(){nn(this,t).duration=+e.apply(this,arguments)}}function o4(t,e){return e=+e,function(){nn(this,t).duration=e}}function a4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?s4:o4)(e,t)):qr(this.node(),e).duration}function l4(t,e){if(typeof e!="function")throw new Error;return function(){nn(this,t).ease=e}}function c4(t){var e=this._id;return arguments.length?this.each(l4(e,t)):qr(this.node(),e).ease}function h4(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;nn(this,t).ease=r}}function u4(t){if(typeof t!="function")throw new Error;return this.each(h4(this._id,t))}function d4(t){typeof t!="function"&&(t=ub(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,h=0;h<o;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&a.push(l);return new fn(n,this._parents,this._name,this._id)}function p4(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],h=r[a],u=l.length,d=o[a]=new Array(u),f,p=0;p<u;++p)(f=l[p]||h[p])&&(d[p]=f);for(;a<n;++a)o[a]=e[a];return new fn(o,this._parents,this._name,this._id)}function f4(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 m4(t,e,r){var n,i,s=f4(e)?lp:nn;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function g4(t,e){var r=this._id;return arguments.length<2?qr(this.node(),r).on.on(t):this.each(m4(r,t,e))}function x4(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function y4(){return this.on("end.remove",x4(this._id))}function b4(t){var e=this._name,r=this._id;typeof t!="function"&&(t=np(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,h=s[o]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=t.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),h[f]=d,xc(h[f],e,r,f,h,qr(u,r)));return new fn(s,this._parents,e,r)}function C4(t){var e=this._name,r=this._id;typeof t!="function"&&(t=hb(t));for(var n=this._groups,i=n.length,s=[],o=[],a=0;a<i;++a)for(var l=n[a],h=l.length,u,d=0;d<h;++d)if(u=l[d]){for(var f=t.call(u,u.__data__,d,l),p,m=qr(u,r),x=0,g=f.length;x<g;++x)(p=f[x])&&xc(p,e,r,x,f,m);s.push(f),o.push(u)}return new fn(s,o,e,r)}var k4=na.prototype.constructor;function v4(){return new k4(this._groups,this._parents)}function w4(t,e){var r,n,i;return function(){var s=Cs(this,t),o=(this.style.removeProperty(t),Cs(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function Ab(t){return function(){this.style.removeProperty(t)}}function S4(t,e,r){var n,i=r+"",s;return function(){var o=Cs(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function T4(t,e,r){var n,i,s;return function(){var o=Cs(this,t),a=r(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),Cs(this,t))),o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a))}}function _4(t,e){var r,n,i,s="style."+e,o="end."+s,a;return function(){var l=nn(this,t),h=l.on,u=l.value[s]==null?a||(a=Ab(e)):void 0;(h!==r||i!==u)&&(n=(r=h).copy()).on(o,i=u),l.on=n}}function E4(t,e,r){var n=(t+="")=="transform"?BF:Lb;return e==null?this.styleTween(t,w4(t,n)).on("end.style."+t,Ab(t)):typeof e=="function"?this.styleTween(t,T4(t,n,cp(this,"style."+t,e))).each(_4(this._id,t)):this.styleTween(t,S4(t,n,e),r).on("end.style."+t,null)}function j4(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function N4(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&j4(t,o,r)),n}return s._value=e,s}function B4(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,N4(t,e,r??""))}function L4(t){return function(){this.textContent=t}}function A4(t){return function(){var e=t(this);this.textContent=e??""}}function M4(t){return this.tween("text",typeof t=="function"?A4(cp(this,"text",t)):L4(t==null?"":t+""))}function I4(t){return function(e){this.textContent=t.call(this,e)}}function F4(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&I4(i)),e}return n._value=t,n}function D4(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,F4(t))}function P4(){for(var t=this._name,e=this._id,r=Mb(),n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,l,h=0;h<a;++h)if(l=o[h]){var u=qr(l,e);xc(l,t,r,h,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new fn(n,this._parents,t,r)}function O4(){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 h=nn(this,n),u=h.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),h.on=e}),i===0&&s()})}var $4=0;function fn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function Mb(){return++$4}var ln=na.prototype;fn.prototype={constructor:fn,select:b4,selectAll:C4,selectChild:ln.selectChild,selectChildren:ln.selectChildren,filter:d4,merge:p4,selection:v4,transition:P4,call:ln.call,nodes:ln.nodes,node:ln.node,size:ln.size,empty:ln.empty,each:ln.each,on:g4,attr:KF,attrTween:e4,style:E4,styleTween:B4,text:M4,textTween:D4,remove:y4,tween:qF,delay:i4,duration:a4,ease:c4,easeVarying:u4,end:O4,[Symbol.iterator]:ln[Symbol.iterator]};function R4(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var z4={time:null,delay:0,duration:250,ease:R4};function W4(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 q4(t){var e,r;t instanceof fn?(e=t._id,t=t._name):(e=Mb(),(r=z4).time=ap(),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,h=0;h<a;++h)(l=o[h])&&xc(l,t,e,h,o,r||W4(l,e));return new fn(n,this._parents,t,e)}na.prototype.interrupt=RF;na.prototype.transition=q4;const yu=Math.PI,bu=2*yu,Zn=1e-6,H4=bu-Zn;function Ib(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function U4(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Ib;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 Y4{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Ib:U4(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,h=i-r,u=o-e,d=a-r,f=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(f>Zn)if(!(Math.abs(d*l-h*u)>Zn)||!s)this._append`L${this._x1=e},${this._y1=r}`;else{let p=n-o,m=i-a,x=l*l+h*h,g=p*p+m*m,y=Math.sqrt(x),C=Math.sqrt(f),b=s*Math.tan((yu-Math.acos((x+f-g)/(2*y*C)))/2),S=b/C,_=b/y;Math.abs(S-1)>Zn&&this._append`L${e+S*u},${r+S*d}`,this._append`A${s},${s},0,0,${+(d*p>u*m)},${this._x1=e+_*l},${this._y1=r+_*h}`}}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),h=e+a,u=r+l,d=1^o,f=o?i-s:s-i;this._x1===null?this._append`M${h},${u}`:(Math.abs(this._x1-h)>Zn||Math.abs(this._y1-u)>Zn)&&this._append`L${h},${u}`,n&&(f<0&&(f=f%bu+bu),f>H4?this._append`A${n},${n},0,1,${d},${e-a},${r-l}A${n},${n},0,1,${d},${this._x1=h},${this._y1=u}`:f>Zn&&this._append`A${n},${n},0,${+(f>=yu)},${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 Mi(t){return function(){return t}}const aY=Math.abs,lY=Math.atan2,cY=Math.cos,hY=Math.max,uY=Math.min,dY=Math.sin,pY=Math.sqrt,Xm=1e-12,hp=Math.PI,Km=hp/2,fY=2*hp;function mY(t){return t>1?0:t<-1?hp:Math.acos(t)}function gY(t){return t>=1?Km:t<=-1?-Km:Math.asin(t)}function G4(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 Y4(e)}function V4(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Fb(t){this._context=t}Fb.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 Eo(t){return new Fb(t)}function X4(t){return t[0]}function K4(t){return t[1]}function Q4(t,e){var r=Mi(!0),n=null,i=Eo,s=null,o=G4(a);t=typeof t=="function"?t:t===void 0?X4:Mi(t),e=typeof e=="function"?e:e===void 0?K4:Mi(e);function a(l){var h,u=(l=V4(l)).length,d,f=!1,p;for(n==null&&(s=i(p=o())),h=0;h<=u;++h)!(h<u&&r(d=l[h],h,l))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+t(d,h,l),+e(d,h,l));if(p)return s=null,p+""||null}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:Mi(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Mi(+l),a):e},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Mi(!!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 Db{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 Pb(t){return new Db(t,!0)}function Ob(t){return new Db(t,!1)}function Pn(){}function Ll(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 yc(t){this._context=t}yc.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:Ll(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:Ll(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Cu(t){return new yc(t)}function $b(t){this._context=t}$b.prototype={areaStart:Pn,areaEnd:Pn,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:Ll(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Z4(t){return new $b(t)}function Rb(t){this._context=t}Rb.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:Ll(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function J4(t){return new Rb(t)}function zb(t,e){this._basis=new yc(t),this._beta=e}zb.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 tD=(function t(e){function r(n){return e===1?new yc(n):new zb(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function Al(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 up(t,e){this._context=t,this._k=(1-e)/6}up.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:Al(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:Al(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 Wb=(function t(e){function r(n){return new up(n,e)}return r.tension=function(n){return t(+n)},r})(0);function dp(t,e){this._context=t,this._k=(1-e)/6}dp.prototype={areaStart:Pn,areaEnd:Pn,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:Al(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 eD=(function t(e){function r(n){return new dp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function pp(t,e){this._context=t,this._k=(1-e)/6}pp.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:Al(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 rD=(function t(e){function r(n){return new pp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function fp(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>Xm){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>Xm){var h=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*h+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*h+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,s,o,t._x2,t._y2)}function qb(t,e){this._context=t,this._alpha=e}qb.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:fp(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 Hb=(function t(e){function r(n){return e?new qb(n,e):new up(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function Ub(t,e){this._context=t,this._alpha=e}Ub.prototype={areaStart:Pn,areaEnd:Pn,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:fp(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 nD=(function t(e){function r(n){return e?new Ub(n,e):new dp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function Yb(t,e){this._context=t,this._alpha=e}Yb.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:fp(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 iD=(function t(e){function r(n){return e?new Yb(n,e):new pp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function Gb(t){this._context=t}Gb.prototype={areaStart:Pn,areaEnd:Pn,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 sD(t){return new Gb(t)}function Qm(t){return t<0?-1:1}function Zm(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(Qm(s)+Qm(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function Jm(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function yh(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 Ml(t){this._context=t}Ml.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:yh(this,this._t0,Jm(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,yh(this,Jm(this,r=Zm(this,t,e)),r);break;default:yh(this,this._t0,r=Zm(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function Vb(t){this._context=new Xb(t)}(Vb.prototype=Object.create(Ml.prototype)).point=function(t,e){Ml.prototype.point.call(this,e,t)};function Xb(t){this._context=t}Xb.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 Kb(t){return new Ml(t)}function Qb(t){return new Vb(t)}function Zb(t){this._context=t}Zb.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=tg(t),i=tg(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 tg(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 Jb(t){return new Zb(t)}function bc(t,e){this._context=t,this._t=e}bc.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 t1(t){return new bc(t,.5)}function e1(t){return new bc(t,0)}function r1(t){return new bc(t,1)}function mo(t,e,r){this.k=t,this.x=e,this.y=r}mo.prototype={constructor:mo,scale:function(t){return t===1?this:new mo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new mo(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+")"}};mo.prototype;var oD=k(t=>{var i;const{securityLevel:e}=Jt();let r=Ut("body");if(e==="sandbox"){const o=((i=Ut(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=Ut(o.body)}return r.select(`#${t}`)},"selectSvgElement");function mp(t){return typeof t>"u"||t===null}k(mp,"isNothing");function n1(t){return typeof t=="object"&&t!==null}k(n1,"isObject");function i1(t){return Array.isArray(t)?t:mp(t)?[]:[t]}k(i1,"toArray");function s1(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}k(s1,"extend");function o1(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}k(o1,"repeat");function a1(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}k(a1,"isNegativeZero");var aD=mp,lD=n1,cD=i1,hD=o1,uD=a1,dD=s1,Ae={isNothing:aD,isObject:lD,toArray:cD,repeat:hD,isNegativeZero:uD,extend:dD};function gp(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+=`
425
-
426
- `+t.mark.snippet),n+" "+r):n}k(gp,"formatError");function vs(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=gp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}k(vs,"YAMLException$1");vs.prototype=Object.create(Error.prototype);vs.prototype.constructor=vs;vs.prototype.toString=k(function(e){return this.name+": "+gp(this,e)},"toString");var ur=vs;function Ja(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}}k(Ja,"getLine");function tl(t,e){return Ae.repeat(" ",e-t.length)+t}k(tl,"padStart");function l1(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,h,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++)h=Ja(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Ae.repeat(" ",e.indent)+tl((t.line-l+1).toString(),u)+" | "+h.str+`
427
- `+a;for(h=Ja(t.buffer,n[o],i[o],t.position,d),a+=Ae.repeat(" ",e.indent)+tl((t.line+1).toString(),u)+" | "+h.str+`
428
- `,a+=Ae.repeat("-",e.indent+u+3+h.pos)+`^
429
- `,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)h=Ja(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Ae.repeat(" ",e.indent)+tl((t.line+l+1).toString(),u)+" | "+h.str+`
430
- `;return a.replace(/\n$/,"")}k(l1,"makeSnippet");var pD=l1,fD=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],mD=["scalar","sequence","mapping"];function c1(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}k(c1,"compileStyleAliases");function h1(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(fD.indexOf(r)===-1)throw new ur('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=c1(e.styleAliases||null),mD.indexOf(this.kind)===-1)throw new ur('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}k(h1,"Type$1");var Ve=h1;function ku(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}k(ku,"compileList");function u1(){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(k(n,"collectType"),e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(n);return t}k(u1,"compileMap");function Il(t){return this.extend(t)}k(Il,"Schema$1");Il.prototype.extend=k(function(e){var r=[],n=[];if(e instanceof Ve)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 ur("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ve))throw new ur("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new ur("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 ur("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 Ve))throw new ur("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Il.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=ku(i,"implicit"),i.compiledExplicit=ku(i,"explicit"),i.compiledTypeMap=u1(i.compiledImplicit,i.compiledExplicit),i},"extend");var gD=Il,xD=new Ve("tag:yaml.org,2002:str",{kind:"scalar",construct:k(function(t){return t!==null?t:""},"construct")}),yD=new Ve("tag:yaml.org,2002:seq",{kind:"sequence",construct:k(function(t){return t!==null?t:[]},"construct")}),bD=new Ve("tag:yaml.org,2002:map",{kind:"mapping",construct:k(function(t){return t!==null?t:{}},"construct")}),CD=new gD({explicit:[xD,yD,bD]});function d1(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}k(d1,"resolveYamlNull");function p1(){return null}k(p1,"constructYamlNull");function f1(t){return t===null}k(f1,"isNull");var kD=new Ve("tag:yaml.org,2002:null",{kind:"scalar",resolve:d1,construct:p1,predicate:f1,represent:{canonical:k(function(){return"~"},"canonical"),lowercase:k(function(){return"null"},"lowercase"),uppercase:k(function(){return"NULL"},"uppercase"),camelcase:k(function(){return"Null"},"camelcase"),empty:k(function(){return""},"empty")},defaultStyle:"lowercase"});function m1(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")}k(m1,"resolveYamlBoolean");function g1(t){return t==="true"||t==="True"||t==="TRUE"}k(g1,"constructYamlBoolean");function x1(t){return Object.prototype.toString.call(t)==="[object Boolean]"}k(x1,"isBoolean");var vD=new Ve("tag:yaml.org,2002:bool",{kind:"scalar",resolve:m1,construct:g1,predicate:x1,represent:{lowercase:k(function(t){return t?"true":"false"},"lowercase"),uppercase:k(function(t){return t?"TRUE":"FALSE"},"uppercase"),camelcase:k(function(t){return t?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function y1(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}k(y1,"isHexCode");function b1(t){return 48<=t&&t<=55}k(b1,"isOctCode");function C1(t){return 48<=t&&t<=57}k(C1,"isDecCode");function k1(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(!y1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!b1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!C1(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}k(k1,"resolveYamlInteger");function v1(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)}k(v1,"constructYamlInteger");function w1(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Ae.isNegativeZero(t)}k(w1,"isInteger");var wD=new Ve("tag:yaml.org,2002:int",{kind:"scalar",resolve:k1,construct:v1,predicate:w1,represent:{binary:k(function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},"binary"),octal:k(function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},"octal"),decimal:k(function(t){return t.toString(10)},"decimal"),hexadecimal:k(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"]}}),SD=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function S1(t){return!(t===null||!SD.test(t)||t[t.length-1]==="_")}k(S1,"resolveYamlFloat");function T1(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)}k(T1,"constructYamlFloat");var TD=/^[-+]?[0-9]+e/;function _1(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(Ae.isNegativeZero(t))return"-0.0";return r=t.toString(10),TD.test(r)?r.replace("e",".e"):r}k(_1,"representYamlFloat");function E1(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Ae.isNegativeZero(t))}k(E1,"isFloat");var _D=new Ve("tag:yaml.org,2002:float",{kind:"scalar",resolve:S1,construct:T1,predicate:E1,represent:_1,defaultStyle:"lowercase"}),j1=CD.extend({implicit:[kD,vD,wD,_D]}),ED=j1,N1=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),B1=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 L1(t){return t===null?!1:N1.exec(t)!==null||B1.exec(t)!==null}k(L1,"resolveYamlTimestamp");function A1(t){var e,r,n,i,s,o,a,l=0,h=null,u,d,f;if(e=N1.exec(t),e===null&&(e=B1.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),h=(u*60+d)*6e4,e[9]==="-"&&(h=-h)),f=new Date(Date.UTC(r,n,i,s,o,a,l)),h&&f.setTime(f.getTime()-h),f}k(A1,"constructYamlTimestamp");function M1(t){return t.toISOString()}k(M1,"representYamlTimestamp");var jD=new Ve("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:L1,construct:A1,instanceOf:Date,represent:M1});function I1(t){return t==="<<"||t===null}k(I1,"resolveYamlMerge");var ND=new Ve("tag:yaml.org,2002:merge",{kind:"scalar",resolve:I1}),xp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
431
- \r`;function F1(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=xp;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}k(F1,"resolveYamlBinary");function D1(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=xp,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)}k(D1,"constructYamlBinary");function P1(t){var e="",r=0,n,i,s=t.length,o=xp;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}k(P1,"representYamlBinary");function O1(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}k(O1,"isBinary");var BD=new Ve("tag:yaml.org,2002:binary",{kind:"scalar",resolve:F1,construct:D1,predicate:O1,represent:P1}),LD=Object.prototype.hasOwnProperty,AD=Object.prototype.toString;function $1(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,AD.call(i)!=="[object Object]")return!1;for(s in i)if(LD.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}k($1,"resolveYamlOmap");function R1(t){return t!==null?t:[]}k(R1,"constructYamlOmap");var MD=new Ve("tag:yaml.org,2002:omap",{kind:"sequence",resolve:$1,construct:R1}),ID=Object.prototype.toString;function z1(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],ID.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}k(z1,"resolveYamlPairs");function W1(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}k(W1,"constructYamlPairs");var FD=new Ve("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:z1,construct:W1}),DD=Object.prototype.hasOwnProperty;function q1(t){if(t===null)return!0;var e,r=t;for(e in r)if(DD.call(r,e)&&r[e]!==null)return!1;return!0}k(q1,"resolveYamlSet");function H1(t){return t!==null?t:{}}k(H1,"constructYamlSet");var PD=new Ve("tag:yaml.org,2002:set",{kind:"mapping",resolve:q1,construct:H1}),U1=ED.extend({implicit:[jD,ND],explicit:[BD,MD,FD,PD]}),On=Object.prototype.hasOwnProperty,Fl=1,Y1=2,G1=3,Dl=4,bh=1,OD=2,eg=3,$D=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,RD=/[\x85\u2028\u2029]/,zD=/[,\[\]\{\}]/,V1=/^(?:!|!!|![a-z\-]+!)$/i,X1=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function vu(t){return Object.prototype.toString.call(t)}k(vu,"_class");function $r(t){return t===10||t===13}k($r,"is_EOL");function Mn(t){return t===9||t===32}k(Mn,"is_WHITE_SPACE");function rr(t){return t===9||t===32||t===10||t===13}k(rr,"is_WS_OR_EOL");function ii(t){return t===44||t===91||t===93||t===123||t===125}k(ii,"is_FLOW_INDICATOR");function K1(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}k(K1,"fromHexCode");function Q1(t){return t===120?2:t===117?4:t===85?8:0}k(Q1,"escapedHexLen");function Z1(t){return 48<=t&&t<=57?t-48:-1}k(Z1,"fromDecimalCode");function wu(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
432
- `: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":""}k(wu,"simpleEscapeSequence");function J1(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}k(J1,"charFromCodepoint");function yp(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}k(yp,"setProperty");var tC=new Array(256),eC=new Array(256);for(Kn=0;Kn<256;Kn++)tC[Kn]=wu(Kn)?1:0,eC[Kn]=wu(Kn);var Kn;function rC(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||U1,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=[]}k(rC,"State$1");function bp(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=pD(r),new ur(e,r)}k(bp,"generateError");function St(t,e){throw bp(t,e)}k(St,"throwError");function Ro(t,e){t.onWarning&&t.onWarning.call(null,bp(t,e))}k(Ro,"throwWarning");var rg={YAML:k(function(e,r,n){var i,s,o;e.version!==null&&St(e,"duplication of %YAML directive"),n.length!==1&&St(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&St(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&St(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Ro(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:k(function(e,r,n){var i,s;n.length!==2&&St(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],V1.test(i)||St(e,"ill-formed tag handle (first argument) of the TAG directive"),On.call(e.tagMap,i)&&St(e,'there is a previously declared suffix for "'+i+'" tag handle'),X1.test(s)||St(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{St(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function dn(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||St(t,"expected valid JSON character");else $D.test(a)&&St(t,"the stream contains non-printable characters");t.result+=a}}k(dn,"captureSegment");function Su(t,e,r,n){var i,s,o,a;for(Ae.isObject(r)||St(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],On.call(e,s)||(yp(e,s,r[s]),n[s]=!0)}k(Su,"mergeMappings");function si(t,e,r,n,i,s,o,a,l){var h,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),h=0,u=i.length;h<u;h+=1)Array.isArray(i[h])&&St(t,"nested arrays are not supported inside keys"),typeof i=="object"&&vu(i[h])==="[object Object]"&&(i[h]="[object Object]");if(typeof i=="object"&&vu(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(h=0,u=s.length;h<u;h+=1)Su(t,e,s[h],r);else Su(t,e,s,r);else!t.json&&!On.call(r,i)&&On.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,St(t,"duplicated mapping key")),yp(e,i,s),delete r[i];return e}k(si,"storeMappingPair");function Cc(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++):St(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}k(Cc,"readLineBreak");function Se(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;Mn(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($r(i))for(Cc(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&&Ro(t,"deficient indentation"),n}k(Se,"skipSeparationSpace");function sa(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||rr(r)))}k(sa,"testDocumentSeparator");function kc(t,e){e===1?t.result+=" ":e>1&&(t.result+=Ae.repeat(`
433
- `,e-1))}k(kc,"writeFoldedLines");function nC(t,e,r){var n,i,s,o,a,l,h,u,d=t.kind,f=t.result,p;if(p=t.input.charCodeAt(t.position),rr(p)||ii(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=t.input.charCodeAt(t.position+1),rr(i)||r&&ii(i)))return!1;for(t.kind="scalar",t.result="",s=o=t.position,a=!1;p!==0;){if(p===58){if(i=t.input.charCodeAt(t.position+1),rr(i)||r&&ii(i))break}else if(p===35){if(n=t.input.charCodeAt(t.position-1),rr(n))break}else{if(t.position===t.lineStart&&sa(t)||r&&ii(p))break;if($r(p))if(l=t.line,h=t.lineStart,u=t.lineIndent,Se(t,!1,-1),t.lineIndent>=e){a=!0,p=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=l,t.lineStart=h,t.lineIndent=u;break}}a&&(dn(t,s,o,!1),kc(t,t.line-l),s=o=t.position,a=!1),Mn(p)||(o=t.position+1),p=t.input.charCodeAt(++t.position)}return dn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=f,!1)}k(nC,"readPlainScalar");function iC(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(dn(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 $r(r)?(dn(t,n,i,!0),kc(t,Se(t,!1,e)),n=i=t.position):t.position===t.lineStart&&sa(t)?St(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);St(t,"unexpected end of the stream within a single quoted scalar")}k(iC,"readSingleQuotedScalar");function sC(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 dn(t,r,t.position,!0),t.position++,!0;if(a===92){if(dn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),$r(a))Se(t,!1,e);else if(a<256&&tC[a])t.result+=eC[a],t.position++;else if((o=Q1(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=K1(a))>=0?s=(s<<4)+o:St(t,"expected hexadecimal character");t.result+=J1(s),t.position++}else St(t,"unknown escape sequence");r=n=t.position}else $r(a)?(dn(t,r,n,!0),kc(t,Se(t,!1,e)),r=n=t.position):t.position===t.lineStart&&sa(t)?St(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}St(t,"unexpected end of the stream within a double quoted scalar")}k(sC,"readDoubleQuotedScalar");function oC(t,e){var r=!0,n,i,s,o=t.tag,a,l=t.anchor,h,u,d,f,p,m=Object.create(null),x,g,y,C;if(C=t.input.charCodeAt(t.position),C===91)u=93,p=!1,a=[];else if(C===123)u=125,p=!0,a={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),C=t.input.charCodeAt(++t.position);C!==0;){if(Se(t,!0,e),C=t.input.charCodeAt(t.position),C===u)return t.position++,t.tag=o,t.anchor=l,t.kind=p?"mapping":"sequence",t.result=a,!0;r?C===44&&St(t,"expected the node content, but found ','"):St(t,"missed comma between flow collection entries"),g=x=y=null,d=f=!1,C===63&&(h=t.input.charCodeAt(t.position+1),rr(h)&&(d=f=!0,t.position++,Se(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,mi(t,e,Fl,!1,!0),g=t.tag,x=t.result,Se(t,!0,e),C=t.input.charCodeAt(t.position),(f||t.line===n)&&C===58&&(d=!0,C=t.input.charCodeAt(++t.position),Se(t,!0,e),mi(t,e,Fl,!1,!0),y=t.result),p?si(t,a,m,g,x,y,n,i,s):d?a.push(si(t,null,m,g,x,y,n,i,s)):a.push(x),Se(t,!0,e),C=t.input.charCodeAt(t.position),C===44?(r=!0,C=t.input.charCodeAt(++t.position)):r=!1}St(t,"unexpected end of the stream within a flow collection")}k(oC,"readFlowCollection");function aC(t,e){var r,n,i=bh,s=!1,o=!1,a=e,l=0,h=!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)bh===i?i=d===43?eg:OD:St(t,"repeat of a chomping mode identifier");else if((u=Z1(d))>=0)u===0?St(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?St(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(Mn(d)){do d=t.input.charCodeAt(++t.position);while(Mn(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!$r(d)&&d!==0)}for(;d!==0;){for(Cc(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),$r(d)){l++;continue}if(t.lineIndent<a){i===eg?t.result+=Ae.repeat(`
434
- `,s?1+l:l):i===bh&&s&&(t.result+=`
435
- `);break}for(n?Mn(d)?(h=!0,t.result+=Ae.repeat(`
436
- `,s?1+l:l)):h?(h=!1,t.result+=Ae.repeat(`
437
- `,l+1)):l===0?s&&(t.result+=" "):t.result+=Ae.repeat(`
438
- `,l):t.result+=Ae.repeat(`
439
- `,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!$r(d)&&d!==0;)d=t.input.charCodeAt(++t.position);dn(t,r,t.position,!1)}return!0}k(aC,"readBlockScalar");function Tu(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,St(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!rr(o))));){if(a=!0,t.position++,Se(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,mi(t,e,G1,!1,!0),s.push(t.result),Se(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)St(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}k(Tu,"readBlockSequence");function lC(t,e,r){var n,i,s,o,a,l,h=t.tag,u=t.anchor,d={},f=Object.create(null),p=null,m=null,x=null,g=!1,y=!1,C;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=d),C=t.input.charCodeAt(t.position);C!==0;){if(!g&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,St(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(C===63||C===58)&&rr(n))C===63?(g&&(si(t,d,f,p,m,null,o,a,l),p=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):St(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,C=n;else{if(o=t.line,a=t.lineStart,l=t.position,!mi(t,r,Y1,!1,!0))break;if(t.line===s){for(C=t.input.charCodeAt(t.position);Mn(C);)C=t.input.charCodeAt(++t.position);if(C===58)C=t.input.charCodeAt(++t.position),rr(C)||St(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(si(t,d,f,p,m,null,o,a,l),p=m=x=null),y=!0,g=!1,i=!1,p=t.tag,m=t.result;else if(y)St(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=h,t.anchor=u,!0}else if(y)St(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=h,t.anchor=u,!0}if((t.line===s||t.lineIndent>e)&&(g&&(o=t.line,a=t.lineStart,l=t.position),mi(t,e,Dl,!0,i)&&(g?m=t.result:x=t.result),g||(si(t,d,f,p,m,x,o,a,l),p=m=x=null),Se(t,!0,-1),C=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&C!==0)St(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&si(t,d,f,p,m,null,o,a,l),y&&(t.tag=h,t.anchor=u,t.kind="mapping",t.result=d),y}k(lC,"readBlockMapping");function cC(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&&St(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)):St(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!rr(o);)o===33&&(n?St(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),V1.test(i)||St(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),zD.test(s)&&St(t,"tag suffix cannot contain flow indicator characters")}s&&!X1.test(s)&&St(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{St(t,"tag name is malformed: "+s)}return r?t.tag=s:On.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:St(t,'undeclared tag handle "'+i+'"'),!0}k(cC,"readTagProperty");function hC(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&St(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!rr(r)&&!ii(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&St(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}k(hC,"readAnchorProperty");function uC(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&&!rr(n)&&!ii(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&St(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),On.call(t.anchorMap,r)||St(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],Se(t,!0,-1),!0}k(uC,"readAlias");function mi(t,e,r,n,i){var s,o,a,l=1,h=!1,u=!1,d,f,p,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=Dl===r||G1===r,n&&Se(t,!0,-1)&&(h=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;cC(t)||hC(t);)Se(t,!0,-1)?(h=!0,a=s,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=h||i),(l===1||Dl===r)&&(Fl===r||Y1===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&(Tu(t,g)||lC(t,g,x))||oC(t,x)?u=!0:(o&&aC(t,x)||iC(t,x)||sC(t,x)?u=!0:uC(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&St(t,"alias node should not have any properties")):nC(t,x,Fl===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&Tu(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"&&St(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,f=t.implicitTypes.length;d<f;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(On.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,p=t.typeMap.multi[t.kind||"fallback"],d=0,f=p.length;d<f;d+=1)if(t.tag.slice(0,p[d].tag.length)===p[d].tag){m=p[d];break}m||St(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&St(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)):St(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}k(mi,"composeNode");function dC(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&&(Se(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&&!rr(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&St(t,"directive name must not be less than one character in length");o!==0;){for(;Mn(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!$r(o));break}if($r(o))break;for(r=t.position;o!==0&&!rr(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&Cc(t),On.call(rg,n)?rg[n](t,n,i):Ro(t,'unknown document directive "'+n+'"')}if(Se(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,Se(t,!0,-1)):s&&St(t,"directives end mark is expected"),mi(t,t.lineIndent-1,Dl,!1,!0),Se(t,!0,-1),t.checkLineBreaks&&RD.test(t.input.slice(e,t.position))&&Ro(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&sa(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,Se(t,!0,-1));return}if(t.position<t.length-1)St(t,"end of the stream or a document separator is expected");else return}k(dC,"readDocument");function Cp(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
440
- `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new rC(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,St(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;)dC(r);return r.documents}k(Cp,"loadDocuments");function WD(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=Cp(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}k(WD,"loadAll$1");function pC(t,e){var r=Cp(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new ur("expected a single document in the stream, but found more")}}k(pC,"load$1");var qD=pC,HD={load:qD},fC=Object.prototype.toString,mC=Object.prototype.hasOwnProperty,kp=65279,UD=9,zo=10,YD=13,GD=32,VD=33,XD=34,_u=35,KD=37,QD=38,ZD=39,JD=42,gC=44,tP=45,Pl=58,eP=61,rP=62,nP=63,iP=64,xC=91,yC=93,sP=96,bC=123,oP=124,CC=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 aP=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],lP=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function kC(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&&mC.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}k(kC,"compileStyleMap");function vC(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 ur("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Ae.repeat("0",n-e.length)+e}k(vC,"encodeHex");var cP=1,Wo=2;function wC(t){this.schema=t.schema||U1,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Ae.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=kC(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==='"'?Wo:cP,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}k(wC,"State");function Eu(t,e){for(var r=Ae.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
441
- `,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
442
- `&&(s+=r),s+=o;return s}k(Eu,"indentString");function Ol(t,e){return`
443
- `+Ae.repeat(" ",t.indent*e)}k(Ol,"generateNextLine");function SC(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}k(SC,"testImplicitResolving");function qo(t){return t===GD||t===UD}k(qo,"isWhitespace");function ws(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==kp||65536<=t&&t<=1114111}k(ws,"isPrintable");function ju(t){return ws(t)&&t!==kp&&t!==YD&&t!==zo}k(ju,"isNsCharOrWhitespace");function Nu(t,e,r){var n=ju(t),i=n&&!qo(t);return(r?n:n&&t!==gC&&t!==xC&&t!==yC&&t!==bC&&t!==CC)&&t!==_u&&!(e===Pl&&!i)||ju(e)&&!qo(e)&&t===_u||e===Pl&&i}k(Nu,"isPlainSafe");function TC(t){return ws(t)&&t!==kp&&!qo(t)&&t!==tP&&t!==nP&&t!==Pl&&t!==gC&&t!==xC&&t!==yC&&t!==bC&&t!==CC&&t!==_u&&t!==QD&&t!==JD&&t!==VD&&t!==oP&&t!==eP&&t!==rP&&t!==ZD&&t!==XD&&t!==KD&&t!==iP&&t!==sP}k(TC,"isPlainSafeFirst");function _C(t){return!qo(t)&&t!==Pl}k(_C,"isPlainSafeLast");function Ui(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}k(Ui,"codePointAt");function vp(t){var e=/^\n* /;return e.test(t)}k(vp,"needIndentIndicator");var EC=1,Bu=2,jC=3,NC=4,Wi=5;function BC(t,e,r,n,i,s,o,a){var l,h=0,u=null,d=!1,f=!1,p=n!==-1,m=-1,x=TC(Ui(t,0))&&_C(Ui(t,t.length-1));if(e||o)for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Ui(t,l),!ws(h))return Wi;x=x&&Nu(h,u,a),u=h}else{for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Ui(t,l),h===zo)d=!0,p&&(f=f||l-m-1>n&&t[m+1]!==" ",m=l);else if(!ws(h))return Wi;x=x&&Nu(h,u,a),u=h}f=f||p&&l-m-1>n&&t[m+1]!==" "}return!d&&!f?x&&!o&&!i(t)?EC:s===Wo?Wi:Bu:r>9&&vp(t)?Wi:o?s===Wo?Wi:Bu:f?NC:jC}k(BC,"chooseScalarStyle");function LC(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===Wo?'""':"''";if(!t.noCompatMode&&(aP.indexOf(e)!==-1||lP.test(e)))return t.quotingType===Wo?'"'+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(h){return SC(t,h)}switch(k(l,"testAmbiguity"),BC(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case EC:return e;case Bu:return"'"+e.replace(/'/g,"''")+"'";case jC:return"|"+Lu(e,t.indent)+Au(Eu(e,s));case NC:return">"+Lu(e,t.indent)+Au(Eu(AC(e,o),s));case Wi:return'"'+MC(e)+'"';default:throw new ur("impossible error: invalid scalar style")}})()}k(LC,"writeScalar");function Lu(t,e){var r=vp(t)?String(e):"",n=t[t.length-1]===`
444
- `,i=n&&(t[t.length-2]===`
445
- `||t===`
446
- `),s=i?"+":n?"":"-";return r+s+`
447
- `}k(Lu,"blockHeader");function Au(t){return t[t.length-1]===`
448
- `?t.slice(0,-1):t}k(Au,"dropEndingNewline");function AC(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var h=t.indexOf(`
449
- `);return h=h!==-1?h:t.length,r.lastIndex=h,Mu(t.slice(0,h),e)})(),i=t[0]===`
450
- `||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
451
- `:"")+Mu(l,e),i=s}return n}k(AC,"foldString");function Mu(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+=`
452
- `+t.slice(i,s),i=s+1),o=a;return l+=`
453
- `,t.length-i>e&&o>i?l+=t.slice(i,o)+`
454
- `+t.slice(o+1):l+=t.slice(i),l.slice(1)}k(Mu,"foldLine");function MC(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=Ui(t,i),n=Ke[r],!n&&ws(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||vC(r);return e}k(MC,"escapeString");function IC(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)),(Zr(t,e,a,!1,!1)||typeof a>"u"&&Zr(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}k(IC,"writeFlowSequence");function Iu(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)),(Zr(t,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&Zr(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Ol(t,e)),t.dump&&zo===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}k(Iu,"writeBlockSequence");function FC(t,e,r){var n="",i=t.tag,s=Object.keys(r),o,a,l,h,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],h=r[l],t.replacer&&(h=t.replacer.call(r,l,h)),Zr(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Zr(t,e,h,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}k(FC,"writeFlowMapping");function DC(t,e,r,n){var i="",s=t.tag,o=Object.keys(r),a,l,h,u,d,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new ur("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!n||i!=="")&&(f+=Ol(t,e)),h=o[a],u=r[h],t.replacer&&(u=t.replacer.call(r,h,u)),Zr(t,e+1,h,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&zo===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,d&&(f+=Ol(t,e)),Zr(t,e+1,u,!0,d)&&(t.dump&&zo===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,i+=f));t.tag=s,t.dump=i||"{}"}k(DC,"writeBlockMapping");function Fu(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,fC.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(mC.call(a.represent,l))n=a.represent[l](e,l);else throw new ur("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}k(Fu,"detectType");function Zr(t,e,r,n,i,s,o){t.tag=null,t.dump=r,Fu(t,r,!1)||Fu(t,r,!0);var a=fC.call(t.dump),l=n,h;n&&(n=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",d,f;if(u&&(d=t.duplicates.indexOf(r),f=d!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(i=!1),f&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(u&&f&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),a==="[object Object]")n&&Object.keys(t.dump).length!==0?(DC(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(FC(t,e,t.dump),f&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?Iu(t,e-1,t.dump,i):Iu(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(IC(t,e,t.dump),f&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&LC(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new ur("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(h=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?h="!"+h:h.slice(0,18)==="tag:yaml.org,2002:"?h="!!"+h.slice(18):h="!<"+h+">",t.dump=h+" "+t.dump)}return!0}k(Zr,"writeNode");function PC(t,e){var r=[],n=[],i,s;for($l(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}k(PC,"getDuplicateReferences");function $l(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)$l(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)$l(t[n[i]],e,r)}k($l,"inspectNode");function hP(t,e){e=e||{};var r=new wC(e);r.noRefs||PC(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Zr(r,0,n,!0,!0)?r.dump+`
455
- `:""}k(hP,"dump$1");function uP(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.")}}k(uP,"renamed");var dP=j1,pP=HD.load;/*! Bundled license information:
456
-
457
- js-yaml/dist/js-yaml.mjs:
458
- (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
459
- */var Zs=k((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},ng={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function go(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=pe(t),e=pe(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}}k(go,"calculateDeltaAndAngle");var pe=k(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),fP=k(t=>({x:k(function(e,r,n){let i=0;const s=pe(n[0]).x<pe(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(Ue,t.arrowTypeStart)){const{angle:p,deltaX:m}=go(n[0],n[1]);i=Ue[t.arrowTypeStart]*Math.cos(p)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ue,t.arrowTypeEnd)){const{angle:p,deltaX:m}=go(n[n.length-1],n[n.length-2]);i=Ue[t.arrowTypeEnd]*Math.cos(p)*(m>=0?1:-1)}const o=Math.abs(pe(e).x-pe(n[n.length-1]).x),a=Math.abs(pe(e).y-pe(n[n.length-1]).y),l=Math.abs(pe(e).x-pe(n[0]).x),h=Math.abs(pe(e).y-pe(n[0]).y),u=Ue[t.arrowTypeStart],d=Ue[t.arrowTypeEnd],f=1;if(o<d&&o>0&&a<d){let p=d+f-o;p*=s==="right"?-1:1,i-=p}if(l<u&&l>0&&h<u){let p=u+f-l;p*=s==="right"?-1:1,i+=p}return pe(e).x+i},"x"),y:k(function(e,r,n){let i=0;const s=pe(n[0]).y<pe(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(Ue,t.arrowTypeStart)){const{angle:p,deltaY:m}=go(n[0],n[1]);i=Ue[t.arrowTypeStart]*Math.abs(Math.sin(p))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ue,t.arrowTypeEnd)){const{angle:p,deltaY:m}=go(n[n.length-1],n[n.length-2]);i=Ue[t.arrowTypeEnd]*Math.abs(Math.sin(p))*(m>=0?1:-1)}const o=Math.abs(pe(e).y-pe(n[n.length-1]).y),a=Math.abs(pe(e).x-pe(n[n.length-1]).x),l=Math.abs(pe(e).y-pe(n[0]).y),h=Math.abs(pe(e).x-pe(n[0]).x),u=Ue[t.arrowTypeStart],d=Ue[t.arrowTypeEnd],f=1;if(o<d&&o>0&&a<d){let p=d+f-o;p*=s==="up"?-1:1,i-=p}if(l<u&&l>0&&h<u){let p=u+f-l;p*=s==="up"?-1:1,i+=p}return pe(e).y+i},"y")}),"getLineFunctionsWithOffset"),Na={},Be={},ig;function mP(){return ig||(ig=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.BLANK_URL=Be.relativeFirstCharacters=Be.whitespaceEscapeCharsRegex=Be.urlSchemeRegex=Be.ctrlCharactersRegex=Be.htmlCtrlEntityRegex=Be.htmlEntitiesRegex=Be.invalidProtocolRegex=void 0,Be.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,Be.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,Be.htmlCtrlEntityRegex=/&(newline|tab);/gi,Be.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Be.urlSchemeRegex=/^.+(:|&colon;)/gim,Be.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Be.relativeFirstCharacters=[".","/"],Be.BLANK_URL="about:blank"),Be}var sg;function gP(){if(sg)return Na;sg=1,Object.defineProperty(Na,"__esModule",{value:!0}),Na.sanitizeUrl=s;var t=mP();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,h){return String.fromCharCode(h)})}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 h=l;if(!h)return t.BLANK_URL;if(e(h))return h;var u=h.trimStart(),d=u.match(t.urlSchemeRegex);if(!d)return h;var f=d[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(f))return t.BLANK_URL;var p=u.replace(/\\/g,"/");if(f==="mailto:"||f.includes("://"))return p;if(f==="http:"||f==="https:"){if(!n(p))return t.BLANK_URL;var m=new URL(p);return m.protocol=m.protocol.toLowerCase(),m.hostname=m.hostname.toLowerCase(),m.toString()}return p}return Na}var xP=gP();function Ch(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 yP(){}function OC(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function wp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const bP="[object RegExp]",$C="[object String]",RC="[object Number]",zC="[object Boolean]",WC="[object Arguments]",CP="[object Symbol]",kP="[object Date]",vP="[object Map]",wP="[object Set]",SP="[object Array]",TP="[object ArrayBuffer]",_P="[object Object]",EP="[object DataView]",jP="[object Uint8Array]",NP="[object Uint8ClampedArray]",BP="[object Uint16Array]",LP="[object Uint32Array]",AP="[object Int8Array]",MP="[object Int16Array]",IP="[object Int32Array]",FP="[object Float32Array]",DP="[object Float64Array]",og=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();function Sp(t){return typeof og.Buffer<"u"&&og.Buffer.isBuffer(t)}function PP(t){return Number.isSafeInteger(t)&&t>=0}function qC(t){return t!=null&&typeof t!="function"&&PP(t.length)}function OP(t){return t==="__proto__"}function Tp(t){return t==null||typeof t!="object"&&typeof t!="function"}function _p(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function $P(t,e){return Yi(t,void 0,t,new Map,e)}function Yi(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(Tp(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]=Yi(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,Yi(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(Yi(a,void 0,r,n,i));return o}if(Sp(t))return t.subarray();if(_p(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Yi(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),Mr(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),Mr(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),Mr(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,Mr(o,t,r,n,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return n.set(t,o),Mr(o,t,r,n,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return n.set(t,o),Mr(o,t,r,n,i),o}if(t instanceof String){const o=new String(t.valueOf());return n.set(t,o),Mr(o,t,r,n,i),o}if(typeof t=="object"&&RP(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),Mr(o,t,r,n,i),o}return t}function Mr(t,e,r=t,n,i){const s=[...Object.keys(e),...OC(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=Yi(e[a],a,r,n,i))}}function RP(t){switch(wp(t)){case WC:case SP:case TP:case EP:case zC:case kP:case FP:case DP:case AP:case MP:case IP:case vP:case RC:case _P:case bP:case wP:case $C:case CP:case jP:case NP:case BP:case LP:return!0;default:return!1}}function zP(t,e){return $P(t,(r,n,i,s)=>{if(typeof t=="object"){if(wp(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Mr(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case RC:case $C:case zC:{const o=new t.constructor(t==null?void 0:t.valueOf());return Mr(o,t),o}case WC:{const o={};return Mr(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function ag(t){return zP(t)}function Du(t){return t!==null&&typeof t=="object"&&wp(t)==="[object Arguments]"}function Pu(t){return typeof t=="object"&&t!==null}function WP(t){return Pu(t)&&qC(t)}function oa(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(oa.Cache||Map),r}oa.Cache=Map;function el(t){return _p(t)}function qP(t){const e=t==null?void 0:t.constructor;return t===(typeof e=="function"?e.prototype:Object.prototype)}function HP(t){if(Tp(t))return t;if(Array.isArray(t)||_p(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 UP(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=rl(i,o,n,new Map)}return i}function rl(t,e,r,n){if(Tp(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return HP(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),...OC(e)];for(let s=0;s<i.length;s++){const o=i[s];if(OP(o))continue;let a=e[o],l=t[o];if(Du(a)&&(a={...a}),Du(l)&&(l={...l}),Sp(a)&&(a=ag(a)),Array.isArray(a))if(Array.isArray(l)){const u=[],d=Reflect.ownKeys(l);for(let f=0;f<d.length;f++){const p=d[f];u[p]=l[p]}l=u}else if(WP(l)){const u=[];for(let d=0;d<l.length;d++)u[d]=l[d];l=u}else l=[];const h=r(l,a,o,t,e,n);h!==void 0?t[o]=h:Array.isArray(a)||Pu(l)&&Pu(a)&&(Ch(l)||Ch(a)||el(l)||el(a))?t[o]=rl(l,a,r,n):l==null&&Ch(a)?t[o]=rl({},a,r,n):l==null&&el(a)?t[o]=ag(a):(l===void 0||a!==void 0)&&(t[o]=a)}return t}function YP(t,...e){return UP(t,...e,yP)}function lg(t){if(t==null)return!0;if(qC(t))return typeof t.splice!="function"&&typeof t!="string"&&!Sp(t)&&!el(t)&&!Du(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 qP(t)?e.filter(r=>r!=="constructor").length===0:e.length===0}return!0}var GP="​",VP={curveBasis:Cu,curveBasisClosed:Z4,curveBasisOpen:J4,curveBumpX:Pb,curveBumpY:Ob,curveBundle:tD,curveCardinalClosed:eD,curveCardinalOpen:rD,curveCardinal:Wb,curveCatmullRomClosed:nD,curveCatmullRomOpen:iD,curveCatmullRom:Hb,curveLinear:Eo,curveLinearClosed:sD,curveMonotoneX:Kb,curveMonotoneY:Qb,curveNatural:Jb,curveStep:t1,curveStepAfter:r1,curveStepBefore:e1},XP=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,KP=k(function(t,e){const r=HC(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);Cl(o),n=Le(n,[...o])}else n=r.args;if(!n)return;let i=Qd(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),HC=k(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${XP.source})(?=[}][%]{2}).*
460
- `,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),et.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=To.exec(t))!==null;)if(s.index===To.lastIndex&&To.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 et.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),QP=k(function(t){return t.replace(To,"")},"removeDirectives"),ZP=k(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function Ep(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return VP[r]??e}k(Ep,"interpolateToCurve");function UC(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?xP.sanitizeUrl(r):r}k(UC,"formatUrl");var JP=k((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){et.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function jp(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}k(jp,"distance");function YC(t){let e,r=0;t.forEach(i=>{r+=jp(i,e),e=i});const n=r/2;return Np(t,n)}k(YC,"traverseEdge");function GC(t){return t.length===1?t[0]:YC(t)}k(GC,"calcLabelPosition");var cg=k((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),Np=k((t,e)=>{let r,n=e;for(const i of t){if(r){const s=jp(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:cg((1-o)*r.x+o*i.x,5),y:cg((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),tO=k((t,e,r)=>{et.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=Np(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 VC(t,e,r){const n=structuredClone(r);et.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=Np(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}k(VC,"calcTerminalLabelPosition");function XC(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}}k(XC,"getStylesFromArray");var hg=0,eO=k(()=>(hg++,"id-"+Math.random().toString(36).substr(2,12)+"-"+hg),"generateId");function KC(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}k(KC,"makeRandomHex");var rO=k(t=>KC(t.length),"random"),nO=k(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"),iO=k(function(t,e){const r=e.text.replace(ra.lineBreakRegex," "),[,n]=vc(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"),sO=oa((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),ra.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const l=mn(`${o} `,r),h=mn(s,r);if(l>e){const{hyphenatedStrings:f,remainingWord:p}=oO(o,e,"-",r);i.push(s,...f),s=p}else h+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}`),oO=oa((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 h=`${o}${a}`;if(mn(h,n)>=e){const d=l+1,f=i.length===d,p=`${h}${r}`;s.push(f?h:p),o=""}else o=h}),{hyphenatedStrings:s,remainingWord:o}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function QC(t,e){return Bp(t,e).height}k(QC,"calculateTextHeight");function mn(t,e){return Bp(t,e).width}k(mn,"calculateTextWidth");var Bp=oa((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=vc(r),o=["sans-serif",n],a=t.split(ra.lineBreakRegex),l=[],h=Ut("body");if(!h.remove)return{width:0,height:0,lineHeight:0};const u=h.append("svg");for(const f of o){let p=0;const m={width:0,height:0,lineHeight:0};for(const x of a){const g=nO();g.text=x||GP;const y=iO(u,g).style("font-size",s).style("font-weight",i).style("font-family",f),C=(y._groups||y)[0][0].getBBox();if(C.width===0&&C.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,C.width)),p=Math.round(C.height),m.height+=p,m.lineHeight=Math.round(Math.max(m.lineHeight,p))}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}`),ps,aO=(ps=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},k(ps,"InitIDGenerator"),ps),Ba,lO=k(function(t){return Ba=Ba||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Ba.innerHTML=t,unescape(Ba.textContent)},"entityDecode");function Lp(t){return"str"in t}k(Lp,"isDetailedError");var cO=k((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"),vc=k(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 Ap(t,e){return YP({},t,e)}k(Ap,"cleanAndMerge");var Pr={assignWithDepth:Le,wrapLabel:sO,calculateTextHeight:QC,calculateTextWidth:mn,calculateTextDimensions:Bp,cleanAndMerge:Ap,detectInit:KP,detectDirective:HC,isSubstringInArray:ZP,interpolateToCurve:Ep,calcLabelPosition:GC,calcCardinalityPosition:tO,calcTerminalLabelPosition:VC,formatUrl:UC,getStylesFromArray:XC,generateId:eO,random:rO,runFunc:JP,entityDecode:lO,insertTitle:cO,isLabelCoordinateInPath:ZC,parseFontSize:vc,InitIDGenerator:aO},hO=k(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"),gi=k(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),xY=k((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function Fe(t){return t??null}k(Fe,"handleUndefinedAttr");function ZC(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())}k(ZC,"isLabelCoordinateInPath");var Mp=k(({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 JC(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=Jt().fontSize?Jt().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[h=Xy.fontSize]=vc(a),u=h*l+"px";i.style.minWidth=u,i.style.maxWidth=u}else i.style.width="100%";s(i)}k(o,"setupImage"),setTimeout(()=>{i.complete&&o()}),i.addEventListener("error",o),i.addEventListener("load",o)})))}k(JC,"configureLabelImages");var uO=k(t=>{const{handDrawnSeed:e}=Jt();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Ls=k(t=>{const e=dO([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),dO=k(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"),tk=k(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"),bt=k(t=>{const{stylesArray:e}=Ls(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];tk(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"),xt=k((t,e)=>{var l;const{themeVariables:r,handDrawnSeed:n}=Jt(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Ls(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:pO(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),pO=k(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 fO=Object.freeze({left:0,top:0,width:16,height:16}),Rl=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ek=Object.freeze({...fO,...Rl}),mO=Object.freeze({...ek,body:"",hidden:!1}),gO=Object.freeze({width:null,height:null}),xO=Object.freeze({...gO,...Rl}),yO=(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(),h={provider:i.length>0?i[0]:n,prefix:l,name:a};return kh(h)?h:null}const s=i[0],o=s.split("-");if(o.length>1){const a={provider:n,prefix:o.shift(),name:o.join("-")};return kh(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return kh(a,r)?a:null}return null},kh=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function bO(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 ug(t,e){const r=bO(t,e);for(const n in mO)n in Rl?n in t&&!(n in r)&&(r[n]=Rl[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function CO(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 dg(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=ug(n[a]||i[a],s)}return o(e),r.forEach(o),ug(t,s)}function kO(t,e){if(t.icons[e])return dg(t,e,[]);const r=CO(t,[e])[e];return r?dg(t,e,r):null}const vO=/(-?[0-9.]*[0-9]+[0-9.]*)/g,wO=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function pg(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(vO);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=wO.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 SO(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 TO(t,e){return t?"<defs>"+t+"</defs>"+e:e}function _O(t,e,r){const n=SO(t);return TO(n.defs,e+n.content+r)}const EO=t=>t==="unset"||t==="undefined"||t==="none";function jO(t,e){const r={...ek,...t},n={...xO,...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,C=x.vFlip;let b=x.rotate;y?C?b+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):C&&(g.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),g.push("scale(1 -1)"),i.top=i.left=0);let S;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:S=i.height/2+i.top,g.unshift("rotate(90 "+S.toString()+" "+S.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:S=i.width/2+i.left,g.unshift("rotate(-90 "+S.toString()+" "+S.toString()+")");break}b%2===1&&(i.left!==i.top&&(S=i.left,i.left=i.top,i.top=S),i.width!==i.height&&(S=i.width,i.width=i.height,i.height=S)),g.length&&(s=_O(s,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=n.width,a=n.height,l=i.width,h=i.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?h:a,u=pg(d,l/h)):(u=o==="auto"?l:o,d=a===null?pg(u,h/l):a==="auto"?h:a);const f={},p=(x,g)=>{EO(g)||(f[x]=g.toString())};p("width",u),p("height",d);const m=[i.left,i.top,l,h];return f.viewBox=m.join(" "),{attributes:f,viewBox:m,body:s}}const NO=/\sid="(\S+)"/g,fg=new Map;function BO(t){t=t.replace(/[0-9]+$/,"")||"a";const e=fg.get(t)||0;return fg.set(t,e+1),e?`${t}${e}`:t}function LO(t){const e=[];let r;for(;r=NO.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=BO(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 AO(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 Ip(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ki=Ip();function rk(t){ki=t}var jo={exec:()=>null};function te(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(nr.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var MO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),nr={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")},IO=/^(?:[ \t]*(?:\n|$))+/,FO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,DO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,aa=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,PO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fp=/(?:[*+-]|\d{1,9}[.)])/,nk=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ik=te(nk).replace(/bull/g,Fp).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(),OO=te(nk).replace(/bull/g,Fp).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(),Dp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$O=/^[^\n]+/,Pp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,RO=te(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pp).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zO=te(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Fp).getRegex(),wc="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",Op=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,WO=te("^ {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",Op).replace("tag",wc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),sk=te(Dp).replace("hr",aa).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",wc).getRegex(),qO=te(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",sk).getRegex(),$p={blockquote:qO,code:FO,def:RO,fences:DO,heading:PO,hr:aa,html:WO,lheading:ik,list:zO,newline:IO,paragraph:sk,table:jo,text:$O},mg=te("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",aa).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",wc).getRegex(),HO={...$p,lheading:OO,table:mg,paragraph:te(Dp).replace("hr",aa).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",mg).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",wc).getRegex()},UO={...$p,html:te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Op).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:jo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:te(Dp).replace("hr",aa).replace("heading",` *#{1,6} *[^
461
- ]`).replace("lheading",ik).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},YO=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,GO=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ok=/^( {2,}|\\)\n(?!\s*$)/,VO=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Sc=/[\p{P}\p{S}]/u,Rp=/[\s\p{P}\p{S}]/u,ak=/[^\s\p{P}\p{S}]/u,XO=te(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Rp).getRegex(),lk=/(?!~)[\p{P}\p{S}]/u,KO=/(?!~)[\s\p{P}\p{S}]/u,QO=/(?:[^\s\p{P}\p{S}]|~)/u,ZO=te(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",MO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ck=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,JO=te(ck,"u").replace(/punct/g,Sc).getRegex(),t$=te(ck,"u").replace(/punct/g,lk).getRegex(),hk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",e$=te(hk,"gu").replace(/notPunctSpace/g,ak).replace(/punctSpace/g,Rp).replace(/punct/g,Sc).getRegex(),r$=te(hk,"gu").replace(/notPunctSpace/g,QO).replace(/punctSpace/g,KO).replace(/punct/g,lk).getRegex(),n$=te("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ak).replace(/punctSpace/g,Rp).replace(/punct/g,Sc).getRegex(),i$=te(/\\(punct)/,"gu").replace(/punct/g,Sc).getRegex(),s$=te(/^<(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(),o$=te(Op).replace("(?:-->|$)","-->").getRegex(),a$=te("^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",o$).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),zl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,l$=te(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",zl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),uk=te(/^!?\[(label)\]\[(ref)\]/).replace("label",zl).replace("ref",Pp).getRegex(),dk=te(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pp).getRegex(),c$=te("reflink|nolink(?!\\()","g").replace("reflink",uk).replace("nolink",dk).getRegex(),gg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,zp={_backpedal:jo,anyPunctuation:i$,autolink:s$,blockSkip:ZO,br:ok,code:GO,del:jo,emStrongLDelim:JO,emStrongRDelimAst:e$,emStrongRDelimUnd:n$,escape:YO,link:l$,nolink:dk,punctuation:XO,reflink:uk,reflinkSearch:c$,tag:a$,text:VO,url:jo},h$={...zp,link:te(/^!?\[(label)\]\((.*?)\)/).replace("label",zl).getRegex(),reflink:te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zl).getRegex()},Ou={...zp,emStrongRDelimAst:r$,emStrongLDelim:t$,url:te(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",gg).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:te(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",gg).getRegex()},u$={...Ou,br:te(ok).replace("{2,}","*").getRegex(),text:te(Ou.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},La={normal:$p,gfm:HO,pedantic:UO},Js={normal:zp,gfm:Ou,breaks:u$,pedantic:h$},d$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xg=t=>d$[t];function Yr(t,e){if(e){if(nr.escapeTest.test(t))return t.replace(nr.escapeReplace,xg)}else if(nr.escapeTestNoEncode.test(t))return t.replace(nr.escapeReplaceNoEncode,xg);return t}function yg(t){try{t=encodeURI(t).replace(nr.percentDecode,"%")}catch{return null}return t}function bg(t,e){var s;let r=t.replace(nr.findPipe,(o,a,l)=>{let h=!1,u=a;for(;--u>=0&&l[u]==="\\";)h=!h;return h?"|":" |"}),n=r.split(nr.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(nr.slashPipe,"|");return n}function to(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 p$(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 Cg(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 f$(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
462
- `).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(`
463
- `)}var Wl=class{constructor(e){ee(this,"options");ee(this,"rules");ee(this,"lexer");this.options=e||ki}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:to(n,`
464
- `)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=f$(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=to(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:to(r[0],`
465
- `)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=to(r[0],`
466
- `).split(`
467
- `),i="",s="",o=[];for(;n.length>0;){let a=!1,l=[],h;for(h=0;h<n.length;h++)if(this.rules.other.blockquoteStart.test(n[h]))l.push(n[h]),a=!0;else if(!a)l.push(n[h]);else break;n=n.slice(h);let u=l.join(`
468
- `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
469
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
470
- ${u}`:u,s=s?`${s}
471
- ${d}`:d;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=f,n.length===0)break;let p=o.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){let m=p,x=m.raw+`
472
- `+n.join(`
473
- `),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((p==null?void 0:p.type)==="list"){let m=p,x=m.raw+`
474
- `+n.join(`
475
- `),g=this.list(x);o[o.length-1]=g,i=i.substring(0,i.length-p.raw.length)+g.raw,s=s.substring(0,s.length-m.raw.length)+g.raw,n=x.substring(o.at(-1).raw.length).split(`
476
- `);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 h=!1,u="",d="";if(!(r=o.exec(e))||this.rules.block.hr.test(e))break;u=r[0],e=e.substring(u.length);let f=r[2].split(`
477
- `,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),p=e.split(`
478
- `,1)[0],m=!f.trim(),x=0;if(this.options.pedantic?(x=2,d=f.trimStart()):m?x=r[1].length+1:(x=r[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=f.slice(x),x+=r[1].length),m&&this.rules.other.blankLine.test(p)&&(u+=p+`
479
- `,e=e.substring(p.length+1),h=!0),!h){let C=this.rules.other.nextBulletRegex(x),b=this.rules.other.hrRegex(x),S=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),w=this.rules.other.htmlBeginRegex(x);for(;e;){let B=e.split(`
480
- `,1)[0],L;if(p=B,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),L=p):L=p.replace(this.rules.other.tabCharGlobal," "),S.test(p)||_.test(p)||w.test(p)||C.test(p)||b.test(p))break;if(L.search(this.rules.other.nonSpaceChar)>=x||!p.trim())d+=`
481
- `+L.slice(x);else{if(m||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(f)||_.test(f)||b.test(f))break;d+=`
482
- `+p}!m&&!p.trim()&&(m=!0),u+=B+`
483
- `,e=e.substring(B.length+1),f=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 h=0;h<s.items.length;h++)if(this.lexer.state.top=!1,s.items[h].tokens=this.lexer.blockTokens(s.items[h].text,[]),!s.loose){let u=s.items[h].tokens.filter(f=>f.type==="space"),d=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));s.loose=d}if(s.loose)for(let h=0;h<s.items.length;h++)s.items[h].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=bg(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(`
484
- `):[],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(bg(l,o.header.length).map((h,u)=>({text:h,tokens:this.lexer.inline(h),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)===`
485
- `?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=to(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=p$(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)),Cg(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 Cg(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,h=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)){h+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+h);let d=[...i[0]][0].length,f=e.slice(0,s+i.index+d+a);if(Math.min(s,a)%2){let m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}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}}}},Ir=class $u{constructor(e){ee(this,"tokens");ee(this,"options");ee(this,"state");ee(this,"tokenizer");ee(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ki,this.options.tokenizer=this.options.tokenizer||new Wl,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:nr,block:La.normal,inline:Js.normal};this.options.pedantic?(r.block=La.pedantic,r.inline=Js.pedantic):this.options.gfm&&(r.block=La.gfm,this.options.breaks?r.inline=Js.breaks:r.inline=Js.gfm),this.tokenizer.rules=r}static get rules(){return{block:La,inline:Js}}static lex(e,r){return new $u(r).lex(e)}static lexInline(e,r){return new $u(r).inlineTokens(e)}lex(e){e=e.replace(nr.carriageReturn,`
486
- `),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(nr.tabCharGlobal," ").replace(nr.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(h=>(a=h.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 h=r.at(-1);a.raw.length===1&&h!==void 0?h.raw+=`
487
- `:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let h=r.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
488
- `)?"":`
489
- `)+a.raw,h.text+=`
490
- `+a.text,this.inlineQueue.at(-1).src=h.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 h=r.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
491
- `)?"":`
492
- `)+a.raw,h.text+=`
493
- `+a.raw,this.inlineQueue.at(-1).src=h.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 h=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(f=>{d=f.call({lexer:this},u),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let h=r.at(-1);n&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
494
- `)?"":`
495
- `)+a.raw,h.text+=`
496
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.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 h=r.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
497
- `)?"":`
498
- `)+a.raw,h.text+=`
499
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):r.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var l,h,u,d,f;let n=e,i=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)p.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=((h=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:h.call({lexer:this},n))??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let p;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(x=>(p=x.call({lexer:this},e,r))?(e=e.substring(p.raw.length),r.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let x=r.at(-1);p.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):r.push(p);continue}if(p=this.tokenizer.emStrong(e,n,a)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.del(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),r.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),r.push(p);continue}let m=e;if((f=this.options.extensions)!=null&&f.startInline){let x=1/0,g=e.slice(1),y;this.options.extensions.startInline.forEach(C=>{y=C.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(p=this.tokenizer.inlineText(m)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(a=p.raw.slice(-1)),o=!0;let x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):r.push(p);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}},ql=class{constructor(e){ee(this,"options");ee(this,"parser");this.options=e||ki}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(nr.notSpaceStart))==null?void 0:o[0],s=e.replace(nr.endingNewline,"")+`
500
- `;return i?'<pre><code class="language-'+Yr(i)+'">'+(n?s:Yr(s,!0))+`</code></pre>
501
- `:"<pre><code>"+(n?s:Yr(s,!0))+`</code></pre>
502
- `}blockquote({tokens:e}){return`<blockquote>
503
- ${this.parser.parse(e)}</blockquote>
504
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
505
- `}hr(e){return`<hr>
506
- `}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+`>
507
- `+i+"</"+s+`>
508
- `}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+" "+Yr(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>
509
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
510
- `}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>
511
- <thead>
512
- `+r+`</thead>
513
- `+i+`</table>
514
- `}tablerow({text:e}){return`<tr>
515
- ${e}</tr>
516
- `}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
517
- `}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>${Yr(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=yg(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+Yr(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=yg(e);if(s===null)return Yr(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${Yr(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Yr(e.text)}},Wp=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""}},Fr=class Ru{constructor(e){ee(this,"options");ee(this,"renderer");ee(this,"textRenderer");this.options=e||ki,this.options.renderer=this.options.renderer||new ql,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Wp}static parse(e,r){return new Ru(r).parse(e)}static parseInline(e,r){return new Ru(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 h=a,u=this.options.extensions.renderers[h.type].call({parser:this},h);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.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 h=l,u=this.renderer.text(h);for(;o+1<e.length&&e[o+1].type==="text";)h=e[++o],u+=`
518
- `+this.renderer.text(h);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 h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}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 h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=h||"";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 h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},Ua,xo=(Ua=class{constructor(e){ee(this,"options");ee(this,"block");this.options=e||ki}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Ir.lex:Ir.lexInline}provideParser(){return this.block?Fr.parse:Fr.parseInline}},ee(Ua,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ee(Ua,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ua),m$=class{constructor(...e){ee(this,"defaults",Ip());ee(this,"options",this.setOptions);ee(this,"parse",this.parseMarkdown(!0));ee(this,"parseInline",this.parseMarkdown(!1));ee(this,"Parser",Fr);ee(this,"Renderer",ql);ee(this,"TextRenderer",Wp);ee(this,"Lexer",Ir);ee(this,"Tokenizer",Wl);ee(this,"Hooks",xo);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 h of l)n=n.concat(this.walkTokens(h.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 h=a[l].flat(1/0);n=n.concat(this.walkTokens(h,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 ql(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],h=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=h.apply(s,u)),d||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Wl(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],h=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=h.apply(s,u)),d}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new xo;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],h=s[a];xo.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&xo.passThroughHooksRespectAsync.has(o))return(async()=>{let f=await l.call(s,u);return h.call(s,f)})();let d=l.call(s,u);return h.call(s,d)}:s[a]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await l.apply(s,u);return f===!1&&(f=await h.apply(s,u)),f})();let d=l.apply(s,u);return d===!1&&(d=h.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 Ir.lex(e,r??this.defaults)}parser(e,r){return Fr.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?Ir.lex:Ir.lexInline)(a,s),h=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(h,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?Fr.parse:Fr.parseInline)(h,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?Ir.lex:Ir.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?Fr.parse:Fr.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+=`
519
- Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Yr(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},xi=new m$;function re(t,e){return xi.parse(t,e)}re.options=re.setOptions=function(t){return xi.setOptions(t),re.defaults=xi.defaults,rk(re.defaults),re};re.getDefaults=Ip;re.defaults=ki;re.use=function(...t){return xi.use(...t),re.defaults=xi.defaults,rk(re.defaults),re};re.walkTokens=function(t,e){return xi.walkTokens(t,e)};re.parseInline=xi.parseInline;re.Parser=Fr;re.parser=Fr.parse;re.Renderer=ql;re.TextRenderer=Wp;re.Lexer=Ir;re.lexer=Ir.lex;re.Tokenizer=Wl;re.Hooks=xo;re.parse=re;re.options;re.setOptions;re.use;re.walkTokens;re.parseInline;Fr.parse;Ir.lex;function pk(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 h=l.match(/\n([\t ]+|(?!\s).)/g);return h?a.concat(h.map(function(u){var d,f;return(f=(d=u.match(/[\t ]/g))===null||d===void 0?void 0:d.length)!==null&&f!==void 0?f:0})):a},[]);if(i.length){var s=new RegExp(`
520
- [ ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(a){return a.replace(s,`
521
- `)})}n[0]=n[0].replace(/^\r?\n/,"");var o=n[0];return e.forEach(function(a,l){var h=o.match(/(?:^|\n)( *)$/),u=h?h[1]:"",d=a;typeof a=="string"&&a.includes(`
522
- `)&&(d=String(a).split(`
523
- `).map(function(f,p){return p===0?f:""+u+f}).join(`
524
- `)),o+=d+n[l+1]}),o}var g$={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},zu=new Map,fk=new Map,x$=k(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(et.debug("Registering icon pack:",e.name),"loader"in e)fk.set(e.name,e.loader);else if("icons"in e)zu.set(e.name,e.icons);else throw et.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),mk=k(async(t,e)=>{const r=yO(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=zu.get(n);if(!i){const o=fk.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},zu.set(n,i)}catch(a){throw et.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=kO(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),y$=k(async t=>{try{return await mk(t),!0}catch{return!1}},"isIconAvailable"),la=k(async(t,e,r)=>{let n;try{n=await mk(t,e==null?void 0:e.fallbackPrefix)}catch(o){et.error(o),n=g$}const i=jO(n,e),s=AO(LO(i.body),{...i.attributes,...r});return zr(s,me())},"getIconSVG");function gk(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
525
- `).replace(/\n{2,}/g,`
526
- `);return pk(n)}k(gk,"preprocessMarkdown");function xk(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"})))??[]})}k(xk,"nonMarkdownToLines");function yk(t,e={}){const r=gk(t,e),n=re.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
527
- `).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(f=>{f=f.replace(/&#39;/g,"'"),f&&i[s].push({content:f,type:l})})}):a.type==="strong"||a.type==="em"?a.tokens.forEach(h=>{o(h,a.type)}):a.type==="html"&&i[s].push({content:a.text,type:"normal"})}return k(o,"processNode"),n.forEach(a=>{var l;a.type==="paragraph"?(l=a.tokens)==null||l.forEach(h=>{o(h)}):a.type==="html"?i[s].push({content:a.text,type:"normal"}):i[s].push({content:a.raw,type:"normal"})}),i}k(yk,"markdownToLines");function bk(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}k(bk,"nonMarkdownToHTML");function Ck(t,{markdownAutoWrap:e}={}){const r=re.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:(et.warn(`Unsupported markdown: ${i.type}`),i.raw)}return k(n,"output"),r.map(n).join("")}k(Ck,"markdownToHTML");function kk(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}k(kk,"splitTextToChars");function vk(t,e){const r=kk(e.content);return qp(t,[],r,e.type)}k(vk,"splitWordToFitWidth");function qp(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}])?qp(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}k(qp,"splitWordToFitWidthRecursion");function wk(t,e){if(t.some(({content:r})=>r.includes(`
528
- `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return Hl(t,e)}k(wk,"splitLineToFitWidth");function Hl(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 Hl(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=vk(e,s);r.push([a]),l.content&&t.unshift(l)}return Hl(t,e,r)}k(Hl,"splitLineToFitWidthRecursion");function Wu(t,e){e&&t.attr("style",e)}k(Wu,"applyStyle");var kg=16384;async function Sk(t,e,r,n,i=!1,s=me()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,kg)}px`),o.attr("height",`${Math.min(10*r,kg)}px`);const a=o.append("xhtml:div"),l=Fo(e.label)?await sb(e.label.replace(ra.lineBreakRegex,`
529
- `),s):zr(e.label,s),h=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),Wu(u,e.labelStyle),u.attr("class",`${h} ${n}`),Wu(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()}k(Sk,"addHtmlSpan");function Tc(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}k(Tc,"createTspan");function Tk(t,e,r){const n=t.append("text"),i=Tc(n,1,e);_c(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}k(Tk,"computeWidthOfText");function b$(t,e,r){var o;const n=t.append("text"),i=Tc(n,1,e);_c(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}k(b$,"computeDimensionOfText");function _k(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 h=0;for(const u of r){const d=k(p=>Tk(o,1.1,p)<=t,"checkWidth"),f=d(u)?[u]:wk(u,d);for(const p of f){const m=Tc(l,h,1.1,i);_c(m,p),h++}}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()}k(_k,"createFormattedText");function qu(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}})}k(qu,"decodeHTMLEntities");function _c(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(qu(r.content)):i.text(" "+qu(r.content))})}k(_c,"updateTextContentAndStyles");async function Ek(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await y$(a)?await la(a,void 0,{class:"label-icon"}):`<i class='${zr(i,e).replace(":"," ")}'></i>`})()),i));const n=await Promise.all(r);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}k(Ek,"replaceIconSubstring");var bn=k(async(t,e="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:s=!0,markdown:o=!0,isNode:a=!0,width:l=200,addSvgBackground:h=!1}={},u)=>{if(et.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",h),s){const d=o?Ck(e,u):bk(e),f=await Ek(gi(d),u),p=e.replace(/\\\\/g,"\\"),m={isNode:a,label:Fo(e)?p:f,labelStyle:r.replace("fill:","color:")};return await Sk(t,m,l,i,h,u)}else{const d=gi(e.replace(/<br\s*\/?>/g,"<br/>")),f=o?yk(d.replace("<br>","<br/>"),u):xk(d),p=_k(l,t,f,e?h:!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:");Ut(p).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Ut(p).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:");Ut(p).select("text").attr("style",x)}return n?Ut(p).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Ut(p).selectAll("tspan.text-outer-tspan").classed("row",!0),p}},"createText");function vh(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[h,u]=l;l[0]=(h-n)*o-(u-i)*a+n,l[1]=(h-n)*a+(u-i)*o+i}}}function C$(t,e){return t[0]===e[0]&&t[1]===e[1]}function k$(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 h of o)vh(h,a,i);const l=(function(h,u,d){const f=[];for(const C of h){const b=[...C];C$(b[0],b[b.length-1])||b.push([b[0][0],b[0][1]]),b.length>2&&f.push(b)}const p=[];u=Math.max(u,.1);const m=[];for(const C of f)for(let b=0;b<C.length-1;b++){const S=C[b],_=C[b+1];if(S[1]!==_[1]){const w=Math.min(S[1],_[1]);m.push({ymin:w,ymax:Math.max(S[1],_[1]),x:w===S[1]?S[0]:_[0],islope:(_[0]-S[0])/(_[1]-S[1])})}}if(m.sort(((C,b)=>C.ymin<b.ymin?-1:C.ymin>b.ymin?1:C.x<b.x?-1:C.x>b.x?1:C.ymax===b.ymax?0:(C.ymax-b.ymax)/Math.abs(C.ymax-b.ymax))),!m.length)return p;let x=[],g=m[0].ymin,y=0;for(;x.length||m.length;){if(m.length){let C=-1;for(let b=0;b<m.length&&!(m[b].ymin>g);b++)C=b;m.splice(0,C+1).forEach((b=>{x.push({s:g,edge:b})}))}if(x=x.filter((C=>!(C.edge.ymax<=g))),x.sort(((C,b)=>C.edge.x===b.edge.x?0:(C.edge.x-b.edge.x)/Math.abs(C.edge.x-b.edge.x))),(d!==1||y%u==0)&&x.length>1)for(let C=0;C<x.length;C+=2){const b=C+1;if(b>=x.length)break;const S=x[C].edge,_=x[b].edge;p.push([[Math.round(S.x),g],[Math.round(_.x),g]])}g+=d,x.forEach((C=>{C.edge.x=C.edge.x+d*C.edge.islope})),y++}return p})(o,s,n);if(i){for(const h of o)vh(h,a,-i);(function(h,u,d){const f=[];h.forEach((p=>f.push(...p))),vh(f,u,d)})(l,a,-i)}return l}function ca(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),k$(t,i,n,s||1)}class Hp{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=ca(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 Ec(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 v$ extends Hp{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=ca(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[h,u]of i)Ec([h,u])&&o.push([[h[0]-a,h[1]+l],[...u]],[[h[0]+a,h[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(o,r)}}}class w$ extends Hp{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 S${constructor(e){this.helper=e}fillPolygons(e,r){const n=ca(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=Ec(a),h=l/i,u=Math.ceil(h)-1,d=l-u*i,f=(a[0][0]+a[1][0])/2-i/4,p=Math.min(a[0][1],a[1][1]);for(let m=0;m<u;m++){const x=p+d+m*i,g=f-o+2*Math.random()*o,y=x-o+2*Math.random()*o,C=this.helper.ellipse(g,y,s,s,r);n.push(...C.ops)}}return{type:"fillSketch",ops:n}}}class T${constructor(e){this.helper=e}fillPolygons(e,r){const n=ca(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=Ec(o),l=Math.floor(a/(n+i)),h=(a+i-l*(n+i))/2;let u=o[0],d=o[1];u[0]>d[0]&&(u=o[1],d=o[0]);const f=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let p=0;p<l;p++){const m=p*(n+i),x=m+n,g=[u[0]+m*Math.cos(f)+h*Math.cos(f),u[1]+m*Math.sin(f)+h*Math.sin(f)],y=[u[0]+x*Math.cos(f)+h*Math.cos(f),u[1]+x*Math.sin(f)+h*Math.sin(f)];s.push(...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],r))}})),s}}class _${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=ca(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=Ec(s),a=Math.round(o/(2*r));let l=s[0],h=s[1];l[0]>h[0]&&(l=s[1],h=s[0]);const u=Math.atan((h[1]-l[1])/(h[0]-l[0]));for(let d=0;d<a;d++){const f=2*d*r,p=2*(d+1)*r,m=Math.sqrt(2*Math.pow(r,2)),x=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],g=[l[0]+p*Math.cos(u),l[1]+p*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 lr={};class E${constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const j$=0,wh=1,vg=2,Aa={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 Sh(t,e){return t.type===e}function Up(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:j$,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:wh,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:vg,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!Sh(s,vg);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return Up("M0,0"+t);i++,o=Aa[s.text],n=s.text}else Sh(s,wh)?o=Aa[n]:(i++,o=Aa[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 h=r[l];if(!Sh(h,wh))throw new Error("Param not a number: "+n+","+h.text);a[a.length]=+h.text}if(typeof Aa[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 jk(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(((h,u)=>u%2?h+r:h+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(((h,u)=>u%2?h+r:h+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(((h,u)=>u%2?h+r:h+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 Nk(t){const e=[];let r="",n=0,i=0,s=0,o=0,a=0,l=0;for(const{key:h,data:u}of t){switch(h){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,f=0;r==="C"||r==="S"?(d=n+(n-a),f=i+(i-l)):(d=n,f=i),e.push({key:"C",data:[d,f,...u]}),a=u[0],l=u[1],n=u[2],i=u[3];break}case"T":{const[d,f]=u;let p=0,m=0;r==="Q"||r==="T"?(p=n+(n-a),m=i+(i-l)):(p=n,m=i);const x=n+2*(p-n)/3,g=i+2*(m-i)/3,y=d+2*(p-d)/3,C=f+2*(m-f)/3;e.push({key:"C",data:[x,g,y,C,d,f]}),a=p,l=m,n=d,i=f;break}case"Q":{const[d,f,p,m]=u,x=n+2*(d-n)/3,g=i+2*(f-i)/3,y=p+2*(d-p)/3,C=m+2*(f-m)/3;e.push({key:"C",data:[x,g,y,C,p,m]}),a=d,l=f,n=p,i=m;break}case"A":{const d=Math.abs(u[0]),f=Math.abs(u[1]),p=u[2],m=u[3],x=u[4],g=u[5],y=u[6];d===0||f===0?(e.push({key:"C",data:[n,i,g,y,g,y]}),n=g,i=y):(n!==g||i!==y)&&(Bk(n,i,g,y,d,f,p,m,x).forEach((function(C){e.push({key:"C",data:C})})),n=g,i=y);break}case"Z":e.push({key:"Z",data:[]}),n=s,i=o}r=h}return e}function eo(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function Bk(t,e,r,n,i,s,o,a,l,h){const u=(d=o,Math.PI*d/180);var d;let f=[],p=0,m=0,x=0,g=0;if(h)[p,m,x,g]=h;else{[t,e]=eo(t,e,-u),[r,n]=eo(r,n,-u);const W=(t-r)/2,O=(e-n)/2;let M=W*W/(i*i)+O*O/(s*s);M>1&&(M=Math.sqrt(M),i*=M,s*=M);const A=i*i,P=s*s,$=A*P-A*O*O-P*W*W,j=A*O*O+P*W*W,T=(a===l?-1:1)*Math.sqrt(Math.abs($/j));x=T*i*O/s+(t+r)/2,g=T*-s*W/i+(e+n)/2,p=Math.asin(parseFloat(((e-g)/s).toFixed(9))),m=Math.asin(parseFloat(((n-g)/s).toFixed(9))),t<x&&(p=Math.PI-p),r<x&&(m=Math.PI-m),p<0&&(p=2*Math.PI+p),m<0&&(m=2*Math.PI+m),l&&p>m&&(p-=2*Math.PI),!l&&m>p&&(m-=2*Math.PI)}let y=m-p;if(Math.abs(y)>120*Math.PI/180){const W=m,O=r,M=n;m=l&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=Bk(r=x+i*Math.cos(m),n=g+s*Math.sin(m),O,M,i,s,o,0,l,[m,W,x,g])}y=m-p;const C=Math.cos(p),b=Math.sin(p),S=Math.cos(m),_=Math.sin(m),w=Math.tan(y/4),B=4/3*i*w,L=4/3*s*w,I=[t,e],E=[t+B*b,e-L*C],F=[r+B*_,n-L*S],z=[r,n];if(E[0]=2*I[0]-E[0],E[1]=2*I[1]-E[1],h)return[E,F,z].concat(f);{f=[E,F,z].concat(f);const W=[];for(let O=0;O<f.length;O+=3){const M=eo(f[O][0],f[O][1],u),A=eo(f[O+1][0],f[O+1][1],u),P=eo(f[O+2][0],f[O+2][1],u);W.push([M[0],M[1],A[0],A[1],P[0],P[1]])}return W}}const N$={randOffset:function(t,e){return At(t,e)},randOffsetWithRange:function(t,e,r){return Ul(t,e,r)},ellipse:function(t,e,r,n,i){const s=Ak(r,n,i);return Hu(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return $n(t,e,r,n,i,!0)}};function Lk(t,e,r,n,i){return{type:"path",ops:$n(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(...$n(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...$n(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?Lk(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function B$(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 wg(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=Ma(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:Ma(r[0],1.5*(1+.22*e.roughness),_g(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=Ma(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:Ma(o,1.5*(1+.22*e.roughness),_g(e));for(const h of a)h.op!=="move"&&n.push(h);for(const h of l)h.op!=="move"&&i.push(h)}}return{type:"path",ops:n.concat(i)}}return{type:"path",ops:[]}}function Ak(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+=At(o*l,r),a+=At(a*l,r),{increment:s,rx:o,ry:a}}function Hu(t,e,r,n){const[i,s]=Eg(n.increment,t,e,n.rx,n.ry,1,n.increment*Ul(.1,Ul(.4,1,r),r),r);let o=Yl(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=Eg(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=Yl(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function Sg(t,e,r,n,i,s,o,a,l){const h=t,u=e;let d=Math.abs(r/2),f=Math.abs(n/2);d+=At(.01*d,l),f+=At(.01*f,l);let p=i,m=s;for(;p<0;)p+=2*Math.PI,m+=2*Math.PI;m-p>2*Math.PI&&(p=0,m=2*Math.PI);const x=2*Math.PI/l.curveStepCount,g=Math.min(x/2,(m-p)/2),y=jg(g,h,u,d,f,p,m,1,l);if(!l.disableMultiStroke){const C=jg(g,h,u,d,f,p,m,1.5,l);y.push(...C)}return o&&(a?y.push(...$n(h,u,h+d*Math.cos(p),u+f*Math.sin(p),l),...$n(h,u,h+d*Math.cos(m),u+f*Math.sin(m),l)):y.push({op:"lineTo",data:[h,u]},{op:"lineTo",data:[h+d*Math.cos(p),u+f*Math.sin(p)]})),{type:"path",ops:y}}function Tg(t,e){const r=Nk(jk(Up(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(...$n(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[l,h,u,d,f,p]=a;n.push(...L$(l,h,u,d,f,p,s,e)),s=[f,p];break}case"Z":n.push(...$n(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function Th(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]+At(i,e),n[0][1]+At(i,e)]});for(let o=1;o<s;o++)r.push({op:"lineTo",data:[n[o][0]+At(i,e),n[o][1]+At(i,e)]})}}return{type:"fillPath",ops:r}}function Ii(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!lr[i])switch(i){case"zigzag":lr[i]||(lr[i]=new v$(n));break;case"cross-hatch":lr[i]||(lr[i]=new w$(n));break;case"dots":lr[i]||(lr[i]=new S$(n));break;case"dashed":lr[i]||(lr[i]=new T$(n));break;case"zigzag-line":lr[i]||(lr[i]=new _$(n));break;default:i="hachure",lr[i]||(lr[i]=new Hp(n))}return lr[i]})(e,N$).fillPolygons(t,e)}function _g(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function Mk(t){return t.randomizer||(t.randomizer=new E$(t.seed||0)),t.randomizer.next()}function Ul(t,e,r,n=1){return r.roughness*n*(Mk(r)*(e-t)+t)}function At(t,e,r=1){return Ul(-t,t,e,r)}function $n(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=Uu(t,e,r,n,i,!0,!1);if(o)return a;const l=Uu(t,e,r,n,i,!0,!0);return a.concat(l)}function Uu(t,e,r,n,i,s,o){const a=Math.pow(t-r,2)+Math.pow(e-n,2),l=Math.sqrt(a);let h=1;h=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,f=.2+.2*Mk(i);let p=i.bowing*i.maxRandomnessOffset*(n-e)/200,m=i.bowing*i.maxRandomnessOffset*(t-r)/200;p=At(p,i,h),m=At(m,i,h);const x=[],g=()=>At(d,i,h),y=()=>At(u,i,h),C=i.preserveVertices;return o?x.push({op:"move",data:[t+(C?0:g()),e+(C?0:g())]}):x.push({op:"move",data:[t+(C?0:At(u,i,h)),e+(C?0:At(u,i,h))]}),o?x.push({op:"bcurveTo",data:[p+t+(r-t)*f+g(),m+e+(n-e)*f+g(),p+t+2*(r-t)*f+g(),m+e+2*(n-e)*f+g(),r+(C?0:g()),n+(C?0:g())]}):x.push({op:"bcurveTo",data:[p+t+(r-t)*f+y(),m+e+(n-e)*f+y(),p+t+2*(r-t)*f+y(),m+e+2*(n-e)*f+y(),r+(C?0:y()),n+(C?0:y())]}),x}function Ma(t,e,r){if(!t.length)return[];const n=[];n.push([t[0][0]+At(e,r),t[0][1]+At(e,r)]),n.push([t[0][0]+At(e,r),t[0][1]+At(e,r)]);for(let i=1;i<t.length;i++)n.push([t[i][0]+At(e,r),t[i][1]+At(e,r)]),i===t.length-1&&n.push([t[i][0]+At(e,r),t[i][1]+At(e,r)]);return Yl(n,null,r)}function Yl(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(...Uu(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function Eg(t,e,r,n,i,s,o,a){const l=[],h=[];if(a.roughness===0){t/=4,h.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),h.push(d)}h.push([e+n*Math.cos(0),r+i*Math.sin(0)]),h.push([e+n*Math.cos(t),r+i*Math.sin(t)])}else{const u=At(.5,a)-Math.PI/2;h.push([At(s,a)+e+.9*n*Math.cos(u-t),At(s,a)+r+.9*i*Math.sin(u-t)]);const d=2*Math.PI+u-.01;for(let f=u;f<d;f+=t){const p=[At(s,a)+e+n*Math.cos(f),At(s,a)+r+i*Math.sin(f)];l.push(p),h.push(p)}h.push([At(s,a)+e+n*Math.cos(u+2*Math.PI+.5*o),At(s,a)+r+i*Math.sin(u+2*Math.PI+.5*o)]),h.push([At(s,a)+e+.98*n*Math.cos(u+o),At(s,a)+r+.98*i*Math.sin(u+o)]),h.push([At(s,a)+e+.9*n*Math.cos(u+.5*o),At(s,a)+r+.9*i*Math.sin(u+.5*o)])}return[h,l]}function jg(t,e,r,n,i,s,o,a,l){const h=s+At(.1,l),u=[];u.push([At(a,l)+e+.9*n*Math.cos(h-t),At(a,l)+r+.9*i*Math.sin(h-t)]);for(let d=h;d<=o;d+=t)u.push([At(a,l)+e+n*Math.cos(d),At(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)]),Yl(u,null,l)}function L$(t,e,r,n,i,s,o,a){const l=[],h=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let u=[0,0];const d=a.disableMultiStroke?1:2,f=a.preserveVertices;for(let p=0;p<d;p++)p===0?l.push({op:"move",data:[o[0],o[1]]}):l.push({op:"move",data:[o[0]+(f?0:At(h[0],a)),o[1]+(f?0:At(h[0],a))]}),u=f?[i,s]:[i+At(h[p],a),s+At(h[p],a)],l.push({op:"bcurveTo",data:[t+At(h[p],a),e+At(h[p],a),r+At(h[p],a),n+At(h[p],a),u[0],u[1]]});return l}function ro(t){return[...t]}function Ng(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(ro(t[0]),ro(t[1]),ro(t[2]),ro(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(ro(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 il(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function A$(t,e,r){const n=il(e,r);if(n===0)return il(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)),il(t,Jn(e,r,i))}function Jn(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function Yu(t,e,r,n){const i=n||[];if((function(a,l){const h=a[l+0],u=a[l+1],d=a[l+2],f=a[l+3];let p=3*u[0]-2*h[0]-f[0];p*=p;let m=3*u[1]-2*h[1]-f[1];m*=m;let x=3*d[0]-2*f[0]-h[0];x*=x;let g=3*d[1]-2*f[1]-h[1];return g*=g,p<x&&(p=x),m<g&&(m=g),p+m})(t,e)<r){const a=t[e+0];i.length?(s=i[i.length-1],o=a,Math.sqrt(il(s,o))>1&&i.push(a)):i.push(a),i.push(t[e+3])}else{const l=t[e+0],h=t[e+1],u=t[e+2],d=t[e+3],f=Jn(l,h,.5),p=Jn(h,u,.5),m=Jn(u,d,.5),x=Jn(f,p,.5),g=Jn(p,m,.5),y=Jn(x,g,.5);Yu([l,f,x,y],0,r,i),Yu([y,g,m,d],0,r,i)}var s,o;return i}function M$(t,e){return Gl(t,0,t.length,e)}function Gl(t,e,r,n,i){const s=i||[],o=t[e],a=t[r-1];let l=0,h=1;for(let u=e+1;u<r-1;++u){const d=A$(t[u],o,a);d>l&&(l=d,h=u)}return Math.sqrt(l)>n?(Gl(t,e,h+1,n,s),Gl(t,h,r,n,s)):(s.length||s.push(o),s.push(a)),s}function _h(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)Yu(t,3*s,e,n);return r&&r>0?Gl(n,0,n.length,r):n}const xr="none";class Vl{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",[Lk(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=B$(e,r,n,i,o);if(o.fill){const h=[[e,r],[e+n,r],[e+n,r+i],[e,r+i]];o.fillStyle==="solid"?a.push(Th([h],o)):a.push(Ii([h],o))}return o.stroke!==xr&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=Ak(n,i,o),h=Hu(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=Hu(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push(Ii([h.estimatedPoints],o));return o.stroke!==xr&&a.push(h.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 h=this._o(l),u=[],d=Sg(e,r,n,i,s,o,a,!0,h);if(a&&h.fill)if(h.fillStyle==="solid"){const f=Object.assign({},h);f.disableMultiStroke=!0;const p=Sg(e,r,n,i,s,o,!0,!1,f);p.type="fillPath",u.push(p)}else u.push((function(f,p,m,x,g,y,C){const b=f,S=p;let _=Math.abs(m/2),w=Math.abs(x/2);_+=At(.01*_,C),w+=At(.01*w,C);let B=g,L=y;for(;B<0;)B+=2*Math.PI,L+=2*Math.PI;L-B>2*Math.PI&&(B=0,L=2*Math.PI);const I=(L-B)/C.curveStepCount,E=[];for(let F=B;F<=L;F+=I)E.push([b+_*Math.cos(F),S+w*Math.sin(F)]);return E.push([b+_*Math.cos(L),S+w*Math.sin(L)]),E.push([b,S]),Ii([E],C)})(e,r,n,i,s,o,h));return h.stroke!==xr&&u.push(d),this._d("arc",u,h)}curve(e,r){const n=this._o(r),i=[],s=wg(e,n);if(n.fill&&n.fill!==xr)if(n.fillStyle==="solid"){const o=wg(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 h of l)h.length<3?o.push(...h):h.length===3?o.push(..._h(Ng([h[0],h[0],h[1],h[2]]),10,(1+n.roughness)/2)):o.push(..._h(Ng(h),10,(1+n.roughness)/2))}o.length&&i.push(Ii([o],n))}return n.stroke!==xr&&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(Th([e],n)):i.push(Ii([e],n))),n.stroke!==xr&&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!==xr,o=n.stroke!==xr,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,f){const p=Nk(jk(Up(u))),m=[];let x=[],g=[0,0],y=[];const C=()=>{y.length>=4&&x.push(..._h(y,d)),y=[]},b=()=>{C(),x.length&&(m.push(x),x=[])};for(const{key:_,data:w}of p)switch(_){case"M":b(),g=[w[0],w[1]],x.push(g);break;case"L":C(),x.push([w[0],w[1]]);break;case"C":if(!y.length){const B=x.length?x[x.length-1]:g;y.push([B[0],B[1]])}y.push([w[0],w[1]]),y.push([w[2],w[3]]),y.push([w[4],w[5]]);break;case"Z":C(),x.push([g[0],g[1]])}if(b(),!f)return m;const S=[];for(const _ of m){const w=M$(_,f);w.length&&S.push(w)}return S})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),h=Tg(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=Tg(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(Th(l,n));else i.push(Ii(l,n));return o&&(a?l.forEach((u=>{i.push(nl(u,!1,n))})):i.push(h)),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:xr};break;case"fillPath":o={d:this.opsToPath(s),stroke:xr,strokeWidth:0,fill:n.fill||xr};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||xr,strokeWidth:n,fill:xr}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class I${constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new Vl(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 h=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(h),h}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 Ia="http://www.w3.org/2000/svg";class F${constructor(e,r){this.svg=e,this.gen=new Vl(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(Ia,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(Ia,"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(Ia,"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(Ia,"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 h=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(h)}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 ft={canvas:(t,e)=>new I$(t,e),svg:(t,e)=>new F$(t,e),generator:t=>new Vl(t),newSeed:()=>Vl.newSeed()},Lt=k(async(t,e,r)=>{var p,m;let n;const i=e.useHtmlLabels||yn((p=Jt())==null?void 0:p.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",Fe(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,h=e.labelType==="markdown",u=await bn(o,zr(gi(a),Jt()),{useHtmlLabels:i,width:e.width||((m=Jt().flowchart)==null?void 0:m.wrappingWidth),classes:h?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:h},Jt());let d=u.getBBox();const f=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=Ut(u);await JC(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:f,label:o}},"labelHelper"),Eh=k(async(t,e,r)=>{var l,h;const n=r.useHtmlLabels??or(Jt()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await bn(i,zr(gi(e),Jt()),{useHtmlLabels:n,width:r.width||((h=(l=Jt())==null?void 0:l.flowchart)==null?void 0:h.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let o=s.getBBox();const a=r.padding/2;if(or(Jt())){const u=s.children[0],d=Ut(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"),Ct=k((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),Bt=k((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Xt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}k(Xt,"createPathFromPoints");function Rn(t,e,r,n,i,s){const o=[],l=r-t,h=n-e,u=l/s,d=2*Math.PI/u,f=e+h/2;for(let p=0;p<=50;p++){const m=p/50,x=t+m*l,g=f+i*Math.sin(d*(x-t));o.push({x,y:g})}return o}k(Rn,"generateFullSineWavePoints");function Ho(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 f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:-p,y:-m})}return o}k(Ho,"generateCirclePoints");function Gu(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=k((l,h)=>(l==null?void 0:l.getAttribute(h))??void 0,"getAttr");if(i){const l={fill:o(i,"fill"),"fill-opacity":o(i,"fill-opacity")??"1"};Object.entries(l).forEach(([h,u])=>{u&&r.setAttribute(h,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(([h,u])=>{u&&r.setAttribute(h,u)})}const a=document.createElementNS("http://www.w3.org/2000/svg","g");return a.appendChild(r),a}k(Gu,"mergePaths");var D$=k((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,h;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),l=s===0?0:a*i/s,h=a):(i<0&&(o=-o),l=o,h=i===0?0:o*s/i),{x:r+l,y:n+h}},"intersectRect"),As=D$,P$=k(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=Jt(),a=or(o);return await bn(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),Bn=P$,Hn=k((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"),Ik=k(async(t,e)=>{et.info("Creating subgraph rect for ",e.id,e);const r=Jt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=bt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=or(r),p=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await bn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width}):m=await Bn(p,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(or(r)){const B=m.children[0],L=Ut(m);x=B.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,C=e.x-g/2,b=e.y-y/2;et.trace("Data ",e,JSON.stringify(e));let S;if(e.look==="handDrawn"){const B=ft.svg(d),L=xt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),I=B.path(Hn(C,b,g,y,0),L);S=d.insert(()=>(et.debug("Rough node insert CXC",I),I),":first-child"),S.select("path:nth-child(2)").attr("style",h.join(";")),S.select("path").attr("style",u.join(";").replace("fill","stroke"))}else S=d.insert("rect",":first-child"),S.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",C).attr("y",b).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=Mp(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const B=p.select("span");B&&B.attr("style",a)}const w=S.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(B){return As(e,B)},{cluster:d,labelBBox:x}},"rect"),O$=k((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 As(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),$$=k(async(t,e)=>{const r=Jt(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:s,compositeBackground:o,compositeTitleBackground:a,nodeBorder:l}=n,h=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-id",e.id).attr("data-look",e.look),u=h.insert("g",":first-child"),d=h.insert("g").attr("class","cluster-label");let f=h.append("rect");const p=await Bn(d,e.label,e.labelStyle,void 0,!0);let m=p.getBBox();if(or(r)){const I=p.children[0],E=Ut(p);m=I.getBoundingClientRect(),E.attr("width",m.width),E.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 C=e.height+x,b=e.height+x-m.height-6,S=e.x-y/2,_=e.y-C/2;e.width=y;const w=e.y-e.height/2-g+m.height+2;let B;if(e.look==="handDrawn"){const I=e.cssClasses.includes("statediagram-cluster-alt"),E=ft.svg(h),F=e.rx||e.ry?E.path(Hn(S,_,y,C,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):E.rectangle(S,_,y,C,{seed:i});B=h.insert(()=>F,":first-child");const z=E.rectangle(S,w,y,b,{fill:I?s:o,fillStyle:I?"hachure":"solid",stroke:l,seed:i});B=h.insert(()=>F,":first-child"),f=h.insert(()=>z)}else B=u.insert("rect",":first-child"),B.attr("class","outer").attr("x",S).attr("y",_).attr("width",y).attr("height",C).attr("data-look",e.look),f.attr("class","inner").attr("x",S).attr("y",w).attr("width",y).attr("height",b);d.attr("transform",`translate(${e.x-m.width/2}, ${_+1-(or(r)?0:3)})`);const L=B.node().getBBox();return e.height=L.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(I){return As(e,I)},{cluster:h,labelBBox:m}},"roundedWithTitle"),R$=k(async(t,e)=>{et.info("Creating subgraph rect for ",e.id,e);const r=Jt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=bt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=or(r),p=d.insert("g").attr("class","cluster-label "),m=await bn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width});let x=m.getBBox();if(or(r)){const B=m.children[0],L=Ut(m);x=B.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,C=e.x-g/2,b=e.y-y/2;et.trace("Data ",e,JSON.stringify(e));let S;if(e.look==="handDrawn"){const B=ft.svg(d),L=xt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),I=B.path(Hn(C,b,g,y,e.rx),L);S=d.insert(()=>(et.debug("Rough node insert CXC",I),I),":first-child"),S.select("path:nth-child(2)").attr("style",h.join(";")),S.select("path").attr("style",u.join(";").replace("fill","stroke"))}else S=d.insert("rect",":first-child"),S.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",C).attr("y",b).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=Mp(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const B=p.select("span");B&&B.attr("style",a)}const w=S.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(B){return As(e,B)},{cluster:d,labelBBox:x}},"kanbanSection"),z$=k((t,e)=>{const r=Jt(),{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,h=e.width+l;e.diff=-e.padding;const u=e.height+l,d=e.x-h/2,f=e.y-u/2;e.width=h;let p;if(e.look==="handDrawn"){const g=ft.svg(o).rectangle(d,f,h,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:s,seed:i});p=o.insert(()=>g,":first-child")}else{p=a.insert("rect",":first-child");let x="outer";e.look,x="divider",p.attr("class",x).attr("x",d).attr("y",f).attr("width",h).attr("height",u).attr("data-look",e.look)}const m=p.node().getBBox();return e.height=m.height,e.offsetX=0,e.offsetY=0,e.intersect=function(x){return As(e,x)},{cluster:o,labelBBox:{}}},"divider"),W$=Ik,q$={rect:Ik,squareRect:W$,roundedWithTitle:$$,noteGroup:O$,divider:z$,kanbanSection:R$},Fk=new Map,H$=k(async(t,e)=>{const r=e.shape||"rect",n=await q$[r](t,e);return Fk.set(e.id,n),n},"insertCluster"),SY=k(()=>{Fk=new Map},"clear");function Dk(t,e){return t.intersect(e)}k(Dk,"intersectNode");var U$=Dk;function Pk(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),h=Math.abs(e*r*o/l);n.x<i&&(h=-h);var u=Math.abs(e*r*a/l);return n.y<s&&(u=-u),{x:i+h,y:s+u}}k(Pk,"intersectEllipse");var Ok=Pk;function $k(t,e,r){return Ok(t,e,e,r)}k($k,"intersectCircle");var Y$=$k;function Rk(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,h=1e-6;if(a!==0&&l!==0&&Vu(a,l))return;const u=n.y-r.y,d=r.x-n.x,f=n.x*r.y-r.x*n.y,p=u*t.x+d*t.y+f,m=u*e.x+d*e.y+f;if(Math.abs(p)<h&&Math.abs(m)<h&&Vu(p,m))return;const x=i*d-u*s;if(x===0)return;const g=Math.abs(x/2);let y=s*f-d*o;const C=y<0?(y-g)/x:(y+g)/x;y=u*o-i*f;const b=y<0?(y-g)/x:(y+g)/x;return{x:C,y:b}}}k(Rk,"intersectLine");function Vu(t,e){return t*e>0}k(Vu,"sameSign");var G$=Rk;function zk(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,h=i-t.height/2-a;for(let u=0;u<e.length;u++){let d=e[u],f=e[u<e.length-1?u+1:0],p=G$(t,r,{x:l+d.x,y:h+d.y},{x:l+f.x,y:h+f.y});p&&s.push(p)}return s.length?(s.length>1&&s.sort(function(u,d){let f=u.x-r.x,p=u.y-r.y,m=Math.sqrt(f*f+p*p),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}k(zk,"intersectPolygon");var V$=zk,pt={node:U$,circle:Y$,ellipse:Ok,polygon:V$,rect:As};function Wk(t,e){const{labelStyles:r}=bt(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=ft.svg(s),h=xt(e,{fill:"black",stroke:"none",fillStyle:"solid"});e.look!=="handDrawn"&&(h.roughness=0);const u=l.circle(0,0,o*2,h),d=s.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",Fe(a)),Ct(e,d),e.intersect=function(f){return et.info("Circle intersect",e,o,f),pt.circle(e,o,f)},s}k(Wk,"anchor");function Xu(t,e,r,n,i,s,o){const l=(t+r)/2,h=(e+n)/2,u=Math.atan2(n-e,r-t),d=(r-t)/2,f=(n-e)/2,p=d/i,m=f/s,x=Math.sqrt(p**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),C=h-g*i*Math.cos(u)*(o?-1:1),b=Math.atan2((e-C)/s,(t-y)/i);let _=Math.atan2((n-C)/s,(r-y)/i)-b;o&&_<0&&(_+=2*Math.PI),!o&&_>0&&(_-=2*Math.PI);const w=[];for(let B=0;B<20;B++){const L=B/19,I=b+L*_,E=y+i*Math.cos(I),F=C+s*Math.sin(I);w.push({x:E,y:F})}return w}k(Xu,"generateArcPoints");function qk(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}k(qk,"calculateArcSagitta");async function Hk(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=k(I=>I+o,"calcTotalHeight"),l=k(I=>{const E=I/2;return[E/(2.5+I/50),E]},"calcEllipseRadius"),{shapeSvg:h,bbox:u}=await Lt(t,e,Bt(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[f,p]=l(d),m=qk(d,f,p),g=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2+m-m,y=d,{cssStyles:C}=e,b=[{x:g/2,y:-y/2},{x:-g/2,y:-y/2},...Xu(-g/2,-y/2,-g/2,y/2,f,p,!1),{x:g/2,y:y/2},...Xu(g/2,y/2,g/2,-y/2,f,p,!0)],S=ft.svg(h),_=xt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=Xt(b),B=S.path(w,_),L=h.insert(()=>B,":first-child");return L.attr("class","basic label-container outer-path"),C&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",C),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(${f/2}, 0)`),Ct(e,L),e.intersect=function(I){return pt.polygon(e,b,I)},h}k(Hk,"bowTieRect");function Cn(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+")")}k(Cn,"insertPolygonShape");var Fa=12;async function Uk(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 Lt(t,e,Bt(e)),h=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s+Fa),u=((e==null?void 0:e.height)??l.height)+(e.look==="neo"?o*2:o),d=0,f=h,p=-u,m=0,x=[{x:d+Fa,y:p},{x:f,y:p},{x:f,y:m},{x:d,y:m},{x:d,y:p+Fa},{x:d+Fa,y:p}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const C=ft.svg(a),b=xt(e,{}),S=Xt(x),_=C.path(S,b);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),y&&g.attr("style",y)}else g=Cn(a,h,u,x);return n&&g.attr("style",n),Ct(e,g),e.intersect=function(C){return pt.polygon(e,x,C)},a}k(Uk,"card");function Yk(t,e){const{nodeStyles:r}=bt(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=ft.svg(n),l=xt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=Xt(o),u=a.path(h,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(f){return pt.polygon(e,o,f)},n}k(Yk,"choice");async function Yp(t,e,r){const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await Lt(t,e,Bt(e)),l=16,h=(r==null?void 0:r.padding)??a,u=e.look==="neo"?o.width/2+l*2:o.width/2+h;let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const p=ft.svg(s),m=xt(e,{}),x=p.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",Fe(f))}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 Ct(e,d),e.calcIntersect=function(p,m){const x=p.width/2;return pt.circle(p,x,m)},e.intersect=function(p){return et.info("Circle intersect",e,u,p),pt.circle(e,u,p)},s}k(Yp,"circle");function Gk(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}
530
- M ${i.x},${i.y} L ${o.x},${o.y}`}k(Gk,"createLine");function Vk(t,e){const{labelStyles:r,nodeStyles:n}=bt(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=ft.svg(i),l=xt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=a.circle(0,0,s*2,l),u=Gk(s),d=a.path(u,l),f=i.insert(()=>h,":first-child");return f.insert(()=>d),f.attr("class","outer-path"),o&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",o),n&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",n),Ct(e,f),e.intersect=function(p){return et.info("crossedCircle intersect",e,{radius:s,point:p}),pt.circle(e,s,p)},i}k(Vk,"crossedCircle");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 f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:-p,y:-m})}return o}k(cn,"generateCirclePoints");async function Xk(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Lt(t,e,Bt(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,h=s.width+a,u=s.height+l,d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...cn(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...cn(h/2+d*2,-d,d,20,-180,-270),...cn(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...cn(h/2,u/2,d,20,0,90)],m=[{x:h/2,y:-u/2-d},{x:-h/2,y:-u/2-d},...cn(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...cn(h/2+h*.1,-d,d,20,-180,-270),...cn(h/2+h*.1,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...cn(h/2,u/2,d,20,0,90),{x:-h/2,y:u/2+d},{x:h/2,y:u/2+d}],x=ft.svg(i),g=xt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Xt(p).replace("Z",""),b=x.path(C,g),S=Xt(m),_=x.path(S,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":first-child").attr("stroke-opacity",0),w.insert(()=>b,":first-child"),w.attr("class","text"),f&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${d}, 0)`),o.attr("transform",`translate(${-h/2+d-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),Ct(e,w),e.intersect=function(B){return pt.polygon(e,m,B)},i}k(Xk,"curlyBraceLeft");function hn(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 f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:p,y:m})}return o}k(hn,"generateCirclePoints");async function Kk(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Lt(t,e,Bt(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,h=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...hn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...hn(h/2+d*2,-d,d,20,-180,-270),...hn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...hn(h/2,u/2,d,20,0,90)],m=[{x:-h/2,y:-u/2-d},{x:h/2,y:-u/2-d},...hn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...hn(h/2+d*2,-d,d,20,-180,-270),...hn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...hn(h/2,u/2,d,20,0,90),{x:h/2,y:u/2+d},{x:-h/2,y:u/2+d}],x=ft.svg(i),g=xt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Xt(p).replace("Z",""),b=x.path(C,g),S=Xt(m),_=x.path(S,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":first-child").attr("stroke-opacity",0),w.insert(()=>b,":first-child"),w.attr("class","text"),f&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${-d}, 0)`),o.attr("transform",`translate(${-h/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),Ct(e,w),e.intersect=function(B){return pt.polygon(e,m,B)},i}k(Kk,"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 f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:-p,y:-m})}return o}k($e,"generateCirclePoints");async function Qk(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Lt(t,e,Bt(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,h=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...$e(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...$e(h/2+d*2,-d,d,20,-180,-270),...$e(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...$e(h/2,u/2,d,20,0,90)],m=[...$e(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...$e(-h/2-d/2,-d,d,20,0,90),...$e(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...$e(-h/2+d+d/2,u/2,d,30,-180,-270)],x=[{x:h/2,y:-u/2-d},{x:-h/2,y:-u/2-d},...$e(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...$e(h/2+d*2,-d,d,20,-180,-270),...$e(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...$e(h/2,u/2,d,20,0,90),{x:-h/2,y:u/2+d},{x:h/2-d-d/2,y:u/2+d},...$e(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...$e(-h/2-d/2,-d,d,20,0,90),...$e(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...$e(-h/2+d+d/2,u/2,d,30,-180,-270)],g=ft.svg(i),y=xt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=Xt(p).replace("Z",""),S=g.path(b,y),w=Xt(m).replace("Z",""),B=g.path(w,y),L=Xt(x),I=g.path(L,{...y}),E=i.insert("g",":first-child");return E.insert(()=>I,":first-child").attr("stroke-opacity",0),E.insert(()=>S,":first-child"),E.insert(()=>B,":first-child"),E.attr("class","text"),f&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(${d-d/4}, 0)`),o.attr("transform",`translate(${-h/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),Ct(e,E),e.intersect=function(F){return pt.polygon(e,x,F)},i}k(Qk,"curlyBraces");async function Zk(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:h,bbox:u}=await Lt(t,e,Bt(e)),d=Math.max(a,(u.width+s*2)*1.25,(e==null?void 0:e.width)??0),f=Math.max(l,u.height+o*2,(e==null?void 0:e.height)??0),p=f/2,{cssStyles:m}=e,x=ft.svg(h),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,C=f,b=y-p,S=C/4,_=[{x:b,y:0},{x:S,y:0},{x:0,y:C/2},{x:S,y:C},{x:b,y:C},...Ho(-b,-C/2,p,50,270,90)],w=Xt(_),B=x.path(w,g),L=h.insert(()=>B,":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}, ${-f/2})`),Ct(e,L),e.intersect=function(I){return pt.polygon(e,_,I)},h}k(Zk,"curvedTrapezoid");var X$=k((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"),K$=k((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"),Q$=k((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Bg=8,Lg=8;async function Jk(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<Lg&&(e.width=Lg);const C=g/2/(2.5+g/50);e.height=(e.height??0)-s-C*3,e.height<Bg&&(e.height=Bg)}const{shapeSvg:a,bbox:l,label:h}=await Lt(t,e,Bt(e)),u=(e.width?e.width:l.width)+o,d=u/2,f=d/(2.5+u/50),p=(e.height?e.height:l.height)+s+f;let m;const{cssStyles:x}=e;if(e.look==="handDrawn"){const g=ft.svg(a),y=K$(0,0,u,p,d,f),C=Q$(0,f,u,p,d,f),b=xt(e,{}),S=g.path(y,b),_=g.path(C,xt(e,{fill:"none"}));m=a.insert(()=>_,":first-child"),m=a.insert(()=>S,":first-child"),m.attr("class","basic label-container"),x&&m.attr("style",x)}else{const g=X$(0,0,u,p,d,f);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",Fe(x)).attr("style",n)}return m.attr("label-offset-y",f),m.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),Ct(e,m),h.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),C=y.x-(e.x??0);if(d!=0&&(Math.abs(C)<(e.width??0)/2||Math.abs(C)==(e.width??0)/2&&Math.abs(y.y-(e.y??0))>(e.height??0)/2-f)){let b=f*f*(1-C*C/(d*d));b>0&&(b=Math.sqrt(b)),b=f-b,g.y-(e.y??0)>0&&(b=-b),y.y+=b}return y},a}k(Jk,"cylinder");async function Ms(t,e,r){const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await Lt(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),h=-a/2,u=-l/2;let d,{rx:f,ry:p}=e;const{cssStyles:m}=e;if(r!=null&&r.rx&&r.ry&&(f=r.rx,p=r.ry),e.look==="handDrawn"){const x=ft.svg(s),g=xt(e,{}),y=f||p?x.path(Hn(h,u,a,l,f||0),g):x.rectangle(h,u,a,l,g);d=s.insert(()=>y,":first-child"),d.attr("class","basic label-container").attr("style",Fe(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",Fe(f)).attr("ry",Fe(p)).attr("x",h).attr("y",u).attr("width",a).attr("height",l);return Ct(e,d),e.calcIntersect=function(x,g){return pt.rect(x,g)},e.intersect=function(x){return pt.rect(e,x)},s}k(Ms,"drawRect");async function tv(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},h=await Ms(t,e,l);if(e.look==="handDrawn"){const p=ft.svg(h),m=xt(e,{}),x=h.select(".basic.label-container > path:nth-child(2)"),g=x.node();if(!g)return h;let y=null;if(g instanceof SVGGraphicsElement)y=g.getBBox();else return h;return h.insert(()=>p.line(y.x,y.y,y.x+y.width,y.y,m),".basic.label-container g.label"),h.insert(()=>p.line(y.x,y.y+y.height,y.x+y.width,y.y+y.height,m),".basic.label-container g.label"),x.remove(),h}const u=h.select(".basic.label-container"),d=(Number(u.attr("width"))||o)??0,f=(Number(u.attr("height"))||a)??0;return d>0&&f>0&&u.attr("stroke-dasharray",`${d} ${f}`),h}k(tv,"datastore");async function ev(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 Lt(t,e,Bt(e)),h=a.width+i,u=a.height+s,d=u*.2,f=-h/2,p=-u/2-d/2,{cssStyles:m}=e,x=ft.svg(o),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:f,y:p+d},{x:-f,y:p+d},{x:-f,y:-p},{x:f,y:-p},{x:f,y:p},{x:-f,y:p},{x:-f,y:p+d}],C=x.polygon(y.map(S=>[S.x,S.y]),g),b=o.insert(()=>C,":first-child");return b.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),l.attr("transform",`translate(${f+(e.padding??0)/2-(a.x-(a.left??0))}, ${p+d+(e.padding??0)/2-(a.y-(a.top??0))})`),Ct(e,b),e.intersect=function(S){return pt.rect(e,S)},o}k(ev,"dividedRectangle");async function rv(t,e){var p,m;const{labelStyles:r,nodeStyles:n}=bt(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 Lt(t,e,Bt(e)),h=(e!=null&&e.width?(e==null?void 0:e.width)/2:l.width/2)+(o??0),u=h-i;let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const x=ft.svg(a),g=xt(e,{roughness:.2,strokeWidth:2.5}),y=xt(e,{roughness:.2,strokeWidth:1.5}),C=x.circle(0,0,h*2,g),b=x.circle(0,0,u*2,y);d=a.insert("g",":first-child"),d.attr("class",Fe(e.cssClasses)).attr("style",Fe(f)),(p=d.node())==null||p.appendChild(C),(m=d.node())==null||m.appendChild(b)}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",h).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",n).attr("r",u).attr("cx",0).attr("cy",0)}return Ct(e,d),e.intersect=function(x){return et.info("DoubleCircle intersect",e,h,x),pt.circle(e,h,x)},a}k(rv,"doublecircle");function nv(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=bt(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=ft.svg(s),{nodeBorder:h}=r,u=xt(e,{fillStyle:"solid"});e.look!=="handDrawn"&&(u.roughness=0);const d=l.circle(0,0,o*2,u),f=s.insert(()=>d,":first-child");return f.selectAll("path").attr("style",`fill: ${h} !important;`),a&&a.length>0&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",a),i&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",i),Ct(e,f),e.intersect=function(p){return et.info("filledCircle intersect",e,{radius:o,point:p}),pt.circle(e,o,p)},s}k(nv,"filledCircle");var Ag=10,Mg=10;async function iv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<Ag&&(e.height=Ag),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<Mg&&(e.width=Mg));const{shapeSvg:o,bbox:a,label:l}=await Lt(t,e,Bt(e)),h=(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:h+a.height,d=u,f=[{x:0,y:-u},{x:d,y:-u},{x:d/2,y:0}],{cssStyles:p}=e,m=ft.svg(o),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Xt(f),y=m.path(g,x),C=o.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`).attr("class","outer-path");return p&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",p),n&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",n),e.width=h,e.height=u,Ct(e,C),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(b){return et.info("Triangle intersect",e,f,b),pt.polygon(e,f,b)},o}k(iv,"flippedTriangle");function sv(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=bt(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),h=Math.max(10,(e==null?void 0:e.height)??0);r==="LR"&&(l=Math.max(10,(e==null?void 0:e.width)??0),h=Math.max(70,(e==null?void 0:e.height)??0));const u=-1*l/2,d=-1*h/2,f=ft.svg(o),p=xt(e,{stroke:i.lineColor,fill:i.lineColor});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=f.rectangle(u,d,l,h,p),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),Ct(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}k(sv,"forkJoin");async function ov(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:h}=await Lt(t,e,Bt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:Math.max(i,h.width))+o*2,d=(e!=null&&e.height?e==null?void 0:e.height:Math.max(s,h.height))+a*2,f=d/2,{cssStyles:p}=e,m=ft.svg(l),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-u/2,y:-d/2},{x:u/2-f,y:-d/2},...Ho(-u/2+f,0,f,50,90,270),{x:u/2-f,y:d/2},{x:-u/2,y:d/2}],y=Xt(g),C=m.path(y,x),b=l.insert(()=>C,":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),Ct(e,b),e.intersect=function(S){return et.info("Pill intersect",e,{radius:f,point:S}),pt.polygon(e,g,S)},l}k(ov,"halfRoundedRectangle");var Z$=k((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 av(t,e){const{labelStyles:r,nodeStyles:n}=bt(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,h=e.look==="neo"?a:s;if(e.width||e.height){const b=(e.height??0)/i;e.width=((e==null?void 0:e.width)??0)-2*b-h,e.height=(e.height??0)-l}const{shapeSvg:u,bbox:d}=await Lt(t,e,Bt(e)),f=(e!=null&&e.height?e==null?void 0:e.height:d.height)+l,p=f/i,m=(e!=null&&e.width?e==null?void 0:e.width:d.width)+2*p+h,x=[{x:p,y:0},{x:m-p,y:0},{x:m,y:-f/2},{x:m-p,y:-f},{x:p,y:-f},{x:0,y:-f/2}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const C=ft.svg(u),b=xt(e,{}),S=Z$(0,0,m,f,p),_=C.path(S,b);g=u.insert(()=>_,":first-child").attr("transform",`translate(${-m/2}, ${f/2})`),y&&g.attr("style",y)}else g=Cn(u,m,f,x);return n&&g.attr("style",n),e.width=m,e.height=f,Ct(e,g),e.intersect=function(C){return pt.polygon(e,x,C)},u}k(av,"hexagon");async function lv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await Lt(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=ft.svg(i),h=xt(e,{});e.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const u=[{x:0,y:0},{x:s,y:0},{x:0,y:o},{x:s,y:o}],d=Xt(u),f=l.path(d,h),p=i.insert(()=>f,":first-child");return p.attr("class","basic label-container outer-path"),a&&e.look!=="handDrawn"&&p.selectChildren("path").attr("style",a),n&&e.look!=="handDrawn"&&p.selectChildren("path").attr("style",n),p.attr("transform",`translate(${-s/2}, ${-o/2})`),Ct(e,p),e.intersect=function(m){return et.info("Pill intersect",e,{points:u}),pt.polygon(e,u,m)},i}k(lv,"hourglass");async function cv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(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:h,bbox:u,label:d}=await Lt(t,e,"icon-shape default"),f=e.pos==="t",p=a,m=a,{nodeBorder:x}=r,{stylesMap:g}=Ls(e),y=-m/2,C=-p/2,b=e.label?8:0,S=ft.svg(h),_=xt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=S.rectangle(y,C,m,p,_),B=Math.max(m,u.width),L=p+u.height+b,I=S.rectangle(-B/2,-L/2,B,L,{..._,fill:"transparent",stroke:"none"}),E=h.insert(()=>w,":first-child"),F=h.insert(()=>I);if(e.icon){const z=h.append("g");z.html(`<g>${await la(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const W=z.node().getBBox(),O=W.width,M=W.height,A=W.x,P=W.y;z.attr("transform",`translate(${-O/2-A},${f?u.height/2+b/2-M/2-P:-u.height/2-b/2-M/2-P})`),z.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-L/2:L/2-u.height})`),E.attr("transform",`translate(0,${f?u.height/2+b/2:-u.height/2-b/2})`),Ct(e,F),e.intersect=function(z){if(et.info("iconSquare intersect",e,z),!e.label)return pt.rect(e,z);const W=e.x??0,O=e.y??0,M=e.height??0;let A=[];return f?A=[{x:W-u.width/2,y:O-M/2},{x:W+u.width/2,y:O-M/2},{x:W+u.width/2,y:O-M/2+u.height+b},{x:W+m/2,y:O-M/2+u.height+b},{x:W+m/2,y:O+M/2},{x:W-m/2,y:O+M/2},{x:W-m/2,y:O-M/2+u.height+b},{x:W-u.width/2,y:O-M/2+u.height+b}]:A=[{x:W-m/2,y:O-M/2},{x:W+m/2,y:O-M/2},{x:W+m/2,y:O-M/2+p},{x:W+u.width/2,y:O-M/2+p},{x:W+u.width/2/2,y:O+M/2},{x:W-u.width/2,y:O+M/2},{x:W-u.width/2,y:O-M/2+p},{x:W-m/2,y:O-M/2+p}],pt.polygon(e,A,z)},h}k(cv,"icon");async function hv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(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:h,bbox:u,label:d}=await Lt(t,e,"icon-shape default"),f=20,p=e.label?8:0,m=e.pos==="t",{nodeBorder:x,mainBkg:g}=r,{stylesMap:y}=Ls(e),C=ft.svg(h),b=xt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const S=y.get("fill");b.stroke=S??g;const _=h.append("g");e.icon&&_.html(`<g>${await la(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const w=_.node().getBBox(),B=w.width,L=w.height,I=w.x,E=w.y,F=Math.max(B,L)*Math.SQRT2+f*2,z=C.circle(0,0,F,b),W=Math.max(F,u.width),O=F+u.height+p,M=C.rectangle(-W/2,-O/2,W,O,{...b,fill:"transparent",stroke:"none"}),A=h.insert(()=>z,":first-child"),P=h.insert(()=>M);return _.attr("transform",`translate(${-B/2-I},${m?u.height/2+p/2-L/2-E:-u.height/2-p/2-L/2-E})`),_.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})`),A.attr("transform",`translate(0,${m?u.height/2+p/2:-u.height/2-p/2})`),Ct(e,P),e.intersect=function($){return et.info("iconSquare intersect",e,$),pt.rect(e,$)},h}k(hv,"iconCircle");async function uv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(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:h,bbox:u,halfPadding:d,label:f}=await Lt(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:C}=Ls(e),b=-x/2,S=-m/2,_=e.label?8:0,w=ft.svg(h),B=xt(e,{});e.look!=="handDrawn"&&(B.roughness=0,B.fillStyle="solid");const L=C.get("fill");B.stroke=L??y;const I=w.path(Hn(b,S,x,m,5),B),E=Math.max(x,u.width),F=m+u.height+_,z=w.rectangle(-E/2,-F/2,E,F,{...B,fill:"transparent",stroke:"none"}),W=h.insert(()=>I,":first-child").attr("class","icon-shape2"),O=h.insert(()=>z);if(e.icon){const M=h.append("g");M.html(`<g>${await la(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const A=M.node().getBBox(),P=A.width,$=A.height,j=A.x,T=A.y;M.attr("transform",`translate(${-P/2-j},${p?u.height/2+_/2-$/2-T:-u.height/2-_/2-$/2-T})`),M.attr("style",`color: ${C.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-F/2:F/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),Ct(e,O),e.intersect=function(M){if(et.info("iconSquare intersect",e,M),!e.label)return pt.rect(e,M);const A=e.x??0,P=e.y??0,$=e.height??0;let j=[];return p?j=[{x:A-u.width/2,y:P-$/2},{x:A+u.width/2,y:P-$/2},{x:A+u.width/2,y:P-$/2+u.height+_},{x:A+x/2,y:P-$/2+u.height+_},{x:A+x/2,y:P+$/2},{x:A-x/2,y:P+$/2},{x:A-x/2,y:P-$/2+u.height+_},{x:A-u.width/2,y:P-$/2+u.height+_}]:j=[{x:A-x/2,y:P-$/2},{x:A+x/2,y:P-$/2},{x:A+x/2,y:P-$/2+m},{x:A+u.width/2,y:P-$/2+m},{x:A+u.width/2/2,y:P+$/2},{x:A-u.width/2,y:P+$/2},{x:A-u.width/2,y:P-$/2+m},{x:A-x/2,y:P-$/2+m}],pt.polygon(e,j,M)},h}k(uv,"iconRounded");async function dv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(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:h,bbox:u,halfPadding:d,label:f}=await Lt(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:C}=Ls(e),b=-x/2,S=-m/2,_=e.label?8:0,w=ft.svg(h),B=xt(e,{});e.look!=="handDrawn"&&(B.roughness=0,B.fillStyle="solid");const L=C.get("fill");B.stroke=L??y;const I=w.path(Hn(b,S,x,m,.1),B),E=Math.max(x,u.width),F=m+u.height+_,z=w.rectangle(-E/2,-F/2,E,F,{...B,fill:"transparent",stroke:"none"}),W=h.insert(()=>I,":first-child"),O=h.insert(()=>z);if(e.icon){const M=h.append("g");M.html(`<g>${await la(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const A=M.node().getBBox(),P=A.width,$=A.height,j=A.x,T=A.y;M.attr("transform",`translate(${-P/2-j},${p?u.height/2+_/2-$/2-T:-u.height/2-_/2-$/2-T})`),M.attr("style",`color: ${C.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-F/2:F/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),Ct(e,O),e.intersect=function(M){if(et.info("iconSquare intersect",e,M),!e.label)return pt.rect(e,M);const A=e.x??0,P=e.y??0,$=e.height??0;let j=[];return p?j=[{x:A-u.width/2,y:P-$/2},{x:A+u.width/2,y:P-$/2},{x:A+u.width/2,y:P-$/2+u.height+_},{x:A+x/2,y:P-$/2+u.height+_},{x:A+x/2,y:P+$/2},{x:A-x/2,y:P+$/2},{x:A-x/2,y:P-$/2+u.height+_},{x:A-u.width/2,y:P-$/2+u.height+_}]:j=[{x:A-x/2,y:P-$/2},{x:A+x/2,y:P-$/2},{x:A+x/2,y:P-$/2+m},{x:A+u.width/2,y:P-$/2+m},{x:A+u.width/2/2,y:P+$/2},{x:A-u.width/2,y:P+$/2},{x:A-u.width/2,y:P-$/2+m},{x:A-x/2,y:P-$/2+m}],pt.polygon(e,j,M)},h}k(dv,"iconSquare");async function pv(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}=bt(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),h=e.constraint==="on"&&e!=null&&e.assetHeight?e.assetHeight*e.imageAspectRatio:l,u=e.constraint==="on"?h/e.imageAspectRatio:(e==null?void 0:e.assetHeight)??s;e.width=Math.max(h,a??0);const{shapeSvg:d,bbox:f,label:p}=await Lt(t,e,"image-shape default"),m=e.pos==="t",x=-h/2,g=-u/2,y=e.label?8:0,C=ft.svg(d),b=xt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const S=C.rectangle(x,g,h,u,b),_=Math.max(h,f.width),w=u+f.height+y,B=C.rectangle(-_/2,-w/2,_,w,{...b,fill:"none",stroke:"none"}),L=d.insert(()=>S,":first-child"),I=d.insert(()=>B);if(e.img){const E=d.append("image");E.attr("href",e.img),E.attr("width",h),E.attr("height",u),E.attr("preserveAspectRatio","none"),E.attr("transform",`translate(${-h/2},${m?w/2-u:-w/2})`)}return p.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${m?-u/2-f.height/2-y/2:u/2-f.height/2+y/2})`),L.attr("transform",`translate(0,${m?f.height/2+y/2:-f.height/2-y/2})`),Ct(e,I),e.intersect=function(E){if(et.info("iconSquare intersect",e,E),!e.label)return pt.rect(e,E);const F=e.x??0,z=e.y??0,W=e.height??0;let O=[];return m?O=[{x:F-f.width/2,y:z-W/2},{x:F+f.width/2,y:z-W/2},{x:F+f.width/2,y:z-W/2+f.height+y},{x:F+h/2,y:z-W/2+f.height+y},{x:F+h/2,y:z+W/2},{x:F-h/2,y:z+W/2},{x:F-h/2,y:z-W/2+f.height+y},{x:F-f.width/2,y:z-W/2+f.height+y}]:O=[{x:F-h/2,y:z-W/2},{x:F+h/2,y:z-W/2},{x:F+h/2,y:z-W/2+u},{x:F+f.width/2,y:z-W/2+u},{x:F+f.width/2/2,y:z+W/2},{x:F-f.width/2,y:z+W/2},{x:F-f.width/2,y:z-W/2+u},{x:F-h/2,y:z-W/2+u}],pt.polygon(e,O,E)},d}k(pv,"imageSquare");async function fv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Lt(t,e,Bt(e)),h=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:h,y:0},{x:h+3*u/6,y:-u},{x:-3*u/6,y:-u}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=ft.svg(a),x=xt(e,{}),g=Xt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&f.attr("style",p)}else f=Cn(a,h,u,d);return n&&f.attr("style",n),e.width=h,e.height=u,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}k(fv,"inv_trapezoid");async function mv(t,e){const{shapeSvg:r,bbox:n,label:i}=await Lt(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))})`),Ct(e,s),e.intersect=function(l){return pt.rect(e,l)},r}k(mv,"labelRect");async function gv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Lt(t,e,Bt(e)),h=((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*h/6,y:0},{x:u,y:-h},{x:-(3*h)/6,y:-h}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=ft.svg(a),x=xt(e,{}),g=Xt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&f.attr("style",p)}else f=Cn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}k(gv,"lean_left");async function xv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Lt(t,e,Bt(e)),h=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*h/6,y:0},{x:u,y:0},{x:u+3*h/6,y:-h},{x:0,y:-h}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=ft.svg(a),x=xt(e,{}),g=Xt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&f.attr("style",p)}else f=Cn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}k(xv,"lean_right");function yv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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,h=[{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=ft.svg(i),d=xt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=Xt(h),p=u.path(f,d),m=i.insert(()=>p,":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})`),Ct(e,m),e.intersect=function(x){return et.info("lightningBolt intersect",e,x),pt.polygon(e,h,x)},i}k(yv,"lightningBolt");var J$=k((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"),tR=k((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"),eR=k((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Ig=10,Fg=10;async function bv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<Fg&&(e.width=Fg);const b=y/2/(2.5+y/50);e.height=(e.height??0)-o-b*3,e.height<Ig&&(e.height=Ig)}const{shapeSvg:a,bbox:l,label:h}=await Lt(t,e,Bt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=u/2,f=d/(2.5+u/50),p=(e!=null&&e.height?e==null?void 0:e.height:l.height)+f+o*2,m=p*.1;let x;const{cssStyles:g}=e;if(e.look==="handDrawn"){const y=ft.svg(a),C=tR(0,0,u,p,d,f,m),b=eR(0,f,u,p,d,f),S=xt(e,{}),_=y.path(C,S),w=y.path(b,S);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=J$(0,0,u,p,d,f,m);x=a.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",Fe(g)).attr("style",n)}return x.attr("label-offset-y",f),x.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),Ct(e,x),h.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+f-(l.y-(l.top??0))})`),e.intersect=function(y){const C=pt.rect(e,y),b=C.x-(e.x??0);if(d!=0&&(Math.abs(b)<(e.width??0)/2||Math.abs(b)==(e.width??0)/2&&Math.abs(C.y-(e.y??0))>(e.height??0)/2-f)){let S=f*f*(1-b*b/(d*d));S>0&&(S=Math.sqrt(S)),S=f-S,y.y-(e.y??0)>0&&(S=-S),C.y+=S}return C},a}k(bv,"linedCylinder");async function Cv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 S=e.width;e.width=(S??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:h}=await Lt(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,f=e.look==="neo"?d/4:d/8,p=d+f,{cssStyles:m}=e,x=ft.svg(a),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:-u/2-u/2*.1,y:-p/2},{x:-u/2-u/2*.1,y:p/2},...Rn(-u/2-u/2*.1,p/2,u/2+u/2*.1,p/2,f,.8),{x:u/2+u/2*.1,y:-p/2},{x:-u/2-u/2*.1,y:-p/2},{x:-u/2,y:-p/2},{x:-u/2,y:p/2*1.1},{x:-u/2,y:-p/2}],C=x.polygon(y.map(S=>[S.x,S.y]),g),b=a.insert(()=>C,":first-child");return b.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),b.attr("transform",`translate(0,${-f/2})`),h.attr("transform",`translate(${-u/2+(e.padding??0)+u/2*.1/2-(l.x-(l.left??0))},${-d/2+(e.padding??0)-f/2-(l.y-(l.top??0))})`),Ct(e,b),e.intersect=function(S){return pt.polygon(e,y,S)},a}k(Cv,"linedWaveEdgedRect");async function kv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:h,label:u}=await Lt(t,e,Bt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:h.width)+s*2+2*a,f=(e!=null&&e.height?e==null?void 0:e.height:h.height)+o*2+2*a,p=d-2*a,m=f-2*a,x=-p/2,g=-m/2,{cssStyles:y}=e,C=ft.svg(l),b=xt(e,{}),S=[{x:x-a,y:g+a},{x:x-a,y:g+m+a},{x:x+p-a,y:g+m+a},{x:x+p-a,y:g+m},{x:x+p,y:g+m},{x:x+p,y:g+m-a},{x:x+p+a,y:g+m-a},{x:x+p+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+p-a,y:g+a},{x:x+p-a,y:g+m},{x:x+p,y:g+m},{x:x+p,y:g},{x,y:g}];e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const w=Xt(S);let B=C.path(w,b);const L=Xt(_);let I=C.path(L,b);e.look!=="handDrawn"&&(B=Gu(B),I=Gu(I));const E=l.insert("g",":first-child");return E.insert(()=>B),E.insert(()=>I),E.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),u.attr("transform",`translate(${-(h.width/2)-a-(h.x-(h.left??0))}, ${-(h.height/2)+a-(h.y-(h.top??0))})`),Ct(e,E),e.intersect=function(F){return pt.polygon(e,S,F)},l}k(kv,"multiRect");async function vv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Lt(t,e,Bt(e)),a=e.padding??0,l=e.look==="neo"?16:a,h=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)-h*3);const d=Math.max(s.width,(e==null?void 0:e.width)??0)+l*2,f=Math.max(s.height,(e==null?void 0:e.height)??0)+h*3,p=e.look==="neo"?f/4:f/8,m=f+(u?p/2:-p/2),x=-d/2,g=-m/2,y=10,{cssStyles:C}=e,b=Rn(x-y,g+m+y,x+d-y,g+m+y,p,.8),S=b==null?void 0:b[b.length-1],_=[{x:x-y,y:g+y},{x:x-y,y:g+m+y},...b,{x:x+d-y,y:S.y-y},{x:x+d,y:S.y-y},{x:x+d,y:S.y-2*y},{x:x+d+y,y:S.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:S.y-y},{x:x+d,y:S.y-y},{x:x+d,y:g},{x,y:g}],B=ft.svg(i),L=xt(e,{});e.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const I=Xt(_),E=B.path(I,L),F=Xt(w),z=B.path(F,L),W=i.insert(()=>E,":first-child");return W.insert(()=>z),W.attr("class","basic label-container outer-path"),C&&e.look!=="handDrawn"&&W.selectAll("path").attr("style",C),n&&e.look!=="handDrawn"&&W.selectAll("path").attr("style",n),W.attr("transform",`translate(0,${-p/2})`),o.attr("transform",`translate(${-(s.width/2)-y-(s.x-(s.left??0))}, ${-(s.height/2)+y-p/2-(s.y-(s.top??0))})`),Ct(e,W),e.intersect=function(O){return pt.polygon(e,_,O)},i}k(vv,"multiWaveEdgedRectangle");async function wv(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n,e.useHtmlLabels||or(me())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:l}=await Lt(t,e,Bt(e)),h=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=-h/2,f=-u/2,{cssStyles:p}=e,m=ft.svg(o),x=xt(e,{fill:r.noteBkgColor,stroke:r.noteBorderColor});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=m.rectangle(d,f,h,u,x),y=o.insert(()=>g,":first-child");return y.attr("class","basic label-container outer-path"),l.attr("class","label noteLabel"),p&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",p),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))})`),Ct(e,y),e.intersect=function(C){return pt.rect(e,C)},o}k(wv,"note");var rR=k((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 Sv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Lt(t,e,Bt(e)),o=s.width+(e.padding??0),a=s.height+(e.padding??0),l=o+a,h=.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:f}=e;if(e.look==="handDrawn"){const p=ft.svg(i),m=xt(e,{}),x=rR(0,0,l),g=p.path(x,m);d=i.insert(()=>g,":first-child").attr("transform",`translate(${-l/2+h}, ${l/2})`),f&&d.attr("style",f)}else d=Cn(i,l,l,u),d.attr("transform",`translate(${-l/2+h}, ${l/2})`);return n&&d.attr("style",n),Ct(e,d),e.calcIntersect=function(p,m){const x=p.width,g=[{x:x/2,y:0},{x,y:-x/2},{x:x/2,y:-x},{x:0,y:-x/2}],y=pt.polygon(p,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(p){return this.calcIntersect(e,p)},i}k(Sv,"question");async function Tv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:h}=await Lt(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),f=-u/2,p=-d/2,m=p/2,x=[{x:f+m,y:p},{x:f,y:0},{x:f+m,y:-p},{x:-f,y:-p},{x:-f,y:p}],{cssStyles:g}=e,y=ft.svg(a),C=xt(e,{});e.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const b=Xt(x),S=y.path(b,C),_=a.insert(()=>S,":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)`),h.attr("transform",`translate(${-m/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),Ct(e,_),e.intersect=function(w){return pt.polygon(e,x,w)},a}k(Tv,"rect_left_inv_arrow");async function _v(t,e){const{labelStyles:r,nodeStyles:n}=bt(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,h=e.label,u=await Bn(a,h,e.labelStyle,!0,!0);let d={width:0,height:0};if(or(Jt())){const L=u.children[0],I=Ut(u);d=L.getBoundingClientRect(),I.attr("width",d.width),I.attr("height",d.height)}et.info("Text 2",l);const f=l||[],p=u.getBBox(),m=await Bn(a,Array.isArray(f)?f.join("<br/>"):f,e.labelStyle,!0,!0),x=m.children[0],g=Ut(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;Ut(m).attr("transform","translate( "+(d.width>p.width?0:(p.width-d.width)/2)+", "+(p.height+y+5)+")"),Ut(u).attr("transform","translate( "+(d.width<p.width?0:-(p.width-d.width)/2)+", 0)"),d=a.node().getBBox(),a.attr("transform","translate("+-d.width/2+", "+(-d.height/2-y+3)+")");const C=d.width+(e.padding||0),b=d.height+(e.padding||0),S=-d.width/2-y,_=-d.height/2-y;let w,B;if(e.look==="handDrawn"){const L=ft.svg(s),I=xt(e,{}),E=L.path(Hn(S,_,C,b,e.rx||0),I),F=L.line(-d.width/2-y,-d.height/2-y+p.height+y,d.width/2+y,-d.height/2-y+p.height+y,I);B=s.insert(()=>(et.debug("Rough node insert CXC",E),F),":first-child"),w=s.insert(()=>(et.debug("Rough node insert CXC",E),E),":first-child")}else w=o.insert("rect",":first-child"),B=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)),B.attr("class","divider").attr("x1",-d.width/2-y).attr("x2",d.width/2+y).attr("y1",-d.height/2-y+p.height+y).attr("y2",-d.height/2-y+p.height+y);return Ct(e,w),e.intersect=function(L){return pt.rect(e,L)},s}k(_v,"rectWithTitle");async function Ev(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 Ms(t,e,i)}k(Ev,"roundedRect");var Qn=8;async function jv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 Lt(t,e,Bt(e)),h=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?Qn:Qn*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=h-Qn,f=u,p=Qn-h/2,m=-u/2,{cssStyles:x}=e,g=ft.svg(o),y=xt(e,{});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const C=[{x:p,y:m},{x:p+d,y:m},{x:p+d,y:m+f},{x:p-Qn,y:m+f},{x:p-Qn,y:m},{x:p,y:m},{x:p,y:m+f}],b=g.polygon(C.map(_=>[_.x,_.y]),y),S=o.insert(()=>b,":first-child");return S.attr("class","basic label-container outer-path").attr("style",Fe(x)),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),l.attr("transform",`translate(${Qn/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),Ct(e,S),e.intersect=function(_){return pt.rect(e,_)},o}k(jv,"shadedProcess");async function Nv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:h}=await Lt(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,f=u,p=d/1.5,m=-f/2,x=-p/2,{cssStyles:g}=e,y=ft.svg(a),C=xt(e,{});e.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const b=[{x:m,y:x},{x:m,y:x+p},{x:m+f,y:x+p},{x:m+f,y:x-p/2}],S=Xt(b),_=y.path(S,C),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, ${p/4})`),h.attr("transform",`translate(${-f/2+(e.padding??0)-(l.x-(l.left??0))}, ${-p/4+(e.padding??0)-(l.y-(l.top??0))})`),Ct(e,w),e.intersect=function(B){return pt.polygon(e,b,B)},a}k(Nv,"slopedRect");async function Bv(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 Ms(t,e,s)}k(Bv,"squareRect");async function Lv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 Lt(t,e,Bt(e)),h=l.height+(e.look==="neo"?o*2:o),u=l.width+h/4+(e.look==="neo"?s*2:s),d=h/2,{cssStyles:f}=e,p=ft.svg(a),m=xt(e,{});e.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const x=[{x:-u/2+d,y:-h/2},{x:u/2-d,y:-h/2},...Ho(-u/2+d,0,d,50,90,270),{x:u/2-d,y:h/2},...Ho(u/2-d,0,d,50,270,450)],g=Xt(x),y=p.path(g,m),C=a.insert(()=>y,":first-child");return C.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",n),Ct(e,C),e.intersect=function(b){return pt.polygon(e,x,b)},a}k(Lv,"stadium");async function Av(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return Ms(t,e,r)}k(Av,"state");function Mv(t,e,{config:{themeVariables:r}}){var C,b;const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n;const{cssStyles:s}=e,{lineColor:o,stateBorder:a,nodeBorder:l,nodeShadow:h}=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=ft.svg(u),f=xt(e,{});e.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const p=d.circle(0,0,e.width,{...f,stroke:o,strokeWidth:2}),m=a??l,x=(e.width??0)*5/14,g=d.circle(0,0,x,{...f,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),y=u.insert(()=>p,":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&&h&&e.look!=="handDrawn"){const S=((b=(C=t.node())==null?void 0:C.ownerSVGElement)==null?void 0:b.id)??"",_=S?`${S}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${_})`)}return Ct(e,y),e.intersect=function(S){return pt.circle(e,(e.width??0)/2,S)},u}k(Mv,"stateEnd");function Iv(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=ft.svg(s).circle(0,0,e.width,uO(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 h=((l=(a=t.node())==null?void 0:a.ownerSVGElement)==null?void 0:l.id)??"",u=h?`${h}-drop-shadow-small`:"drop-shadow-small";o.attr("style",`filter:url(#${u})`)}return Ct(e,o),e.intersect=function(h){return pt.circle(e,(e.width??7)/2,h)},s}k(Iv,"stateStart");var Fi=8;async function Fv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 Lt(t,e,Bt(e)),h=((e==null?void 0:e.width)??l.width)+2*Fi+s,u=((e==null?void 0:e.height)??l.height)+o,d=h-2*Fi,f=u,p=-h/2,m=-u/2,x=[{x:0,y:0},{x:d,y:0},{x:d,y:-f},{x:0,y:-f},{x:0,y:0},{x:-8,y:0},{x:d+8,y:0},{x:d+8,y:-f},{x:-8,y:-f},{x:-8,y:0}];if(e.look==="handDrawn"){const g=ft.svg(a),y=xt(e,{}),C=g.rectangle(p,m,d+16,f,y),b=g.line(p+Fi,m,p+Fi,m+f,y),S=g.line(p+Fi+d,m,p+Fi+d,m+f,y);a.insert(()=>b,":first-child"),a.insert(()=>S,":first-child");const _=a.insert(()=>C,":first-child"),{cssStyles:w}=e;_.attr("class","basic label-container").attr("style",Fe(w)),Ct(e,_)}else{const g=Cn(a,d,f,x);n&&g.attr("style",n),Ct(e,g)}return e.intersect=function(g){return pt.polygon(e,x,g)},a}k(Fv,"subroutine");var jh=.2;async function Dv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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-jh*(e.height+o*2),10));const{shapeSvg:a,bbox:l}=await Lt(t,e,Bt(e)),h=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2,u=jh*h,d=jh*h,p=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2+u-u,m=h,x=-p/2,g=-m/2,{cssStyles:y}=e,C=ft.svg(a),b=xt(e,{}),S=[{x:x-u/2,y:g},{x:x+p+u/2,y:g},{x:x+p+u/2,y:g+m},{x:x-u/2,y:g+m}],_=[{x:x+p-u/2,y:g+m},{x:x+p+u/2,y:g+m},{x:x+p+u/2,y:g+m-d}];e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const w=Xt(S),B=C.path(w,b),L=Xt(_),I=C.path(L,{...b,fillStyle:"solid"}),E=a.insert(()=>I,":first-child");return E.insert(()=>B,":first-child"),E.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),Ct(e,E),e.intersect=function(F){return pt.polygon(e,S,F)},a}k(Dv,"taggedRect");async function Pv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Lt(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),h=l/8,u=.2*a,d=.2*l,f=l+h,{cssStyles:p}=e,m=ft.svg(i),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:f/2},...Rn(-a/2-a/2*.1,f/2,a/2+a/2*.1,f/2,h,.8),{x:a/2+a/2*.1,y:-f/2},{x:-a/2-a/2*.1,y:-f/2}],y=-a/2+a/2*.1,C=-f/2-d*.4,b=[{x:y+a-u,y:(C+l)*1.3},{x:y+a,y:C+l-d},{x:y+a,y:(C+l)*.9},...Rn(y+a,(C+l)*1.25,y+a-u,(C+l)*1.3,-l*.02,.5)],S=Xt(g),_=m.path(S,x),w=Xt(b),B=m.path(w,{...x,fillStyle:"solid"}),L=i.insert(()=>B,":first-child");return L.insert(()=>_,":first-child"),L.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(0,${-h/2})`),o.attr("transform",`translate(${-a/2+(e.padding??0)-(s.x-(s.left??0))},${-l/2+(e.padding??0)-h/2-(s.y-(s.top??0))})`),Ct(e,L),e.intersect=function(I){return pt.polygon(e,g,I)},i}k(Pv,"taggedWaveEdgedRectangle");async function Ov(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Lt(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,h=-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",h).attr("width",o).attr("height",a),Ct(e,u),e.intersect=function(d){return pt.rect(e,d)},i}k(Ov,"text");var nR=k((t,e,r,n,i,s)=>`M${t},${e}
531
- a${i},${s} 0,0,1 0,${-n}
532
- l${r},0
533
- a${i},${s} 0,0,1 0,${n}
534
- M${r},${-n}
535
- a${i},${s} 0,0,0 0,${n}
536
- l${-r},0`,"createCylinderPathD"),iR=k((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"),sR=k((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),Dg=5,Pg=10;async function $v(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<Dg&&(e.height=Dg);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<Pg&&(e.width=Pg)}const{shapeSvg:o,bbox:a,label:l}=await Lt(t,e,Bt(e)),h=(e.height?e.height:a.height)+s,u=h/2,d=u/(2.5+h/50),f=(e.width?e.width:a.width)+d+s,{cssStyles:p}=e;let m;if(e.look==="handDrawn"){const x=ft.svg(o),g=iR(0,0,f,h,d,u),y=sR(0,0,f,h,d,u),C=x.path(g,xt(e,{})),b=x.path(y,xt(e,{fill:"none"}));m=o.insert(()=>b,":first-child"),m=o.insert(()=>C,":first-child"),m.attr("class","basic label-container"),p&&m.attr("style",p)}else{const x=nR(0,0,f,h,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",Fe(p)).attr("style",n),m.attr("class","basic label-container outer-path"),p&&m.selectAll("path").attr("style",p),n&&m.selectAll("path").attr("style",n)}return m.attr("label-offset-x",d),m.attr("transform",`translate(${-f/2}, ${h/2} )`),l.attr("transform",`translate(${-(a.width/2)-d-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),Ct(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 C=d*d*(1-y*y/(u*u));C!=0&&(C=Math.sqrt(Math.abs(C))),C=d-C,x.x-(e.x??0)>0&&(C=-C),g.x+=C}return g},o}k($v,"tiltedCylinder");async function Rv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 Lt(t,e,Bt(e)),h=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*h/6,y:0},{x:u+3*h/6,y:0},{x:u,y:-h},{x:0,y:-h}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=ft.svg(a),x=xt(e,{}),g=Xt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&f.attr("style",p)}else f=Cn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}k(Rv,"trapezoid");async function zv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:h,bbox:u}=await Lt(t,e,Bt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2,f=(e!=null&&e.height?e==null?void 0:e.height:u.height)+o*2,{cssStyles:p}=e,m=ft.svg(h),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-d/2*.8,y:-f/2},{x:d/2*.8,y:-f/2},{x:d/2,y:-f/2*.6},{x:d/2,y:f/2},{x:-d/2,y:f/2},{x:-d/2,y:-f/2*.6}],y=Xt(g),C=m.path(y,x),b=h.insert(()=>C,":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),Ct(e,b),e.intersect=function(S){return pt.polygon(e,g,S)},h}k(zv,"trapezoidalPentagon");var Og=10,$g=10;async function Wv(t,e){var S;const{labelStyles:r,nodeStyles:n}=bt(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<$g&&(e.width=$g),e.height=(e==null?void 0:e.height)??0,e.height<Og&&(e.height=Og));const{shapeSvg:o,bbox:a,label:l}=await Lt(t,e,Bt(e)),h=yn((S=Jt().flowchart)==null?void 0:S.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,f=d,p=[{x:0,y:0},{x:f,y:0},{x:f/2,y:-d}],{cssStyles:m}=e,x=ft.svg(o),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Xt(p),C=x.path(y,g),b=o.insert(()=>C,":first-child").attr("transform",`translate(${-d/2}, ${d/2})`).attr("class","outer-path");return m&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),e.width=u,e.height=d,Ct(e,b),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${d/2-(a.height+(e.padding??0)/(h?2:1)-(a.y-(a.top??0)))})`),e.intersect=function(_){return et.info("Triangle intersect",e,p,_),pt.polygon(e,p,_)},o}k(Wv,"triangle");async function qv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:h,label:u}=await Lt(t,e,Bt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:h.width)+(s??0)*2,f=(e!=null&&e.height?e==null?void 0:e.height:h.height)+(o??0)*2,p=e.look==="neo"?f/4:f/8,m=f+(a?p:-p),{cssStyles:x}=e,y=14-d,C=y>0?y/2:0,b=ft.svg(l),S=xt(e,{});e.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const _=[{x:-d/2-C,y:m/2},...Rn(-d/2-C,m/2,d/2+C,m/2,p,.8),{x:d/2+C,y:-m/2},{x:-d/2-C,y:-m/2}],w=Xt(_),B=b.path(w,S),L=l.insert(()=>B,":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,${-p/2})`),u.attr("transform",`translate(${-d/2+(e.padding??0)-(h.x-(h.left??0))},${-f/2+(e.padding??0)-p-(h.y-(h.top??0))})`),Ct(e,L),e.intersect=function(I){return pt.polygon(e,_,I)},l}k(qv,"waveEdgedRectangle");async function Hv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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 S=Math.min(e.height*.2,e.height/4);e.height=Math.ceil(e.height-o-S*(20/9)),e.width=e.width-s*2}const{shapeSvg:a,bbox:l}=await Lt(t,e,Bt(e)),h=(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,f=u+d*2,{cssStyles:p}=e,m=ft.svg(a),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-h/2,y:f/2},...Rn(-h/2,f/2,h/2,f/2,d,1),{x:h/2,y:-f/2},...Rn(h/2,-f/2,-h/2,-f/2,d,-1)],y=Xt(g),C=m.path(y,x),b=a.insert(()=>C,":first-child");return b.attr("class","basic label-container"),p&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),Ct(e,b),e.intersect=function(S){return pt.polygon(e,g,S)},a}k(Hv,"waveRectangle");var ye=10;async function Uv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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-ye,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-ye,10));const{shapeSvg:o,bbox:a,label:l}=await Lt(t,e,Bt(e)),h=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+ye,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+ye,d=h-ye,f=u-ye,p=-d/2,m=-f/2,{cssStyles:x}=e,g=ft.svg(o),y=xt(e,{}),C=[{x:p-ye,y:m-ye},{x:p-ye,y:m+f},{x:p+d,y:m+f},{x:p+d,y:m-ye}],b=`M${p-ye},${m-ye} L${p+d},${m-ye} L${p+d},${m+f} L${p-ye},${m+f} L${p-ye},${m-ye}
537
- M${p-ye},${m} L${p+d},${m}
538
- M${p},${m-ye} L${p},${m+f}`;e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const S=g.path(b,y),_=o.insert(()=>S,":first-child");return _.attr("transform",`translate(${ye/2}, ${ye/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)+ye/2-(a.x-(a.left??0))}, ${-(a.height/2)+ye/2-(a.y-(a.top??0))})`),Ct(e,_),e.intersect=function(w){return pt.polygon(e,C,w)},o}k(Uv,"windowPane");var Rg=new Set(["redux-color","redux-dark-color"]),oR=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function Gp(t,e){var ct,$t,Et,ot;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=me(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:G}=me(),{background:lt}=G,kt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${lt}`]};await Gp(t,kt)}const h=me();e.useHtmlLabels=h.htmlLabels;let u=((ct=h.er)==null?void 0:ct.diagramPadding)??10,d=(($t=h.er)==null?void 0:$t.entityPadding)??6;const{cssStyles:f}=e,{labelStyles:p,nodeStyles:m}=bt(e);if(r.attributes.length===0&&e.label){const G={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};mn(e.label,h)+G.labelPaddingX*2<h.er.minEntityWidth&&(e.width=h.er.minEntityWidth);const lt=await Ms(t,e,G);if(n!=null&&Rg.has(n)){const kt=r.colorIndex??0;lt.attr("data-color-id",`color-${kt%l.length}`)}if(!yn(h.htmlLabels)){const kt=lt.select("text"),_t=(Et=kt.node())==null?void 0:Et.getBBox();kt.attr("transform",`translate(${-_t.width/2}, 0)`)}return lt}h.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 qi(g,e.label??"",h,0,0,["name"],p);y.height+=d;let C=0;const b=[],S=[];let _=0,w=0,B=0,L=0,I=!0,E=!0;for(const G of r.attributes){const lt=await qi(g,G.type,h,0,C,["attribute-type"],p);_=Math.max(_,lt.width+u);const kt=await qi(g,G.name,h,0,C,["attribute-name"],p);w=Math.max(w,kt.width+u);const _t=await qi(g,G.keys.join(),h,0,C,["attribute-keys"],p);B=Math.max(B,_t.width+u);const Rt=await qi(g,G.comment,h,0,C,["attribute-comment"],p);L=Math.max(L,Rt.width+u);const se=Math.max(lt.height,kt.height,_t.height,Rt.height)+d;S.push({yOffset:C,rowHeight:se}),C+=se}let F=4;B<=u&&(I=!1,B=0,F--),L<=u&&(E=!1,L=0,F--);const z=g.node().getBBox();if(y.width+u*2-(_+w+B+L)>0){const G=y.width+u*2-(_+w+B+L);_+=G/F,w+=G/F,B>0&&(B+=G/F),L>0&&(L+=G/F)}const W=_+w+B+L,O=ft.svg(g),M=xt(e,{});e.look!=="handDrawn"&&(M.roughness=0,M.fillStyle="solid");let A=0;S.length>0&&(A=S.reduce((G,lt)=>G+((lt==null?void 0:lt.rowHeight)??0),0));const P=Math.max(z.width+u*2,(e==null?void 0:e.width)||0,W),$=Math.max((A??0)+y.height,(e==null?void 0:e.height)||0),j=-P/2,T=-$/2;if(g.selectAll("g:not(:first-child)").each((G,lt,kt)=>{const _t=Ut(kt[lt]),Rt=_t.attr("transform");let se=0,ge=0;if(Rt){const Gt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Rt);Gt&&(se=parseFloat(Gt[1]),ge=parseFloat(Gt[2]),_t.attr("class").includes("attribute-name")?se+=_:_t.attr("class").includes("attribute-keys")?se+=_+w:_t.attr("class").includes("attribute-comment")&&(se+=_+w+B))}_t.attr("transform",`translate(${j+u/2+se}, ${ge+T+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(T+d/2)+")"),n!=null&&Rg.has(n)){const G=r.colorIndex??0;g.attr("data-color-id",`color-${G%l.length}`)}const Y=O.rectangle(j,T,P,$,M),J=g.insert(()=>Y,":first-child").attr("class","outer-path").attr("style",f.join(""));b.push(0);for(const[G,lt]of S.entries()){const _t=(G+1)%2===0&&lt.yOffset!==0,Rt=O.rectangle(j,y.height+T+(lt==null?void 0:lt.yOffset),P,lt==null?void 0:lt.rowHeight,{...M,fill:_t?s:o,stroke:a});g.insert(()=>Rt,"g.label").attr("style",f.join("")).attr("class",`row-rect-${_t?"even":"odd"}`)}const D=1e-4;let Q=Hi(j,y.height+T,P+j,y.height+T,D),ut=O.polygon(Q.map(G=>[G.x,G.y]),M);if(g.insert(()=>ut).attr("class","divider"),Q=Hi(_+j,y.height+T,_+j,$+T,D),ut=O.polygon(Q.map(G=>[G.x,G.y]),M),g.insert(()=>ut).attr("class","divider"),I){const G=_+w+j;Q=Hi(G,y.height+T,G,$+T,D),ut=O.polygon(Q.map(lt=>[lt.x,lt.y]),M),g.insert(()=>ut).attr("class","divider")}if(E){const G=_+w+B+j;Q=Hi(G,y.height+T,G,$+T,D),ut=O.polygon(Q.map(lt=>[lt.x,lt.y]),M),g.insert(()=>ut).attr("class","divider")}for(const G of b){const lt=y.height+T+G;Q=Hi(j,lt,P+j,lt,D),ut=O.polygon(Q.map(kt=>[kt.x,kt.y]),M),g.insert(()=>ut).attr("class","divider")}if(Ct(e,J),m&&e.look!=="handDrawn")if(n!=null&&oR.has(n))g.selectAll("path").attr("style",m);else{const G=m.split(";"),lt=(ot=G==null?void 0:G.filter(kt=>kt.includes("stroke")))==null?void 0:ot.map(kt=>`${kt}`).join("; ");g.selectAll("path").attr("style",lt??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(G){return pt.rect(e,G)},g}k(Gp,"erBox");async function qi(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!==Bm(e)&&(e=Bm(e),e=e.replaceAll("<","&lt;").replaceAll(">","&gt;"));const l=a.node().appendChild(await bn(a,e,{width:mn(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 h=l.getBBox();if(yn(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const d=Ut(l);h=u.getBoundingClientRect(),d.attr("width",h.width),d.attr("height",h.height)}return h}k(qi,"addText");function Hi(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}]}k(Hi,"lineToPolygon");async function Yv(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,h=null,u=null,d=0,f=0,p=0;if(a=o.insert("g").attr("class","annotation-group text"),e.annotations.length>0){const C=e.annotations[0];await yo(a,{text:`«${C}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await yo(l,e,0,["font-weight: bolder"]);const m=l.node().getBBox();f=m.height,h=o.insert("g").attr("class","members-group text");let x=0;for(const C of e.members){const b=await yo(h,C,x,[C.parseClassifier()]);x+=b+s}p=h.node().getBBox().height,p<=0&&(p=i/2),u=o.insert("g").attr("class","methods-group text");let g=0;for(const C of e.methods){const b=await yo(u,C,g,[C.parseClassifier()]);g+=b+s}let y=o.node().getBBox();if(a!==null){const C=a.node().getBBox();a.attr("transform",`translate(${-C.width/2})`)}return l.attr("transform",`translate(${-m.width/2}, ${d})`),y=o.node().getBBox(),h.attr("transform",`translate(0, ${d+f+i*2})`),y=o.node().getBBox(),u.attr("transform",`translate(0, ${d+f+(p?p+i*4:i*2)})`),y=o.node().getBBox(),{shapeSvg:o,bbox:y}}k(Yv,"textHelper");async function yo(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=me();let o="useHtmlLabels"in e?e.useHtmlLabels:yn(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),Fo(a)&&(o=!0);const l=await bn(i,rp(gi(a)),{width:mn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let h,u=1;if(o){const d=l.children[0],f=Ut(l);u=d.innerHTML.split("<br>").length,d.innerHTML.includes("</math>")&&(u+=d.innerHTML.split("<mrow>").length-1);const p=d.getElementsByTagName("img");if(p){const m=a.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...p].map(x=>new Promise(g=>{function y(){var C;if(x.style.display="flex",x.style.flexDirection="column",m){const b=((C=s.fontSize)==null?void 0:C.toString())??window.getComputedStyle(document.body).fontSize,_=parseInt(b,10)*5+"px";x.style.minWidth=_,x.style.maxWidth=_}else x.style.width="100%";g(x)}k(y,"setupImage"),setTimeout(()=>{x.complete&&y()}),x.addEventListener("error",y),x.addEventListener("load",y)})))}h=d.getBoundingClientRect(),f.attr("width",h.width),f.attr("height",h.height)}else{n.includes("font-weight: bolder")&&Ut(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=""),h=l.getBBox()}return i.attr("transform","translate(0,"+(-h.height/(2*u)+r)+")"),h.height}k(yo,"addText");async function Gv(t,e){var O,M;const r=Jt(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??yn(r.htmlLabels)??!0,l=e;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];const{shapeSvg:h,bbox:u}=await Yv(t,e,r,a,o),{labelStyles:d,nodeStyles:f}=bt(e);e.labelStyle=d,e.cssStyles=l.styles||"";const p=((O=l.styles)==null?void 0:O.join(";"))||f||"";e.cssStyles||(e.cssStyles=p.replaceAll("!important","").split(";"));const m=l.members.length===0&&l.methods.length===0&&!((M=r.class)!=null&&M.hideEmptyMembersBox),x=ft.svg(h),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Math.max(e.width??0,u.width);let C=Math.max(e.height??0,u.height);const b=(e.height??0)>u.height;l.members.length===0&&l.methods.length===0?C+=o:l.members.length>0&&l.methods.length===0&&(C+=o*2);const S=-y/2,_=-C/2;let w=m?s*2:l.members.length===0&&l.methods.length===0?-s:0;b&&(w=s*2);const B=x.rectangle(S-s,_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0),y+2*s,C+2*s+w,g),L=h.insert(()=>B,":first-child");L.attr("class","basic label-container outer-path");const I=L.node().getBBox(),E=h.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,F=h.select(".label-group").node().getBBox().height-(m?s/2:0)||0,z=h.select(".members-group").node().getBBox().height-(m?s/2:0)||0,W=(E+F+_+s-(_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(h.selectAll(".text").each((A,P,$)=>{var Q,ut;const j=Ut($[P]),T=j.attr("transform");let Y=0;if(T){const $t=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(T);$t&&(Y=parseFloat($t[2]))}let J=Y+_+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(j.attr("class").includes("methods-group")){const ct=Math.max(z,o/2);b?J=Math.max(W,E+F+ct+_+o*2+s)+o*2:J=E+F+ct+_+o*4+s}l.members.length===0&&l.methods.length===0&&((Q=r.class)!=null&&Q.hideEmptyMembersBox)&&(l.annotations.length>0?J=Y-o:J=Y),a||(J-=4);let D=S;(j.attr("class").includes("label-group")||j.attr("class").includes("annotation-group"))&&(D=-((ut=j.node())==null?void 0:ut.getBBox().width)/2||0,h.selectAll("text").each(function(ct,$t,Et){window.getComputedStyle(Et[$t]).textAnchor==="middle"&&(D=0)})),j.attr("transform",`translate(${D}, ${J})`)}),l.members.length>0||l.methods.length>0||m){const A=E+F+_+s,P=x.line(I.x,A,I.x+I.width,A+.001,g);h.insert(()=>P).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(m||l.members.length>0||l.methods.length>0){const A=E+F+z+_+o*2+s,P=x.line(I.x,b?Math.max(W,A):A,I.x+I.width,(b?Math.max(W,A):A)+.001,g);h.insert(()=>P).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(l.look!=="handDrawn"&&h.selectAll("path").attr("style",p),L.select(":nth-child(2)").attr("style",p),h.selectAll(".divider").select("path").attr("style",p),e.labelStyle?h.selectAll("span").attr("style",e.labelStyle):h.selectAll("span").attr("style",p),!a){const A=RegExp(/color\s*:\s*([^;]*)/),P=A.exec(p);if(P){const $=P[0].replace("color","fill");h.selectAll("tspan").attr("style",$)}else if(d){const $=A.exec(d);if($){const j=$[0].replace("color","fill");h.selectAll("tspan").attr("style",j)}}}return Ct(e,L),e.intersect=function(A){return pt.rect(e,A)},h}k(Gv,"classBox");async function Vv(t,e){var I,E;const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,h=Bt(e),{themeVariables:u}=Jt(),{borderColorArray:d,requirementEdgeLabelBackground:f}=u,p=t.insert("g").attr("class",h).attr("id",e.domId??e.id);let m;l?m=await Gr(p,`&lt;&lt;${i.type}&gt;&gt;`,0,e.labelStyle):m=await Gr(p,"&lt;&lt;Element&gt;&gt;",0,e.labelStyle);let x=m;const g=await Gr(p,i.name,x,e.labelStyle+"; font-weight: bold;");if(x+=g+a,l){const F=await Gr(p,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=F;const z=await Gr(p,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=z;const W=await Gr(p,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=W,await Gr(p,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const F=await Gr(p,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=F,await Gr(p,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((I=p.node())==null?void 0:I.getBBox().width)??200)+o,C=(((E=p.node())==null?void 0:E.getBBox().height)??200)+o,b=-y/2,S=-C/2,_=ft.svg(p),w=xt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const B=_.rectangle(b,S,y,C,w),L=p.insert(()=>B,":first-child");if(L.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const F=e.colorIndex??0;p.attr("data-color-id",`color-${F%d.length}`)}if(p.selectAll(".label").each((F,z,W)=>{const O=Ut(W[z]),M=O.attr("transform");let A=0,P=0;if(M){const Y=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(M);Y&&(A=parseFloat(Y[1]),P=parseFloat(Y[2]))}const $=P-C/2;let j=b+o/2;(z===0||z===1)&&(j=A),O.attr("transform",`translate(${j}, ${$+o})`)}),x>m+g+a){const F=S+m+g+a;let z;if(e.look==="neo"){const M=[[b,F],[b+y,F],[b+y,F+.001],[b,F+.001]];z=_.polygon(M,w)}else z=_.line(b,F,b+y,F,w);p.insert(()=>z).attr("class","divider")}return Ct(e,L),e.intersect=function(F){return pt.rect(e,F)},n&&e.look!=="handDrawn"&&(f||d!=null&&d.length)&&p.selectAll("path").attr("style",n),p}k(Vv,"requirementBox");async function Gr(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=Jt(),o=s.htmlLabels??!0,a=await bn(i,rp(gi(e)),{width:mn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let l;if(o){const h=a.children[0],u=Ut(a);l=h.getBoundingClientRect(),u.attr("width",l.width),u.attr("height",l.height)}else{const h=a.children[0];for(const u of h.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}k(Gr,"addText");var aR=k(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 Xv(t,e,{config:r}){var z,W;const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n||"";const s=10,o=e.width;e.width=(e.width??200)-10;const{shapeSvg:a,bbox:l,label:h}=await Lt(t,e,Bt(e)),u=e.padding||10;let d="",f;"ticket"in e&&e.ticket&&((z=r==null?void 0:r.kanban)!=null&&z.ticketBaseUrl)&&(d=(W=r==null?void 0:r.kanban)==null?void 0:W.ticketBaseUrl.replace("#TICKET#",e.ticket),f=a.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",d).attr("target","_blank"));const p={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1};let m,x;f?{label:m,bbox:x}=await Eh(f,"ticket"in e&&e.ticket||"",p):{label:m,bbox:x}=await Eh(a,"ticket"in e&&e.ticket||"",p);const{label:g,bbox:y}=await Eh(a,"assigned"in e&&e.assigned||"",p);e.width=o;const C=10,b=(e==null?void 0:e.width)||0,S=Math.max(x.height,y.height)/2,_=Math.max(l.height+C*2,(e==null?void 0:e.height)||0)+S,w=-b/2,B=-_/2;h.attr("transform","translate("+(u-b/2)+", "+(-S-l.height/2)+")"),m.attr("transform","translate("+(u-b/2)+", "+(-S+l.height/2)+")"),g.attr("transform","translate("+(u+b/2-y.width-2*s)+", "+(-S+l.height/2)+")");let L;const{rx:I,ry:E}=e,{cssStyles:F}=e;if(e.look==="handDrawn"){const O=ft.svg(a),M=xt(e,{}),A=I||E?O.path(Hn(w,B,b,_,I||0),M):O.rectangle(w,B,b,_,M);L=a.insert(()=>A,":first-child"),L.attr("class","basic label-container").attr("style",F||null)}else{L=a.insert("rect",":first-child"),L.attr("class","basic label-container __APA__").attr("style",i).attr("rx",I??5).attr("ry",E??5).attr("x",w).attr("y",B).attr("width",b).attr("height",_);const O="priority"in e&&e.priority;if(O){const M=a.append("line"),A=w+2,P=B+Math.floor((I??0)/2),$=B+_-Math.floor((I??0)/2);M.attr("x1",A).attr("y1",P).attr("x2",A).attr("y2",$).attr("stroke-width","4").attr("stroke",aR(O))}}return Ct(e,L),e.height=_,e.intersect=function(O){return pt.rect(e,O)},a}k(Xv,"kanbanItem");async function Kv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Lt(t,e,Bt(e)),l=s.width+10*o,h=s.height+8*o,u=.15*l,{cssStyles:d}=e,f=s.width+20,p=s.height+20,m=Math.max(l,f),x=Math.max(h,p);a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let g;const y=`M0 0
539
- a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
540
- a${u},${u} 1 0,0 ${m*.25},0
541
- a${u},${u} 1 0,0 ${m*.25},0
542
- a${u},${u} 1 0,0 ${m*.25},${x*.1}
543
-
544
- a${u},${u} 1 0,0 ${m*.15},${x*.33}
545
- a${u*.8},${u*.8} 1 0,0 0,${x*.34}
546
- a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
547
-
548
- a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
549
- a${u},${u} 1 0,0 ${-1*m*.25},0
550
- a${u},${u} 1 0,0 ${-1*m*.25},0
551
- a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
552
-
553
- a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
554
- a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
555
- a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
556
- H0 V0 Z`;if(e.look==="handDrawn"){const C=ft.svg(i),b=xt(e,{}),S=C.path(y,b);g=i.insert(()=>S,":first-child"),g.attr("class","basic label-container").attr("style",Fe(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})`),Ct(e,g),e.calcIntersect=function(C,b){return pt.rect(C,b)},e.intersect=function(C){return et.info("Bang intersect",e,C),pt.rect(e,C)},i}k(Kv,"bang");async function Qv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Lt(t,e,Bt(e)),l=s.width+2*o,h=s.height+2*o,u=.15*l,d=.25*l,f=.35*l,p=.2*l,{cssStyles:m}=e;let x;const g=`M0 0
557
- a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
558
- a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
559
- a${d},${d} 1 0,1 ${l*.35},${l*.2}
560
-
561
- a${u},${u} 1 0,1 ${l*.15},${h*.35}
562
- a${p},${p} 1 0,1 ${-1*l*.15},${h*.65}
563
-
564
- a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
565
- a${f},${f} 1 0,1 ${-1*l*.5},0
566
- a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
567
-
568
- a${u},${u} 1 0,1 ${-1*l*.1},${-1*h*.35}
569
- a${p},${p} 1 0,1 ${l*.1},${-1*h*.65}
570
- H0 V0 Z`;if(e.look==="handDrawn"){const y=ft.svg(i),C=xt(e,{}),b=y.path(g,C);x=i.insert(()=>b,":first-child"),x.attr("class","basic label-container").attr("style",Fe(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}, ${-h/2})`),Ct(e,x),e.calcIntersect=function(y,C){return pt.rect(y,C)},e.intersect=function(y){return et.info("Cloud intersect",e,y),pt.rect(e,y)},i}k(Qv,"cloud");async function Zv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Lt(t,e,Bt(e)),l=s.width+8*o,h=s.height+2*o,u=5,d=e.look==="neo"?`
571
- M${-l/2} ${h/2-u}
572
- v${-h+2*u}
573
- q0,-${u} ${u},-${u}
574
- h${l-2*u}
575
- q${u},0 ${u},${u}
576
- v${h-u}
577
- H${-l/2}
578
- Z
579
- `:`
580
- M${-l/2} ${h/2-u}
581
- v${-h+2*u}
582
- q0,-${u} ${u},-${u}
583
- h${l-2*u}
584
- q${u},0 ${u},${u}
585
- v${h-2*u}
586
- q0,${u} ${-u},${u}
587
- h${-(l-2*u)}
588
- q${-u},0 ${-u},${-u}
589
- Z
590
- `;if(!e.domId)throw new Error(`defaultMindmapNode: node "${e.id}" is missing a domId — was render.ts domId prefixing skipped?`);const f=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",h/2).attr("x2",l/2).attr("y2",h/2),a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),i.append(()=>a.node()),Ct(e,f),e.calcIntersect=function(p,m){return pt.rect(p,m)},e.intersect=function(p){return pt.rect(e,p)},i}k(Zv,"defaultMindmapNode");async function Jv(t,e){const r={padding:e.padding??0};return Yp(t,e,r)}k(Jv,"mindmapCircle");var lR=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Bv},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Ev},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Lv},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Fv},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Jk},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:tv},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Yp},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:Kv},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:Qv},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Sv},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:av},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:xv},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:gv},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Rv},{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:fv},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:rv},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Ov},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Uk},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:jv},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Iv},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Mv},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:sv},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:lv},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Xk},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Kk},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:Qk},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:yv},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:qv},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:ov},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:$v},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:bv},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Zk},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:ev},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Wv},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:Uv},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:nv},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:zv},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:iv},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Nv},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:vv},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:kv},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Hk},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Vk},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Pv},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Dv},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Hv},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Tv},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:Cv}],cR=k(()=>{const e=[...Object.entries({state:Av,choice:Yk,note:wv,rectWithTitle:_v,labelRect:mv,iconSquare:dv,iconCircle:hv,icon:cv,iconRounded:uv,imageSquare:pv,anchor:Wk,kanbanItem:Xv,mindmapCircle:Jv,defaultMindmapNode:Zv,classBox:Gv,erBox:Gp,requirementBox:Vv}),...lR.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),tw=cR();function hR(t){return t in tw}k(hR,"isValidShape");var jc=new Map;async function ew(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?tw[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",Fe(e.look)),e.tooltip&&i.attr("title",e.tooltip),jc.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}k(ew,"insertNode");var TY=k((t,e)=>{jc.set(e.id,t)},"setNodeElem"),_Y=k(()=>{jc.clear()},"clear"),EY=k(t=>{const e=jc.get(t.id);et.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"),uR=k((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&zg(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&zg(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),dR={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}},pR=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],zg=k((t,e,r,n,i,s,o=!1,a)=>{var m;const l=dR[r],h=l&&pR.includes(l.type);if(!l){et.warn(`Unknown arrow type: ${r}`);return}const u=l.type,p=`${i}_${s}-${u}${e==="start"?"Start":"End"}${o&&h?"-margin":""}`;if(a&&a.trim()!==""){const x=a.replace(/[^\dA-Za-z]/g,"_"),g=`${p}_${x}`;if(!document.getElementById(g)){const y=document.getElementById(p);if(y){const C=y.cloneNode(!0);C.id=g,C.querySelectorAll("path, circle, line").forEach(S=>{S.setAttribute("stroke",a),l.fill&&S.setAttribute("fill",a)}),(m=y.parentNode)==null||m.appendChild(C)}}t.attr(`marker-${e}`,`url(${n}#${g})`)}else t.attr(`marker-${e}`,`url(${n}#${p})`)},"addEdgeMarker"),fR=k(t=>{var e,r;return typeof t=="string"?t:(r=(e=Jt())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),Xl=new Map,Re=new Map,jY=k(()=>{Xl.clear(),Re.clear()},"clear"),no=k(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),mR=k(async(t,e)=>{const r=Jt();let n=or(r);const{labelStyles:i}=bt(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",h=await bn(t,e.label,{style:no(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(h),et.info("abc82",e,e.labelType);let u=h.getBBox(),d=u;if(n){const p=h.children[0],m=Ut(h);u=p.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const p=Ut(h).select("text").node();p&&typeof p.getBBox=="function"&&(d=p.getBBox())}o.attr("transform",Zs(d,n)),Xl.set(e.id,s),e.width=u.width,e.height=u.height;let f;if(e.startLabelLeft){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Bn(m,e.startLabelLeft,no(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Ut(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",Zs(g,n)),Re.get(e.id)||Re.set(e.id,{}),Re.get(e.id).startLeft=p,bo(f,e.startLabelLeft)}if(e.startLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Bn(m,e.startLabelRight,no(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Ut(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",Zs(g,n)),Re.get(e.id)||Re.set(e.id,{}),Re.get(e.id).startRight=p,bo(f,e.startLabelRight)}if(e.endLabelLeft){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Bn(p,e.endLabelLeft,no(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Ut(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",Zs(g,n)),Re.get(e.id)||Re.set(e.id,{}),Re.get(e.id).endLeft=p,bo(f,e.endLabelLeft)}if(e.endLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Bn(p,e.endLabelRight,no(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Ut(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",Zs(g,n)),Re.get(e.id)||Re.set(e.id,{}),Re.get(e.id).endRight=p,bo(f,e.endLabelRight)}return h},"insertEdgeLabel");function bo(t,e){or(Jt())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}k(bo,"setTerminalWidth");var gR=k((t,e)=>{et.debug("Moving label abc88 ",t.id,t.label,Xl.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=Jt(),{subGraphTitleTotalMargin:i}=Mp(n);if(t.label){const s=Xl.get(t.id);let o=t.x,a=t.y;if(r){const l=Pr.calcLabelPosition(r);et.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=Re.get(t.id).startLeft;let o=t.x,a=t.y;if(r){const l=Pr.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=Re.get(t.id).startRight;let o=t.x,a=t.y;if(r){const l=Pr.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=Re.get(t.id).endLeft;let o=t.x,a=t.y;if(r){const l=Pr.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=Re.get(t.id).endRight;let o=t.x,a=t.y;if(r){const l=Pr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}},"positionEdgeLabel"),xR=k((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"),yR=k((t,e,r)=>{et.debug(`intersection calc abc89:
591
- outsidePoint: ${JSON.stringify(e)}
592
- insidePoint : ${JSON.stringify(r)}
593
- 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,h=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/h;const f={x:r.x<e.x?r.x+a:r.x-u+a,y:r.y<e.y?r.y+h-d:r.y-h+d};return a===0&&(f.x=e.x,f.y=e.y),u===0&&(f.x=e.x),h===0&&(f.y=e.y),et.debug(`abc89 top/bottom calc, Q ${h}, q ${d}, R ${u}, r ${a}`,f),f}else{r.x<e.x?a=e.x-o-n:a=n-o-e.x;let d=h*a/u,f=r.x<e.x?r.x+u-a:r.x-u+a,p=r.y<e.y?r.y+d:r.y-d;return et.debug(`sides calc abc89, Q ${h}, q ${d}, R ${u}, r ${a}`,{_x:f,_y:p}),a===0&&(f=e.x,p=e.y),u===0&&(f=e.x),h===0&&(p=e.y),{x:f,y:p}}},"intersection"),Wg=k((t,e)=>{et.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(et.info("abc88 checking point",s,e),!xR(e,s)&&!i){const o=yR(e,n,s);et.debug("abc88 inside",s,n,o),et.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)?et.warn("abc88 no intersect",o,r):r.push(o),i=!0}else et.warn("abc88 outside",s,n),n=s,i||r.push(s)}),et.debug("returning points",r),r},"cutPathAtIntersect");function rw(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}}k(rw,"extractCornerPoints");var qg=k(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"),bR=k(function(t){const{cornerPointPositions:e}=rw(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=qg(i,o,5),l=qg(s,o,5),h=l.x-a.x,u=l.y-a.y;r.push(a);const d=Math.sqrt(2)*2;let f={x:o.x,y:o.y};if(Math.abs(s.x-i.x)>10&&Math.abs(s.y-i.y)>=10){et.debug("Corner point fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));const p=5;o.x===a.x?f={x:h<0?a.x-p+d:a.x+p-d,y:u<0?a.y-d:a.y+d}:f={x:h<0?a.x-d:a.x+d,y:u<0?a.y-p+d:a.y+p-d}}else et.debug("Corner point skipping fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));r.push(f,l)}else r.push(t[n]);return r},"fixCorners"),CR=k((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"),kR=k(function(t,e,r,n,i,s,o,a=!1){var P;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:l}=Jt();let h=e.points,u=!1;const d=i;var f=s;const p=[];for(const $ in e.cssCompiledStyles)tk($)||p.push(e.cssCompiledStyles[$]);et.debug("UIO intersect check",e.points,f.x,d.x),f.intersect&&d.intersect&&!a&&(h=h.slice(1,e.points.length-1),h.unshift(d.intersect(h[0])),et.debug("Last point UIO",e.start,"-->",e.end,h[h.length-1],f,f.intersect(h[h.length-1])),h.push(f.intersect(h[h.length-1])));const m=btoa(JSON.stringify(h));e.toCluster&&(et.info("to cluster abc88",r.get(e.toCluster)),h=Wg(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(et.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(h,null,2)),h=Wg(h.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=h.filter($=>!Number.isNaN($.y));const g=fR(e.curve);g!=="rounded"&&(x=bR(x));let y=Eo;switch(g){case"linear":y=Eo;break;case"basis":y=Cu;break;case"cardinal":y=Wb;break;case"bumpX":y=Pb;break;case"bumpY":y=Ob;break;case"catmullRom":y=Hb;break;case"monotoneX":y=Kb;break;case"monotoneY":y=Qb;break;case"natural":y=Jb;break;case"step":y=t1;break;case"stepAfter":y=r1;break;case"stepBefore":y=e1;break;case"rounded":y=Eo;break;default:y=Cu}const{x:C,y:b}=fP(e),S=Q4().x(C).y(b).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,B=g==="rounded"?nw(iw(x,e),5):S(x);const L=Array.isArray(e.style)?e.style:[e.style];let I=L.find($=>$==null?void 0:$.startsWith("stroke:")),E="";e.animate&&(E="edge-animation-fast"),e.animation&&(E="edge-animation-"+e.animation);let F=!1;if(e.look==="handDrawn"){const $=ft.svg(t);Object.assign([],x);const j=$.path(B,{roughness:.3,seed:l});_+=" transition",w=Ut(j).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(E?" "+E:"")).attr("style",L?L.reduce((Y,J)=>Y+";"+J,""):"");let T=w.attr("d");w.attr("d",T),t.node().appendChild(w.node())}else{const $=p.join(";"),j=L?L.reduce((ut,ct)=>ut+ct+";",""):"",T=($?$+";"+j+";":j)+";"+(L?L.reduce((ut,ct)=>ut+";"+ct,""):"");w=t.append("path").attr("d",B).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(E?" "+E:"")).attr("style",T),I=(P=T.match(/stroke:([^;]+)/))==null?void 0:P[1],F=e.animate===!0||!!e.animation||$.includes("animation");const Y=w.node(),J=typeof Y.getTotalLength=="function"?Y.getTotalLength():0,D=ng[e.arrowTypeStart]||0,Q=ng[e.arrowTypeEnd]||0;if(e.look==="neo"&&!F){const ct=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?CR(J,D,Q):`0 ${D} ${J-D-Q} ${Q}`}; stroke-dashoffset: 0;`;w.attr("style",ct+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",Fe(e.look)),e.showPoints&&x.forEach($=>{t.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",$.x).attr("cy",$.y)});let z="";(Jt().flowchart.arrowMarkerAbsolute||Jt().state.arrowMarkerAbsolute)&&(z=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,z=z.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),et.info("arrowTypeStart",e.arrowTypeStart),et.info("arrowTypeEnd",e.arrowTypeEnd);const W=!F&&(e==null?void 0:e.look)==="neo";uR(w,e,z,o,n,W,I);const O=Math.floor(h.length/2),M=h[O];Pr.isLabelCoordinateInPath(M,w.attr("d"))||(u=!0);let A={};return u&&(A.updatedPath=h),A.originalPath=e.points,A},"insertEdge");function nw(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 h=o.x-a.x,u=o.y-a.y,d=l.x-o.x,f=l.y-o.y,p=Math.hypot(h,u),m=Math.hypot(d,f);if(p<i||m<i){r+=`L${o.x},${o.y}`;continue}const x=h/p,g=u/p,y=d/m,C=f/m,b=x*y+g*C,S=Math.max(-1,Math.min(1,b)),_=Math.acos(S);if(_<i||Math.abs(Math.PI-_)<i){r+=`L${o.x},${o.y}`;continue}const w=Math.min(e/Math.sin(_/2),p/2,m/2),B=o.x-x*w,L=o.y-g*w,I=o.x+y*w,E=o.y+C*w;r+=`L${B},${L}`,r+=`Q${o.x},${o.y} ${I},${E}`}}return r}k(nw,"generateRoundedPath");function Ku(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}}k(Ku,"calculateDeltaAndAngle");function iw(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}=Ku(s,o),l=i*Math.cos(a),h=i*Math.sin(a);r[0].x=s.x+l,r[0].y=s.y+h}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}=Ku(o,s),l=i*Math.cos(a),h=i*Math.sin(a);r[n-1].x=s.x-l,r[n-1].y=s.y-h}return r}k(iw,"applyMarkerOffsetsToPoints");var vR=k((t,e,r,n)=>{e.forEach(i=>{UR[i](t,r,n)})},"insertMarkers"),wR=k((t,e,r)=>{et.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"),SR=k((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"),TR=k((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"),_R=k((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"),ER=k((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"),jR=k((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"),NR=k((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"),BR=k((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"),LR=k((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"),AR=k((t,e,r)=>{const n=me(),{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"),MR=k((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"),IR=k((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"),FR=k((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"),DR=k((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"),PR=k((t,e,r)=>{const n=me(),{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"),OR=k((t,e,r)=>{const n=me(),{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"),$R=k((t,e,r)=>{const n=me(),{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"),RR=k((t,e,r)=>{const n=me(),{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"),zR=k((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
594
- L20,10
595
- M20,10
596
- L0,20`)},"requirement_arrow"),WR=k((t,e,r)=>{const n=me(),{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
597
- L20,10
598
- M20,10
599
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),qR=k((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"),HR=k((t,e,r)=>{const n=me(),{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"),UR={extension:wR,composition:SR,aggregation:TR,dependency:_R,lollipop:ER,point:jR,circle:NR,cross:BR,barb:LR,barbNeo:AR,only_one:MR,zero_or_one:IR,one_or_more:FR,zero_or_more:DR,only_one_neo:PR,zero_or_one_neo:OR,one_or_more_neo:$R,zero_or_more_neo:RR,requirement_arrow:zR,requirement_contains:qR,requirement_arrow_neo:WR,requirement_contains_neo:HR},YR=vR,GR={common:ra,getConfig:me,insertCluster:H$,insertEdge:kR,insertEdgeLabel:mR,insertMarkers:YR,insertNode:ew,interpolateToCurve:Ep,labelHelper:Lt,log:et,positionEdgeLabel:gR},Uo={},sw=k(t=>{for(const e of t)Uo[e.name]=e},"registerLayoutLoaders"),VR=k(()=>{sw([{name:"dagre",loader:k(async()=>await Kt(()=>import("./dagre-BM42HDAG-DAFO7F2u.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"cose-bilkent",loader:k(async()=>await Kt(()=>import("./cose-bilkent-S5V4N54A-D8YuuIpy.js"),__vite__mapDeps([8,7,3,4,5,6])),"loader")}])},"registerDefaultLayoutLoaders");VR();var NY=k(async(t,e)=>{if(!(t.layoutAlgorithm in Uo))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=Uo[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:l}=s,h=e.attr("id");if(e.append("defs").append("filter").attr("id",`${h}-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",`${h}-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,GR,{algorithm:r.algorithm})},"render"),BY=k((t="",{fallback:e="dagre"}={})=>{if(t in Uo)return t;if(e in Uo)return et.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"),Vp="comm",ow="rule",aw="decl",XR="@media",KR="@import",QR="@supports",ZR="@namespace",Qu="@keyframes",lw="@layer",JR="@scope",t6=Math.abs,No=String.fromCharCode;function cw(t){return t.trim()}function Zu(t,e,r){return t.replace(e,r)}function Zi(t,e){return t.charCodeAt(e)|0}function Ss(t,e,r){return t.slice(e,r)}function Xr(t){return t.length}function hw(t){return t.length}function Da(t,e){return e.push(t),t}var Nc=1,Ts=1,uw=0,jr=0,Ee=0,Is="";function Xp(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:Nc,column:Ts,length:o,return:"",siblings:a}}function e6(){return Ee}function r6(){return Ee=jr>0?Zi(Is,--jr):0,Ts--,Ee===10&&(Ts=1,Nc--),Ee}function Rr(){return Ee=jr<uw?Zi(Is,jr++):0,Ts++,Ee===10&&(Ts=1,Nc++),Ee}function Ln(){return Zi(Is,jr)}function sl(){return jr}function Bc(t,e){return Ss(Is,t,e)}function Yo(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 n6(t){return Nc=Ts=1,uw=Xr(Is=t),jr=0,[]}function i6(t){return Is="",t}function Nh(t){return cw(Bc(jr-1,Ju(t===91?t+2:t===40?t+1:t)))}function s6(t){for(;(Ee=Ln())&&Ee<33;)Rr();return Yo(t)>2||Yo(Ee)>3?"":" "}function o6(t,e){for(;--e&&Rr()&&!(Ee<48||Ee>102||Ee>57&&Ee<65||Ee>70&&Ee<97););return Bc(t,sl()+(e<6&&Ln()==32&&Rr()==32))}function Ju(t){for(;Rr();)switch(Ee){case t:return jr;case 34:case 39:t!==34&&t!==39&&Ju(Ee);break;case 40:t===41&&Ju(t);break;case 92:Rr();break}return jr}function a6(t,e){for(;Rr()&&t+Ee!==57;)if(t+Ee===84&&Ln()===47)break;return"/*"+Bc(e,jr-1)+"*"+No(t===47?t:Rr())}function l6(t){for(;!Yo(Ln());)Rr();return Bc(t,jr)}function c6(t){return i6(ol("",null,null,null,[""],t=n6(t),0,[0],t))}function ol(t,e,r,n,i,s,o,a,l){for(var h=0,u=0,d=o,f=0,p=0,m=0,x=1,g=1,y=1,C=0,b=0,S="",_=i,w=s,B=n,L=S;g;)switch(m=b,b=Rr()){case 40:m!=108&&Zi(L,d-1)==58?(C++,L+="("):L+=Nh(b);break;case 41:C--,L+=")";break;case 34:case 39:case 91:L+=Nh(b);break;case 9:case 10:case 13:case 32:if(C>0){L+=No(b);break}L+=s6(m);break;case 92:L+=o6(sl()-1,7);continue;case 47:switch(Ln()){case 42:case 47:Da(h6(a6(Rr(),sl()),e,r,l),l),(Yo(m||1)==5||Yo(Ln()||1)==5)&&Xr(L)&&Ss(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*x:a[h++]=Xr(L)*y;case 125*x:case 59:case 0:if(C>0&&b){L+=No(b);break}switch(b){case 0:case 125:g=0;case 59+u:y==-1&&(L=Zu(L,/\f/g,"")),p>0&&(Xr(L)-d||x===0)&&Da(p>32?Ug(L+";",n,r,d-1,l):Ug(Zu(L," ","")+";",n,r,d-2,l),l);break;case 59:L+=";";default:if(Da(B=Hg(L,e,r,h,u,i,a,S,_=[],w=[],d,s),s),b===123)if(u===0)ol(L,e,B,B,_,s,d,a,w);else{switch(f){case 99:if(Zi(L,3)===110)break;case 108:if(Zi(L,2)===97)break;default:u=0;case 100:case 109:case 115:}u?ol(t,B,B,n&&Da(Hg(t,B,B,0,0,i,a,S,i,_=[],d,w),w),i,w,d,a,n?_:w):ol(L,B,B,B,[""],w,0,a,w)}}h=u=p=0,x=y=1,S=L="",d=o;break;case 58:d=1+Xr(L),p=m;default:if(x<1){if(b==123)--x;else if(b==125&&x++==0&&r6()==125)continue}switch(L+=No(b),b*x){case 38:y=u>0?1:(L+="\f",-1);break;case 44:if(C>0)break;a[h++]=(Xr(L)-1)*y,y=1;break;case 64:Ln()===45&&(L+=Nh(Rr())),f=Ln(),u=d=Xr(S=L+=l6(sl())),b++;break;case 45:m===45&&Xr(L)==2&&(x=0)}}return s}function Hg(t,e,r,n,i,s,o,a,l,h,u,d){for(var f=i-1,p=i===0?s:[""],m=hw(p),x=0,g=0,y=0;x<n;++x)for(var C=0,b=Ss(t,f+1,f=t6(g=o[x])),S=t;C<m;++C)(S=cw(g>0?p[C]+" "+b:Zu(b,/&\f/g,p[C])))&&(l[y++]=S);return Xp(t,e,r,i===0?ow:a,l,h,u,d)}function h6(t,e,r,n){return Xp(t,e,r,Vp,No(e6()),Ss(t,2,-2),0,n)}function Ug(t,e,r,n,i){return Xp(t,e,r,aw,Ss(t,0,n),Ss(t,n+1,-1),n,i)}function td(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function u6(t,e,r,n){switch(t.type){case lw:if(t.children.length)break;case KR:case ZR:case aw:return t.return=t.return||t.value;case Vp:return"";case Qu:return t.return=t.value+"{"+td(t.children,n)+"}";case ow:if(!Xr(t.value=t.props.join(",")))return""}return Xr(r=td(t.children,n))?t.return=t.value+"{"+r+"}":""}function d6(t){var e=hw(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 dw="c4",p6=k(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),f6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./c4Diagram-AAUBKEIU-BhXknY2V.js");return{diagram:e}},__vite__mapDeps([9,10,3,4,5,6,7]));return{id:dw,diagram:t}},"loader"),m6={id:dw,detector:p6,loader:f6},g6=m6,pw="flowchart",x6=k((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"),y6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DqCc80Gc.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:pw,diagram:t}},"loader"),b6={id:pw,detector:x6,loader:y6},C6=b6,fw="flowchart-v2",k6=k((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"),v6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DqCc80Gc.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:fw,diagram:t}},"loader"),w6={id:fw,detector:k6,loader:v6},S6=w6,mw="er",T6=k(t=>/^\s*erDiagram/.test(t),"detector"),_6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./erDiagram-TEJ5UH35-BA3HXlzl.js");return{diagram:e}},__vite__mapDeps([16,13,14,15,3,4,5,6,7]));return{id:mw,diagram:t}},"loader"),E6={id:mw,detector:T6,loader:_6},j6=E6,gw="gitGraph",N6=k(t=>/^\s*gitGraph/.test(t),"detector"),B6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-PVQCEYII-DeFaU-B5.js");return{diagram:e}},__vite__mapDeps([17,18,19,20,5,3,4,6,7]));return{id:gw,diagram:t}},"loader"),L6={id:gw,detector:N6,loader:B6},A6=L6,xw="gantt",M6=k(t=>/^\s*gantt/.test(t),"detector"),I6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./ganttDiagram-6RSMTGT7-2JYlowTb.js");return{diagram:e}},__vite__mapDeps([21,3,4,22,23,24,5,6,7]));return{id:xw,diagram:t}},"loader"),F6={id:xw,detector:M6,loader:I6},D6=F6,yw="info",P6=k(t=>/^\s*info/.test(t),"detector"),O6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./infoDiagram-5YYISTIA-Denratb4.js");return{diagram:e}},__vite__mapDeps([25,20,5,3,4,6,7]));return{id:yw,diagram:t}},"loader"),$6={id:yw,detector:P6,loader:O6},bw="pie",R6=k(t=>/^\s*pie/.test(t),"detector"),z6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./pieDiagram-4H26LBE5-BFeercFA.js");return{diagram:e}},__vite__mapDeps([26,18,20,5,3,4,6,27,28,23,7]));return{id:bw,diagram:t}},"loader"),W6={id:bw,detector:R6,loader:z6},Cw="quadrantChart",q6=k(t=>/^\s*quadrantChart/.test(t),"detector"),H6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./quadrantDiagram-W4KKPZXB-BCX6XEvx.js");return{diagram:e}},__vite__mapDeps([29,22,23,24,3,4,5,6,7]));return{id:Cw,diagram:t}},"loader"),U6={id:Cw,detector:q6,loader:H6},Y6=U6,kw="xychart",G6=k(t=>/^\s*xychart(-beta)?/.test(t),"detector"),V6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./xychartDiagram-2RQKCTM6-DvmK5-UN.js");return{diagram:e}},__vite__mapDeps([30,23,28,22,24,3,4,5,6,7]));return{id:kw,diagram:t}},"loader"),X6={id:kw,detector:G6,loader:V6},K6=X6,vw="requirement",Q6=k(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),Z6=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./requirementDiagram-4Y6WPE33-Cbby1ELs.js");return{diagram:e}},__vite__mapDeps([31,13,14,3,4,5,6,7]));return{id:vw,diagram:t}},"loader"),J6={id:vw,detector:Q6,loader:Z6},t8=J6,ww="sequence",e8=k(t=>/^\s*sequenceDiagram/.test(t),"detector"),r8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./sequenceDiagram-3UESZ5HK-Ppn3RRuA.js");return{diagram:e}},__vite__mapDeps([32,10,19,3,4,5,6,7]));return{id:ww,diagram:t}},"loader"),n8={id:ww,detector:e8,loader:r8},i8=n8,Sw="class",s8=k((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"),o8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./classDiagram-4FO5ZUOK-BEiB5jyR.js");return{diagram:e}},__vite__mapDeps([33,34,12,10,13,14,3,4,5,6,7]));return{id:Sw,diagram:t}},"loader"),a8={id:Sw,detector:s8,loader:o8},l8=a8,Tw="classDiagram",c8=k((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"),h8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./classDiagram-v2-Q7XG4LA2-BEiB5jyR.js");return{diagram:e}},__vite__mapDeps([35,34,12,10,13,14,3,4,5,6,7]));return{id:Tw,diagram:t}},"loader"),u8={id:Tw,detector:c8,loader:h8},d8=u8,_w="state",p8=k((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"),f8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./stateDiagram-AJRCARHV-z3isZwb4.js");return{diagram:e}},__vite__mapDeps([36,37,13,14,1,2,3,4,5,6,7]));return{id:_w,diagram:t}},"loader"),m8={id:_w,detector:p8,loader:f8},g8=m8,Ew="stateDiagram",x8=k((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"),y8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-BHNVJYJU-CU-EnGpI.js");return{diagram:e}},__vite__mapDeps([38,37,13,14,3,4,5,6,7]));return{id:Ew,diagram:t}},"loader"),b8={id:Ew,detector:x8,loader:y8},C8=b8,jw="journey",k8=k(t=>/^\s*journey/.test(t),"detector"),v8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./journeyDiagram-JHISSGLW-XCrNbncG.js");return{diagram:e}},__vite__mapDeps([39,12,10,27,3,4,5,6,7]));return{id:jw,diagram:t}},"loader"),w8={id:jw,detector:k8,loader:v8},S8=w8,T8=k((t,e,r)=>{et.debug(`rendering svg for syntax error
600
- `);const n=oD(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),ob(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"),Nw={draw:T8},_8=Nw,E8={db:{},renderer:Nw,parser:{parse:k(()=>{},"parse")}},j8=E8,Bw="flowchart-elk",N8=k((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"),B8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DqCc80Gc.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:Bw,diagram:t}},"loader"),L8={id:Bw,detector:N8,loader:B8},A8=L8,Lw="timeline",M8=k(t=>/^\s*timeline/.test(t),"detector"),I8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./timeline-definition-PNZ67QCA-MzpbvgHe.js");return{diagram:e}},__vite__mapDeps([40,27,3,4,5,6,7]));return{id:Lw,diagram:t}},"loader"),F8={id:Lw,detector:M8,loader:I8},D8=F8,Aw="mindmap",P8=k(t=>/^\s*mindmap/.test(t),"detector"),O8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./mindmap-definition-RKZ34NQL-DtZJzpjH.js");return{diagram:e}},__vite__mapDeps([41,13,14,3,4,5,6,7]));return{id:Aw,diagram:t}},"loader"),$8={id:Aw,detector:P8,loader:O8},R8=$8,Mw="kanban",z8=k(t=>/^\s*kanban/.test(t),"detector"),W8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./kanban-definition-UN3LZRKU-tdCgL_BJ.js");return{diagram:e}},__vite__mapDeps([42,12,3,4,5,6,7]));return{id:Mw,diagram:t}},"loader"),q8={id:Mw,detector:z8,loader:W8},H8=q8,Iw="sankey",U8=k(t=>/^\s*sankey(-beta)?/.test(t),"detector"),Y8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./sankeyDiagram-5OEKKPKP-CoGrYNGu.js");return{diagram:e}},__vite__mapDeps([43,28,23,3,4,5,6,7]));return{id:Iw,diagram:t}},"loader"),G8={id:Iw,detector:U8,loader:Y8},V8=G8,Fw="packet",X8=k(t=>/^\s*packet(-beta)?/.test(t),"detector"),K8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./diagram-LMA3HP47-B_BQfoht.js");return{diagram:e}},__vite__mapDeps([44,18,20,5,3,4,6,7]));return{id:Fw,diagram:t}},"loader"),Q8={id:Fw,detector:X8,loader:K8},Dw="radar",Z8=k(t=>/^\s*radar-beta/.test(t),"detector"),J8=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./diagram-2AECGRRQ-BwnnQC9d.js");return{diagram:e}},__vite__mapDeps([45,18,20,5,3,4,6,7]));return{id:Dw,diagram:t}},"loader"),tz={id:Dw,detector:Z8,loader:J8},Pw="block",ez=k(t=>/^\s*block(-beta)?/.test(t),"detector"),rz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./blockDiagram-GPEHLZMM-Cl9S3jDb.js");return{diagram:e}},__vite__mapDeps([46,12,1,15,3,4,5,6,7]));return{id:Pw,diagram:t}},"loader"),nz={id:Pw,detector:ez,loader:rz},iz=nz,Ow="treeView",sz=k(t=>/^\s*treeView-beta/.test(t),"detector"),oz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./diagram-5GNKFQAL-DBEb2BhO.js");return{diagram:e}},__vite__mapDeps([47,18,19,20,5,3,4,6,7]));return{id:Ow,diagram:t}},"loader"),az={id:Ow,detector:sz,loader:oz},lz=az,$w="architecture",cz=k(t=>/^\s*architecture/.test(t),"detector"),hz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./architectureDiagram-3BPJPVTR-Cj7dBJg7.js");return{diagram:e}},__vite__mapDeps([48,18,20,5,3,4,6,7]));return{id:$w,diagram:t}},"loader"),uz={id:$w,detector:cz,loader:hz},dz=uz,Rw="eventmodeling",pz=k(t=>/^\s*eventmodeling/.test(t),"detector"),fz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./diagram-KO2AKTUF-BMIv-hqj.js");return{diagram:e}},__vite__mapDeps([49,18,20,5,3,4,6,7]));return{id:Rw,diagram:t}},"loader"),mz={id:Rw,detector:pz,loader:fz},gz=mz,zw="ishikawa",xz=k(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),yz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-YF4QCWOH-DmYnlEGM.js");return{diagram:e}},__vite__mapDeps([50,3,4,5,6,7]));return{id:zw,diagram:t}},"loader"),bz={id:zw,detector:xz,loader:yz},Ww="venn",Cz=k(t=>/^\s*venn-beta/.test(t),"detector"),kz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./vennDiagram-CIIHVFJN-Bsvlh8Xw.js");return{diagram:e}},__vite__mapDeps([51,3,4,5,6,7]));return{id:Ww,diagram:t}},"loader"),vz={id:Ww,detector:Cz,loader:kz},wz=vz,qw="treemap",Sz=k(t=>/^\s*treemap/.test(t),"detector"),Tz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./diagram-OG6HWLK6-CGX5WRJy.js");return{diagram:e}},__vite__mapDeps([52,14,18,20,5,3,4,6,24,28,23,7]));return{id:qw,diagram:t}},"loader"),_z={id:qw,detector:Sz,loader:Tz},Hw="wardley-beta",Ez=k(t=>/^\s*wardley-beta/i.test(t),"detector"),jz=k(async()=>{const{diagram:t}=await Kt(async()=>{const{diagram:e}=await import("./wardleyDiagram-YWT4CUSO-DhsQvXBN.js");return{diagram:e}},__vite__mapDeps([53,18,20,5,3,4,6,7]));return{id:Hw,diagram:t}},"loader"),Nz={id:Hw,detector:Ez,loader:jz},Bz=Nz,Yg=!1,Lc=k(()=>{Yg||(Yg=!0,Sl("error",j8,t=>t.toLowerCase().trim()==="error"),Sl("---",{db:{clear:k(()=>{},"clear")},styles:{},renderer:{draw:k(()=>{},"draw")},parser:{parse:k(()=>{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:k(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),su(A8,R8,dz),su(g6,H8,d8,l8,j6,D6,$6,W6,t8,i8,S6,C6,D8,A6,C8,g8,S8,Y6,V8,Q8,K6,iz,gz,lz,tz,bz,_z,wz,Bz))},"addDiagrams"),Lz=k(async()=>{et.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(di).map(async([r,{detector:n,loader:i}])=>{if(i)try{hu(r)}catch{try{const{diagram:s,id:o}=await i();Sl(o,s,n)}catch(s){throw et.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete di[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){et.error(`Failed to load ${e.length} external diagrams`);for(const r of e)et.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),Az="graphics-document document";function Uw(t,e){t.attr("role",Az),e!==""&&t.attr("aria-roledescription",e)}k(Uw,"setA11yDiagramInfo");function Yw(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)}}}k(Yw,"addSVGa11yTitleDescription");var ci,ed=(ci=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 h,u;const n=me(),i=Qd(e,n);e=hO(e)+`
601
- `;try{hu(i)}catch{const d=_M(i);if(!d)throw new Uy(`Diagram ${i} not found.`);const{id:f,diagram:p}=await d();Sl(f,p)}const{db:s,parser:o,renderer:a,init:l}=hu(i);return o.parser&&(o.parser.yy=s),(h=s.clear)==null||h.call(s),l==null||l(n),r.title&&((u=s.setDiagramTitle)==null||u.call(s,r.title)),await o.parse(e),new ci(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}},k(ci,"Diagram"),ci),Gg=[],Mz=k(()=>{Gg.forEach(t=>{t()}),Gg=[]},"attachFunctions"),Iz=k(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Gw(t){const e=t.match(Hy);if(!e)return{text:t,metadata:{}};let r=pP(e[1],{schema:dP})??{};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}}k(Gw,"extractFrontMatter");var Fz=k(t=>t.replace(/\r\n?/g,`
602
- `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),Dz=k(t=>{const{text:e,metadata:r}=Gw(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"),Pz=k(t=>{const e=Pr.detectInit(t)??{},r=Pr.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:QP(t),directive:e}},"processDirectives");function Kp(t){const e=Fz(t),r=Dz(e),n=Pz(r.text),i=Ap(r.config,n.directive);return t=Iz(n.text),{code:t,title:r.title,config:i}}k(Kp,"preprocessDiagram");function Vw(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}k(Vw,"toBase64");var Oz=5e4,$z="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",Rz="sandbox",zz="loose",Wz="http://www.w3.org/2000/svg",qz="http://www.w3.org/1999/xlink",Hz="http://www.w3.org/1999/xhtml",Uz="100%",Yz="100%",Gz="border:0;margin:0;",Vz="margin:0",Xz="allow-top-navigation-by-user-activation allow-popups",Kz='The "iframe" tag is not supported by your browser.',Qz=["foreignobject"],Zz=["dominant-baseline"];function Qp(t){const e=Kp(t);return vl(),JM(e.config??{}),e}k(Qp,"processAndSetConfigs");async function Xw(t,e){Lc();try{const{code:r,config:n}=Qp(t);return{diagramType:(await Qw(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}k(Xw,"parse");var Vg=k((t,e,r=[])=>{const n=Ky(`{ ${r.join(" !important; ")} !important; }`);return`.${t} ${e} ${n}`},"cssImportantStyles"),Jz=k((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=>{lg(l.styles)||a.forEach(h=>{r.insertRule(Vg(l.id,h,l.styles),r.cssRules.length)}),lg(l.textStyles)||r.insertRule(Vg(l.id,"tspan",((l==null?void 0:l.textStyles)||[]).map(h=>h.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=cu(i)+`
603
- `}else n+=`${t.themeCSS}
604
- `;return n+cu(r)},"createCssStyles"),t9=k((t,e)=>td(c6(`${t}{${e}}`),d6([k(function(n,i,s,o){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===Qu)return;n.props=n.props.map(a=>a.startsWith(t)?a:`${t} ${a}`)}else n.type.startsWith("@")&&([...[XR,QR,lw,JR,"@container","@starting-style"],Qu].includes(n.type)||(et.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=Vp))},"addNamespace"),u6])),"compileCSS"),e9=k((t,e,r,n)=>{const i=Jz(t,r),s=y3(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return t9(n,s)},"createUserStyles"),r9=k((t="",e,r)=>{let n=t;return!r&&!e&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=gi(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),n9=k((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":Yz,n=Vw(`<body style="${Vz}">${t}</body>`);return`<iframe style="width:${Uz};height:${r};${Gz}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${Xz}">
605
- ${Kz}
606
- </iframe>`},"putIntoIFrame"),Xg=k((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",Wz);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function rd(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}k(rd,"sandboxedIframe");var i9=k((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"),s9=k(async function(t,e,r){var z,W,O,M,A,P;Lc();const n=Qp(e);e=n.code;const i=me();et.debug(i),e.length>((i==null?void 0:i.maxTextSize)??Oz)&&(e=$z);const s=`#${t}`,o="i"+t,a="#"+o,l="d"+t,h="#"+l,u=k(()=>{const j=Ut(f?a:h).node();j&&"remove"in j&&j.remove()},"removeTempElements");let d=Ut(document.body);const f=i.securityLevel===Rz,p=i.securityLevel===zz,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const $=rd(Ut(r),o);d=Ut($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Ut(r);Xg(d,t,l,`font-family: ${m}`,qz)}else{if(i9(document,t,l,o),f){const $=rd(Ut(document.body),o);d=Ut($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Ut("body");Xg(d,t,l)}let x,g;try{x=await ed.fromText(e,{title:n.title})}catch($){if(i.suppressErrorRendering)throw u(),$;x=await ed.fromText("error"),g=$}const y=d.select(h).node(),C=x.type,b=y.firstChild,S=b.firstChild,_=(W=(z=x.renderer).getClasses)==null?void 0:W.call(z,e,x),w=e9(i,C,_,s),B=document.createElement("style");B.innerHTML=w,b.insertBefore(B,S);try{await x.renderer.draw(e,t,"11.15.0",x)}catch($){throw i.suppressErrorRendering?u():_8.draw(e,t,"11.15.0"),$}const L=d.select(`${h} svg`),I=(M=(O=x.db).getAccTitle)==null?void 0:M.call(O),E=(P=(A=x.db).getAccDescription)==null?void 0:P.call(A);Zw(C,L,I,E),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",Hz);let F=d.select(h).node().innerHTML;if(et.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),F=r9(F,f,yn(i.arrowMarkerAbsolute)),f){const $=d.select(h+" svg").node();F=n9(F,$)}else p||(F=ys.sanitize(F,{ADD_TAGS:Qz,ADD_ATTR:Zz,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(Mz(),g)throw g;return u(),{diagramType:C,svg:F,bindFunctions:x.db.bindFunctions}},"render");function Kw(t={}){var n;const e=Le({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),QM(e),e!=null&&e.theme&&e.theme in un?e.themeVariables=un[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=un.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?KM(e):Qy();Kd(r.logLevel),Lc()}k(Kw,"initialize");var Qw=k((t,e={})=>{const{code:r}=Kp(t);return ed.fromText(r,e)},"getDiagramFromText");function Zw(t,e,r,n){Uw(e,t),Yw(e,r,n,e.attr("id"))}k(Zw,"addA11yInfo");var yi=Object.freeze({render:s9,parse:Xw,getDiagramFromText:Qw,initialize:Kw,getConfig:me,setConfig:Zy,getSiteConfig:Qy,updateSiteConfig:ZM,reset:k(()=>{vl()},"reset"),globalReset:k(()=>{vl(bs)},"globalReset"),defaultConfig:bs});Kd(me().logLevel);vl(me());var o9=k((t,e,r)=>{et.warn(t),Lp(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"),Jw=k(async function(t={querySelector:".mermaid"}){try{await a9(t)}catch(e){if(Lp(e)&&et.error(e.str),kr.parseError&&kr.parseError(e),!t.suppressErrors)throw et.error("Use the suppressErrors option to suppress these errors"),e}},"run"),a9=k(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=yi.getConfig();et.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");et.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(et.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),yi.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new Pr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const l of Array.from(i)){if(et.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const h=`mermaid-${s.next()}`;o=l.innerHTML,o=pk(Pr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Pr.detectInit(o);u&&et.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:f}=await n2(h,o,l);l.innerHTML=d,t&&await t(h),f&&f(l)}catch(d){o9(d,a,kr.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),t2=k(function(t){yi.initialize(t)},"initialize"),l9=k(async function(t,e,r){et.warn("mermaid.init is deprecated. Please use run instead."),t&&t2(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await Jw(n)},"init"),c9=k(async(t,{lazyLoad:e=!0}={})=>{Lc(),su(...t),e===!1&&await Lz()},"registerExternalDiagrams"),e2=k(function(){if(kr.startOnLoad){const{startOnLoad:t}=yi.getConfig();t&&kr.run().catch(e=>et.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",e2,!1);var h9=k(function(t){kr.parseError=t},"setParseErrorHandler"),Kl=[],Bh=!1,r2=k(async()=>{if(!Bh){for(Bh=!0;Kl.length>0;){const t=Kl.shift();if(t)try{await t()}catch(e){et.error("Error executing queue",e)}}Bh=!1}},"executeQueue"),u9=k(async(t,e)=>new Promise((r,n)=>{const i=k(()=>new Promise((s,o)=>{yi.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;et.error("Error parsing",a),(l=kr.parseError)==null||l.call(kr,a),o(a),n(a)})}),"performCall");Kl.push(i),r2().catch(n)}),"parse"),n2=k((t,e,r)=>new Promise((n,i)=>{const s=k(()=>new Promise((o,a)=>{yi.render(t,e,r).then(l=>{o(l),n(l)},l=>{var h;et.error("Error parsing",l),(h=kr.parseError)==null||h.call(kr,l),a(l),i(l)})}),"performCall");Kl.push(s),r2().catch(i)}),"render"),d9=k(()=>Object.keys(di).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),kr={startOnLoad:!0,mermaidAPI:yi,parse:u9,render:n2,init:l9,run:Jw,registerExternalDiagrams:c9,registerLayoutLoaders:sw,initialize:t2,parseError:void 0,contentLoaded:e2,setParseErrorHandler:h9,detectType:Qd,registerIconPacks:x$,getRegisteredDiagramsMetadata:d9},i2=kr;/*! Check if previously processed *//*!
607
- * Wait for document loaded before starting the execution
608
- */const s2=4e3,Kg={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 p9(){const[t,e]=v.useState(null),r=v.useRef(null);if(v.useEffect(()=>{function i(s){const{message:o,level:a="info",ttl:l=s2}=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=Kg[t.level]??Kg.info;return c.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:[c.jsx("span",{className:"flex-1 min-w-0 truncate",children:t.message}),c.jsx("button",{className:"shrink-0 opacity-60 hover:opacity-100 text-[10px]",onClick:()=>{clearTimeout(r.current),e(null)},"aria-label":"Dismiss notification",children:"✕"})]})}function je(t,e="info",r=s2){try{window.dispatchEvent(new CustomEvent("compose:notify",{detail:{message:t,level:e,ttl:r}}))}catch{}}i2.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function f9({code:t}){const e=v.useRef(null),r=v.useId(),[n,i]=v.useState(null),[s,o]=v.useState(null);return v.useEffect(()=>{let a=!1;const l=`mermaid-${r.replace(/:/g,"")}`;return i2.render(l,t).then(({svg:h})=>{a||i(h)}).catch(h=>{a||o(h.message||"Invalid diagram")}),()=>{a=!0}},[t,r]),s?c.jsx("pre",{className:"text-[11px] text-destructive bg-destructive/10 border border-destructive/20 rounded p-3 overflow-x-auto",children:`Mermaid error: ${s}
609
-
610
- ${t}`}):n?c.jsx("div",{ref:e,className:"my-3 overflow-x-auto",dangerouslySetInnerHTML:{__html:n}}):c.jsx("div",{className:"text-[11px] text-muted-foreground py-2",children:"Rendering diagram..."})}function m9({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?c.jsx(f9,{code:String(e).trim()}):c.jsx("code",{className:t,...r,children:e})}function g9(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 o2(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=o2(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function a2(t){let e=t.files.length;for(const r of t.children.values())e+=a2(r);return e}function l2({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=x9(t,e),h=r.has(l)||!!a,u=a2(t);return c.jsxs("div",{children:[c.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:[h?c.jsx(AS,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):c.jsx(Cd,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name}),c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto tabular-nums shrink-0",children:u})]}),h&&c.jsxs(c.Fragment,{children:[[...t.children.values()].sort((d,f)=>d.name.localeCompare(f.name)).map(d=>c.jsx(l2,{node:d,depth:e+1,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a},d.name)),t.files.sort((d,f)=>d.name.localeCompare(f.name)).map(d=>c.jsx(c2,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function c2({file:t,depth:e,isSelected:r,isTracked:n,onSelect:i}){return c.jsxs("button",{onClick:i,className:st("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:[c.jsx(bi,{className:"h-3 w-3 shrink-0",style:{color:n?"hsl(var(--primary))":void 0}}),c.jsx("span",{className:st("text-xs truncate",r?"text-accent font-medium":"text-foreground"),children:t.name}),n&&c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 ml-auto",style:{background:"hsl(var(--primary))"}})]})}function x9(t,e){return`dir-${e}-${t.name}`}function h2({items:t,selectedFile:e,onSelectedFileChange:r,previousView:n,onBack:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,h]=v.useState([]),[u,d]=v.useState(!0),[f,p]=v.useState(null),m=e||f,x=G=>{p(G),r&&r(G)},[g,y]=v.useState(null),[C,b]=v.useState(!1),[S,_]=v.useState(!1),[w,B]=v.useState(""),[L,I]=v.useState(null),[E,F]=v.useState(!1),z=v.useRef(null),[W,O]=v.useState(""),[M,A]=v.useState(()=>new Set(["dir-0-docs"])),[P,$]=v.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),j=v.useRef(!1),T=v.useRef(null),Y=v.useCallback(G=>{G.preventDefault(),j.current=!0;const lt=_t=>{if(!j.current||!T.current)return;const Rt=T.current.getBoundingClientRect(),se=Math.min(Math.max(_t.clientX-Rt.left,160),500);$(se)},kt=()=>{j.current=!1,document.removeEventListener("mousemove",lt),document.removeEventListener("mouseup",kt),$(_t=>(localStorage.setItem("compose:docsTreeWidth",_t),_t))};document.addEventListener("mousemove",lt),document.addEventListener("mouseup",kt)},[]),J=S&&w!==L,D=v.useCallback(async()=>{if(!(!m||E)){F(!0);try{const G=await Ft("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:w})});G.ok?(I(w),y(w),je("Saved","info")):je(`Save failed (${G.status})`,"error")}catch(G){je(`Save failed: ${G.message}`,"error")}F(!1)}},[m,w,E]),Q=v.useCallback(()=>{_(G=>(!G&&g!==null&&(B(g),I(g)),!G))},[g]);v.useEffect(()=>{if(!S)return;const G=lt=>{(lt.metaKey||lt.ctrlKey)&&lt.key==="s"&&(lt.preventDefault(),D())};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[S,D]),v.useEffect(()=>{_(!1),B(""),I(null)},[m]),v.useEffect(()=>{Ft("/api/files").then(G=>G.json()).then(G=>{h(G.files||[]),d(!1);const lt=new Set(["dir-0-docs"]);for(const kt of G.files||[]){const _t=kt.split("/");_t.length>1&&lt.add(`dir-1-${_t[1]}`)}A(lt)}).catch(()=>d(!1))},[]),v.useEffect(()=>{if(!m){y(null);return}b(!0),Ft(`/api/file?path=${encodeURIComponent(m)}`).then(G=>G.json()).then(G=>{y(G.content??null),b(!1)}).catch(()=>{y(null),b(!1)})},[m]);const ut=v.useMemo(()=>!o||!s?l:l.filter(G=>G.includes(`features/${s}/`)),[l,o,s]),ct=v.useMemo(()=>{const G=new Set,lt=kt=>kt.split("/").pop();for(const kt of t){const _t=`${kt.title||""} ${kt.description||""} ${kt.planLink||""}`.toLowerCase();for(const Rt of ut)(_t.includes(Rt.toLowerCase())||_t.includes(lt(Rt).replace(".md","").toLowerCase()))&&G.add(Rt)}return G},[t,ut]),$t=v.useMemo(()=>g9(ut),[ut]),Et=v.useMemo(()=>o2($t,W),[$t,W]),ot=v.useCallback(G=>{A(lt=>{const kt=new Set(lt);return kt.has(G)?kt.delete(G):kt.add(G),kt})},[]);return u?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading docs..."})}):c.jsxs("div",{ref:T,className:"flex-1 flex min-h-0",children:[c.jsxs("div",{className:"shrink-0 flex flex-col min-h-0",style:{width:`${P}px`},children:[c.jsxs("div",{className:"px-2 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[c.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:c.jsx(ta,{featureCode:s,active:o,onToggle:a})}),c.jsxs("div",{className:"relative",children:[c.jsx(Wn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(pd,{placeholder:"Search files...",value:W,onChange:G=>O(G.target.value),className:"h-7 pl-7 pr-7 text-xs"}),W&&c.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c.jsx(gn,{className:"h-3 w-3"})})]}),c.jsxs("div",{className:"flex items-center justify-between mt-1.5 px-1",children:[c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ut.length," files"]}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ut.length-ct.size," untracked"]})]})]}),c.jsx(Dn,{className:"flex-1",children:c.jsxs("div",{className:"py-1",children:[[...Et.children.values()].sort((G,lt)=>G.name.localeCompare(lt.name)).map(G=>c.jsx(l2,{node:G,depth:0,expandedDirs:M,onToggleDir:ot,selectedFile:m,onSelectFile:x,trackedPaths:ct,searchQuery:W},G.name)),Et.files.sort((G,lt)=>G.name.localeCompare(lt.name)).map(G=>c.jsx(c2,{file:G,depth:0,isSelected:m===G.path,isTracked:ct.has(G.path),onSelect:()=>x(G.path)},G.path))]})})]}),c.jsx("div",{onMouseDown:Y,className:"w-1 shrink-0 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors",style:{background:"hsl(var(--border))"}}),c.jsx("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:m?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2",style:{borderBottom:"1px solid hsl(var(--border))"},children:[n&&i&&c.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:[c.jsx(lS,{className:"h-3 w-3"}),"Back to ",n.charAt(0).toUpperCase()+n.slice(1)]}),c.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:m}),J&&c.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"}),ct.has(m)&&c.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"}),S&&c.jsxs("button",{onClick:D,disabled:E||!J,className:st("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",J?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[c.jsx(oT,{className:"h-3 w-3"}),E?"Saving...":"Save"]}),c.jsx("button",{onClick:Q,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:S?"Preview":"Edit",disabled:g===null,children:S?c.jsx(Xx,{className:"h-3.5 w-3.5"}):c.jsx(Zx,{className:"h-3.5 w-3.5"})})]}),C?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):g!==null&&S?c.jsx("textarea",{ref:z,value:w,onChange:G=>B(G.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?c.jsx(Dn,{className:"flex-1",children:c.jsx("div",{className:"px-6 py-4 max-w-3xl",children:c.jsx("article",{className:`prose prose-sm prose-invert max-w-none
611
- prose-headings:text-foreground prose-p:text-muted-foreground
612
- prose-a:text-accent prose-strong:text-foreground
613
- prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
614
- prose-pre:bg-muted prose-pre:border prose-pre:border-border
615
- prose-li:text-muted-foreground prose-table:text-xs
616
- prose-th:text-foreground prose-td:text-muted-foreground
617
- prose-hr:border-border`,children:c.jsx($d,{remarkPlugins:[qd],components:{code:m9},children:g})})})}):c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Could not load file"})})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx(bi,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/30"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a file to preview"}),c.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Markdown files from the project docs/ directory"})]})})})]})}class y9{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=C=>{if(C=this.postProcess(C,n),i){setTimeout(function(){i(C)},0);return}else return C},a=r.length,l=e.length;let h=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,f=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(p[0],r,e,0,n);if(p[0].oldPos+1>=l&&m+1>=a)return o(this.buildValues(p[0].lastComponent,r,e));let x=-1/0,g=1/0;const y=()=>{for(let C=Math.max(x,-h);C<=Math.min(g,h);C+=2){let b;const S=p[C-1],_=p[C+1];S&&(p[C-1]=void 0);let w=!1;if(_){const L=_.oldPos-C;w=_&&0<=L&&L<a}const B=S&&S.oldPos+1<l;if(!w&&!B){p[C]=void 0;continue}if(!B||w&&S.oldPos<_.oldPos?b=this.addToPath(_,!0,!1,0,n):b=this.addToPath(S,!1,!0,1,n),m=this.extractCommon(b,r,e,C,n),b.oldPos+1>=l&&m+1>=a)return o(this.buildValues(b.lastComponent,r,e))||!0;p[C]=b,b.oldPos+1>=l&&(g=Math.min(g,C-1)),m+1>=a&&(x=Math.max(x,C+1))}h++};if(i)(function C(){setTimeout(function(){if(h>u||Date.now()>f)return i(void 0);y()||C()},0)})();else for(;h<=u&&Date.now()<=f;){const C=y();if(C)return C}}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,h=l-i,u=0;for(;h+1<o&&l+1<a&&this.equals(n[l+1],r[h+1],s);)h++,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,h}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,h=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(n.slice(h,h+u.count)),h+=u.count;else{if(!u.added&&this.useLongestToken){let d=r.slice(l,l+u.count);d=d.map(function(f,p){const m=n[h+p];return m.length>f.length?m:f}),u.value=this.join(d)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(h+=u.count)}}return i}}class b9 extends y9{constructor(){super(...arguments),this.tokenize=v9}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
618
- `))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
619
- `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
620
- `)&&(e=e.slice(0,-1)),r.endsWith(`
621
- `)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const C9=new b9;function k9(t,e,r){return C9.diff(t,e,r)}function v9(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
622
- `));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 Zp({oldText:t,newText:e}){const[r,n]=v.useState(!1),{parts:i,addCount:s,removeCount:o}=v.useMemo(()=>{if(!t||!e)return{parts:[],addCount:0,removeCount:0};const a=k9(t,e);let l=0,h=0;for(const u of a){const d=u.value.split(`
623
- `).filter(f=>f!=="").length;u.added&&(l+=d),u.removed&&(h+=d)}return{parts:a,addCount:l,removeCount:h}},[t,e]);return!t||!e?null:s===0&&o===0?c.jsx("span",{className:"text-[9px] text-muted-foreground/50 italic",children:"No changes"}):r?c.jsxs("div",{className:"mt-1.5",children:[c.jsx("button",{onClick:()=>n(!1),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors mb-1",children:"Hide changes"}),c.jsx("div",{className:"rounded border border-border bg-muted/30 overflow-x-auto max-h-[300px] overflow-y-auto",children:c.jsx("pre",{className:"text-[10px] font-mono leading-relaxed",children:i.map((a,l)=>{const h=a.value.split(`
624
- `);return h[h.length-1]===""&&h.pop(),h.map((u,d)=>c.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:[c.jsx("span",{className:"inline-block w-3 text-muted-foreground/40 select-none mr-1",children:a.added?"+":a.removed?"-":" "}),u||" "]},`${l}-${d}`))})})})]}):c.jsxs("button",{onClick:()=>n(!0),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors",children:["Show changes (+",s," -",o,")"]})}function u2(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 w9({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=r0[t.fromPhase];return e.exists?c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r&&c.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&&c.jsxs("span",{className:"text-amber-400",children:[" (missing: ",e.sections.missing.join(", "),")"]}),!e.meetsMinWordCount&&c.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}):c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r??"Artifact"," not found"]})}function S9(t){var p;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,h=((p=s==null?void 0:s.missing)==null?void 0:p.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(h>0)return{sentence:`Missing ${h} section${h>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 T9({gate:t}){const e=S9(t);if(!e)return null;const r=e.outcome==="approve";return c.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 Qg({title:t,count:e,color:r,children:n}){return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:r}}),c.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:t}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:e})]}),n]})}function _9({gate:t,item:e,priorRevision:r,isExpanded:n,expandedAction:i,onExpand:s,onResolve:o,onSelect:a}){const[l,h]=v.useState(""),u=()=>{o(t.id,"revised",l||void 0),s(null,null),h("")},d=()=>{l.trim()&&(o(t.id,"killed",l),s(null,null),h(""))};return c.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent hover:bg-muted/50 transition-colors",children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[c.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"}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:pn[t.stepId]??`${we[t.fromPhase]??t.fromPhase} → ${we[t.toPhase]??t.toPhase}`}),c.jsx(w9,{gate:t}),r?c.jsxs("div",{className:"space-y-1",children:[c.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&&c.jsx("div",{className:"px-2",children:c.jsx(Zp,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:u2(t.createdAt)})]}),c.jsx("div",{className:"mt-1.5",children:c.jsx(T9,{gate:t})}),c.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[c.jsx(Ot,{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"}),c.jsx(Ot,{variant:"outline",size:"sm",className:st("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"),h(""))},children:"Revise"}),c.jsx(Ot,{variant:"outline",size:"sm",className:st("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"),h(""))},children:"Kill"})]}),n&&c.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[c.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:f=>h(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(i==="revise"?u():i==="kill"&&d()),f.key==="Escape"&&s(null,null)},autoFocus:!0}),c.jsx(Ot,{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 E9(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function j9({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=E9(t);return c.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:(e==null?void 0:e.title)??"Unknown"}),c.jsx(ir,{variant:"outline",className:st("text-[10px] px-1.5 py-0 h-4",n.color,n.border),children:t.outcome}),i!=="human"&&c.jsx("span",{className:"text-[9px] px-1 py-0 rounded bg-muted text-muted-foreground",children:i}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:u2(t.resolvedAt)})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:pn[t.stepId]??`${we[t.fromPhase]??t.fromPhase} → ${we[t.toPhase]??t.toPhase}`}),t.comment&&c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function d2({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o}){const[a,l]=v.useState(null),[h,u]=v.useState(null),d=v.useMemo(()=>{if(!s||!i)return t;const b=new Set(e.filter(S=>{var _;return S.featureCode===i||((_=S.lifecycle)==null?void 0:_.featureCode)===i}).map(S=>S.id));return t.filter(S=>b.has(S.itemId))},[t,e,s,i]),f=(b,S)=>{l(b),u(S)},{pending:p,resolved:m,priorRevisions:x}=v.useMemo(()=>{const b=[],S=[];for(const w of d)w.status==="pending"?b.push(w):w.resolvedAt&&S.push(w);b.sort((w,B)=>new Date(w.createdAt)-new Date(B.createdAt)),S.sort((w,B)=>new Date(B.resolvedAt)-new Date(w.resolvedAt));const _=new Map;for(const w of b){const B=S.find(L=>L.stepId===w.stepId&&L.itemId===w.itemId&&(L.outcome==="revised"||L.outcome==="revise")&&L.comment);B&&_.set(w.id,{comment:B.comment,priorSnapshot:B.artifactSnapshot||null,currentSnapshot:w.artifactSnapshot||null})}return{pending:b,resolved:S,priorRevisions:_}},[d]),[g,y]=v.useState(!1),C=v.useMemo(()=>new Map(e.map(b=>[b.id,b])),[e]);return c.jsxs("div",{className:"flex-1 overflow-auto flex flex-col",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0",children:[c.jsx(ta,{featureCode:i,active:s,onToggle:o}),c.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),p.length>0?c.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:[p.length," pending"]}):c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),m.length>0&&c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",m.length," resolved"]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[p.length>0&&c.jsx(Qg,{title:"Pending",count:p.length,color:"#f59e0b",children:p.map(b=>c.jsx(_9,{gate:b,item:C.get(b.itemId),priorRevision:x.get(b.id),isExpanded:a===b.id,expandedAction:a===b.id?h:null,onExpand:f,onResolve:r,onSelect:n},b.id))}),m.length>0&&c.jsxs(Qg,{title:"History",count:m.length,color:"#22c55e",children:[(g?m.slice(0,50):m.slice(0,10)).map(b=>c.jsx(j9,{gate:b,item:C.get(b.itemId)},b.id)),m.length>10&&!g&&c.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"]})]}),p.length===0&&m.length===0&&c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function p2({event:t,items:e,onNavigate:r}){const[n,i]=v.useState(!1),[s,o]=v.useState(null);if(v.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",h=s.type==="pending"?`Gate pending: ${Ao(s,a)}`:`Gate ${s.outcome}: ${l}`;return c.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:h})}function N9({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=v.useContext(hc),i=r.has(t.id)?"vision-entering":n.has(t.id)?"vision-updated":"",[s,o]=v.useState(!1),[a,l]=v.useState(""),h=t.status==="complete"||t.status==="killed",{baseDesc:u,resolution:d}=v.useMemo(()=>{if(!t.description)return{baseDesc:"",resolution:""};const x=`
625
-
626
- ---
627
- 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]),f=v.useCallback(async()=>{const g=`Be brief. Summarize, give your recommendation, refine the decision wording based on the resolution if needed: ${t.description||t.title}
628
- `;try{const y=await Ft(K2("/api/terminal/inject"),{method:"POST",headers:Vi({"Content-Type":"application/json"}),body:JSON.stringify({text:g})});if(!y.ok){je(`Could not send to terminal (${y.status})`,"error");return}const C=document.querySelector(".xterm-helper-textarea");C&&C.focus()}catch(y){console.error("Failed to inject into terminal:",y),je(`Could not send to terminal: ${y.message}`,"error")}},[t]),p=v.useCallback(()=>{const x=a.trim()?`${t.description||""}
629
-
630
- ---
631
- Resolution: ${a.trim()}`:t.description;e(t.id,{status:"complete",description:x}),o(!1),l("")},[t.id,t.description,a,e]),m=v.useCallback(()=>{e(t.id,{status:"killed"})},[t.id,e]);return c.jsxs("div",{className:st("rounded-lg border p-3 space-y-2 transition-all",h?"border-border/50 bg-muted/20 opacity-60":"border-border bg-muted/30",i),children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{background:h?"hsl(var(--muted-foreground))":fr.question}}),c.jsx("p",{className:st("text-sm font-medium leading-snug flex-1",h?"text-muted-foreground line-through":"text-foreground"),children:t.title})]}),u&&c.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed pl-4",children:u}),d&&c.jsxs("div",{className:st("ml-4 pl-3 border-l-2 border-success/40 py-1",n.has(t.id)&&"resolution-sparkle"),children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-0.5",children:"Resolution"}),c.jsx("p",{className:"text-xs text-foreground leading-relaxed",children:d})]}),s&&c.jsxs("div",{className:"ml-4 flex items-center gap-1.5",children:[c.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"&&p(),x.key==="Escape"&&o(!1)},autoFocus:!0}),c.jsx(Ot,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:p,children:c.jsx(kd,{className:"h-3 w-3"})}),c.jsx(Ot,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:c.jsx(gn,{className:"h-3 w-3"})})]}),!h&&!s&&c.jsxs("div",{className:"flex items-center gap-1.5 pl-4",children:[c.jsxs("button",{onClick:f,className:"text-[10px] px-2 py-0.5 rounded-md text-accent hover:bg-accent/10 flex items-center gap-1 transition-colors",children:[c.jsx(nc,{className:"h-2.5 w-2.5"})," Discuss"]}),c.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:[c.jsx(Xo,{className:"h-2.5 w-2.5"})," Resolve"]}),c.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:[c.jsx(SS,{className:"h-2.5 w-2.5"})," Dismiss"]})]}),h&&c.jsx("div",{className:"pl-4",children:c.jsx("span",{className:st("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 f2({item:t,items:e,connections:r,onUpdate:n,onClose:i}){const[s,o]=v.useState(null),[a,l]=v.useState(null),[h,u]=v.useState(""),d=v.useRef(null),f=v.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 C=x.get(y.fromId);C&&g.push(C)}if(y.fromId===t.id){const C=x.get(y.toId);C&&g.push(C)}}return g.sort((y,C)=>{const b=new Date(y.createdAt||0).getTime();return new Date(C.createdAt||0).getTime()-b}),g},[t.id,e,r]),p=f.filter(x=>x.status!=="complete"&&x.status!=="killed").length;v.useEffect(()=>{if(!(!s||a!=="running"))return d.current=setInterval(async()=>{try{const x=await Ft(`/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=v.useCallback(async()=>{if(a==="running")return;const x=t.description?`
632
- 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(`
633
- `);l("running");try{const y=await Ft("/api/agent/spawn",{method:"POST",headers:Vi({"Content-Type":"application/json"}),body:JSON.stringify({prompt:g})});if(!y.ok){const b=await y.json().catch(()=>({}));l("failed"),u(b.error||"Failed to spawn agent"),je(`Could not start challenge agent (${y.status})`,"error");return}const C=await y.json();o(C.agentId)}catch(y){l("failed"),u(y.message),je(`Could not start challenge agent: ${y.message}`,"error")}},[t,a]);return c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[c.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:i}),c.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:[c.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3 border-b border-border shrink-0",children:[c.jsx(cl,{className:"h-5 w-5 text-amber-400 shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pressure Test"}),c.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t.title})]}),c.jsx(Ot,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:c.jsx(gn,{className:"h-3.5 w-3.5"})})]}),c.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-3",children:[a==="running"&&c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[c.jsx(Qx,{className:"h-3.5 w-3.5 text-accent animate-spin"}),c.jsx("span",{className:"text-xs text-accent",children:"Generating challenges..."})]}),a==="failed"&&c.jsx("div",{className:"px-3 py-2 rounded-lg bg-destructive/10 border border-destructive/20",children:c.jsxs("span",{className:"text-xs text-destructive",children:["Failed: ",h]})}),f.length===0&&!a?c.jsxs("div",{className:"text-center py-8",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"No challenges yet."}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Run a pressure test to generate counter-questions."})]}):f.map(x=>c.jsx(N9,{item:x,onUpdate:n},x.id))]}),c.jsxs("div",{className:"flex items-center justify-between p-4 pt-3 border-t border-border shrink-0",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:p>0?`${p} open / ${f.length} total`:f.length>0?`${f.length} resolved`:"No challenges"}),c.jsxs(Ot,{size:"sm",className:st("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[c.jsx(cl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const B9=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],L9=["gate","flag","skip"],A9=["light","dark","system"],Zg=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function io({title:t,children:e}){return c.jsxs("div",{className:"mb-6",children:[c.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:t}),e]})}function Di({label:t,children:e}){return c.jsxs("div",{className:"flex items-center justify-between py-1.5 px-1",children:[c.jsx("label",{className:"text-sm text-foreground",children:t}),e]})}function M9({value:t,className:e,onCommit:r}){const[n,i]=v.useState(t||"");return v.useEffect(()=>{i(t||"")},[t]),c.jsx("input",{type:"text",className:e,value:n,onChange:s=>i(s.target.value),onBlur:()=>{n.trim()&&n.trim()!==t&&r(n.trim())}})}function m2({settings:t,onSettingsChange:e,onReset:r}){var p,m,x,g,y,C;const n=Rx();if(!t)return c.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."});const i=v.useCallback((b,S)=>{const _=S==="null"?null:S;e({policies:{[b]:_}})},[e]),s=v.useCallback((b,S)=>{const _=parseInt(S,10);_>=1&&_<=100&&e({iterations:{[b]:{maxIterations:_}}})},[e]),o=v.useCallback((b,S)=>{S.trim()&&e({models:{[b]:S.trim()}})},[e]),a=v.useCallback(b=>{if(e({ui:{theme:b}}),b==="system"){const S=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",S),localStorage.removeItem("compose:theme")}else document.documentElement.classList.toggle("dark",b==="dark"),localStorage.setItem("compose:theme",b)},[e]),l=v.useCallback(b=>{e({ui:{defaultView:b}})},[e]),h=v.useCallback(b=>{e({capabilities:{enforcement:b}})},[e]),u=v.useCallback(async()=>{await n({title:"Reset all settings to defaults?",destructive:!0})&&r()},[r,n]),d="h-7 text-xs rounded-md border border-input bg-background px-2 py-1",f="h-7 text-xs rounded-md border border-input bg-background px-2 py-1 w-24";return c.jsxs("div",{className:"flex-1 overflow-auto p-6 max-w-2xl",children:[c.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Settings"}),c.jsx(io,{title:"Phase Policies",children:B9.map(b=>c.jsx(Di,{label:we[b]||b,children:c.jsxs("select",{className:d,value:t.policies[b]===null?"null":t.policies[b]||"skip",onChange:S=>i(b,S.target.value),children:[b==="explore_design"&&c.jsx("option",{value:"null",children:"—"}),L9.map(S=>c.jsx("option",{value:S,children:S},S))]})},b))}),c.jsxs(io,{title:"Iteration Limits",children:[c.jsx(Di,{label:"Review max iterations",children:c.jsx("input",{type:"number",className:f,min:1,max:100,value:((m=(p=t.iterations)==null?void 0:p.review)==null?void 0:m.maxIterations)??10,onChange:b=>s("review",b.target.value)})}),c.jsx(Di,{label:"Coverage max iterations",children:c.jsx("input",{type:"number",className:f,min:1,max:100,value:((g=(x=t.iterations)==null?void 0:x.coverage)==null?void 0:g.maxIterations)??15,onChange:b=>s("coverage",b.target.value)})})]}),c.jsx(io,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var S;return c.jsx(Di,{label:b,children:c.jsx(M9,{className:f+" w-48",value:((S=t.models)==null?void 0:S[b])||"",onCommit:_=>o(b,_)},b)},b)})}),c.jsxs(io,{title:"Appearance",children:[c.jsx(Di,{label:"Theme",children:c.jsx("select",{className:d,value:((y=t.ui)==null?void 0:y.theme)||"system",onChange:b=>a(b.target.value),children:A9.map(b=>c.jsx("option",{value:b,children:b},b))})}),c.jsx(Di,{label:"Default view",children:c.jsx("select",{className:d,value:Zg.includes((C=t.ui)==null?void 0:C.defaultView)?t.ui.defaultView:"graph",onChange:b=>l(b.target.value),children:Zg.map(b=>c.jsx("option",{value:b,children:b},b))})})]}),c.jsx(io,{title:"Capability Enforcement",children:c.jsxs("div",{className:"space-y-2 px-1",children:[[{value:"log",label:"Log (default)"},{value:"block",label:"Block"}].map(({value:b,label:S})=>{var _;return c.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[c.jsx("input",{type:"radio",name:"enforcement",value:b,checked:(((_=t.capabilities)==null?void 0:_.enforcement)??"log")===b,onChange:()=>h(b),className:"accent-accent"}),c.jsx("span",{className:"text-sm text-foreground",children:S})]},b)}),c.jsx("p",{className:"text-[11px] text-muted-foreground pt-1",children:"Block stops the build on disallowed tool use; Log records but continues."})]})}),c.jsx("button",{onClick:u,className:"text-xs text-destructive hover:underline mt-2",children:"Reset to Defaults"})]})}function I9({icon:t=OS,title:e,description:r,action:n,onAction:i,className:s}){return c.jsxs("div",{className:st("flex flex-col items-center justify-center gap-3 p-8 text-center",s),children:[c.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-muted/50",children:c.jsx(t,{className:"w-6 h-6 text-muted-foreground/60"})}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("h3",{className:"text-sm font-medium text-foreground",children:e}),r&&c.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),n&&c.jsx(Ot,{variant:"outline",size:"sm",onClick:i,children:n})]})}function F9(){const[t,e]=v.useState([]),[r,n]=v.useState(!0),[i,s]=v.useState(null);v.useEffect(()=>{Ft("/api/pipeline/templates").then(a=>a.json()).then(a=>{e(a.templates||[]),n(!1)}).catch(()=>n(!1))},[]);const o=async a=>{s(a);try{const l=await Ft("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})});l.ok||je(`Could not create draft (${l.status})`,"error")}catch(l){console.error("[TemplateSelector] Failed to create draft:",l),je(`Could not create draft: ${l.message}`,"error")}s(null)};return r?c.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[c.jsx(Qx,{className:"w-4 h-4 animate-spin mr-2"}),"Loading templates..."]}):t.length===0?c.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"No pipeline templates found"}):c.jsxs("div",{className:"p-4 space-y-3",children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Choose a pipeline template"}),c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(a=>c.jsxs("button",{onClick:()=>o(a.id),disabled:i!==null,className:st("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",jT[a.category]||"border-border bg-card"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(bi,{className:"w-4 h-4 shrink-0"}),c.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.label})]}),c.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),c.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-auto",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(RS,{className:"w-3 h-3"})," ",a.steps," steps"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Vx,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),c.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function g2({activeBuild:t,pipelineDraft:e,onSelectStep:r,onRefresh:n}){const[i,s]=v.useState(null),[o,a]=v.useState(!1),[l,h]=v.useState(!1),u=b=>{const S=i===b?null:b;s(S),r&&r(S)},d=()=>{n&&n()},f=async()=>{if(e!=null&&e.draftId){a(!0);try{const b=await Ft("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});b.ok?je("Draft approved","info"):je(`Approve failed (${b.status})`,"error")}catch(b){console.error("[PipelineView] Approve failed:",b),je(`Approve failed: ${b.message}`,"error")}a(!1)}},p=async()=>{if(e!=null&&e.draftId){h(!0);try{const b=await Ft("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});b.ok||je(`Reject failed (${b.status})`,"error")}catch(b){console.error("[PipelineView] Reject failed:",b),je(`Reject failed: ${b.message}`,"error")}h(!1)}};if(!t&&!e)return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pipeline Templates"}),c.jsx("div",{className:"ml-auto",children:c.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:[c.jsx(ll,{className:"w-3 h-3"})," Refresh"]})})]}),c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(F9,{})})]});if(e){const b=e.steps||[],S=e.metadata||{};return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Draft Review"}),c.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[c.jsxs("button",{onClick:p,disabled:l||o,className:st("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:[c.jsx(gn,{className:"w-3 h-3"})," Reject"]}),c.jsxs("button",{onClick:f,disabled:o||l,className:st("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:[c.jsx(Xo,{className:"w-3 h-3"})," Approve"]})]})]}),c.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:[c.jsxs("span",{className:"text-amber-400 font-medium",children:["Draft: ",S.label||S.id||"Pipeline"]}),c.jsx("span",{className:"text-muted-foreground ml-2",children:S.description||""}),S.category&&c.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",S.category]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3",children:c.jsx("div",{className:"space-y-1",children:b.map((_,w)=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-slate-800/40 bg-card",children:[c.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}),c.jsx("span",{className:"text-xs text-foreground",children:_.id}),_.agent&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:_.agent}),_.function&&c.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(b=>[b.id,b.status])):{},x=(t==null?void 0:t.currentStepId)??null,g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(b=>[b.id,b])):{},y=Fc.map(b=>{const S=g[b.id];return S?{...b,...S}:b});if(t!=null&&t.steps)for(const b of t.steps)Fc.find(S=>S.id===b.id)||y.push({id:b.id,name:b.id.replace(/_/g," "),agent:"claude",phase:"implementation",...b});const C=Object.keys(nf).map(b=>({phase:b,config:nf[b],steps:y.filter(S=>S.phase===b)}));return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Pa,{icon:Xi,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),c.jsx(Pa,{icon:bd,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),c.jsx(Pa,{icon:vd,color:"text-slate-300 bg-slate-500/10",label:"Human"}),c.jsx(Pa,{icon:js,color:"text-amber-400 bg-amber-500/10",label:"Gate"})]}),c.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t&&c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Live: ",c.jsx("span",{className:"text-blue-400 font-medium",children:t.featureCode})]}),c.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:[c.jsx(ll,{className:"w-3 h-3"})," Refresh"]})]})]}),t&&c.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:[c.jsxs("span",{className:"text-blue-400 font-medium",children:["Active Build: ",t.featureCode]}),c.jsxs("span",{className:"text-muted-foreground ml-2",children:["status: ",t.status," · step ",t.stepNum??"?","/",t.totalSteps??Fc.length]}),x&&c.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",c.jsx("span",{className:"font-medium",children:x})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:C.map(({phase:b,config:S,steps:_})=>c.jsxs("div",{className:st("rounded-lg border p-3",S.color),children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:S.label}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:_.map((w,B)=>{const L=m[w.id]??null,I=w.id===x,E=w.id===i;return c.jsxs(Yt.Fragment,{children:[c.jsx(D9,{step:w,liveStatus:L,isCurrent:I,isSelected:E,onClick:()=>u(w.id)}),B<_.length-1&&c.jsx(Hx,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},w.id)})})]},b))})]})}function D9({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?js:t.agent==="claude"?Xi:t.agent==="codex"?bd:vd,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 c.jsxs("button",{onClick:i,className:st("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:[c.jsx("div",{className:st("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:c.jsx(s,{className:"w-3 h-3"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-[10px] font-medium text-foreground truncate leading-tight",children:t.name}),e&&c.jsx("p",{className:"text-[8px] text-muted-foreground capitalize",children:e})]})]})}function Pa({icon:t,color:e,label:r}){return c.jsxs("div",{className:st("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",e),children:[c.jsx(t,{className:"w-3 h-3"}),c.jsx("span",{children:r})]})}function P9(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,h,u;return((a=o.featureCode)==null?void 0:a.toLowerCase().includes(s))||((l=o.feature_code)==null?void 0:l.toLowerCase().includes(s))||((h=o.summary)==null?void 0:h.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 O9={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:Xi},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:bd},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:Xi},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:vd},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:Xi}},$9={bg:"bg-slate-800",text:"text-slate-600",Icon:Xi},Jg={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 R9({agent:t,size:e="md",className:r}){const n=O9[t]||$9,i=Jg[e]||Jg.md,{Icon:s}=n;return c.jsx("span",{className:st("inline-flex items-center justify-center rounded-full shrink-0",n.bg,n.text,i.outer,r),title:t||"unassigned",children:c.jsx(s,{className:i.icon})})}function ae(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 zn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const x2=6048e5,z9=864e5,Oa=43200,tx=1440;let W9={};function ha(){return W9}function Go(t,e){var a,l,h,u;const r=ha(),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=(h=r.locale)==null?void 0:h.options)==null?void 0:u.weekStartsOn)??0,i=ae(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 Ql(t){return Go(t,{weekStartsOn:1})}function y2(t){const e=ae(t),r=e.getFullYear(),n=zn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=Ql(n),s=zn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=Ql(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function ex(t){const e=ae(t);return e.setHours(0,0,0,0),e}function Zl(t){const e=ae(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 q9(t,e){const r=ex(t),n=ex(e),i=+r-Zl(r),s=+n-Zl(n);return Math.round((i-s)/z9)}function H9(t){const e=y2(t),r=zn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Ql(r)}function al(t,e){const r=ae(t),n=ae(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function U9(t){return zn(t,Date.now())}function Y9(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function G9(t){if(!Y9(t)&&typeof t!="number")return!1;const e=ae(t);return!isNaN(Number(e))}function V9(t,e){const r=ae(t),n=ae(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function X9(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function K9(t,e){return+ae(t)-+ae(e)}function Q9(t){const e=ae(t);return e.setHours(23,59,59,999),e}function Z9(t){const e=ae(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function J9(t){const e=ae(t);return+Q9(e)==+Z9(e)}function t7(t,e){const r=ae(t),n=ae(e),i=al(r,n),s=Math.abs(V9(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;J9(ae(t))&&s===1&&al(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function e7(t,e,r){const n=K9(t,e)/1e3;return X9(r==null?void 0:r.roundingMethod)(n)}function r7(t){const e=ae(t),r=zn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const n7={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"}},i7=(t,e,r)=>{let n;const i=n7[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 Lh(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const s7={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},o7={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},a7={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},l7={date:Lh({formats:s7,defaultWidth:"full"}),time:Lh({formats:o7,defaultWidth:"full"}),dateTime:Lh({formats:a7,defaultWidth:"full"})},c7={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},h7=(t,e,r,n)=>c7[t];function so(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 u7={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},d7={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},p7={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"]},f7={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"]},m7={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"}},g7={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"}},x7=(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"},y7={ordinalNumber:x7,era:so({values:u7,defaultWidth:"wide"}),quarter:so({values:d7,defaultWidth:"wide",argumentCallback:t=>t-1}),month:so({values:p7,defaultWidth:"wide"}),day:so({values:f7,defaultWidth:"wide"}),dayPeriod:so({values:m7,defaultWidth:"wide",formattingValues:g7,defaultFormattingWidth:"wide"})};function oo(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)?C7(a,d=>d.test(o)):b7(a,d=>d.test(o));let h;h=t.valueCallback?t.valueCallback(l):l,h=r.valueCallback?r.valueCallback(h):h;const u=e.slice(o.length);return{value:h,rest:u}}}function b7(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function C7(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function k7(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 v7=/^(\d+)(th|st|nd|rd)?/i,w7=/\d+/i,S7={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},T7={any:[/^b/i,/^(a|c)/i]},_7={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},E7={any:[/1/i,/2/i,/3/i,/4/i]},j7={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},N7={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]},B7={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},L7={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]},A7={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},M7={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}},I7={ordinalNumber:k7({matchPattern:v7,parsePattern:w7,valueCallback:t=>parseInt(t,10)}),era:oo({matchPatterns:S7,defaultMatchWidth:"wide",parsePatterns:T7,defaultParseWidth:"any"}),quarter:oo({matchPatterns:_7,defaultMatchWidth:"wide",parsePatterns:E7,defaultParseWidth:"any",valueCallback:t=>t+1}),month:oo({matchPatterns:j7,defaultMatchWidth:"wide",parsePatterns:N7,defaultParseWidth:"any"}),day:oo({matchPatterns:B7,defaultMatchWidth:"wide",parsePatterns:L7,defaultParseWidth:"any"}),dayPeriod:oo({matchPatterns:A7,defaultMatchWidth:"any",parsePatterns:M7,defaultParseWidth:"any"})},b2={code:"en-US",formatDistance:i7,formatLong:l7,formatRelative:h7,localize:y7,match:I7,options:{weekStartsOn:0,firstWeekContainsDate:1}};function F7(t){const e=ae(t);return q9(e,r7(e))+1}function D7(t){const e=ae(t),r=+Ql(e)-+H9(e);return Math.round(r/x2)+1}function C2(t,e){var u,d,f,p;const r=ae(t),n=r.getFullYear(),i=ha(),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??((p=(f=i.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=zn(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=Go(o,e),l=zn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const h=Go(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=h.getTime()?n:n-1}function P7(t,e){var a,l,h,u;const r=ha(),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=(h=r.locale)==null?void 0:h.options)==null?void 0:u.firstWeekContainsDate)??1,i=C2(t,e),s=zn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),Go(s,e)}function O7(t,e){const r=ae(t),n=+Go(r,e)-+P7(r,e);return Math.round(n/x2)+1}function ie(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const _n={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return ie(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):ie(r+1,2)},d(t,e){return ie(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 ie(t.getHours()%12||12,e.length)},H(t,e){return ie(t.getHours(),e.length)},m(t,e){return ie(t.getMinutes(),e.length)},s(t,e){return ie(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return ie(i,e.length)}},Pi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},rx={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 _n.y(t,e)},Y:function(t,e,r,n){const i=C2(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return ie(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):ie(s,e.length)},R:function(t,e){const r=y2(t);return ie(r,e.length)},u:function(t,e){const r=t.getFullYear();return ie(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 ie(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 ie(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 _n.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 ie(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=O7(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):ie(i,e.length)},I:function(t,e,r){const n=D7(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):ie(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):_n.d(t,e)},D:function(t,e,r){const n=F7(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):ie(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 ie(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 ie(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 ie(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=Pi.noon:n===0?i=Pi.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=Pi.evening:n>=12?i=Pi.afternoon:n>=4?i=Pi.morning:i=Pi.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 _n.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):_n.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):ie(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):ie(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):_n.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):_n.s(t,e)},S:function(t,e){return _n.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return ix(n);case"XXXX":case"XX":return ti(n);case"XXXXX":case"XXX":default:return ti(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return ix(n);case"xxxx":case"xx":return ti(n);case"xxxxx":case"xxx":default:return ti(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+nx(n,":");case"OOOO":default:return"GMT"+ti(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+nx(n,":");case"zzzz":default:return"GMT"+ti(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return ie(n,e.length)},T:function(t,e,r){const n=t.getTime();return ie(n,e.length)}};function nx(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+ie(s,2)}function ix(t,e){return t%60===0?(t>0?"-":"+")+ie(Math.abs(t)/60,2):ti(t,e)}function ti(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=ie(Math.trunc(n/60),2),s=ie(n%60,2);return r+i+e+s}const sx=(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"})}},k2=(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"})}},$7=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return sx(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}}",sx(n,e)).replace("{{time}}",k2(i,e))},R7={p:k2,P:$7},z7=/^D+$/,W7=/^Y+$/,q7=["D","DD","YY","YYYY"];function H7(t){return z7.test(t)}function U7(t){return W7.test(t)}function Y7(t,e,r){const n=G7(t,e,r);if(console.warn(n),q7.includes(t))throw new RangeError(n)}function G7(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 V7=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,X7=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,K7=/^'([^]*?)'?$/,Q7=/''/g,Z7=/[a-zA-Z]/;function J7(t,e,r){var u,d,f,p;const n=ha(),i=n.locale??b2,s=n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=n.weekStartsOn??((p=(f=n.locale)==null?void 0:f.options)==null?void 0:p.weekStartsOn)??0,a=ae(t);if(!G9(a))throw new RangeError("Invalid time value");let l=e.match(X7).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=R7[x];return g(m,i.formatLong)}return m}).join("").match(V7).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:tW(m)};if(rx[x])return{isToken:!0,value:m};if(x.match(Z7))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 h={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(m=>{if(!m.isToken)return m.value;const x=m.value;(U7(x)||H7(x))&&Y7(x,e,String(t));const g=rx[x[0]];return g(a,x,i.localize,h)}).join("")}function tW(t){const e=t.match(K7);return e?e[1].replace(Q7,"'"):t}function eW(t,e,r){const n=ha(),i=(r==null?void 0:r.locale)??n.locale??b2,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,h;o>0?(l=ae(e),h=ae(t)):(l=ae(t),h=ae(e));const u=e7(h,l),d=(Zl(h)-Zl(l))/1e3,f=Math.round((u-d)/60);let p;if(f<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):f===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",f,a);if(f<45)return i.formatDistance("xMinutes",f,a);if(f<90)return i.formatDistance("aboutXHours",1,a);if(f<tx){const m=Math.round(f/60);return i.formatDistance("aboutXHours",m,a)}else{if(f<s)return i.formatDistance("xDays",1,a);if(f<Oa){const m=Math.round(f/tx);return i.formatDistance("xDays",m,a)}else if(f<Oa*2)return p=Math.round(f/Oa),i.formatDistance("aboutXMonths",p,a)}if(p=t7(h,l),p<12){const m=Math.round(f/Oa);return i.formatDistance("xMonths",m,a)}else{const m=p%12,x=Math.trunc(p/12);return m<3?i.formatDistance("aboutXYears",x,a):m<9?i.formatDistance("overXYears",x,a):i.formatDistance("almostXYears",x+1,a)}}function rW(t,e){return eW(t,U9(t),e)}function nW({date:t,className:e}){if(!t)return c.jsx("span",{className:st("text-muted-foreground",e),children:"—"});let r;try{if(r=typeof t=="string"?new Date(t):t,isNaN(r.getTime()))return c.jsx("span",{className:st("text-muted-foreground",e),children:"—"})}catch{return c.jsx("span",{className:st("text-muted-foreground",e),children:"—"})}const n=rW(r,{addSuffix:!0}),i=J7(r,"PPpp");return c.jsx("time",{dateTime:r.toISOString(),title:i,className:st("text-muted-foreground tabular-nums",e),children:n})}function v2({sessions:t=[],items:e=[],onSelectItem:r,featureCode:n,focusActive:i,onToggleFocus:s}){const[o,a]=v.useState(""),[l,h]=v.useState("all"),[u,d]=v.useState("all"),f=v.useMemo(()=>t.filter(m=>m.status==="active").length,[t]),p=v.useMemo(()=>{let m=P9(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 c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[c.jsx(ta,{featureCode:n,active:i,onToggle:s}),c.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[c.jsx("span",{className:st("w-2 h-2 rounded-full",f>0?"bg-emerald-400":"bg-slate-600")}),c.jsxs("span",{className:"text-muted-foreground",children:[f," active"]})]}),c.jsx("div",{className:"h-4 w-px bg-border"}),c.jsxs("div",{className:"relative",children:[c.jsx(Wn,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),c.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"})]}),c.jsxs("select",{value:l,onChange:m=>h(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:[c.jsx("option",{value:"all",children:"All agents"}),n0.filter(m=>m!=="unassigned").map(m=>c.jsx("option",{value:m,children:m},m))]}),c.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:[c.jsx("option",{value:"all",children:"All status"}),["active","completed","failed","paused"].map(m=>c.jsx("option",{value:m,children:m},m))]}),c.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[p.length,"/",t.length]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[p.length===0&&c.jsx(I9,{icon:yd,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),p.map(m=>c.jsx(iW,{session:m,items:e,onSelectItem:r},m.id))]})]})}function iW({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=rf[n]||rf.exploring,a=i?e.find(l=>{var h;return l.featureCode===i||l.feature_code===i||((h=l.lifecycle)==null?void 0:h.featureCode)===i}):null;return c.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:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(R9,{agent:t.agent,size:"sm",className:"shrink-0"}),c.jsx(Xd,{status:t.status,className:"shrink-0"}),n&&c.jsx("span",{className:st("text-[10px] px-1.5 py-0.5 rounded",o),children:n}),i&&c.jsx("button",{onClick:()=>a&&(r==null?void 0:r(a.id)),className:st("text-[10px] font-mono",a?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:i}),c.jsx(nW,{date:s,className:"ml-auto text-[10px] shrink-0"})]}),t.summary&&c.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:t.summary}),c.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[c.jsxs("span",{children:["📄 ",t.reads??0]}),c.jsxs("span",{children:["📤 ",t.writes??0]}),c.jsxs("span",{className:(t.errors??0)>0?"text-red-400":void 0,children:["⚠ ",t.errors??0]})]})]})}const ox=t=>Symbol.iterator in t,ax=t=>"entries"in t,lx=(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},sW=(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 oW(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:ox(t)&&ox(e)?ax(t)&&ax(e)?lx(t,e):sW(t,e):lx({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function vi(t){const e=Yt.useRef(void 0);return r=>{const n=t(r);return oW(e.current,n)?e.current:e.current=n}}function w2({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=pr(vi(g=>({items:g.items,gates:g.gates,sessions:g.sessions}))),[a,l]=v.useState(""),[h,u]=v.useState(0),d=v.useRef(null);v.useEffect(()=>{t&&(l(""),u(0),setTimeout(()=>{var g;return(g=d.current)==null?void 0:g.focus()},0))},[t]);const f=v.useMemo(()=>{if(!t)return[];if(!a.trim()){const S=s.filter(w=>w.status==="pending").slice(0,3).map(w=>({type:"gate",id:w.id,label:Ao(w,i.find(B=>B.id===w.itemId)),sub:pn[w.stepId]?`${we[w.fromPhase]??w.fromPhase} → ${we[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[...S.length?[{type:"section",label:"Pending Gates"}]:[],...S,..._.length?[{type:"section",label:"Blocked Items"}]:[],..._]}const g=a.toLowerCase(),y=i.filter(S=>{var _,w;return((_=S.title)==null?void 0:_.toLowerCase().includes(g))||((w=S.featureCode)==null?void 0:w.toLowerCase().includes(g))||(S.description||"").toLowerCase().includes(g)}).slice(0,5).map(S=>({type:"item",id:S.id,label:S.title,sub:`${S.type} · ${S.phase??""}`,status:S.status,item:S})),C=s.filter(S=>{var _;return(S.fromPhase||"").toLowerCase().includes(g)||(S.toPhase||"").toLowerCase().includes(g)||(((_=i.find(w=>w.id===S.itemId))==null?void 0:_.title)??"").toLowerCase().includes(g)}).slice(0,3).map(S=>({type:"gate",id:S.id,label:Ao(S,i.find(_=>_.id===S.itemId)),sub:S.status,status:S.status,gate:S})),b=(o||[]).filter(S=>(S.featureCode||"").toLowerCase().includes(g)||(S.summary||"").toLowerCase().includes(g)).slice(0,2).map(S=>({type:"session",id:S.id,label:S.featureCode||S.id,sub:S.summary||S.agent||"",status:S.status,session:S}));return[...y.length?[{type:"section",label:"Items"}]:[],...y,...C.length?[{type:"section",label:"Gates"}]:[],...C,...b.length?[{type:"section",label:"Sessions"}]:[],...b]},[t,a,i,s,o]),p=f.filter(g=>g.type!=="section"),m=v.useCallback(g=>{if(g.key==="Escape"){e();return}if(g.key==="ArrowDown"){g.preventDefault(),u(y=>(y+1)%Math.max(1,p.length));return}if(g.key==="ArrowUp"){g.preventDefault(),u(y=>(y-1+Math.max(1,p.length))%Math.max(1,p.length));return}if(g.key==="Enter"){const y=p[h];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}},[p,h,a,e,n,r]);let x=0;return t?c.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh]",onClick:e,children:c.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:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-slate-700/50",children:[c.jsx(Wn,{className:"h-4 w-4 text-muted-foreground shrink-0"}),c.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"}),c.jsx("kbd",{className:"text-[10px] text-muted-foreground border border-border rounded px-1 py-0.5",children:"esc"})]}),c.jsxs("div",{className:"max-h-80 overflow-y-auto py-1",children:[f.length===0&&c.jsx("div",{className:"py-8 text-center text-xs text-muted-foreground",children:a?"No results":"No pending gates or blocked items"}),f.map((g,y)=>{if(g.type==="section")return c.jsx("div",{className:"px-4 pt-2 pb-1",children:c.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:g.label})},`section-${y}`);const C=x++,b=h===C;return c.jsxs("button",{className:st("flex w-full items-center gap-3 px-4 py-2 text-left transition-colors",b?"bg-accent/10":"hover:bg-muted/50"),onMouseEnter:()=>u(C),onClick:()=>{g.type==="gate"?n==null||n(g.id):g.type==="item"?r==null||r(g.id):e()},children:[g.type==="gate"&&c.jsx(js,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&c.jsx(ic,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&c.jsx(yd,{className:"h-4 w-4 text-blue-400 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm text-foreground truncate",children:g.label}),g.sub&&c.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:g.sub})]}),g.status&&c.jsx(Xd,{status:g.status})]},g.id)})]}),c.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/50 text-[10px] text-muted-foreground",children:[c.jsxs("span",{children:[c.jsx("kbd",{className:"border border-border rounded px-1",children:"↑↓"})," navigate"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"border border-border rounded px-1",children:"↵"})," select"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"border border-border rounded px-1",children:"esc"})," close"]})]})]})}):null}const cx=[{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"}}],aW=["gate","flag","skip"];function hx(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function S2({open:t,onClose:e,parentItem:r}){const n=pr(C=>C.createItem),[i,s]=v.useState(()=>hx(r)),[o,a]=v.useState("task"),[l,h]=v.useState(!1),[u,d]=v.useState(!1),[f,p]=v.useState(""),m=v.useRef(null);v.useEffect(()=>{if(t){const C=hx(r);s(C),a("task"),h(!1),p(""),setTimeout(()=>{var b;return(b=m.current)==null?void 0:b.focus()},50)}},[t,r]);const x=C=>{const b=cx.find(S=>S.id===C);b&&(a(C),s(S=>({...S,type:b.defaults.type,phase:(r==null?void 0:r.phase)??b.defaults.phase,priority:b.defaults.priority,governance:b.defaults.governance})))},g=async()=>{if(!i.title.trim()){p("Title is required");return}d(!0),p("");try{const C={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(C),e()}catch{p("Failed to create item")}finally{d(!1)}},y=C=>{C.key==="Enter"&&!C.shiftKey&&C.target.tagName!=="TEXTAREA"&&(C.preventDefault(),g())};return c.jsx(fd,{open:t,onOpenChange:C=>!C&&e(),children:c.jsxs(md,{className:"max-w-md",onKeyDown:y,children:[c.jsx(gd,{children:c.jsx(xd,{children:"New Item"})}),c.jsxs("div",{className:"px-6 pb-2 space-y-4",children:[c.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:cx.map(C=>c.jsx("button",{type:"button",onClick:()=>x(C.id),className:st("rounded-md px-2 py-1.5 text-[11px] font-medium border transition-colors",o===C.id?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:C.label},C.id))}),c.jsx("input",{ref:m,type:"text",placeholder:"Item title…",value:i.title,onChange:C=>s(b=>({...b,title:C.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"}),c.jsx("textarea",{placeholder:"Description (optional)…",value:i.description,onChange:C=>s(b=>({...b,description:C.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"}),c.jsxs("button",{type:"button",onClick:()=>h(C=>!C),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l?c.jsx(Yx,{className:"h-3 w-3"}):c.jsx(Ko,{className:"h-3 w-3"}),"Advanced"]}),l&&c.jsxs("div",{className:"space-y-3 border border-border/40 rounded-md p-3 bg-muted/20",children:[c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Feature Code"}),c.jsx("input",{type:"text",placeholder:"e.g. COMP-UI-5",value:i.featureCode,onChange:C=>s(b=>({...b,featureCode:C.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none"})]}),c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Phase"}),c.jsx("select",{value:i.phase,onChange:C=>s(b=>({...b,phase:C.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:e0.map(C=>c.jsx("option",{value:C,children:hl[C]??C},C))})]}),c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Priority"}),c.jsxs("select",{value:i.priority,onChange:C=>s(b=>({...b,priority:Number(C.target.value)})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:[c.jsx("option",{value:0,children:"Low (0)"}),c.jsx("option",{value:1,children:"Normal (1)"}),c.jsx("option",{value:2,children:"High (2)"}),c.jsx("option",{value:3,children:"Critical (3)"})]})]}),c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Assign to"}),c.jsx("select",{value:i.assignedTo,onChange:C=>s(b=>({...b,assignedTo:C.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:n0.map(C=>c.jsx("option",{value:C,children:C},C))})]}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Governance"}),c.jsx("div",{className:"flex gap-1.5",children:aW.map(C=>c.jsx("button",{type:"button",onClick:()=>s(b=>({...b,governance:C})),className:st("flex-1 text-[11px] px-2 py-1 rounded border transition-colors",i.governance===C?C==="gate"?"bg-amber-500/20 text-amber-300 border-amber-500/40":C==="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:C},C))})]})]}),f&&c.jsx("p",{className:"text-xs text-destructive",children:f})]}),c.jsxs(zx,{children:[c.jsx(Ot,{variant:"ghost",size:"sm",onClick:e,disabled:u,children:"Cancel"}),c.jsx(Ot,{size:"sm",onClick:g,disabled:u||!i.title.trim(),children:u?"Creating…":"Create"})]})]})})}const lW=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],cW=[{id:"gate",Icon:js,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:Xx,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:t0,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function hW(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 T2({open:t,onClose:e,settings:r,onSettingsChange:n}){const[i,s]=v.useState(!1),o=v.useRef(null),a=v.useCallback((l,h)=>{n==null||n({governance:{phases:{[l]:h}}}),clearTimeout(o.current),s(!0),o.current=setTimeout(()=>s(!1),1500)},[n]);return c.jsx(fd,{open:t,onOpenChange:l=>!l&&e(),children:c.jsxs(md,{className:"max-w-sm",children:[c.jsx(gd,{children:c.jsxs("div",{className:"flex items-center justify-between pr-6",children:[c.jsx(xd,{children:"Governance Settings"}),i&&c.jsx("span",{className:"text-[11px] text-emerald-400 font-medium",children:"Saved ✓"})]})}),c.jsx("div",{className:"px-6 pb-6 space-y-1 max-h-96 overflow-y-auto",children:lW.map(l=>{const h=l==="explore_design",u=hW(r,l),d=we[l]??l;return c.jsxs("div",{className:st("flex items-center gap-3 rounded-md px-2 py-1.5",h&&"opacity-40"),children:[c.jsx("span",{className:st("text-xs flex-1 min-w-0 truncate",h?"text-muted-foreground":"text-foreground"),children:d}),h?c.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"no policy"}):c.jsx("div",{className:"flex gap-1 shrink-0",children:cW.map(f=>{const p=u===f.id,{Icon:m}=f;return c.jsxs("button",{onClick:()=>a(l,f.id),title:f.label,className:st("flex items-center gap-1 px-2 py-0.5 text-[10px] rounded border transition-colors",p?f.active:"border-border/30 text-muted-foreground hover:border-border hover:text-foreground"),children:[c.jsx(m,{className:"h-2.5 w-2.5"}),f.label]},f.id)})})]},l)})}),c.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 _2({onOpenGate:t}){const{gates:e,items:r}=pr(vi(g=>({gates:g.gates,items:g.items}))),[n,i]=v.useState(new Set),[s,o]=v.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),h=a[l],u=r.find(g=>g.id===h.itemId)||r.find(g=>{var y;return((y=g.lifecycle)==null?void 0:y.featureCode)&&h.featureCode&&g.lifecycle.featureCode===h.featureCode}),d=Ao(h,u),f=NT[h.fromPhase]??BT,p=()=>{i(g=>new Set([...g,h.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 c.jsxs("div",{className:st("shrink-0 h-10 border-t flex items-center gap-2 px-3",f.bg,f.border),children:[c.jsx(js,{className:st("h-3.5 w-3.5 shrink-0",f.text)}),c.jsx("span",{className:st("text-[11px] font-medium truncate flex-1 min-w-0",f.text),children:d}),a.length>1&&c.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[c.jsx("button",{onClick:m,disabled:l===0,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:c.jsx(Ux,{className:"h-3 w-3"})}),c.jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[l+1,"/",a.length]}),c.jsx("button",{onClick:x,disabled:l===a.length-1,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:c.jsx(fs,{className:"h-3 w-3"})})]}),c.jsx("button",{onClick:()=>t==null?void 0:t(h.id),className:st("shrink-0 text-[10px] px-2 py-0.5 rounded border transition-colors hover:opacity-80",f.border,f.text),children:"Review"}),c.jsx("button",{onClick:p,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:c.jsx(gn,{className:"h-3 w-3"})})]})}const uW="●",dW="text-zinc-400";function pW(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 fW(t){var e;return((e=i0[t])==null?void 0:e.icon)??uW}function mW(t){var e;return((e=i0[t])==null?void 0:e.color)??dW}const gW={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 xW(t){return gW[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function yW(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function bW(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function CW({event:t,now:e}){const r=fW(t.kind),n=mW(t.kind),i=pW(t.timestamp,e);return c.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:[c.jsxs("div",{className:"flex items-center justify-between gap-1",children:[c.jsx("span",{className:st("text-[11px] shrink-0",n),children:r}),c.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:i||bW(t.timestamp)})]}),c.jsx("p",{className:"text-[11px] text-foreground/80 truncate leading-tight",children:t.title}),t.roles&&t.roles.length>0&&c.jsx("div",{className:"flex flex-wrap gap-0.5 mt-0.5",children:t.roles.map((s,o)=>c.jsx("span",{"data-role-chip":!0,className:st("text-[9px] px-1 py-px rounded-full leading-tight",xW(s.name)),children:s.name},o))})]})}function E2({events:t=[],currentFeatureCode:e,now:r}){const n=yW(t,e);return n.length===0?null:c.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:c.jsx("div",{className:"flex items-center gap-2 px-3 h-full",children:n.map(i=>c.jsx(CW,{event:i,now:r},i.id))})})}function kW(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 vW="Select a feature to see status.";function j2({featureCode:t,snapshot:e}){const[r,n]=v.useState(!1),i=v.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??vW,o=kW(e);return c.jsxs(c.Fragment,{children:[c.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:[c.jsx("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1},children:s}),c.jsx("span",{style:{marginLeft:8,opacity:.5,fontSize:10},"aria-hidden":"true",children:r?"▲":"▼"})]}),r&&c.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:c.jsx("div",{style:{padding:"8px 12px"},children:o.length===0?c.jsx("span",{className:"text-muted-foreground",children:"No details available."}):c.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:c.jsx("tbody",{children:o.map((a,l)=>c.jsxs("tr",{children:[c.jsx("td",{style:{paddingRight:16,paddingBottom:2,fontWeight:500,whiteSpace:"nowrap"},className:"text-foreground/60",children:a.label}),c.jsx("td",{style:{paddingBottom:2},children:String(a.value)})]},l))})})})})]})}function wW({onContextSelect:t,sidebarOpen:e=!0,onToggleSidebar:r}){const{items:n,connections:i,connected:s,uiCommand:o,clearUICommand:a,recentChanges:l,createItem:h,updateItem:u,deleteItem:d,createConnection:f,deleteConnection:p,agentActivity:m,agentErrors:x,sessionState:g,registerSnapshotProvider:y,gates:C,gateEvent:b,resolveGate:S,settings:_,updateSettings:w,resetSettings:B,activeBuild:L,setActiveBuild:I,pipelineDraft:E,sessions:F,selectedPhase:z,setSelectedPhase:W,decisionEvents:O,statusSnapshots:M,setStatusSnapshot:A}=pr(),[P,$]=v.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),j=v.useRef(!!sessionStorage.getItem("vision-activeView")),[T,Y]=v.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[J,D]=v.useState(""),[Q,ut]=v.useState(null),[ct,$t]=v.useState(!1),[Et,ot]=v.useState(!1),[G,lt]=v.useState(!1);v.useEffect(()=>{sessionStorage.setItem("vision-activeView",T)},[T]),v.useEffect(()=>{P?sessionStorage.setItem("vision-selectedItemId",P):sessionStorage.removeItem("vision-selectedItemId")},[P]);const kt=v.useRef(!1);v.useEffect(()=>{var rt;(rt=_==null?void 0:_.ui)!=null&&rt.defaultView&&!kt.current&&!j.current&&(Y(_.ui.defaultView),kt.current=!0)},[_]),v.useEffect(()=>{o&&(o.view&&Y(o.view),o.phase!==void 0&&W(o.phase),o.select!==void 0&&$(o.select),a())},[o,a]),v.useEffect(()=>{const rt=()=>{var U;return["INPUT","TEXTAREA","SELECT"].includes((U=document.activeElement)==null?void 0:U.tagName)},mt=U=>{(U.metaKey||U.ctrlKey)&&U.key==="k"&&(U.preventDefault(),$t(nt=>!nt)),(U.metaKey||U.ctrlKey)&&U.key==="n"&&(U.preventDefault(),ot(!0)),U.key===","&&!U.metaKey&&!U.ctrlKey&&!rt()&&lt(!0)};return window.addEventListener("keydown",mt),()=>window.removeEventListener("keydown",mt)},[]);const _t=v.useMemo(()=>{let rt=n;if(z&&(rt=rt.filter(mt=>mt.phase===z)),J){const mt=J.toLowerCase();rt=rt.filter(U=>U.title.toLowerCase().includes(mt)||(U.description||"").toLowerCase().includes(mt))}return rt},[n,z,J]),Rt=v.useMemo(()=>z?n.filter(rt=>rt.phase===z):n,[n,z]),se=v.useMemo(()=>new Set(Rt.map(rt=>rt.id)),[Rt]),ge=v.useMemo(()=>z?C.filter(rt=>se.has(rt.itemId)):C,[C,se,z]),Qe=v.useMemo(()=>{if(!z&&!J)return i;const rt=new Set(_t.map(mt=>mt.id));return i.filter(mt=>rt.has(mt.fromId)&&rt.has(mt.toId))},[i,_t,z,J]);v.useEffect(()=>{y(()=>({activeView:T,selectedPhase:z,searchQuery:J,selectedItemId:P,totalItems:n.length,filteredCount:_t.length,connected:s}))},[y,T,z,J,P,n.length,_t.length,s]);const Gt=v.useCallback(rt=>{$(rt),t&&t({type:"item",id:rt})},[t]),Ce=v.useCallback((rt,mt)=>{u(rt,mt)},[u]);v.useCallback(async()=>{const mt=await h({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:z||"vision"});mt&&mt.id&&$(mt.id)},[h,z]),v.useCallback(async rt=>{await d(rt),P===rt&&($(null),t&&t(null))},[d,P,t]);const V=v.useCallback(rt=>{const mt=C.find(U=>U.id===rt);mt&&($(mt.itemId),t&&t({type:"item",id:mt.itemId}))},[C,t]);v.useCallback(async rt=>f(rt),[f]),v.useCallback(async rt=>p(rt),[p]);const it=v.useCallback(()=>{Ft("/api/build/state").then(rt=>rt.json()).then(rt=>I(rt.state??null)).catch(()=>{})},[I]),dt=v.useCallback(rt=>{t&&t({type:"step",id:rt})},[t]),wt=v.useMemo(()=>{var mt;if(!P)return null;const rt=n.find(U=>U.id===P);return((mt=rt==null?void 0:rt.lifecycle)==null?void 0:mt.featureCode)||null},[P,n]);return v.useEffect(()=>{wt&&(M&&M[wt]||Ft(`/api/lifecycle/status?featureCode=${encodeURIComponent(wt)}`).then(rt=>rt.json()).then(rt=>{rt.snapshot&&A&&A(wt,rt.snapshot)}).catch(()=>{}))},[wt]),c.jsx(hc.Provider,{value:l,children:c.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[c.jsx(j2,{featureCode:wt,snapshot:wt?(M==null?void 0:M[wt])??null:null}),wt&&c.jsx(E2,{events:O,currentFeatureCode:wt}),c.jsxs("div",{className:"flex-1 flex min-h-0",children:[c.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[r&&c.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&&c.jsx(My,{items:n,gates:C,activeBuild:L,activeView:T,onViewChange:Y,selectedPhase:z,onPhaseSelect:W,searchQuery:J,onSearchChange:D,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Gt,onThemeChange:w,onNewItem:()=>ot(!0)})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[!s&&c.jsx("div",{className:"text-center text-[10px] py-0.5 bg-destructive text-destructive-foreground",children:"Disconnected — reconnecting..."}),T==="tree"&&c.jsx(Fy,{items:_t,connections:Qe,selectedItemId:P,onSelect:Gt}),T==="graph"&&c.jsx(Py,{items:_t,connections:Qe,selectedItemId:P,onSelect:Gt}),T==="pipeline"&&c.jsx(g2,{activeBuild:L,pipelineDraft:E,onSelectStep:dt,onRefresh:it}),T==="sessions"&&c.jsx(v2,{sessions:F,items:n,onSelectItem:Gt}),T==="docs"&&c.jsx(h2,{items:Rt}),T==="gates"&&c.jsx(d2,{gates:ge,items:Rt,onResolve:S,onSelect:Gt}),T==="settings"&&c.jsx(m2,{settings:_,onSettingsChange:w,onReset:B})]}),c.jsx(_2,{onOpenGate:V}),Q&&(()=>{const rt=n.find(mt=>mt.id===Q);return rt?c.jsx(f2,{item:rt,items:n,connections:i,onUpdate:Ce,onClose:()=>ut(null)}):null})(),c.jsx(p2,{event:b,items:n,onNavigate:()=>Y("gates")}),c.jsx(w2,{open:ct,onClose:()=>$t(!1),onSelectItem:rt=>{Gt(rt),$t(!1)},onSelectGate:rt=>{V(rt),$t(!1)}}),c.jsx(S2,{open:Et,onClose:()=>ot(!1)}),c.jsx(T2,{open:G,onClose:()=>lt(!1),settings:_,onSettingsChange:w})]})]})})}Vo.use(qx);const SW={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},TW={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function _W(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 EW(){const[t,e]=v.useState(()=>document.documentElement.classList.contains("dark"));return v.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const jW={"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}},NW={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function BW(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 Jl="compose:graph:";function LW(t){try{const e=localStorage.getItem(Jl+t);return e?JSON.parse(e):null}catch{return null}}function AW(t,e){try{localStorage.setItem(Jl+t,JSON.stringify(e))}catch{}}const MW=[{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 Gi({onClick:t,active:e,children:r,title:n}){return c.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 $a({mode:t,active:e,onClick:r}){return c.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 Ah(){return c.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function ux({arrow:t,label:e,edgeStyle:r,color:n,targetLabel:i,targetColor:s,suffix:o}){return c.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:t}),c.jsx("span",{style:{color:n||"hsl(var(--muted-foreground))",fontStyle:r==="dashed"?"italic":"normal"},children:e||"connects"}),i?c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s||"hsl(var(--muted-foreground) / 0.6)"}}),c.jsx("span",{style:{color:"hsl(var(--foreground))"},children:i})]})]}):o?c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:o}):null,r&&r!=="solid"&&c.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",r,")"]})]})}function IW({nodes:t,edges:e,graphKey:r}){const[n,i]=v.useState(()=>{try{const l=localStorage.getItem(Jl+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});v.useEffect(()=>{try{localStorage.setItem(Jl+r+":tree-collapsed",JSON.stringify([...n]))}catch{}},[n,r]);const s=v.useMemo(()=>{const l={};for(const h of t)l[h.id]=h;return l},[t]),o=v.useMemo(()=>{var u,d;const l={},h={};for(const f of t)l[f.id]=[],h[f.id]=[];for(const f of e)(u=l[f.from])==null||u.push(f),(d=h[f.to])==null||d.push(f);return{out:l,inc:h}},[t,e]),a=l=>i(h=>{const u=new Set(h);return u.has(l)?u.delete(l):u.add(l),u});return c.jsxs("div",{className:"w-full h-full overflow-y-auto",style:{background:"hsl(var(--background))",padding:"1rem"},children:[c.jsxs("div",{className:"flex items-center mb-4",style:{gap:"8px"},children:[c.jsx(Gi,{onClick:()=>i(new Set),children:"Expand all"}),c.jsx(Gi,{onClick:()=>i(new Set(t.map(l=>l.id))),children:"Collapse all"}),c.jsxs("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground))"},children:[t.length," entities · ",e.length," relations"]})]}),t.map(l=>{const h=n.has(l.id),u=o.out[l.id]||[],d=o.inc[l.id]||[],f=u.filter(g=>g.from===g.to),p=u.filter(g=>g.from!==g.to),m=d.filter(g=>g.from!==g.to),x=p.length+m.length+f.length;return c.jsxs("div",{className:"mb-0.5",children:[c.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:[c.jsx("span",{className:"text-xs w-4 text-center inline-block transition-transform",style:{color:"hsl(var(--muted-foreground))",transform:h?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),c.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"}}),c.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:l.label}),l.sublabel&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:["— ",l.sublabel]}),c.jsx("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:x})]}),!h&&c.jsxs("div",{style:{paddingLeft:"32px",paddingBottom:"4px"},children:[p.map((g,y)=>{var C,b;return c.jsx(ux,{arrow:"→",label:g.label,edgeStyle:g.style,color:g.color,targetLabel:((C=s[g.to])==null?void 0:C.label)||g.to,targetColor:(b=s[g.to])==null?void 0:b.color},`out-${y}`)}),f.map((g,y)=>c.jsx(ux,{arrow:"↻",label:g.label,edgeStyle:g.style,color:g.color,suffix:"(self)"},`self-${y}`)),m.map((g,y)=>{var C,b;return c.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:((C=s[g.from])==null?void 0:C.color)||"hsl(var(--muted-foreground) / 0.6)"}}),c.jsx("span",{style:{color:"hsl(var(--foreground))"},children:((b=s[g.from])==null?void 0:b.label)||g.from})]}),c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),c.jsx("span",{style:{color:g.color||"hsl(var(--muted-foreground))",fontStyle:g.style==="dashed"?"italic":"normal"},children:g.label||"connects"}),c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→ this"}),g.style&&g.style!=="solid"&&c.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",g.style,")"]})]},`in-${y}`)}),x===0&&c.jsx("div",{className:"text-xs italic",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground) / 0.6)"},children:"no relations"})]})]},l.id)})]})}function FW({elements:t,nodes:e,edges:r,layout:n,style:i,title:s,subtitle:o,graphKey:a="default",onNodeClick:l}){const h=v.useRef(null),u=v.useRef(null),[d,f]=v.useState(null),p=EW(),m=p?SW:TW,x=v.useMemo(()=>LW(a),[a]),[g,y]=v.useState((x==null?void 0:x.layoutKey)||"dagre-tb"),[C,b]=v.useState((x==null?void 0:x.showEdgeLabels)??!0),[S,_]=v.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[w,B]=v.useState((x==null?void 0:x.showLegend)??!0),[L,I]=v.useState((x==null?void 0:x.viewMode)||"graph");v.useEffect(()=>{AW(a,{layoutKey:g,showEdgeLabels:C,hiddenNodes:[...S],showLegend:w,viewMode:L})},[a,g,C,S,w,L]);const E=t||(e&&r?BW(e,r):[]),F=v.useMemo(()=>i||_W(m),[i,p]),z=n||jW[g],W=v.useMemo(()=>E.filter(T=>!T.data.source).map(T=>({id:T.data.id,label:T.data.label,color:T.data.color})),[JSON.stringify(E)]),O=v.useMemo(()=>S.size===0?E:E.filter(T=>T.data.source?!S.has(T.data.source)&&!S.has(T.data.target):!S.has(T.data.id)),[E,S]);v.useEffect(()=>{if(!h.current)return;const T=Vo({container:h.current,elements:O,style:F,layout:z,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=T,T.on("mouseover","node",Y=>{const J=Y.target;J.style("border-width",2),J.style("border-opacity",1);const D=J.renderedPosition();f({x:D.x,y:D.y-J.renderedHeight()/2-12,label:J.data("label"),sublabel:J.data("sublabel"),id:J.id(),color:J.data("color")})}),T.on("mouseout","node",Y=>{Y.target.style("border-width",1),Y.target.style("border-opacity",.5),f(null)}),l&&T.on("tap","node",Y=>l(Y.target.id())),T.on("layoutstop",()=>T.fit(void 0,40)),()=>{T.destroy(),u.current=null}},[JSON.stringify(O),JSON.stringify(z),p,L]),v.useEffect(()=>{const T=u.current;T&&T.edges().forEach(Y=>{Y.data("label")&&Y.style("label",C?Y.data("label"):"")})},[C]);const M=v.useCallback(()=>{var T;return(T=u.current)==null?void 0:T.fit(void 0,40)},[]),A=v.useCallback(()=>{const T=u.current;T&&T.zoom({level:T.zoom()*1.3,renderedPosition:{x:T.width()/2,y:T.height()/2}})},[]),P=v.useCallback(()=>{const T=u.current;T&&T.zoom({level:T.zoom()/1.3,renderedPosition:{x:T.width()/2,y:T.height()/2}})},[]),$=v.useCallback(T=>{_(Y=>{const J=new Set(Y);return J.has(T)?J.delete(T):J.add(T),J})},[]),j=v.useCallback(()=>_(new Set),[]);return L==="tree"?c.jsxs("div",{className:"w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[c.jsxs("div",{className:"flex items-center justify-between shrink-0",style:{padding:"8px 16px",borderBottom:"1px solid hsl(var(--border))"},children:[c.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[s&&c.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&c.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),c.jsxs("div",{className:"flex",style:{gap:"4px"},children:[c.jsx($a,{mode:"graph",active:L==="graph",onClick:()=>I("graph")}),c.jsx($a,{mode:"tree",active:L==="tree",onClick:()=>I("tree")})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(IW,{nodes:e||[],edges:r||[],graphKey:a})})]}):c.jsxs("div",{className:"w-full h-full relative",style:{background:"hsl(var(--background))"},children:[(s||o)&&c.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&&c.jsx("div",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&c.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),c.jsxs("div",{className:"absolute top-2 right-3 z-[2] flex items-center",style:{gap:"4px"},children:[c.jsx("select",{value:g,onChange:T=>y(T.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(NW).map(([T,Y])=>c.jsx("option",{value:T,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:Y},T))}),c.jsx(Ah,{}),c.jsx(Gi,{onClick:P,title:"Zoom out",children:"−"}),c.jsx(Gi,{onClick:M,title:"Fit to view",children:"Fit"}),c.jsx(Gi,{onClick:A,title:"Zoom in",children:"+"}),c.jsx(Ah,{}),c.jsx(Gi,{onClick:()=>B(!w),active:w,title:w?"Hide legend":"Show legend",children:"Legend"}),c.jsx(Ah,{}),c.jsx($a,{mode:"graph",active:L==="graph",onClick:()=>I("graph")}),c.jsx($a,{mode:"tree",active:L==="tree",onClick:()=>I("tree")})]}),w&&c.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:[c.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Entities"}),S.size>0&&c.jsx("button",{onClick:j,className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:"hsl(var(--primary))"},children:"Show all"})]}),c.jsx("div",{className:"flex flex-col gap-1",children:W.map(T=>{const Y=S.has(T.id);return c.jsxs("button",{onClick:()=>$(T.id),className:"flex items-center gap-1.5 bg-transparent border-none py-0.5 cursor-pointer transition-opacity",style:{opacity:Y?.35:1},title:Y?`Show ${T.label}`:`Hide ${T.label}`,children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:Y?"transparent":T.color,border:`1.5px solid ${T.color}`}}),c.jsx("span",{className:"text-xs",style:{color:Y?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:Y?"line-through":"none"},children:T.label})]},T.id)})}),c.jsxs("div",{className:"flex justify-between items-center mt-2.5 mb-1.5",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Edges"}),c.jsx("button",{onClick:()=>b(!C),className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:C?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:C?"Hide labels":"Show labels"})]}),c.jsx("div",{className:"flex flex-col gap-1",children:MW.map(T=>c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("svg",{width:"20",height:"6",className:"shrink-0",children:c.jsx("line",{x1:"0",y1:"3",x2:"20",y2:"3",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.5",strokeDasharray:T.dash||"none"})}),c.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:T.label})]},T.style))})]}),d&&c.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:[c.jsx("div",{className:"text-sm font-semibold",style:{color:d.color||"hsl(var(--foreground))"},children:d.label}),d.sublabel&&c.jsx("div",{className:"text-xs mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:d.sublabel}),c.jsx("div",{className:"text-[10px] mt-1 font-mono",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:d.id})]}),c.jsx("div",{ref:h,className:"w-full h-full"})]})}const zt={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"},DW=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:zt.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:zt.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:zt.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:zt.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:zt.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:zt.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:zt.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:zt.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:zt.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:zt.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:zt.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:zt.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:zt.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:zt.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:zt.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:zt.decision},{id:"question",label:"Question",sublabel:"may block progress",color:zt.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:zt.artifact}],PW=[{from:"p-vision",to:"p-specification",color:zt.pipeline},{from:"p-specification",to:"p-planning",color:zt.pipeline},{from:"p-planning",to:"p-implementation",color:zt.pipeline},{from:"p-implementation",to:"p-verification",color:zt.pipeline},{from:"p-verification",to:"p-release",color:zt.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:zt.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:zt.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:zt.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:zt.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:zt.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:zt.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:zt.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:zt.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:zt.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:zt.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:zt.track},{from:"task",to:"feature",label:"implements",color:zt.task},{from:"spec",to:"feature",label:"implements",color:zt.spec},{from:"feature",to:"feature",label:"blocks",color:zt.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:zt.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:zt.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:zt.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:zt.artifact},{from:"question",to:"decision",label:"contradicts",color:zt.question},{from:"feature",to:"p-vision",label:"enters",color:zt.feature,style:"dashed"}];function OW(){return c.jsx(FW,{graphKey:"product",nodes:DW,edges:PW,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const $W="compose-popout";function N2(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 Ra({path:t,onDock:e}){return c.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:[c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:N2(t)}),c.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:[c.jsx(oS,{style:{width:11,height:11}}),"pop in"]})]})}function RW({path:t}){const[e,r]=v.useState(null),[n,i]=v.useState(!0),s=v.useRef(null),o=v.useRef(null),a=t.startsWith("vision://")?"vision":t.startsWith("graph://")?"graph":t.endsWith(".html")||t.endsWith(".htm")?"html":"markdown";v.useEffect(()=>{document.title=N2(t)+" — Compose"},[t]),v.useEffect(()=>{const h=new BroadcastChannel($W);s.current=h,h.postMessage({type:"popout-mounted",path:t});const u=()=>{h.postMessage({type:"popout-closed",path:t})};return window.addEventListener("beforeunload",u),()=>{u(),h.close(),window.removeEventListener("beforeunload",u)}},[t]);const l=v.useCallback(()=>{var h;(h=s.current)==null||h.postMessage({type:"popout-dock",path:t}),window.close()},[t]);return v.useEffect(()=>{if(a==="vision"||a==="graph"){i(!1);return}Ft(`/api/file?path=${encodeURIComponent(t)}`).then(h=>h.json()).then(h=>{h.content!==void 0&&r(h.content),i(!1)}).catch(()=>i(!1))},[t,a]),v.useEffect(()=>{if(a==="vision"||a==="graph")return;const h=window.location.protocol==="https:"?"wss:":"ws:",u=new WebSocket(`${h}//${window.location.host}/ws/files`);return o.current=u,u.onmessage=d=>{try{const f=JSON.parse(d.data);f.type==="fileChanged"&&f.path===t&&r(f.content)}catch{}},()=>u.close()},[t,a]),n?c.jsx("div",{className:"h-screen w-screen flex items-center justify-center bg-background",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a==="vision"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Ra,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(wW,{})})]}):a==="graph"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Ra,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(OW,{})})]}):a==="html"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Ra,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx("iframe",{srcDoc:e,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin",title:t})})]}):c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Ra,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 overflow-y-auto px-8 py-6",children:c.jsx("div",{className:"canvas-markdown max-w-4xl mx-auto",children:c.jsx($d,{remarkPlugins:[qd],children:e||""})})})]})}const zW="/api/stratum";async function Ac(t,e={}){return(await Ft(`${zW}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function WW(t,e){return Ac(t,{method:"POST",body:JSON.stringify(e)})}function B2({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 c.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 Jp(){return c.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function qW({onAction:t}){const[e,r]=v.useState(null),[n,i]=v.useState(null),[s,o]=v.useState({}),[a,l]=v.useState({}),h=v.useCallback(()=>{Ac("/gates").then(d=>{r(Array.isArray(d)?d:[]),i(null)}).catch(d=>i(d.message))},[]);v.useEffect(()=>{h();const d=setInterval(h,1e4);return()=>clearInterval(d)},[h]);async function u(d,f,p){const m=`${d}/${f}/${p}`;o(g=>({...g,[m]:!0}));const x=a[`${d}/${f}`]||"";try{const g=await WW(`/gates/${d}/${f}/${p}`,{note:x});g.conflict?i(`Gate already resolved (${d}/${f})`):g.error?i(g.error.message):(t==null||t(),h())}catch(g){i(g.message)}finally{o(g=>({...g,[m]:!1}))}}return e===null&&!n?c.jsx(Jp,{}):c.jsxs("section",{children:[c.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&&c.jsxs("span",{style:{opacity:1,color:"#f59e0b"},children:["(",e.length,")"]})]}),n&&c.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em",margin:"0 0 8px"},children:n}),(e==null?void 0:e.length)===0&&c.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No pending gates."}),e==null?void 0:e.map(d=>{const f=`${d.flow_id}/${d.step_id}`,p=m=>s[`${f}/${m}`];return c.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",marginBottom:8,background:"#18181b"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[c.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:d.flow_name||d.flow_id}),c.jsx("span",{style:{opacity:.4,fontSize:"0.8em"},children:"›"}),c.jsx("span",{style:{fontFamily:"monospace",fontSize:"0.82em",opacity:.7},children:d.step_id}),d.function&&c.jsxs("span",{style:{opacity:.4,fontSize:"0.78em"},children:["fn:",d.function]})]}),c.jsx("input",{type:"text",placeholder:"Note (optional)",value:a[f]||"",onChange:m=>l(x=>({...x,[f]: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"}}),c.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})=>c.jsx("button",{disabled:p(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:p(m)?"not-allowed":"pointer",opacity:p(m)?.5:1},children:p(m)?"…":x},m))})]},f)})]})}function HW({flowId:t,onClose:e}){const[r,n]=v.useState(null),[i,s]=v.useState(null);return v.useEffect(()=>{Ac(`/flows/${t}`).then(o=>{o.error?s(o.error.message):n(o)}).catch(o=>s(o.message))},[t]),c.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",background:"#18181b"},children:[c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[c.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:(r==null?void 0:r.flow_name)||t}),c.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"1.1em"},children:"✕"})]}),i&&c.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:i}),!r&&!i&&c.jsx(Jp,{}),r&&c.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,h=r.step_count??"?";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:[c.jsx("span",{children:c.jsx(B2,{status:r.status})}),c.jsxs("span",{children:["steps ",l,"/",h,a.size>0&&c.jsxs("span",{style:{marginLeft:6,color:"#34d399",fontSize:"0.85em"},children:["∥ ",a.size," running"]})]}),r.round>0&&c.jsxs("span",{children:["round ",r.round]})]}),Array.isArray(r.ordered_steps)&&r.ordered_steps.length>0&&c.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",lineHeight:1.7},children:r.ordered_steps.map(u=>c.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:[c.jsx("span",{style:{fontFamily:"monospace"},children:u.id}),u.mode==="gate"&&c.jsx("span",{style:{marginLeft:6,color:"#f59e0b",fontSize:"0.9em"},children:"gate"}),a.has(u.id)&&c.jsx("span",{style:{marginLeft:6,fontSize:"0.85em"},children:"∥ running"})]},u.id))})]})})()})]})}function UW({activeBuild:t}){const[e,r]=v.useState(null),[n,i]=v.useState(null),[s,o]=v.useState(null),a=v.useCallback(()=>{Ac("/flows").then(l=>{r(Array.isArray(l)?l:[]),i(null)}).catch(l=>i(l.message))},[]);return v.useEffect(()=>{a();const l=setInterval(a,15e3);return()=>clearInterval(l)},[a]),v.useEffect(()=>{t&&a()},[t,a]),e===null&&!n?c.jsx(Jp,{}):c.jsxs("section",{children:[c.jsx("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:"Flows"}),n&&c.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:n}),(e==null?void 0:e.length)===0&&c.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No flows found."}),e==null?void 0:e.map(l=>c.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:c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[c.jsx("span",{style:{fontSize:"0.88em",fontWeight:500},children:l.flow_name||l.flow_id}),c.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[c.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??"?"]}),c.jsx(B2,{status:l.status})]})]})},l.flow_id)),s&&c.jsx("div",{style:{marginTop:8},children:c.jsx(HW,{flowId:s,onClose:()=>o(null)})})]})}const YW={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 GW({build:t,onDismiss:e}){const r=t.status==="running",n=["complete","failed","aborted"].includes(t.status);v.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 c.jsxs("div",{style:{border:`1px solid ${r?"#22c55e33":"#3f3f46"}`,borderRadius:6,padding:"10px 12px",marginBottom:12,background:i[t.status]||"#18181b"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[r&&c.jsx("span",{style:YW}),c.jsx("span",{style:{fontWeight:600,fontSize:"0.88em"},children:t.featureCode}),c.jsx("span",{style:{opacity:.5,fontSize:"0.78em"},children:r?"building":t.status})]}),n&&t.status!=="complete"&&c.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"0.9em"},children:"✕"})]}),c.jsxs("div",{style:{fontSize:"0.8em",opacity:.7,marginTop:4,fontFamily:"monospace"},children:[t.currentStepId,t.stepNum!=null&&t.totalSteps!=null&&c.jsxs("span",{style:{marginLeft:8,opacity:.5},children:["(",t.stepNum,"/",t.totalSteps,")"]}),t.retries>0&&c.jsxs("span",{style:{marginLeft:8,color:"#f59e0b"},children:["retry ",t.retries]})]})]})}function VW(){const t=pr(s=>s.activeBuild),[e,r]=v.useState(null),n=v.useCallback(()=>{t&&r(`${t.flowId}:${t.completedAt}`)},[t]);v.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 c.jsxs("div",{style:{padding:"12px 14px",color:"#e4e4e7",fontSize:"0.9em",overflowY:"auto",height:"100%"},children:[i&&c.jsx(GW,{build:t,onDismiss:n}),c.jsx(qW,{}),c.jsx("div",{style:{marginTop:20},children:c.jsx(UW,{activeBuild:t})})]})}function XW({projectName:t,projectRoot:e,onSwitch:r}){const[n,i]=v.useState(!1),[s,o]=v.useState(e||""),a=v.useRef(null);return v.useEffect(()=>{o(e||"")},[e]),v.useEffect(()=>{if(!n)return;const l=h=>{var u;(u=a.current)!=null&&u.contains(h.target)||i(!1)};return window.addEventListener("mousedown",l),()=>window.removeEventListener("mousedown",l)},[n]),v.useEffect(()=>{if(!n)return;const l=h=>{h.key==="Escape"&&i(!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]),c.jsxs("div",{ref:a,className:"flex items-center shrink-0 gap-2 relative",children:[c.jsx("span",{className:"text-xs font-semibold tracking-widest uppercase text-blue-600 dark:text-accent",children:"Compose"}),c.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&&c.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:[c.jsxs("div",{className:"text-[10px] text-muted-foreground mb-1 px-1",children:["Current: ",e]}),c.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 KW={dashboard:{label:"Dashboard",icon:WS,tip:"Overview of project status and activity"},tree:{label:"Items",icon:Kx,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:JS,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:ST,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:yd,tip:"Active and past agent sessions"},gates:{label:"Gates",icon:js,tip:"Quality gates and approval checkpoints"},docs:{label:"Docs",icon:bi,tip:"Project documentation and specs"},design:{label:"Design",icon:nc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:hi,tip:"Captured ideas and suggestions"}};function QW({tabs:t=[],activeTab:e,onTabChange:r,onOpenPalette:n,badges:i={}}){return c.jsxs("div",{className:"flex items-center gap-0.5 h-full",role:"tablist","aria-label":"Main views",children:[t.map(s=>{const o=KW[s],a=s===e,l=o==null?void 0:o.icon,h=(o==null?void 0:o.label)||s,u=i[s];return c.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&&c.jsx(l,{style:{width:12,height:12}}),h,u>0&&c.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)}),c.jsx("div",{className:"flex-1"}),n&&c.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:[c.jsx(Wn,{style:{width:12,height:12}}),c.jsx("kbd",{className:"text-[9px] font-mono opacity-50 bg-muted px-1 py-0.5 rounded",children:"⌘K"})]})]})}function ZW(){const[t,e]=v.useState(o0);function r(){const n=!t;ZT(n),e(n)}return c.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 Ye={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},JW={[Ye.COLLAPSED]:Ye.EXPANDED,[Ye.EXPANDED]:Ye.MAXIMIZED,[Ye.MAXIMIZED]:Ye.COLLAPSED};function tq(t){return JW[t]??Ye.COLLAPSED}function eq(t){return Ye.COLLAPSED}function rq(t){return Ye.MAXIMIZED}const nq=new Set(Object.values(Ye));function iq(t){return nq.has(t)}function sq(t){switch(t){case Ye.COLLAPSED:return"h-7";case Ye.EXPANDED:return"h-[40vh]";case Ye.MAXIMIZED:return"flex-1";default:return"h-7"}}const L2="compose:agentBarState";function oq(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(L2);return iq(e)?e:Ye.COLLAPSED}catch{return Ye.COLLAPSED}}function aq(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(L2,t)}catch{}}const dx="▾",lq="▴",cq="⤢";function hq({barState:t="collapsed",onStateChange:e}){const[r,n]=v.useState("ready"),[i,s]=v.useState(null);v.useEffect(()=>{function u(d){const{status:f,tool:p,category:m,parallelTasks:x}=d.detail??{};if(s(x??null),x){const{total:g,completed:y,failed:C,active:b}=x;n(`∥ ${y}/${g} tasks${C?` (${C} failed)`:""}${b?` • ${b} active`:""}`)}else n(f==="idle"?"ready":p?`${p} — ${m??f}`:m||(f==="idle"?"ready":f??"ready"))}return window.addEventListener("compose:agent-status",u),()=>window.removeEventListener("compose:agent-status",u)},[]);const o=v.useCallback(()=>{e==null||e(tq(t))},[t,e]),a=v.useCallback(()=>{e==null||e(eq())},[t,e]);v.useCallback(()=>{e==null||e(rq())},[t,e]);const l=t==="collapsed",h=t==="expanded";return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{borderTop:"1px solid hsl(var(--border))"},"data-agent-bar-state":t,children:[c.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:[c.jsx("button",{className:"compose-btn-icon shrink-0",onClick:o,title:l?"Expand agent bar":h?"Maximize agent bar":"Collapse agent bar","aria-label":"Toggle agent bar",children:l?lq:h?cq:dx}),c.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold shrink-0",style:{color:"hsl(var(--accent))"},children:"Agent"}),c.jsx("span",{className:"flex-1 min-w-0 truncate text-[11px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:r}),c.jsx(ZW,{}),i&&i.total>0&&c.jsx("div",{className:"shrink-0 flex items-center gap-1",title:`${i.completed}/${i.total} tasks complete`,children:c.jsx("div",{style:{width:48,height:4,borderRadius:2,background:"hsl(var(--muted))",overflow:"hidden"},children:c.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&&c.jsx("button",{className:"compose-btn-icon shrink-0",onClick:a,title:"Collapse agent bar","aria-label":"Collapse agent bar",children:dx})]}),!l&&c.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:c.jsx(c0,{})})]})}const uq=280,dq=.6;function pq({isOpen:t=!1,onToggle:e,widthPx:r=380,onResizePx:n,children:i,activeBuild:s,gates:o=[],agentErrors:a=[],items:l=[]}){const h=v.useRef(!1),u=v.useCallback(f=>{f.preventDefault(),h.current=!0;const p=x=>{if(!h.current)return;const g=window.innerWidth-x.clientX,y=window.innerWidth*dq,C=Math.max(uq,Math.min(y,g));n==null||n(C)},m=()=>{h.current=!1,document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",p),document.addEventListener("mouseup",m)},[n]),d=o.filter(f=>f.status==="pending"||f.status==="awaiting");return c.jsxs("div",{className:"flex shrink-0 h-full",style:{borderLeft:"1px solid hsl(var(--border))"},"data-context-panel-open":t,children:[t&&n&&c.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0",onMouseDown:u}),c.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&&c.jsx("div",{className:"flex flex-col h-full overflow-hidden",style:{width:`${r}px`},children:Yt.Children.toArray(i).length>0?c.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):c.jsx(mq,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const fq={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function px(t){return fq[t]||"#6b7280"}function mq({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 c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"h-7 flex items-center px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:c.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-muted-foreground",children:"Project Overview"})}),c.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-3 space-y-4",children:[t?c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Active Build"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-accent font-mono",children:t.featureCode||"—"}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),c.jsx("span",{className:"text-[10px] text-foreground",children:t.currentStep||t.step||"—"})]})]}):c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Status"}),c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No active build"})]}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Pending Gates (",e.length,")"]}),e.length===0?c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):c.jsx("div",{className:"space-y-0.5",children:e.slice(0,5).map((a,l)=>c.jsx("p",{className:"text-[10px] text-amber-400 truncate",children:Ao(a,n.find(h=>h.id===a.itemId))},l))})]}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Recent Errors (",o.length,")"]}),o.length===0?c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):c.jsx("div",{className:"space-y-0.5",children:o.map((a,l)=>c.jsx("p",{className:"text-[10px] text-destructive truncate",children:a.message||a.error||"Error"},l))})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase Distribution"}),c.jsx("div",{className:"flex h-2 rounded overflow-hidden gap-px",children:Object.entries(i).map(([a,l])=>c.jsx("div",{className:"h-full",style:{width:`${l/s*100}%`,background:px(a),opacity:.75,minWidth:"2px"},title:`${a}: ${l}`},a))}),c.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1",children:Object.entries(i).map(([a,l])=>c.jsxs("span",{className:"text-[9px] text-muted-foreground flex items-center gap-1",children:[c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:px(a)}}),a,": ",l]},a))})]})]})]})}const En=60,Ar=24,za=80,Mh=28,Ih=48,fx=8,Ji=5,tc=9;function gq(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function xq(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 h of r)if(h.fromId===a.id&&h.toId!==t.id){const u=n.get(h.toId);u&&l.push(u)}l.length>0&&o.set(a.id,l)}return{parents:i,children:s,grandchildren:o}}function Fh(t,e,r,n,i){const s=Math.min(t,Ji),o=s*n+(s-1)*fx,a=(r-o)/2,l=[];for(let h=0;h<s;h++)l.push({x:a+h*(n+fx),y:e,w:n,h:i});return{positions:l,overflow:t>Ji?t-Ji+1:0}}function Wa({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:h}){const u=fr[t.type]||fr.task,d=s?.2:.08;return c.jsxs("g",{style:{cursor:"pointer"},onClick:()=>a(t.id),onMouseEnter:f=>l(t,f),onMouseLeave:h,children:[c.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}),c.jsx("text",{x:e+n/2,y:r+i/2,textAnchor:"middle",dominantBaseline:"central",fontSize:s?tc+1:tc,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:gq(t.title,s?10:8)})]})}function yq({item:t,pos:e}){if(!t||!e)return null;const r=fr[t.type]||fr.task,n=Fn[t.status]||Fn.planned;return c.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:[c.jsx("p",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:t.title}),c.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[c.jsx("span",{className:"text-[10px]",style:{color:r},children:t.type}),c.jsxs("span",{className:"text-[10px] flex items-center gap-1",children:[c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:n}}),t.status]}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:wd[t.confidence||0]})]})]})}function bq({item:t,items:e,connections:r,onSelect:n}){const[i,s]=v.useState(null),[o,a]=v.useState(null),{parents:l,children:h,grandchildren:u}=v.useMemo(()=>xq(t,e,r),[t,e,r]),d=v.useCallback((M,A)=>{const P=A.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),$=A.currentTarget.getBoundingClientRect();s(M),a({x:$.x+$.width/2-P.x,y:$.y-P.y-4})},[]),f=v.useCallback(()=>{s(null),a(null)},[]);if(!(l.length>0||h.length>0))return null;const m=288,x=[];let g=12,y=[],C=0;if(l.length>0){const M=Fh(l.length,g,m,En,Ar);y=M.positions,C=M.overflow,g+=Ar+Ih}const b=(m-za)/2,S=g;g+=Mh+Ih;let _=[],w=0;if(h.length>0){const M=Fh(h.length,g,m,En,Ar);_=M.positions,w=M.overflow,g+=Ar}let B=new Map,L=new Map;const I=[...u.entries()];let E=[];if(I.length>0){g+=Ih;for(const[P,$]of I)for(const j of $)E.push({...j,_parentChildId:P});const M=Fh(E.length,g,m,En,Ar);let A=0;for(const[P,$]of I){const j=[];for(let T=0;T<$.length&&A<M.positions.length;T++,A++)j.push(M.positions[A]);B.set(P,j)}M.overflow>0&&L.set("all",M.overflow),g+=Ar}const F=g+12;for(let M=0;M<y.length;M++){const A=y[M];x.push({x1:A.x+A.w/2,y1:A.y+A.h,x2:b+za/2,y2:S})}for(let M=0;M<_.length;M++){const A=_[M];x.push({x1:b+za/2,y1:S+Mh,x2:A.x+A.w/2,y2:A.y})}for(const[M,A]of B){const P=h.findIndex($=>$.id===M);if(P>=0&&P<_.length){const $=_[P];for(const j of A)x.push({x1:$.x+$.w/2,y1:$.y+$.h,x2:j.x+j.w/2,y2:j.y})}}const z=l.slice(0,Ji-(C>0?1:0)),W=h.slice(0,Ji-(w>0?1:0)),O=E.slice(0,Ji-(L.size>0?1:0));return c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Graph"}),c.jsxs("div",{className:"relative connection-graph-wrap",children:[c.jsxs("svg",{width:m,height:F,className:"w-full",viewBox:`0 0 ${m} ${F}`,children:[x.map((M,A)=>c.jsx("line",{x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},A)),z.map((M,A)=>c.jsx(Wa,{item:M,x:y[A].x,y:y[A].y,w:En,h:Ar,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:f},M.id)),C>0&&c.jsxs("text",{x:y[y.length-1].x+En/2,y:y[0].y+Ar/2,textAnchor:"middle",dominantBaseline:"central",fontSize:tc,fill:"hsl(var(--muted-foreground))",children:["+",C," more"]}),c.jsx(Wa,{item:t,x:b,y:S,w:za,h:Mh,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:f}),W.map((M,A)=>c.jsx(Wa,{item:M,x:_[A].x,y:_[A].y,w:En,h:Ar,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},M.id)),w>0&&c.jsxs("text",{x:_[_.length-1].x+En/2,y:_[0].y+Ar/2,textAnchor:"middle",dominantBaseline:"central",fontSize:tc,fill:"hsl(var(--muted-foreground))",children:["+",w," more"]}),O.map((M,A)=>{const $=[...B.values()].flat()[A];return $?c.jsx(Wa,{item:M,x:$.x,y:$.y,w:En,h:Ar,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},M.id):null})]}),c.jsx(yq,{item:i,pos:o})]})]})}const Cq=["Untested","Low","Moderate","High","Crystallized"];function kq({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=Cq[r]??"Untested",i=r===0?of[0]:of[r];return c.jsxs("span",{className:st("inline-flex items-center gap-1",e),children:[c.jsx("span",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(s=>c.jsx("span",{className:st("h-2.5 w-1.5 rounded-sm",s<=r?i:"bg-slate-600")},s))}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:n})]})}function vq(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 mx(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function wq(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function Sq(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 Tq(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:vq(new Date(n).toISOString(),e)}function _q(t,e=Date.now()){const r=(t==null?void 0:t.branches)||[],n=r.filter(h=>h.state==="complete"),i=r.filter(h=>h.state==="running"),s=r.length,o=Tq(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 Eq(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 gx({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:`${mx(i.tokens_in)} / ${mx(i.tokens_out)}`},{label:"USD",value:wq(i.usd)},{label:"Wall clock",value:Sq(i.wall_clock_ms)},{label:"Final artifact",value:((o=t.final_artifact)==null?void 0:o.path)||"—"},...e];return c.jsx("div",{className:"space-y-1",children:s.map((a,l)=>c.jsxs("div",{className:"flex justify-between gap-2 text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground",children:a.label}),c.jsx("span",{className:"font-mono text-right truncate",title:typeof a.value=="string"?a.value:void 0,children:a.value})]},l))})}function jq({lineage:t,selectedPair:e=[],onSelectPair:r=()=>{},extraMetricsForBranch:n=()=>[],now:i=Date.now()}){var g,y;const[s,o]=v.useState(!1),{summary:a,canCompare:l,completeBranches:h}=_q(t,i),[u,d]=Eq(h,e),f=()=>{l&&(o(C=>!C),!s&&u&&d&&r([u.branch_id,d.branch_id]))};if(!s)return c.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[c.jsx("span",{children:a}),c.jsx("button",{disabled:!l,onClick:f,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 p=(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=!!p&&!!m;return c.jsxs("div",{className:"space-y-2 rounded border border-border p-2 bg-muted/10",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:a}),c.jsx("button",{onClick:()=>o(!1),className:"text-[10px] text-muted-foreground hover:text-foreground",children:"Collapse"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.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&&c.jsx(gx,{branch:u,extraRows:n(u)})]}),c.jsxs("div",{children:[c.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&&c.jsx(gx,{branch:d,extraRows:n(d)})]})]}),c.jsx("div",{className:"col-span-2",children:x?c.jsx(Zp,{oldText:p,newText:m}):c.jsxs("div",{className:"text-[10px] italic text-muted-foreground",children:["No artifact produced on ",!p&&!m?"either branch":p?"branch B":"branch A","."]})})]})}const Nq={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function Bq(t){return Nq[t]??t}function xx(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function Lq(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 Aq({item:t}){const[e,r]=v.useState(!1),n=Lq(t);if(n.length===0)return null;const i=n.length;return c.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:[c.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:[c.jsx(ic,{size:13}),c.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?c.jsx(Yx,{size:13,style:{marginLeft:"auto"}}):c.jsx(Ko,{size:13,style:{marginLeft:"auto"}})]}),e&&c.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse",marginTop:"4px"},"data-testid":"drift-ribbon-table",children:[c.jsx("thead",{children:c.jsxs("tr",{style:{color:"hsl(var(--muted-foreground))"},children:[c.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Axis"}),c.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Ratio"}),c.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Threshold"}),c.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Explanation"})]})}),c.jsx("tbody",{children:n.map(s=>c.jsxs("tr",{"data-testid":`drift-axis-row-${s.axis_id}`,children:[c.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--foreground))",fontWeight:500},children:Bq(s.axis_id)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:xx(s.ratio)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:xx(s.threshold)}),c.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--muted-foreground))",maxWidth:"200px",wordBreak:"break-word"},children:s.explanation??""})]},s.axis_id))})]})]})}function Mq({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]=v.useState(r),[s,o]=v.useState((t==null?void 0:t.type)==="bug"?"bug":"feature"),[a,l]=v.useState(""),[h,u]=v.useState(!1),[d,f]=v.useState(null);async function p(x){x==null||x.preventDefault();const g=n.trim();if(!g){f("Feature code is required");return}u(!0),f(null);try{const y=await Ft("/api/build/start",{method:"POST",headers:Vi({"Content-Type":"application/json"}),body:JSON.stringify({featureCode:g,mode:s,description:a.trim()})});if(!y.ok){let C=null;try{C=await y.json()}catch{}throw new Error(C&&C.error||`Failed to start build (HTTP ${y.status})`)}e==null||e()}catch(y){f(y.message||"Failed to start build"),u(!1)}}return c.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:c.jsxs("form",{className:"p-2 space-y-2",onSubmit:p,children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-feature",children:"Feature code"}),c.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})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Mode"}),c.jsxs("div",{className:"flex items-center gap-1.5",role:"radiogroup","aria-label":"Build mode",children:[c.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"}),c.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"})]})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-desc",children:"Description (optional)"}),c.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?c.jsx("div",{className:"text-[10px] text-destructive",role:"alert",children:d}):null,c.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[c.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:h,"data-testid":"start-build-cancel",children:"Cancel"}),c.jsx("button",{type:"submit",className:"text-[10px] px-2 py-1 rounded border border-accent bg-accent/10 text-foreground disabled:opacity-50",disabled:h||!n.trim(),"data-testid":"start-build-submit",children:h?"Starting…":"Start"})]})]})})}function Iq({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 c.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:[c.jsx("span",{className:"text-xs text-muted-foreground",children:wd[t]}),c.jsx("div",{className:"flex items-center gap-0.5",children:[0,1,2,3].map(i=>c.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 Fq({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 h=s.get(l.toId);h&&o.push({item:h,type:l.type,direction:"outgoing",connId:l.id})}if(l.toId===t.id){const h=s.get(l.fromId);h&&o.push({item:h,type:l.type,direction:"incoming",connId:l.id})}}if(o.length===0)return null;const a={};for(const l of o){const h=`${l.type}-${l.direction}`;a[h]||(a[h]={type:l.type,direction:l.direction,items:[]}),a[h].items.push({item:l.item,connId:l.connId})}return c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Connections"}),Object.values(a).map(l=>c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] text-muted-foreground mb-1",children:l.direction==="incoming"?`${l.type} from`:`${l.type} to`}),c.jsx("div",{className:"space-y-0.5",children:l.items.map(({item:h,connId:u})=>c.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:[c.jsxs("button",{onClick:()=>n(h.id),className:"flex flex-1 items-center gap-2 min-w-0",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Fn[h.status]||Fn.planned}}),c.jsx("span",{className:"text-xs text-foreground truncate",children:h.title}),c.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:fr[h.type]},children:h.type})]}),i&&c.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:c.jsx(gn,{className:"h-3 w-3"})})]},u))})]},`${l.type}-${l.direction}`))]})}function qa(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 Dq({featureCode:t,lineage:e}){const r=pr(i=>i.selectedBranches),n=pr(i=>i.setSelectedBranches);return c.jsx(jq,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function Pq({featureCode:t}){const[e,r]=v.useState([]),[n,i]=v.useState(!0);return v.useEffect(()=>{const s=new AbortController;return i(!0),Ft(`/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:c.jsxs("div",{children:[c.jsxs("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Sessions (",e.length,")"]}),c.jsx("div",{className:"space-y-2",children:e.map(s=>{var o;return c.jsxs("div",{className:"text-xs text-muted-foreground border-l-2 border-border pl-2",children:[c.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," ")}`]}),c.jsxs("div",{children:[s.toolCount," tools · ",Math.round((new Date(s.endedAt)-new Date(s.startedAt))/6e4),"m"]})]},s.id)})})]})}const Oq=["informs","supports","blocks","contradicts"];function $q({item:t,items:e,onCreateConnection:r,onDismiss:n}){const[i,s]=v.useState(""),[o,a]=v.useState("informs"),l=e.filter(u=>u.id===t.id?!1:i?u.title.toLowerCase().includes(i.toLowerCase()):!0).slice(0,8),h=v.useCallback(async u=>{await r({fromId:t.id,toId:u,type:o}),n()},[t.id,o,r,n]);return c.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50",children:c.jsxs("div",{className:"p-2 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.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:Oq.map(u=>c.jsx("option",{value:u,children:u},u))}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"to..."})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Wn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),c.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})]}),c.jsx("div",{className:"max-h-40 overflow-auto space-y-0.5",children:l.length===0?c.jsx("p",{className:"text-[10px] text-muted-foreground text-center py-2",children:"No items found"}):l.map(u=>c.jsxs("button",{onClick:()=>h(u.id),className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Fn[u.status]||Fn.planned}}),c.jsx("span",{className:"text-xs text-foreground truncate",children:u.title}),c.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:fr[u.type]},children:u.type})]},u.id))})]})})}function Rq({gate:t,onResolveGate:e}){const[r,n]=v.useState(null),[i,s]=v.useState(""),o=()=>{e(t.id,"revised",i||void 0),n(null),s("")},a=()=>{i.trim()&&(e(t.id,"killed",i),n(null),s(""))};return c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(Ot,{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"}),c.jsx(Ot,{variant:"outline",size:"sm",className:st("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"}),c.jsx(Ot,{variant:"outline",size:"sm",className:st("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&&c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.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}),c.jsx(Ot,{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 zq({item:t,items:e,connections:r,gates:n,onUpdate:i,onDelete:s,onCreateConnection:o,onDeleteConnection:a,onSelect:l,onClose:h,onPressureTest:u,onResolveGate:d}){var $,j,T,Y,J,D;const f=Rx(),[p,m]=v.useState(!1),[x,g]=v.useState(""),[y,C]=v.useState(!1),[b,S]=v.useState(""),[_,w]=v.useState(!1),[B,L]=v.useState(!1),[I,E]=v.useState("");v.useEffect(()=>{E((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const F=v.useCallback(()=>{const Q=I.trim(),ut=(t==null?void 0:t.group)||"";Q!==ut&&i(t.id,{group:Q||null})},[I,t==null?void 0:t.id,t==null?void 0:t.group,i]),z=v.useCallback(()=>{g(t.title),m(!0)},[t==null?void 0:t.title]),W=v.useCallback(()=>{x.trim()&&x!==t.title&&i(t.id,{title:x.trim()}),m(!1)},[x,t==null?void 0:t.id,t==null?void 0:t.title,i]),O=v.useCallback(()=>{S(t.description||""),C(!0)},[t==null?void 0:t.description]),M=v.useCallback(()=>{b!==(t.description||"")&&i(t.id,{description:b}),C(!1)},[b,t==null?void 0:t.id,t==null?void 0:t.description,i]),A=v.useMemo(()=>{if(!t)return 0;let Q=0;for(const ut of r)ut.type==="contradicts"&&(ut.fromId===t.id||ut.toId===t.id)&&Q++;return Q},[t==null?void 0:t.id,r]);if(!t)return null;const P=fr[t.type]||fr.task;return c.jsxs("div",{className:"w-full bg-card flex flex-col h-full",children:[c.jsxs("div",{className:"p-3 pb-2 flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[c.jsx(ir,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:P,borderColor:P},children:t.type}),t.phase&&c.jsx(ir,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:hl[t.phase]||t.phase})]}),p?c.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:x,onChange:Q=>g(Q.target.value),onBlur:W,onKeyDown:Q=>{Q.key==="Enter"&&W(),Q.key==="Escape"&&m(!1)},autoFocus:!0}):c.jsx("h3",{className:"text-sm font-semibold text-foreground cursor-pointer hover:text-accent transition-colors",onDoubleClick:z,title:"Double-click to edit",children:t.title})]}),c.jsx(Ot,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:h,children:c.jsx(gn,{className:"h-3.5 w-3.5"})})]}),c.jsx(yl,{}),c.jsx(Dn,{className:"flex-1",children:c.jsxs("div",{className:"p-3 space-y-4",children:[c.jsx(Aq,{item:t}),(($=t.lifecycle)==null?void 0:$.featureCode)&&c.jsx(Dq,{featureCode:t.lifecycle.featureCode,lineage:(j=t.lifecycle.lifecycle_ext)==null?void 0:j.branch_lineage}),c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.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:Q=>i(t.id,{status:Q.target.value}),children:_T.map(Q=>c.jsx("option",{value:Q,children:Q.replace("_"," ")},Q))}),c.jsx(Iq,{level:t.confidence||0,onChange:Q=>i(t.id,{confidence:Q})})]}),c.jsx(kq,{level:t.confidence||0}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase"}),c.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:Q=>i(t.id,{phase:Q.target.value||null}),children:[c.jsx("option",{value:"",children:"No phase"}),e0.map(Q=>c.jsx("option",{value:Q,children:hl[Q]},Q))]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Group"}),c.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:I,placeholder:"(none)",onChange:Q=>E(Q.target.value),onBlur:F,onKeyDown:Q=>{Q.key==="Enter"&&(Q.preventDefault(),Q.currentTarget.blur()),Q.key==="Escape"&&(E(t.group||""),Q.currentTarget.blur())},"data-testid":"item-detail-group-input"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),y?c.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:Q=>S(Q.target.value),onBlur:M,onKeyDown:Q=>{Q.key==="Escape"&&C(!1)},autoFocus:!0}):c.jsx("p",{className:st("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:O,children:t.description||"Click to add description..."})]}),c.jsx(Fq,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),c.jsx(bq,{item:t,items:e,connections:r,onSelect:l}),((T=t.lifecycle)==null?void 0:T.featureCode)&&c.jsx(Pq,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(Q=>Q.itemId===t.id))&&(()=>{var Et;const Q=t.lifecycle,ut=n?n.filter(ot=>ot.itemId===t.id):[],ct=ut.filter(ot=>ot.status==="pending"),$t=ut.filter(ot=>ot.status!=="pending");return c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Lifecycle"}),c.jsxs("div",{className:"space-y-1.5",children:[Q&&c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Phase:"}),c.jsx("span",{className:"text-[10px] text-foreground font-medium",children:we[Q.currentPhase]??Q.currentPhase}),Q.featureCode&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:Q.featureCode})]}),((Et=Q==null?void 0:Q.phaseHistory)==null?void 0:Et.length)>1&&c.jsxs("div",{className:"px-2 py-1 rounded bg-muted/30",children:[c.jsx("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"History"}),c.jsx("div",{className:"flex flex-wrap gap-x-1 gap-y-0.5",children:Q.phaseHistory.map((ot,G)=>c.jsxs("span",{className:st("text-[10px]",ot.phase===Q.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[we[ot.phase]??ot.phase,ot.outcome&&ot.outcome!=="approved"&&c.jsxs("span",{className:"text-amber-400",children:[" (",ot.outcome,")"]}),G<Q.phaseHistory.length-1&&" → "]},G))})]}),ct.map(ot=>{var kt,_t;const G=ot.artifactAssessment,lt=r0[ot.fromPhase];return c.jsxs("div",{className:"rounded bg-amber-400/10 border border-amber-400/20 px-2 py-1.5",children:[c.jsxs("p",{className:"text-[10px] text-amber-400 font-medium mb-1",children:["Pending: ",pn[ot.stepId]??`${we[ot.fromPhase]??ot.fromPhase} → ${we[ot.toPhase]??ot.toPhase}`]}),G&&G.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[lt&&c.jsx("span",{className:"font-mono",children:lt}),lt&&": ",Math.round(G.completeness*100),"% complete"," · ",G.wordCount," words",((_t=(kt=G.sections)==null?void 0:kt.missing)==null?void 0:_t.length)>0&&c.jsxs("span",{className:"text-amber-400",children:[" (missing: ",G.sections.missing.join(", "),")"]}),!G.meetsMinWordCount&&c.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),G&&!G.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[lt??"Artifact"," not found"]}),d&&c.jsx(Rq,{gate:ot,onResolveGate:d})]},ot.id)}),$t.map(ot=>{const G={approved:"text-success",revised:"text-amber-400",killed:"text-destructive"};return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:pn[ot.stepId]??`${we[ot.fromPhase]??ot.fromPhase} → ${we[ot.toPhase]??ot.toPhase}`}),c.jsx(ir,{variant:"outline",className:st("text-[10px] px-1.5 py-0 h-4 ml-auto",G[ot.outcome]||""),children:ot.outcome})]},ot.id)})]})]})})(),((J=(Y=t.evidence)==null?void 0:Y.stratumViolations)==null?void 0:J.length)>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1.5",children:["Blocked — Ensure Violations",t.evidence.violatedAt&&c.jsx("span",{className:"ml-2 font-normal normal-case text-muted-foreground",children:qa(t.evidence.violatedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((Q,ut)=>c.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),c.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:Q})]},ut))})]}),((D=t.evidence)==null?void 0:D.stratumTrace)&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Stratum Trace",t.evidence.tracedAt&&c.jsx("span",{className:"ml-2 font-normal normal-case",children:qa(t.evidence.tracedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(Q=>c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--success))"}}),c.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:Q.step_id}),Q.attempts>1&&c.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[Q.attempts,"x"]}),Q.duration_ms!=null&&c.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:Q.duration_ms<1e3?`${Q.duration_ms}ms`:`${(Q.duration_ms/1e3).toFixed(1)}s`})]},Q.step_id))})]}),c.jsxs("div",{className:"space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",qa(t.createdAt)]}),c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",qa(t.updatedAt)]})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[!t.lifecycle&&t.status!=="killed"&&t.type!=="question"&&c.jsxs("div",{className:"relative",children:[c.jsxs(Ot,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",B&&"bg-accent/10 border-accent"),onClick:()=>L(!B),"data-testid":"item-start-build",title:"Start the build/bug-fix lifecycle for this item",children:[c.jsx(rT,{className:"h-3 w-3"})," Start"]}),B&&c.jsx(Mq,{item:t,onClose:()=>L(!1)})]}),c.jsxs("div",{className:"relative",children:[c.jsxs(Ot,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",_&&"bg-accent/10 border-accent"),onClick:()=>w(!_),children:[c.jsx(US,{className:"h-3 w-3"})," Connect"]}),_&&c.jsx($q,{item:t,items:e,onCreateConnection:o,onDismiss:()=>w(!1)})]}),c.jsxs(Ot,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:z,children:[c.jsx(Zx,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&c.jsxs(Ot,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[c.jsx(cl,{className:"h-3 w-3"})," Pressure Test",A>0&&c.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:A})]}),t.status!=="killed"&&c.jsxs(Ot,{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 Q=await Ft(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!Q.ok){const ut=await Q.json().catch(()=>({}));console.error("[vision] Lifecycle kill failed:",ut.error),je(`Kill failed: ${ut.error||Q.status}`,"error")}}catch(Q){console.error("[vision] Lifecycle kill failed:",Q.message),je(`Kill failed: ${Q.message}`,"error")}else i(t.id,{status:"killed"})},children:[c.jsx(ef,{className:"h-3 w-3"})," Kill"]}),s&&c.jsxs(Ot,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:async()=>{await f({title:"Delete permanently?",body:`"${t.title}" cannot be undone.`,destructive:!0})&&s(t.id)},title:"Permanently delete this item",children:[c.jsx(ef,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const A2=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];A2.map(t=>t.id);const Wq={overview:bi,pipeline:Kx,sessions:Vx,errors:ic,files:Cd};function qq({activeTab:t="overview",onTabChange:e,errorCount:r=0}){return c.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:A2.map(({id:n,label:i})=>{const s=Wq[n],o=n===t,a=n==="errors"?r:0;return c.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:[c.jsx(s,{style:{width:10,height:10}}),i,a>0&&c.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 yx=[{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 nd(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 Hq({item:t,activeBuild:e}){const[r,n]=v.useState(null),i=(t==null?void 0:t.phaseHistory)||[],s=(t==null?void 0:t.featureCode)||(t==null?void 0:t.text)||"";return c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"flex items-center gap-0 mb-3",children:yx.map((o,a)=>{const l=nd(o.id,i,e,s),h=sf[l],u=r===o.id;return c.jsxs(Yt.Fragment,{children:[a>0&&c.jsx("div",{className:"flex-1 h-px",style:{background:l==="pending"?"hsl(var(--muted-foreground) / 0.2)":h,minWidth:"8px"}}),c.jsxs("button",{onClick:()=>n(u?null:o.id),className:"relative flex flex-col items-center group",title:o.label,children:[c.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:h,background:l==="complete"||l==="failed"?h:"transparent"}}),c.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)})}),c.jsx("div",{className:"flex justify-between px-0.5",children:yx.map(o=>{const a=nd(o.id,i,e,s);return c.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider",style:{color:a==="pending"?"hsl(var(--muted-foreground) / 0.4)":sf[a]},children:o.label},o.id)})}),r&&c.jsx("div",{className:"mt-3 p-2 rounded border border-border/50 bg-muted/20",children:c.jsx(Uq,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function Uq({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=nd(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 c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-foreground capitalize",children:t}),c.jsx("span",{className:`text-[10px] font-medium ${o[i]}`,children:i})]}),(s==null?void 0:s.summary)&&c.jsx("p",{className:"text-[10px] text-muted-foreground",children:s.summary}),(s==null?void 0:s.durationMs)!=null&&c.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)&&c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Agent: ",s.agent]}),i==="active"&&r&&c.jsx("p",{className:"text-[10px] text-accent",children:"Running..."}),i==="pending"&&c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Not started"})]})}function Yq(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 Gq(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function Vq({featureCode:t,sessions:e=[],items:r=[]}){const[n,i]=v.useState(null),s=v.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=v.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?c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"No sessions for this feature."}):c.jsxs("div",{className:"p-2 space-y-0.5",children:[c.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 c.jsxs("div",{children:[c.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:[c.jsx("span",{className:"text-[10px] font-mono text-accent shrink-0 w-12 truncate",children:a.source||"agent"}),c.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 w-16 truncate",children:a.classification||a.workType||"—"}),c.jsxs("span",{className:"text-[9px] text-muted-foreground tabular-nums flex gap-1.5 shrink-0",children:[c.jsxs("span",{title:"reads",children:[a.reads||0,"r"]}),c.jsxs("span",{title:"writes",children:[a.writes||0,"w"]}),c.jsxs("span",{title:"errors",style:a.errors>0?{color:"hsl(var(--destructive))"}:{},children:[a.errors||0,"e"]})]}),c.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:Gq(a.durationMs)}),c.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:Yq(a.startedAt||a.createdAt)})]}),l&&a.summary&&c.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 Xq(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 Dh=10;function Kq({featureCode:t,errors:e=[],items:r=[]}){const[n,i]=v.useState(null),[s,o]=v.useState(!1),a=v.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=v.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 c.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[c.jsx(kS,{style:{width:20,height:20,color:"hsl(var(--success, 160 60% 45%))"}}),c.jsx("span",{className:"text-[11px] italic",children:"No errors for this feature."})]});const h=s?l:l.slice(0,Dh);return c.jsxs("div",{className:"p-2 space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Errors (",l.length,")"]}),h.map((u,d)=>{const f=n===d;return c.jsxs("button",{onClick:()=>i(f?null:d),className:"flex flex-col w-full px-2 py-1.5 text-left rounded hover:bg-destructive/5 transition-colors",children:[c.jsxs("div",{className:"flex items-center gap-2 w-full",children:[c.jsx("span",{className:"text-[10px] text-destructive shrink-0",children:"✕"}),c.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0 w-16 truncate",children:u.tool||u.toolName||"unknown"}),c.jsx("span",{className:`text-[10px] text-foreground flex-1 ${f?"":"line-clamp-2"} truncate`,children:u.message||u.error||"Unknown error"}),c.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0 ml-auto",children:Xq(u.timestamp||u.createdAt)})]}),f&&c.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>Dh&&c.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-Dh," more"]})]})}function Qq(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function Zq(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 Jq({featureCode:t,onOpenFile:e}){const[r,n]=v.useState([]),[i,s]=v.useState(!0);v.useEffect(()=>{const l=new AbortController;return s(!0),Ft("/api/files",{signal:l.signal}).then(h=>h.json()).then(h=>{l.signal.aborted||(n(Array.isArray(h)?h:h.files||[]),s(!1))}).catch(h=>{l.signal.aborted||(n([]),s(!1))}),()=>l.abort()},[t]);const o=`docs/features/${t}/`,a=v.useMemo(()=>r.filter(l=>(typeof l=="string"?l:l.path||l.name||"").startsWith(o)),[r,o]);return i?c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Loading files..."}):a.length===0?c.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[c.jsx(Cd,{style:{width:20,height:20,opacity:.5}}),c.jsx("span",{className:"text-[11px] italic",children:"No files in feature folder."})]}):c.jsxs("div",{className:"p-2 space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Files (",a.length,")"]}),a.map((l,h)=>{const u=typeof l=="string"?l:l.path||l.name||"",d=u.split("/").pop(),f=typeof l=="object"?l.size:null,p=typeof l=="object"?l.modified||l.mtime:null;return c.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:[c.jsx(bi,{className:"h-3 w-3 shrink-0 text-accent"}),c.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:d}),f!=null&&c.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:Qq(f)}),p&&c.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:Zq(p)})]},h)})]})}function tH({itemId:t,onSelect:e,onClose:r,onOpenFile:n,onViewInGraph:i,onViewInTree:s}){var w;const{items:o,connections:a,gates:l,updateItem:h,deleteItem:u,createConnection:d,deleteConnection:f,resolveGate:p,activeBuild:m,sessions:x,agentErrors:g}=pr(vi(B=>({items:B.items,connections:B.connections,gates:B.gates,updateItem:B.updateItem,deleteItem:B.deleteItem,createConnection:B.createConnection,deleteConnection:B.deleteConnection,resolveGate:B.resolveGate,activeBuild:B.activeBuild,sessions:B.sessions,agentErrors:B.agentErrors}))),y=o.find(B=>B.id===t)||null,[C,b]=v.useState("overview"),S=((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)||"",_=v.useMemo(()=>S?g.filter(B=>B.featureCode===S||S&&B.message&&B.message.includes(S)):[],[g,S]);return y?c.jsxs("div",{className:"h-full flex flex-col",children:[c.jsx(qq,{activeTab:C,onTabChange:b,errorCount:_.length}),c.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[C==="overview"&&c.jsxs(c.Fragment,{children:[c.jsx(zq,{item:y,items:o,connections:a,gates:l,onUpdate:(B,L)=>h(B,L),onDelete:B=>{u(B),r()},onCreateConnection:d,onDeleteConnection:f,onSelect:e,onClose:r,onPressureTest:()=>{},onResolveGate:p}),c.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 mt-1",style:{borderTop:"1px solid hsl(var(--border))"},children:[i&&c.jsxs("button",{onClick:()=>i(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[c.jsx("span",{style:{fontSize:10},children:"↑"})," View in Graph"]}),s&&c.jsxs("button",{onClick:()=>s(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[c.jsx("span",{style:{fontSize:10},children:"↓"})," View in Tree"]})]})]}),C==="pipeline"&&c.jsx(Hq,{item:y,activeBuild:m}),C==="sessions"&&c.jsx(Vq,{featureCode:S,sessions:x,items:o}),C==="errors"&&c.jsx(Kq,{featureCode:S,errors:g,items:o}),C==="files"&&c.jsx(Jq,{featureCode:S,onOpenFile:n})]})]}):c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function eH(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 rH(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function nH(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function iH(t,e,r){var h;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=(h=e==null?void 0:e.per_loop_type)==null?void 0:h[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 sH(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 bx(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const Cx=[{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 oH({tierMap:t,tierSummary:e}){const[r,n]=v.useState(null),i=s=>n(o=>o===s?null:s);return c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Tier Pipeline"}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[Cx.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 h,u;return l?(h="bg-muted-foreground/40",u=`${s.id} (${s.name}): skipped`):a===!0?(h="bg-success",u=`${s.id} (${s.name}): passed`):a===!1?(h="bg-destructive",u=`${s.id} (${s.name}): failed`):(h="bg-muted-foreground/20",u=`${s.id} (${s.name}): not run`),c.jsxs(Yt.Fragment,{children:[o>0&&c.jsx("div",{className:"h-px w-3 bg-muted-foreground/20 shrink-0"}),c.jsxs("button",{className:"flex flex-col items-center gap-0.5 group",onClick:()=>i(s.id),title:u,children:[c.jsx("div",{className:`w-2.5 h-2.5 rounded-full transition-all group-hover:scale-125 ${h} ${r===s.id?"ring-1 ring-foreground/40":""}`}),c.jsx("span",{className:"text-[8px] text-muted-foreground leading-none",children:s.label})]})]},s.id)}),(e==null?void 0:e.costSaved)>0&&c.jsxs("span",{className:"ml-2 text-[9px] text-success/80",children:["saved ~$",e.costSaved.toFixed(2)]})]}),r&&c.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=Cx.find(h=>h.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 Ph(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function aH(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const kx={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function vx(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 lH({loopState:t,budget:e}){const[r,n]=v.useState(()=>Date.now());v.useEffect(()=>{if(!t||t.status!=="running")return;const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[t]);const i=iH(t,e,r);return i?c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Live Counters"}),c.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsxs("span",{className:"text-foreground font-mono font-medium",children:["attempt ",i.count,"/",i.maxIterations??"?"]}),c.jsx("span",{className:"text-muted-foreground",children:"·"}),c.jsxs("span",{className:"text-foreground font-mono",children:[vx(i.elapsedMs),i.timeoutMs!=null&&c.jsxs("span",{className:"text-muted-foreground",children:[" / ",vx(i.timeoutMs)]})]}),i.usedIterations!=null&&i.maxTotal!=null&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground",children:"·"}),c.jsxs("span",{className:"text-foreground font-mono",children:["cumulative ",i.usedIterations,"/",i.maxTotal]})]})]}),c.jsxs("div",{className:"text-muted-foreground/70 text-[9px]",children:["loop: ",i.loopType]})]})]}):null}function cH({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=pr(vi(I=>({activeBuild:I.activeBuild,iterationStates:I.iterationStates}))),[o,a]=v.useState(!1),[l,h]=v.useState(null),u=(i==null?void 0:i.featureCode)??null,d=v.useRef(null);v.useEffect(()=>{if(!u){h(null);return}u!==d.current&&(d.current=u,Ft(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(I=>I.json()).then(I=>h(I)).catch(()=>{}))},[u]);const{step:f,allSteps:p}=v.useMemo(()=>i!=null&&i.steps?{step:i.steps.find(E=>E.id===t||E.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=v.useMemo(()=>{if(!r||r.length===0)return null;for(let I=r.length-1;I>=0;I--){const E=r[I];if(E.subtype==="health_score"&&typeof E.score=="number")return E}return null},[r]),{tierMap:x,tierSummary:g}=v.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const I={};let E=null;for(const F of e)F.subtype==="gate_tier_result"?I[F.tierId]=F.passed:F.subtype==="gate_tier_summary"&&(E=F);return{tierMap:I,tierSummary:E}},[e]),y=Object.keys(x).length>0||g!==null,C=v.useMemo(()=>{const I=p.filter(E=>E.cost_usd!=null);return I.length===0?[]:[...I].sort((E,F)=>o?(E.cost_usd??0)-(F.cost_usd??0):(F.cost_usd??0)-(E.cost_usd??0))},[p,o]),b=C.length>0?C[0].id:null,S=v.useMemo(()=>eH(f),[f]),_=v.useMemo(()=>rH(f),[f]),w=v.useMemo(()=>nH(s,t),[s,t]),B=v.useMemo(()=>{if(!n||n.length===0)return null;const I=n.filter(z=>z.stepId===t);if(I.length===0)return null;const E=I.filter(z=>z.severity==="violation").length,F=I.filter(z=>z.severity==="warning").length;return{total:I.length,hardViolations:E,warnings:F}},[n,t]);if(!f)return c.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 c.jsxs("div",{className:"p-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Step"}),c.jsx("p",{className:"text-sm font-semibold text-foreground font-mono",children:f.id||f.step_id})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Status:"}),c.jsx("span",{className:`text-xs font-medium ${L[f.status]||"text-foreground"}`,children:f.status||"unknown"})]}),S&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Retries"}),c.jsxs("p",{className:"text-xs text-amber-400",children:["Retried ",S.count," ",S.count===1?"time":"times"]}),S.isArray&&S.items.length>0&&c.jsx("div",{className:"mt-1 space-y-0.5",children:S.items.map((I,E)=>c.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",E+1,I.reason?`: ${I.reason}`:""]},E))})]}),f.durationMs!=null&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Duration:"}),c.jsx("span",{className:"text-xs text-foreground",children:f.durationMs<1e3?`${f.durationMs}ms`:f.durationMs<6e4?`${(f.durationMs/1e3).toFixed(1)}s`:`${(f.durationMs/6e4).toFixed(1)}m`})]}),f.summary&&c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Summary:"}),c.jsx("p",{className:"text-xs text-foreground mt-0.5",children:f.summary})]}),f.artifact&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Artifact:"}),c.jsx("span",{className:"text-xs text-foreground font-mono truncate",children:f.artifact})]}),f.agent&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Agent:"}),c.jsx("span",{className:"text-xs text-foreground font-mono",children:f.agent})]}),f.filesChanged&&f.filesChanged.length>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Files Changed (",f.filesChanged.length,")"]}),c.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:f.filesChanged.map((I,E)=>c.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:I},E))})]}),(f.input_tokens>0||f.output_tokens>0||f.cost_usd>0)&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Tokens & Cost"}),c.jsxs("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground",children:"Input"}),c.jsx("span",{className:"text-muted-foreground",children:"Output"}),c.jsx("span",{className:"text-muted-foreground",children:"Cost"}),c.jsx("span",{className:"text-foreground font-mono",children:(f.input_tokens??0).toLocaleString()}),c.jsx("span",{className:"text-foreground font-mono",children:(f.output_tokens??0).toLocaleString()}),c.jsx("span",{className:"text-foreground font-mono",children:bx(f.cost_usd)})]})]}),y&&c.jsx("div",{children:c.jsx(oH,{tierMap:x,tierSummary:g})}),_.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1",children:"Postcondition Violations"}),c.jsx("div",{className:"space-y-0.5",children:_.map((I,E)=>c.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),c.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:typeof I=="string"?I:I.message||JSON.stringify(I)})]},E))})]}),B&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Capability Findings"}),c.jsxs("p",{className:"text-xs text-amber-400",children:[B.total," ",B.total===1?"finding":"findings"," ","(",B.hardViolations," ",B.hardViolations===1?"violation":"violations",","," ",B.warnings," ",B.warnings===1?"warning":"warnings",")"]})]}),(w==null?void 0:w.status)==="running"&&c.jsx(lH,{loopState:w,budget:l}),m!=null&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Health Score"}),c.jsxs("div",{className:"flex items-baseline gap-2 mb-2",children:[c.jsx("span",{className:`text-2xl font-bold font-mono tabular-nums ${Ph(m.score)}`,children:m.score}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"/100"}),m.trend&&c.jsxs("span",{className:`text-sm font-mono ${Ph(m.score)}`,children:[aH(m.trend.direction),m.trend.delta!=null&&c.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&&c.jsxs("div",{className:"space-y-1",children:[Object.entries(m.breakdown).map(([I,E])=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:kx[I]??I}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted-foreground/20 overflow-hidden",children:c.jsx("div",{className:`h-full rounded-full transition-all ${E>=80?"bg-success":E>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${E}%`}})}),c.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${Ph(E)}`,children:E})]},I)),m.missing&&m.missing.length>0&&c.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-0.5",children:["No data: ",m.missing.map(I=>kx[I]??I).join(", ")]})]})]}),C.length>1&&c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Build Cost Breakdown"}),c.jsx("button",{className:"text-[9px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>a(I=>!I),children:o?"cost asc":"cost desc"})]}),c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-[10px] border-collapse",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-muted-foreground",children:[c.jsx("th",{className:"text-left pr-2 pb-0.5 font-medium",children:"Step"}),c.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"In"}),c.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"Out"}),c.jsx("th",{className:"text-right pb-0.5 font-medium",children:"Cost"}),c.jsx("th",{className:"text-right pb-0.5 pl-2 font-medium",children:"Dur"})]})}),c.jsx("tbody",{children:C.map(I=>{const E=I.id===b,F=I.id===t,z=I.durationMs!=null?I.durationMs<1e3?`${I.durationMs}ms`:I.durationMs<6e4?`${(I.durationMs/1e3).toFixed(1)}s`:`${(I.durationMs/6e4).toFixed(1)}m`:"—";return c.jsxs("tr",{className:`${E?"text-amber-400":"text-foreground"} ${F?"font-semibold":""}`,children:[c.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:I.id}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((I.input_tokens??0)/1e3).toFixed(1),"k"]}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((I.output_tokens??0)/1e3).toFixed(1),"k"]}),c.jsx("td",{className:"text-right py-0.5 font-mono",children:bx(I.cost_usd)}),c.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:z})]},I.id)})})]})})]})]})}function M2(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 wx(t,e){var l;const r=(e||[]).filter(h=>!h.superseded);if(r.length===0)return"";let n=`# Design Document
634
-
635
- `;const i=(t||[]).filter(h=>h.role==="human"&&h.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
636
-
637
- `,n+=i.map(h=>h.content).join(`
638
-
639
- `),n+=`
640
-
641
- `);for(const h of r){const u=h.selectedOption||{};n+=`## ${h.question}
642
-
643
- `,n+=`**Decision:** ${u.title||u.id||"Selected option"}
644
-
645
- `,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
646
- `),n+=`
647
-
648
- `),h.comment&&(n+=`*Note: ${h.comment}*
649
-
650
- `)}const s=(l=r[r.length-1])==null?void 0:l.timestamp,o=s?(t||[]).filter(h=>h.role==="assistant"&&h.timestamp>s):[],a=[];for(const h of o){if(typeof h.content!="string")continue;const u=h.content.split(`
651
- `);for(const d of u){const f=d.trim();f.endsWith("?")&&f.length>10&&f.length<200&&a.push(f)}}return n+=`## Open Threads
652
-
653
- `,a.length>0?(n+=a.map(h=>`- ${h}`).join(`
654
- `),n+=`
655
- `):n+=`_No open threads._
656
- `,n}function hH(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const ao={es:null},In=Hd((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 h=JSON.parse(localStorage.getItem("compose:designSession")||"{}");r=h.scope||"product",n=h.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 Ft(`/api/design/session${a}`),{session:h}=await l.json();if(h){const u=h.messages||[],d=h.decisions||[],f=wx(u,d),p=hH(u,d);t({session:h,messages:u,decisions:d,status:h.status==="complete"?"complete":"active",scope:r,featureCode:n,draftDoc:i?s:f,docManuallyEdited:i,topicOutline:p,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 Ft("/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 Ft("/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 Ft("/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 Ft("/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 Ft("/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(ao.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}`);ao.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 h=[...l.researchItems],u=a.id?h.findIndex(d=>d.id===a.id):-1;return u!==-1&&(h[u]={...h[u],summary:a.summary}),{researchItems:h}})}),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:()=>{ao.es&&(ao.es.close(),ao.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=wx(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function uH(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=In(vi(h=>({draftDoc:h.draftDoc,docManuallyEdited:h.docManuallyEdited,updateDraftDoc:h.updateDraftDoc,resetDocEdited:h.resetDocEdited}))),[i,s]=v.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))"}),c.jsxs("div",{className:"h-full flex flex-col",style:{fontFamily:"inherit"},children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[12px] font-semibold",style:{color:"hsl(var(--foreground))"},children:"Design Document"}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{...l,background:"hsl(var(--muted))"},children:a})]}),!o&&c.jsx("button",{onClick:()=>s(h=>!h),className:"text-[11px] px-2 py-1 rounded transition-colors",style:{color:"hsl(var(--muted-foreground))",background:i?"hsl(var(--accent))":"transparent"},onMouseEnter:h=>{h.currentTarget.style.color="hsl(var(--foreground))"},onMouseLeave:h=>{h.currentTarget.style.color="hsl(var(--muted-foreground))"},children:i?"Preview":"Edit"})]}),c.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o?c.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?c.jsxs("div",{className:"h-full flex flex-col p-2 gap-2",children:[c.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:h=>r(h.target.value),spellCheck:!1}),c.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:h=>{h.currentTarget.style.color="hsl(var(--foreground))",h.currentTarget.style.borderColor="hsl(var(--foreground))"},onMouseLeave:h=>{h.currentTarget.style.color="hsl(var(--muted-foreground))",h.currentTarget.style.borderColor="hsl(var(--border))"},children:"Reset to auto-generated"})]}):c.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:c.jsx($d,{remarkPlugins:[qd],children:t})})})]})}const Oh={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%)"}},Sx={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 dH({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?Oh.done:Oh[t])||Oh.build,l=Sx[o]||Sx.steady,h=o==="exit"?"200ms":o==="flash"?"300ms":"200ms";return c.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 ${h} ease, opacity ${h} 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:[c.jsxs("span",{style:{fontSize:"12px",lineHeight:1},children:[t==="build"&&"▶",t==="gate"&&"⚠",t==="error"&&"✕",t==="done"&&"✓",t==="iteration"&&"↻"]}),c.jsx("span",{children:e}),r>0&&c.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&&c.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&&c.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 pH(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function fH(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function mH(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function gH({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}`:"",h=pH(t.cumulative_cost_usd),u=h?` · ${h}`:"",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=pn[a.stepId]??(a.fromPhase||a.toPhase||"Gate"),h=Array.isArray(r)?r.find(d=>d.id===a.itemId):null,u=(h==null?void 0:h.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 h=l.loopType==="review"?"review":"coverage",u=`${l.count}/${l.maxIterations}`;let d="";if(l.wallClockTimeout!=null&&l.startedAt){const f=s-new Date(l.startedAt).getTime();d=`, ${fH(f)}/${mH(l.wallClockTimeout)}`}o.push({key:`iter-${a}`,type:"iteration",label:`${h} ${u}${d}`})}}if(Array.isArray(n))for(const a of n){const l=a.featureCode||"system",h=(a.message||a.errorType||"error").substring(0,60);o.push({key:`error-${a.timestamp}-${h.substring(0,10)}`,type:"error",label:`${l} · ${h}`,featureCode:l,timestamp:a.timestamp})}return o}function xH({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=pr(vi(O=>({activeBuild:O.activeBuild,gates:O.gates,items:O.items,recentErrors:O.recentErrors,resolveGate:O.resolveGate,iterationStates:O.iterationStates}))),[l,h]=v.useState(new Map),u=v.useRef([]),d=v.useRef(new Set),f=v.useRef(new Set),[p,m]=v.useState(null),x=v.useRef(null),g=(r==null?void 0:r.featureCode)??null;v.useEffect(()=>{if(!g){m(null),x.current=null;return}g!==x.current&&(x.current=g,Ft(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(O=>O.json()).then(O=>m(O)).catch(()=>{}))},[g]);const y=v.useRef(0);v.useEffect(()=>{if(!g)return;const O=a?[...a.values()].reduce((M,A)=>M+(A.count??0),0):0;O!==y.current&&(y.current=O,Ft(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(M=>M.json()).then(M=>m(M)).catch(()=>{}))},[a,g]);const C=v.useRef(r),[b,S]=v.useState(null);v.useEffect(()=>{const O=C.current;if(O&&O.featureCode&&!r){S({...O,status:"complete"});const M=setTimeout(()=>S(null),3e3);return C.current=r,()=>clearTimeout(M)}C.current=r},[r]);const _=r||b,[w,B]=v.useState(()=>Date.now()),L=a&&[...a.values()].some(O=>O.status==="running");v.useEffect(()=>{if(!L)return;const O=setInterval(()=>B(Date.now()),1e3);return()=>clearInterval(O)},[L]);const I=v.useMemo(()=>gH({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:w}),[_,n,i,s,a,w]),E=v.useMemo(()=>I.filter(O=>!d.current.has(O.key)),[I]);v.useEffect(()=>{const O=new Set(u.current.map(A=>A.key)),M=E.filter(A=>!O.has(A.key)).map(A=>A.key);M.length>0&&(h(A=>{const P=new Map(A);for(const $ of M)P.set($,"enter");return P}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{h(A=>{const P=new Map(A);for(const $ of M)P.get($)==="enter"&&P.set($,"steady");return P})})}));for(const A of E)A.type==="done"&&!f.current.has(A.key)&&(f.current.add(A.key),h(P=>{const $=new Map(P);return $.set(A.key,"flash"),$}),setTimeout(()=>{h(P=>{const $=new Map(P);return $.set(A.key,"exit"),$}),setTimeout(()=>{d.current.add(A.key),h(P=>{const $=new Map(P);return $.delete(A.key),$})},500)},2e3));u.current=E},[E]);const F=v.useCallback(O=>{h(M=>{const A=new Map(M);return A.set(O,"exit"),A}),setTimeout(()=>{d.current.add(O),h(M=>{const A=new Map(M);return A.delete(O),A})},200)},[]),z=v.useCallback(O=>{o&&o(O,"approve","Approved from ops strip")},[o]);if(t==="docs"||E.length===0)return null;const W=sH(p);return c.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:[E.map(O=>c.jsx(dH,{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?()=>z(O.gateId):void 0,onDismiss:O.type==="error"?()=>F(O.key):void 0},O.key)),W&&c.jsx("span",{className:"ml-auto text-[9px] text-muted-foreground font-mono shrink-0 opacity-70",title:"Cumulative budget usage: review / coverage",children:W})]})}const $h=["dashboard","graph","tree","docs","design","gates","pipeline","sessions","ideabox"];function yH(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function bH(t){return(t==null?void 0:t[0])??null}const CH="compose:mainTabs",I2="compose:activeTab";function kH(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(CH);if(!e)return[...$h];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of $h)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[...$h]}function vH(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(I2);if(r&&yH(t,r))return r}catch{}return bH(t)}function Tx(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(I2,t)}catch{}}function F2(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 D2(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const P2="compose:sidebarOpen",O2="compose:contextPanelOpen";function wH(){return F2(P2,!0)}function SH(t){return D2(P2,t)}function TH(){return F2(O2,!1)}function _x(t){return D2(O2,t)}const id=v.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("rounded-xl border bg-card text-card-foreground shadow",t),...e}));id.displayName="Card";const sd=v.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex flex-col space-y-1.5 p-6",t),...e}));sd.displayName="CardHeader";const od=v.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("font-semibold leading-none tracking-tight",t),...e}));od.displayName="CardTitle";const _H=v.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("text-sm text-muted-foreground",t),...e}));_H.displayName="CardDescription";const ad=v.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("p-6 pt-0",t),...e}));ad.displayName="CardContent";const EH=v.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex items-center p-6 pt-0",t),...e}));EH.displayName="CardFooter";function jH(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 Ex({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,h=!o&&!l,u=t.silent,[d,f]=v.useState(()=>{const m=t.startedAt?new Date(t.startedAt).getTime():Date.now();return(t.completedAt?new Date(t.completedAt).getTime():Date.now())-m});v.useEffect(()=>{if(!o)return;const m=t.startedAt?new Date(t.startedAt).getTime():Date.now(),x=()=>f(Date.now()-m);x();const g=setInterval(x,1e3);return()=>clearInterval(g)},[o,t.startedAt]);const p=t.agentType||t.type||t.agent||"agent";return c.jsxs("div",{className:"px-3 py-2 rounded border border-border bg-muted/20",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-[11px] text-foreground font-medium truncate",children:p}),c.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[c.jsx("span",{className:st("w-1.5 h-1.5 rounded-full inline-block",o&&!u&&"bg-green-400",o&&u&&"bg-yellow-400",h&&"bg-emerald-400",l&&"bg-red-400"),style:o&&!u?{animation:"phase-active-pulse 2s ease-in-out infinite"}:void 0}),c.jsx("span",{className:st("text-[10px]",o&&!u&&"text-green-400",o&&u&&"text-yellow-400",h&&"text-emerald-400",l&&"text-red-400"),children:u?"silent":t.status}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:jH(d)}),o&&s&&c.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"})]})]}),c.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:e!=null&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{children:[e," tools"]}),c.jsx("span",{className:"mx-1",children:"·"}),c.jsxs("span",{className:st(r>0&&"text-red-400"),children:[r??0," err"]}),o&&n&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"mx-1",children:"·"}),c.jsxs("span",{children:[i||"working"," (",n,")"]})]})]})})]})}function NH(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 h=i[l];if(!h){const u=e[l*2];h=i[l]={index:l,key:r(l),start:u,size:e[l*2+1],end:u+e[l*2+1],lane:0}}return h}}if(s==="length")return t}return Reflect.get(i,s,o)}})}function Oi(t,e,r){let n=r.initialDeps??[],i,s=!0;function o(){const a=t();return(a.length!==n.length||a.some((h,u)=>n[u]!==h))&&(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 jx(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const BH=(t,e)=>Math.abs(t-e)<1.01,LH=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}};let lo;const Rh=()=>{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},Nx=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},AH=t=>t,MH=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},IH=(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(Nx(r)),!n.ResizeObserver)return()=>{};const s=new n.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const h=l.borderBoxSize[0];if(h){i({width:h.inlineSize,height:h.blockSize});return}}i(Nx(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},ec={passive:!0},FH=typeof window>"u"?!0:"onscrollend"in window,DH=(t,e,r)=>{const n=t.scrollElement;if(!n)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&FH;let o=0;const a=s?null:LH(i,()=>e(o,!1),t.options.isScrollingResetDelay),l=d=>()=>{o=r(n),a==null||a(),e(o,d)},h=l(!0),u=l(!1);return n.addEventListener("scroll",h,ec),s&&n.addEventListener("scrollend",u,ec),()=>{n.removeEventListener("scroll",h),s&&n.removeEventListener("scrollend",u)}},PH=(t,e)=>DH(t,e,r=>{const{horizontal:n,isRtl:i}=t.options;return n?r.scrollLeft*(i&&-1||1):r.scrollTop}),OH=(t,e,r)=>{if(r.options.useCachedMeasurements){const n=r.indexFromElement(t),i=r.options.getItemKey(n);return r.itemSizeCache.get(i)??r.options.estimateSize(n)}if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}if(!e){const n=r.indexFromElement(t),i=r.options.getItemKey(n),s=r.itemSizeCache.get(i);if(s!==void 0)return s}return t[r.options.horizontal?"offsetWidth":"offsetHeight"]},$H=(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})},RH=$H;class zH{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[h,u]of this.elementsCache)if(u===a){this.elementsCache.delete(h);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:AH,rangeExtractor:MH,onChange:()=>{},measureElement:OH,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",useCachedMeasurements:!1};for(const f in r){const p=r[f];p!==void 0&&(s[f]=p)}const o=this.options;let a=null,l=null,h=!1;if(o!==void 0&&o.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,p=s.count,m=this.getMeasurements(),x=f>0?((n=m[0])==null?void 0:n.key)??o.getItemKey(0):null,g=f>0?((i=m[f-1])==null?void 0:i.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(s.getItemKey(0)!==x||s.getItemKey(p-1)!==g)){h=!0;const b=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??m[0]:null;b&&(a=[b.key,this.getScrollOffset()-b.start]);const S=s.followOnAppend===!0?"auto":s.followOnAppend||null;S&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||s.getItemKey(p-1)!==g)&&(l=S)}}this.options=s,h&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(a&&this.scrollOffset!==null){const[f,p]=a,m=this.getMeasurements(),{count:x,getItemKey:g}=this.options;let y=0;for(;y<x&&g(y)!==f;)y++;if(y<x){const C=m[y];if(C){const b=C.start+p;b!==this.scrollOffset&&(d=b-this.scrollOffset,this.scrollOffset=b,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?a[0]:null,u?a[1]:0,l,d])},this.notify=r=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,r)},this.maybeNotify=Oi(()=>(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,!(!Rh()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,ec),s.addEventListener("touchend",a,ec),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,l]=i;s!==null&&!a&&(Rh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),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=Oi(()=>[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=Oi(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l},h)=>{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 b=new Float64Array(x);g&&d>0&&b.set(g.subarray(0,d*2)),g=b,this._flatMeasurements=g}let y;if(d===0)y=n+i;else{const b=d-1;y=g[b*2]+g[b*2+1]+m}for(let b=d;b<r;b++){const S=s(b),_=u.get(S),w=typeof _=="number"?_:this.options.estimateSize(b);g[b*2]=y,g[b*2+1]=w,y+=w+m}const C=NH(r,g,s);return this.measurementsCache=C,C}const f=this.measurementsCache.slice(0,d),p=new Array(a).fill(void 0);for(let m=0;m<d;m++){const x=f[m];x&&(p[x.lane]=m)}for(let m=d;m<r;m++){const x=s(m),g=this.laneAssignments.get(m);let y,C;const b=l==="estimate"||u.has(x);if(g!==void 0&&this.options.lanes>1){y=g;const B=p[y],L=B!==void 0?f[B]:void 0;C=L?L.end+this.options.gap:n+i}else{const B=this.options.lanes===1?f[m-1]:this.getFurthestMeasurement(f,m);C=B?B.end+this.options.gap:n+i,y=B?B.lane:m%this.options.lanes,this.options.lanes>1&&b&&this.laneAssignments.set(m,y)}const S=u.get(x),_=typeof S=="number"?S:this.options.estimateSize(m),w=C+_;f[m]={index:m,start:C,size:_,end:w,key:x,lane:y},p[y]=m}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Oi(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?WH({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=Oi(()=>{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 h=this._flatMeasurements;if(this.options.lanes===1&&h!==null)l=this.options.getItemKey(r),a=h[r*2],o=h[r*2+1];else{const f=this.measurementsCache[r];if(!f)return;l=f.key,a=f.start,o=f.size}const u=this.itemSizeCache.get(l)??o,d=n-u;if(d!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?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++,f?this.applyScrollAdjustment(this.getTotalSize()-p):m&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=Oi(()=>[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=$2(0,n.length-1,s?a=>i[a*2]:a=>jx(n[a]).start,r);return jx(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&&(Rh()&&(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&&BH(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()),h=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=i,h||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:h?"smooth":"auto"})}this.scheduleScrollReconcile()}}const $2=(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 WH({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=$2(0,s,o,r),h=l;if(n===1)for(;h<s&&a(h)<r+e;)h++;else if(n>1){const u=Array(n).fill(0);for(;h<s&&u.some(f=>f<r+e);){const f=t[h];u[f.lane]=f.end,h++}const d=Array(n).fill(r+e);for(;l>=0&&d.some(f=>f>=r);){const f=t[l];d[f.lane]=f.start,l--}l=Math.max(0,l-l%n),h=Math.min(s,h+(n-1-h%n))}return{startIndex:l,endIndex:h}}const zh=typeof document<"u"?v.useLayoutEffect:v.useEffect;function qH({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:r="transform",...n}){const i=v.useReducer(h=>h+1,0)[1],s=v.useRef({enabled:e,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=e,s.current.mode=r;const o=h=>{const u=s.current;if(!u.enabled)return;const d=h.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const y=h.options.horizontal?"width":"height";u.container.style[y]=`${d}px`}const f=!!h.options.horizontal,p=u.mode==="transform",m=f?"left":"top",x=h.options.scrollMargin,g=h.getVirtualItems();for(const y of g){const C=y.start-x,b=h.elementsCache.get(y.key);b&&u.lastPositions.get(b)!==C&&(u.lastPositions.set(b,C),p?b.style.transform=f?`translate3d(${C}px, 0, 0)`:`translate3d(0, ${C}px, 0)`:b.style[m]=`${C}px`)}},a={...n,onChange:(h,u)=>{var d;const f=s.current;let p=!0;if(f.enabled){o(h);const m=h.range,x=f.prevRange;p=!x||x.isScrolling!==h.isScrolling||x.startIndex!==(m==null?void 0:m.startIndex)||x.endIndex!==(m==null?void 0:m.endIndex),p&&(f.prevRange=m?{startIndex:m.startIndex,endIndex:m.endIndex,isScrolling:h.isScrolling}:null)}p&&(t&&u?tS.flushSync(i):i()),(d=n.onChange)==null||d.call(n,h,u)}},[l]=v.useState(()=>{const h=new zH(a);return Object.assign(h,{containerRef:u=>{const d=s.current;if(d.container=u,d.lastSize=null,u&&d.enabled){const f=h.getTotalSize();d.lastSize=f;const p=h.options.horizontal?"width":"height";u.style[p]=`${f}px`}}})});return l.setOptions(a),zh(()=>l._didMount(),[]),zh(()=>l._willUpdate()),zh(()=>{o(l)}),l}function HH(t){return qH({observeElementRect:IH,observeElementOffset:PH,scrollToFn:RH,...t})}function UH(t,e,r){var a,l;const n=[],i=(r==null?void 0:r.id)??null;if(Array.isArray(t))for(const h of t){if(n.push({id:`session-start-${h.id}`,timestamp:h.startedAt,category:"session",title:"Session started",detail:h.source?`Source: ${h.source}`:null,severity:"info",sessionId:h.id,meta:{toolCount:h.toolCount,source:h.source}}),h.endedAt&&n.push({id:`session-end-${h.id}`,timestamp:h.endedAt,category:"session",title:`Session ended (${h.toolCount??0} tools${(a=h.errors)!=null&&a.length?`, ${h.errors.length} error${h.errors.length>1?"s":""}`:""})`,detail:null,severity:"info",sessionId:h.id,meta:{toolCount:h.toolCount,errorCount:((l=h.errors)==null?void 0:l.length)??0}}),Array.isArray(h.errors))for(let u=0;u<h.errors.length;u++){const d=h.errors[u];n.push({id:`error-${h.id}-${u}`,timestamp:d.timestamp||h.startedAt,category:"error",title:d.message||`${d.type} error`,detail:d.tool?`Tool: ${d.tool}`:null,severity:d.severity==="error"?"error":"warning",sessionId:h.id,meta:{type:d.type,tool:d.tool}})}if(h.phaseAtBind&&h.phaseAtEnd&&h.phaseAtBind!==h.phaseAtEnd){const u=new Date(h.startedAt).getTime(),d=h.endedAt?new Date(h.endedAt).getTime():u,f=new Date(u+(d-u)*.8).toISOString();n.push({id:`phase-${h.id}`,timestamp:f,category:"phase",title:`Phase: ${h.phaseAtBind} → ${h.phaseAtEnd}`,detail:null,severity:"success",sessionId:h.id,meta:{from:h.phaseAtBind,to:h.phaseAtEnd}})}}if(Array.isArray(e)){const h=i?e.filter(u=>u.itemId===i):e;for(const u of h){if(u.createdAt){const d=pn[u.stepId]??(u.fromPhase&&u.toPhase?`${we[u.fromPhase]??u.fromPhase} → ${we[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 f={approve:"approve",approved:"approve",revise:"revise",revised:"revise",kill:"kill",killed:"kill"}[u.outcome]||u.outcome,p={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[f]||u.outcome}`,detail:u.comment||null,severity:p[f]||"info",sessionId:null,meta:{gateId:u.id,outcome:u.outcome,comment:u.comment}})}}}const s=new Set,o=[];for(const h of n)s.has(h.id)||(s.add(h.id),o.push(h));return o.sort((h,u)=>h.timestamp.localeCompare(u.timestamp)),o}const YH={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function GH(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 VH({event:t,onSelectItem:e,style:r}){const n=YH[t.category]||"●",i=AT[t.category]||"text-zinc-400",s=LT[t.severity]||"text-zinc-400";return c.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded",style:r,children:[c.jsx("span",{className:st("text-[11px] shrink-0 w-4 text-center leading-4",i),children:n}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:st("text-[11px] truncate",s),children:t.title}),t.detail&&c.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.detail})]}),c.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0 leading-4",children:GH(t.timestamp)})]})}const XH=["all","phase","gate","session","iteration","error"],Bx={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function KH({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=v.useState("all"),[s,o]=v.useState([]),a=v.useRef(null),l=pr(m=>m.gates),h=pr(m=>m.featureTimeline),u=pr(m=>m.setFeatureTimeline);v.useEffect(()=>{if(!t)return;let m=!1;return Ft(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=50`).then(x=>x.json()).then(x=>{if(m)return;const g=e?(l||[]).filter(C=>C.itemId===e):l||[],y=UH(x.sessions||[],g,{id:e});o(y)}).catch(()=>{m||o([])}),()=>{m=!0}},[t,e]);const d=v.useMemo(()=>{var g,y;const m=new Map;for(const C of s)m.set(C.id,C);for(const C of h){const b=(g=C.meta)==null?void 0:g.itemId,S=(y=C.meta)==null?void 0:y.featureCode;(!b&&!S||b===e||S===t)&&m.set(C.id,C)}const x=[...m.values()];return x.sort((C,b)=>C.timestamp.localeCompare(b.timestamp)),x},[s,h,e,t]),f=v.useMemo(()=>n==="all"?d:d.filter(m=>m.category===n),[d,n]),p=HH({count:f.length,getScrollElement:()=>a.current,estimateSize:()=>48,overscan:5});return v.useEffect(()=>{u&&u([])},[t]),t?c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsx("div",{className:"flex flex-wrap gap-1 px-2 py-2 border-b border-border",children:XH.map(m=>c.jsxs("button",{className:st("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:[Bx[m],m!=="all"&&c.jsx("span",{className:"ml-1 text-[9px] opacity-60",children:d.filter(x=>x.category===m).length})]},m))}),c.jsx("div",{className:"px-2 py-1",children:c.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[f.length," event",f.length!==1?"s":""]})}),c.jsx("div",{ref:a,className:"flex-1 overflow-auto",children:f.length===0?c.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2 py-4 text-center",children:["No events",n!=="all"?` in "${Bx[n]}"`:"","."]}):c.jsx("div",{style:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"},children:p.getVirtualItems().map(m=>c.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${m.size}px`,transform:`translateY(${m.start}px)`},children:c.jsx(VH,{event:f[m.index],onSelectItem:r})},m.key))})})]}):c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"Select a feature to see its timeline."})})}const Bo=["explore_design","prd","architecture","blueprint","plan","execute","report"];function QH(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 ZH({currentPhase:t}){const e=Bo.indexOf(t);return c.jsx("div",{className:"space-y-1.5",children:Bo.map((r,n)=>{const i=e>n,s=e===n,o=we[r]??r;return c.jsxs("div",{className:"flex items-center gap-2",style:{animation:`phase-slide-in 300ms ease-out ${n*50}ms both`},children:[i?c.jsx(Gx,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?c.jsx(Hx,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):c.jsx(_S,{className:"w-3.5 h-3.5 text-muted-foreground/40 shrink-0"}),c.jsx("span",{className:st("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 JH({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=v.useMemo(()=>{const a=["design.md","blueprint.md","plan.md","prd.md","architecture.md"],l=new Set(((e==null?void 0:e.steps)||[]).filter(h=>h.status==="done"||h.status==="completed").map(h=>h.id||h.name));return a.map(h=>({name:h,done:l.has(h)||((e==null?void 0:e.steps)||[]).some(u=>{var d,f;return(u.status==="done"||u.status==="completed")&&(((d=u.id)==null?void 0:d.includes(h.replace(".md","")))||((f=u.name)==null?void 0:f.includes(h.replace(".md",""))))})}))},[e]);return c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents"}),i.length===0&&s.length===0&&c.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-1",children:"No agents active"}),c.jsxs("div",{className:"mt-1 space-y-1.5",children:[i.map((a,l)=>c.jsx(Ex,{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)=>c.jsx(Ex,{agent:a},a.agentId||`r-${l}`))]})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Artifacts"}),c.jsx("div",{className:"mt-1 space-y-1",children:o.map(a=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(bi,{className:st("w-3 h-3",a.done?"text-emerald-400":"text-muted-foreground/40")}),c.jsx("span",{className:st("text-[11px] font-mono",a.done?"text-foreground":"text-muted-foreground/50"),children:a.name})]},a.name))})]})]})}function tU({gates:t,allGates:e,items:r,onResolveGate:n}){const i=eS(),s=v.useMemo(()=>{const o=new Map,a=(e||[]).filter(l=>l.resolvedAt&&(l.outcome==="revised"||l.outcome==="revise")).sort((l,h)=>new Date(h.resolvedAt)-new Date(l.resolvedAt));for(const l of t||[]){const h=a.find(u=>u.stepId===l.stepId&&u.itemId===l.itemId);h!=null&&h.artifactSnapshot&&l.artifactSnapshot&&o.set(l.id,{priorSnapshot:h.artifactSnapshot,currentSnapshot:l.artifactSnapshot})}return o},[t,e]);return!t||t.length===0?c.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No gates pending."}):c.jsx("div",{className:"space-y-2",children:t.map(o=>{var h;const a=r.find(u=>u.id===o.itemId),l=(h=o.artifactAssessment)==null?void 0:h.completeness;return c.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/30",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-[11px] text-foreground truncate",children:(a==null?void 0:a.title)??"Unknown"}),c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[pn[o.stepId]??we[o.fromPhase]??o.fromPhase??"Gate",l!=null&&` · ${Math.round(l*100)}% complete`]}),s.has(o.id)&&c.jsx("div",{className:"mt-1",children:c.jsx(Zp,{oldText:s.get(o.id).priorSnapshot,newText:s.get(o.id).currentSnapshot})})]}),c.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[c.jsx(Ot,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>n(o.id,"approved"),children:"Approve"}),c.jsx(Ot,{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(o.id,"revised"),children:"Revise"}),c.jsx(Ot,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:async()=>{const u=await i({title:"Kill this gate?",label:"Reason (required)",destructive:!0});u&&n(o.id,"killed",u)},children:"Kill"})]})]})},o.id)})})}function eU({sessions:t,items:e,onSelect:r}){const n=(t||[]).slice(-5).reverse();return n.length===0?c.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No sessions yet."}):c.jsx("div",{className:"space-y-1",children:n.map(i=>{const s=i.featureCode||i.feature_code,o=s?e.find(l=>{var h;return l.featureCode===s||l.feature_code===s||((h=l.lifecycle)==null?void 0:h.featureCode)===s}):null,a=i.startedAt||i.created_date;return c.jsxs("div",{className:st("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:[c.jsx(bT,{className:"w-3 h-3 text-muted-foreground shrink-0"}),c.jsx("span",{className:"text-[11px] text-foreground",children:i.agent||"agent"}),s&&c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:s}),c.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:QH(a)}),c.jsx("span",{className:st("w-1.5 h-1.5 rounded-full shrink-0",i.status==="active"?"bg-emerald-400":"bg-slate-600")})]},i.id)})})}function rU({items:t=[],gates:e=[],sessions:r=[],activeBuild:n,spawnedAgents:i=[],featureCode:s,sessionState:o,agentActivity:a,iterationStates:l,onSelect:h,onResolveGate:u,onOpenGate:d}){var S;const f=v.useMemo(()=>t.find(_=>{var w;return _.featureCode===s||((w=_.lifecycle)==null?void 0:w.featureCode)===s}),[t,s]),[p,m]=v.useState(()=>{try{return localStorage.getItem("compose:timeline-open")==="true"}catch{return!1}}),x=v.useCallback(()=>{m(_=>{const w=!_;try{localStorage.setItem("compose:timeline-open",String(w))}catch{}return w})},[]),g=((S=f==null?void 0:f.lifecycle)==null?void 0:S.currentPhase)||(f==null?void 0:f.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,y=Bo.indexOf(g),C=g?Math.max(0,(y+1)/Bo.length):0,b=v.useMemo(()=>{let _=e.filter(w=>w.status==="pending"||!w.resolvedAt);if(s){const w=new Set(t.filter(B=>{var L;return B.featureCode===s||((L=B.lifecycle)==null?void 0:L.featureCode)===s}).map(B=>B.id));_=_.filter(B=>w.has(B.itemId))}return _},[e,t,s]);if(!s){const _=t.filter(w=>w.type==="feature"&&(w.status==="complete"||w.status==="done")).slice(-5);return c.jsx("div",{className:"flex-1 overflow-auto p-4",children:c.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-center",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"No feature in progress."}),c.jsx("p",{className:"text-[11px] text-muted-foreground/70 font-mono",children:"Run /compose <feature-code> in the terminal to start."}),_.length>0&&c.jsxs("div",{className:"mt-6 w-full max-w-sm",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recently completed"}),c.jsx("div",{className:"mt-2 space-y-1",children:_.map(w=>c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>h(w.id),children:[c.jsx(Gx,{className:"w-3 h-3 text-emerald-400 shrink-0"}),c.jsx("span",{className:"text-[11px] text-foreground truncate",children:w.title}),w.featureCode&&c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:w.featureCode})]},w.id))})]})]})})}return c.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[c.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4 min-w-0",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h2",{className:"text-sm font-semibold text-foreground truncate",children:(f==null?void 0:f.title)??s}),c.jsx(ir,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),g&&c.jsx(ir,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:we[g]??g}),c.jsxs("button",{className:st("ml-auto flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition-colors shrink-0",p?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:x,children:[c.jsx(GS,{className:"w-3 h-3"}),"Timeline"]})]}),c.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full bg-blue-500",style:{width:`${Math.round(C*100)}%`,transition:"width 800ms cubic-bezier(0.4, 0, 0.2, 1)"}})}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:y>=0?`${y+1} of ${Bo.length} phases`:"Phase unknown"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs(id,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[c.jsx(sd,{className:"p-3 pb-2",children:c.jsx(od,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),c.jsx(ad,{className:"p-3 pt-0",children:c.jsx(ZH,{currentPhase:g})})]}),c.jsxs(id,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[c.jsx(sd,{className:"p-3 pb-2",children:c.jsx(od,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),c.jsx(ad,{className:"p-3 pt-0",children:c.jsx(JH,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),l&&l.size>0&&c.jsx("div",{className:"space-y-2",children:[...l.values()].map(_=>c.jsxs("div",{className:"px-3 py-2.5 rounded border border-blue-500/30 bg-blue-500/10",children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsxs("span",{className:"text-[11px] text-blue-400 font-medium",children:[_.status==="running"?"↻":_.outcome==="clean"?"✓":"✗"," ",_.loopType==="review"?"Review Loop":"Coverage Sweep"]}),c.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[_.count," of ",_.maxIterations]})]}),c.jsx("div",{className:"h-1.5 rounded-full bg-blue-500/20 overflow-hidden",children:c.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"}})}),c.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))}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Pending Gates"}),b.length>0&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:b.length})]}),c.jsx(tU,{gates:b,allGates:e,items:t,onResolveGate:u})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recent Sessions"}),c.jsx("div",{className:"mt-2",children:c.jsx(eU,{sessions:r,items:t,onSelect:h})})]})]}),p&&c.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0",children:[c.jsx("div",{className:"px-3 py-2 border-b border-border",children:c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Event Timeline"})}),c.jsx(KH,{featureCode:s,itemId:f==null?void 0:f.id,onSelectItem:h})]})]})}function nU(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 iU(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:nU(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function sU({results:t,onClose:e}){const r=v.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 c.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:c.jsx(hi,{className:"w-5 h-5 text-emerald-400"})}),c.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Triage complete"}),c.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Triaged ",n," of ",t.length," ideas"]}),c.jsxs("div",{className:"flex gap-3 text-[11px]",children:[r.P0>0&&c.jsxs("span",{className:"text-red-400",children:[r.P0," P0"]}),r.P1>0&&c.jsxs("span",{className:"text-amber-400",children:[r.P1," P1"]}),r.P2>0&&c.jsxs("span",{className:"text-blue-400",children:[r.P2," P2"]}),r.promoted>0&&c.jsxs("span",{className:"text-emerald-400",children:[r.promoted," promoted"]}),r.killed>0&&c.jsxs("span",{className:"text-muted-foreground",children:[r.killed," killed"]}),r.skipped>0&&c.jsxs("span",{className:"text-muted-foreground/60",children:[r.skipped," skipped"]})]}),c.jsx(Ot,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function oU({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=xs(),[o,a]=v.useState(()=>[...t]),[l,h]=v.useState(0),[u,d]=v.useState([]),[f,p]=v.useState(!1),[m,x]=v.useState(""),[g,y]=v.useState(!1),[C,b]=v.useState(!1),S=o[l]??null;o.length-l;const _=v.useMemo(()=>S?iU(S,s.filter(F=>F.id!==S.id)):[],[S,s]),w=v.useCallback(()=>{const F=l+1;F>=o.length?p(!0):(h(F),y(!1),x(""))},[l,o.length]),B=v.useCallback(async F=>{if(!(!S||C)){b(!0);try{await r(S.id,F),d(z=>[...z,{id:S.id,action:"priority",priority:F}]),w()}finally{b(!1)}}},[S,C,r,w]),L=v.useCallback(async()=>{if(!(!S||C)){b(!0);try{await n(S.id,m),d(F=>[...F,{id:S.id,action:"kill"}]),y(!1),x(""),w()}finally{b(!1)}}},[S,C,n,m,w]),I=v.useCallback(()=>{S&&(d(F=>[...F,{id:S.id,action:"skip"}]),w())},[S,w]),E=v.useCallback(async()=>{if(!(!S||C)){b(!0);try{await i(S.id),d(F=>[...F,{id:S.id,action:"promote"}]),w()}finally{b(!1)}}},[S,C,i,w]);return v.useEffect(()=>{const F=z=>{if(z.key==="Escape"){e();return}g||(z.key==="0"&&B("P0"),z.key==="1"&&B("P1"),z.key==="2"&&B("P2"),(z.key==="s"||z.key==="ArrowRight")&&I(),z.key==="k"&&y(!0))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[g,B,I,e]),c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"hsl(var(--background) / 0.8)",backdropFilter:"blur(4px)"},children:c.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:[c.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[c.jsx(hi,{className:"w-4 h-4 text-amber-400 shrink-0"}),c.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Triage"}),!f&&c.jsxs("span",{className:"text-[11px] text-muted-foreground ml-1",children:[l+1," of ",o.length," untriaged"]}),c.jsx("div",{className:"flex-1"}),c.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:c.jsx(gn,{className:"w-4 h-4"})})]}),!f&&c.jsx("div",{className:"h-1 bg-muted",children:c.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${Math.round(l/o.length*100)}%`}})}),c.jsx("div",{className:"flex-1 p-4",children:f?c.jsx(sU,{results:u,onClose:e}):S?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:S.id}),S.cluster&&c.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:S.cluster})]}),c.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:S.title}),S.description&&c.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:S.description}),c.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(S.tags||[]).map(F=>c.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:F},F))}),S.source&&c.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",S.source]})]}),_.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Similar to:"}),c.jsx("div",{className:"space-y-1",children:_.map(F=>c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-muted/30 border border-border/40",children:[c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:F.id}),c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:F.title})]},F.id))})]}),g&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing (optional)…",value:m,onChange:F=>x(F.target.value),onKeyDown:F=>{F.key==="Enter"&&L(),F.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"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Ot,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),c.jsx(Ot,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:L,disabled:C,children:"Confirm Kill"})]})]})]}):c.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-8",children:"No more untriaged ideas."})}),!f&&S&&!g&&c.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[c.jsxs(Ot,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>B("P0"),disabled:C,title:"Press 0",children:["P0 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),c.jsxs(Ot,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>B("P1"),disabled:C,title:"Press 1",children:["P1 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),c.jsxs(Ot,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>B("P2"),disabled:C,title:"Press 2",children:["P2 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"2"})]})]}),c.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[c.jsx(Ot,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:E,disabled:C,children:"Promote"}),c.jsxs(Ot,{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 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"k"})]}),c.jsxs(Ot,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:I,title:"Press s or →",children:[c.jsx(t0,{className:"w-3 h-3"}),"Skip ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function Lx(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 aU(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
657
-
658
- **Date:** ${r}
659
- **Promoted from:** ${t.id}
660
- **Priority:** ${t.priority||"TBD"}
661
- **Tags:** ${n}
662
-
663
- ## Context
664
-
665
- ${t.description||t.title}
666
-
667
- ## Source
668
-
669
- ${t.source||"Internal idea"}
670
-
671
- ## Goals
672
-
673
- - [ ] Define acceptance criteria
674
- - [ ] Identify affected components
675
- - [ ] Estimate effort
676
-
677
- ## Related
678
-
679
- ${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
680
- `.trimStart()}function lU({step:t,current:e}){const r=e>t,n=e===t;return c.jsx("div",{className:"flex items-center gap-1.5",children:c.jsx("div",{className:st("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?c.jsx(Xo,{className:"w-3 h-3"}):t})})}function cU({idea:t,onClose:e}){var _;const{promoteIdea:r}=xs(),[n,i]=v.useState(1),[s,o]=v.useState(()=>Lx(t)),[a,l]=v.useState(""),[h,u]=v.useState(""),[d,f]=v.useState(!1),[p,m]=v.useState(null),x=v.useRef(null);v.useEffect(()=>{u(aU(t,s||"FEAT-?"))},[t,s]),v.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)},C=()=>i(w=>w-1),b=async()=>{if(!d){f(!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{f(!1)}}},S=["Feature ID","Preview","Confirm"];return c.jsx(fd,{open:!0,onOpenChange:w=>!w&&e(),children:c.jsxs(md,{className:"max-w-lg",children:[c.jsx(gd,{children:c.jsxs(xd,{className:"flex items-center gap-2",children:[c.jsx(hi,{className:"w-4 h-4 text-amber-400"}),"Promote to Feature"]})}),n<4&&c.jsx("div",{className:"px-6 -mt-1 mb-1",children:c.jsx("div",{className:"flex items-center gap-2",children:[1,2,3].map((w,B)=>c.jsxs(Yt.Fragment,{children:[c.jsx(lU,{step:w,current:n}),c.jsx("span",{className:st("text-[10px] transition-colors",n===w?"text-foreground font-medium":"text-muted-foreground/60"),children:S[B]}),B<2&&c.jsx(fs,{className:"w-3 h-3 text-muted-foreground/30 mx-0.5"})]},w))})}),c.jsxs("div",{className:"px-6 pb-2",children:[n<4&&c.jsxs("div",{className:"mb-4 px-3 py-2 rounded border border-border/50 bg-muted/20",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:t.id}),t.priority&&t.priority!=="—"&&c.jsx("span",{className:st("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})]}),c.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug",children:t.title})]}),n===1&&c.jsxs("div",{className:"space-y-3",children:[c.jsxs("label",{className:"block",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Feature Code"}),c.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&&c.jsx("p",{className:"text-[11px] text-destructive mt-1",children:a})]}),t.cluster&&c.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Suggested from cluster: ",c.jsx("span",{className:"text-muted-foreground",children:t.cluster})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Suggestions"}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:[Lx(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((w,B,L)=>L.indexOf(w)===B).map(w=>c.jsx("button",{onClick:()=>{o(w),l("")},className:st("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&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Generated plan.md stub"}),c.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:h}),c.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&&c.jsxs("div",{className:"space-y-3",children:[c.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Promote ",c.jsx("span",{className:"text-foreground font-medium",children:t.id})," to feature"," ",c.jsx("span",{className:"font-mono text-accent font-semibold",children:s}),"?"]}),c.jsxs("p",{className:"text-[11px] text-muted-foreground/70",children:["The idea will be marked ",c.jsxs("span",{className:"font-mono",children:["PROMOTED (",s,")"]})," in the ideabox."]})]}),n===4&&p&&c.jsxs("div",{className:"flex flex-col items-center gap-3 py-4 text-center",children:[c.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:c.jsx(Xo,{className:"w-5 h-5 text-emerald-400"})}),c.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Promoted!"}),c.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t.id," is now linked to feature"," ",c.jsx("span",{className:"font-mono text-accent font-semibold",children:p.featureCode})]}),c.jsx(Ot,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&c.jsxs(zx,{children:[n>1&&c.jsxs(Ot,{variant:"ghost",size:"sm",onClick:C,disabled:d,children:[c.jsx(Ux,{className:"w-3 h-3 mr-1"}),"Back"]}),c.jsx(Ot,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?c.jsxs(Ot,{size:"sm",onClick:y,children:["Next",c.jsx(fs,{className:"w-3 h-3 ml-1"})]}):c.jsx(Ot,{size:"sm",onClick:b,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const ld=["S","M","L"],hU=["high","medium","low"],uU={"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"},Ax={"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"},Mx=["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 dU({idea:t,onSubmit:e,onCancel:r}){const[n,i]=v.useState(t.effort||""),[s,o]=v.useState(t.impact||"");return c.jsxs("div",{className:"p-2 bg-card border border-border rounded-lg shadow-md w-52",children:[c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-2 truncate font-medium",children:[t.id,": ",t.title]}),c.jsxs("div",{className:"mb-2",children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Effort"}),c.jsx("div",{className:"flex gap-1",children:ld.map(a=>c.jsx("button",{onClick:()=>i(a),className:st("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))})]}),c.jsxs("div",{className:"mb-2.5",children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Impact"}),c.jsx("div",{className:"flex gap-1",children:["high","medium","low"].map(a=>c.jsx("button",{onClick:()=>o(a),className:st("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))})]}),c.jsxs("div",{className:"flex gap-1",children:[c.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"}),c.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 pU({ideas:t,selectedIdeaId:e,onSelectIdea:r,onUpdateIdea:n}){const[i,s]=v.useState(null),o=v.useMemo(()=>{const u=[...new Set(t.map(f=>f.cluster||"__none__"))],d={};return u.forEach((f,p)=>{d[f]=Mx[p%Mx.length]}),d},[t]),a=v.useMemo(()=>t.filter(u=>u.effort&&u.impact),[t]),l=v.useMemo(()=>t.filter(u=>!u.effort||!u.impact),[t]),h=v.useCallback(async(u,d)=>{await n(u,d),s(null)},[n]);return c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"flex mb-1 ml-12",children:ld.map(u=>c.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),hU.map(u=>c.jsxs("div",{className:"flex mb-1",children:[c.jsx("div",{className:"w-12 shrink-0 flex items-center justify-end pr-2",children:c.jsx("span",{className:"text-[9px] text-muted-foreground capitalize",children:u})}),ld.map(d=>{const f=`${u}-${d}`,p=uU[f],m=a.filter(x=>x.impact===u&&x.effort===d);return c.jsxs("div",{className:st("flex-1 min-h-[90px] rounded border p-1.5 mr-1 relative transition-colors",Ax[p]||"border-border/30"),children:[c.jsx("span",{className:"absolute top-1 right-1 text-[8px] text-muted-foreground/50 italic",children:p}),c.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 c.jsx("button",{onClick:()=>r==null?void 0:r(x.id),title:`${x.id}: ${x.title}`,className:st("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)),c.jsx("div",{className:"flex ml-12",children:c.jsx("div",{className:"flex-1 text-center text-[9px] text-muted-foreground/60 mt-0.5",children:"Effort (S = small, M = medium, L = large)"})})]}),c.jsx("div",{className:"flex flex-wrap gap-3 text-[10px]",children:Object.entries(Ax).map(([u,d])=>c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("div",{className:st("w-2.5 h-2.5 rounded-sm border",d)}),c.jsx("span",{className:"text-muted-foreground",children:u})]},u))}),l.length>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-2",children:["Unassigned (",l.length,") — click to assign effort/impact"]}),c.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(u=>c.jsxs("div",{className:"relative",children:[c.jsxs("button",{onClick:()=>s((i==null?void 0:i.id)===u.id?null:u),className:st("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:[c.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&&c.jsx("div",{className:"absolute left-0 top-full mt-1 z-10",children:c.jsx(dU,{idea:u,onSubmit:h,onCancel:()=>s(null)})})]},u.id))})]})]})}function Wh({value:t,max:e,color:r="bg-primary/60"}){const n=e>0?Math.round(t/e*100):0;return c.jsx("div",{className:"flex-1 h-1.5 bg-muted/50 rounded-full overflow-hidden",children:c.jsx("div",{className:st("h-full rounded-full transition-all",r),style:{width:`${n}%`}})})}function fU({ideas:t,killed:e}){const[r,n]=v.useState(!1),i=v.useMemo(()=>{var C,b,S,_;const s=[...t,...e||[]],o={};for(const w of s){const B=((C=w.source)==null?void 0:C.trim())||"(no source)",L=B.length>30?B.slice(0,30)+"…":B;o[L]=(o[L]||0)+1}const a=Object.entries(o).sort((w,B)=>B[1]-w[1]).slice(0,6),l=((b=a[0])==null?void 0:b[1])||1,h=s.filter(w=>w.status==="NEW").length,u=s.filter(w=>w.status==="DISCUSSING").length,d=s.filter(w=>{var B;return(B=w.status)==null?void 0:B.startsWith("PROMOTED")}).length,f=(e||[]).length,p=t.length,m=s.length>0?Math.round(f/s.length*100):0,x={};for(const w of s){const B=w.cluster||"(unclustered)";x[B]||(x[B]={total:0,promoted:0}),x[B].total+=1,(S=w.status)!=null&&S.startsWith("PROMOTED")&&(x[B].promoted+=1)}const g=Object.entries(x).sort((w,B)=>B[1].total-w[1].total).slice(0,5),y=((_=g[0])==null?void 0:_[1].total)||1;return{sourceEntries:a,maxSourceCount:l,newCount:h,discussingCount:u,promotedCount:d,killedCount:f,killRate:m,totalActive:p,clusterEntries:g,maxClusterTotal:y}},[t,e]);return t.length===0&&(!e||e.length===0)?null:c.jsxs("div",{className:"mt-1.5",children:[c.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?c.jsx(Ko,{className:"w-3 h-3"}):c.jsx(fs,{className:"w-3 h-3"}),c.jsx(fS,{className:"w-3 h-3"}),c.jsx("span",{children:"Analytics"})]}),r&&c.jsxs("div",{className:"mt-2 space-y-3 border border-border/30 rounded-lg p-3 bg-muted/10",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Status Funnel"}),c.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})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-16 text-[9px] text-muted-foreground shrink-0",children:s}),c.jsx(Wh,{value:o,max:Math.max(i.newCount,i.discussingCount,i.promotedCount,i.killedCount,1),color:a}),c.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))}),i.killRate>0&&c.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-1",children:["Kill rate: ",i.killRate,"%"]})]}),i.sourceEntries.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"By Source"}),c.jsx("div",{className:"space-y-1",children:i.sourceEntries.map(([s,o])=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),c.jsx(Wh,{value:o,max:i.maxSourceCount,color:"bg-violet-400/50"}),c.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))})]}),i.clusterEntries.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Cluster Health"}),c.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 c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),c.jsx(Wh,{value:o,max:i.maxClusterTotal,color:"bg-cyan-400/50"}),c.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o}),l>0&&c.jsxs("span",{className:"text-[9px] text-blue-400 shrink-0",children:[l,"%"]})]},s)})})]})]})]})}const mU=[{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 Ix(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function R2({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 c.jsx("span",{className:st("inline-block w-2 h-2 rounded-full shrink-0",e),title:t})}function gU({priority:t}){if(!t||t==="—")return c.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 c.jsx("span",{className:st("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 xU({idea:t,selected:e,onClick:r,onDragStart:n,onDragEnd:i}){var s;return c.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:st("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:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),c.jsx(R2,{status:t.status}),c.jsx("div",{className:"flex-1"}),c.jsx(gU,{priority:t.priority})]}),c.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&&c.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[t.tags.slice(0,4).map(o=>c.jsx("span",{className:"text-[9px] text-muted-foreground/70 font-mono",children:o},o)),t.tags.length>4&&c.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["+",t.tags.length-4]})]}),t.source&&c.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.source})]})}function yU({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,C,b,S;const[o,a]=v.useState(""),[l,h]=v.useState(!1),[u,d]=v.useState(!1),[f,p]=v.useState(""),[m,x]=v.useState(!1);if(!t)return null;const g=async()=>{const _=f.trim();if(_){x(!0);try{await s(t.id,"human",_),p("")}finally{x(!1)}}};return c.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0 overflow-hidden",children:[c.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),c.jsx(R2,{status:t.status}),c.jsx("span",{className:"text-[11px] text-muted-foreground flex-1 truncate",children:t.status}),c.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground text-xs px-1",children:"x"})]}),c.jsxs("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Title"}),c.jsx("p",{className:"text-[13px] text-foreground font-medium leading-snug",children:t.title})]}),t.description&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),c.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:t.description})]}),t.source&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Source"}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.source})]}),t.cluster&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Cluster"}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.cluster})]}),((y=t.tags)==null?void 0:y.length)>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Tags"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(_=>c.jsx("span",{className:"text-[10px] bg-muted/50 px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:_},_))})]}),t.mapsTo&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Maps To"}),c.jsx("p",{className:"text-[11px] text-muted-foreground font-mono",children:t.mapsTo})]}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5 flex items-center gap-1",children:[c.jsx(nc,{className:"w-3 h-3"}),"Discussion",((C=t.discussion)==null?void 0:C.length)>0&&c.jsxs("span",{className:"text-muted-foreground/50",children:["(",t.discussion.length,")"]})]}),((b=t.discussion)==null?void 0:b.length)>0&&c.jsx("div",{className:"space-y-1.5 mb-2",children:t.discussion.map((_,w)=>c.jsxs("div",{className:"px-2 py-1.5 rounded bg-muted/30 border border-border/30",children:[c.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[c.jsx("span",{className:st("text-[9px] font-mono font-semibold",_.author==="agent"?"text-blue-400":"text-emerald-400"),children:_.author}),c.jsx("span",{className:"text-[9px] text-muted-foreground/50",children:_.date})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground leading-relaxed",children:_.text})]},w))}),c.jsxs("div",{className:"flex gap-1.5 items-end",children:[c.jsx("input",{type:"text",placeholder:"Add comment…",value:f,onChange:_=>p(_.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}),c.jsx("button",{onClick:g,disabled:!f.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:c.jsx(kd,{className:"w-3 h-3"})})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Priority"}),c.jsx("div",{className:"flex gap-1.5",children:["P0","P1","P2","—"].map(_=>c.jsx("button",{onClick:()=>i(t.id,_),className:st("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":_},_))})]})]}),!((S=t.status)!=null&&S.startsWith("PROMOTED"))&&t.status!=="KILLED"&&c.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[c.jsx(Ot,{size:"sm",className:"w-full h-7 text-[11px]",onClick:()=>r(t),children:"Promote to Feature"}),l?c.jsxs("div",{className:"space-y-1.5",children:[c.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"}),c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx(Ot,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{h(!1),a("")},children:"Cancel"}),c.jsx(Ot,{size:"sm",className:"flex-1 h-7 text-[10px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:()=>{n(t.id,o),h(!1),a("")},children:"Confirm Kill"})]})]}):c.jsx(Ot,{size:"sm",variant:"outline",className:"w-full h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>h(!0),children:"Kill"})]})]})}function bU({killed:t,onResurrect:e}){const[r,n]=v.useState(!1);return t.length===0?null:c.jsxs("div",{className:"mt-4 border border-border/40 rounded-lg overflow-hidden",children:[c.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?c.jsx(Ko,{className:"w-3 h-3 text-muted-foreground"}):c.jsx(fs,{className:"w-3 h-3 text-muted-foreground"}),c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Graveyard"}),c.jsxs("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:["(",t.length,")"]})]}),r&&c.jsx("div",{className:"p-3 grid grid-cols-1 gap-2 bg-muted/10",children:t.map(i=>c.jsx("div",{className:"px-3 py-2 rounded border border-border/40 bg-card/40",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[c.jsx(ir,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0 opacity-60",children:i.id}),c.jsx("p",{className:"text-[11px] text-muted-foreground/70 line-clamp-1 font-medium",children:i.title})]}),i.killedDate&&c.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Killed ",i.killedDate,i.killedReason?` — ${i.killedReason}`:""]})]}),c.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 CU(){const{ideas:t,killed:e,loading:r,error:n,selectedIdeaId:i,filters:s,hydrate:o,setPriority:a,killIdea:l,resurrectIdea:h,setSelectedIdea:u,updateFilters:d,addDiscussion:f,updateIdea:p}=xs(),[m,x]=v.useState(!1),[g,y]=v.useState(null),[C,b]=v.useState(null),[S,_]=v.useState(null),[w,B]=v.useState("cards"),L=v.useMemo(()=>{var J;const P=t.filter(D=>D.status==="NEW").length,$=t.filter(D=>!D.priority||D.priority==="—").length,j=t.filter(D=>D.priority==="P0").length,T={};t.filter(D=>D.priority==="P0"&&D.cluster).forEach(D=>{T[D.cluster]=(T[D.cluster]||0)+1});const Y=((J=Object.entries(T).sort((D,Q)=>Q[1]-D[1])[0])==null?void 0:J[0])??null;return{newCount:P,untriaged:$,p0Count:j,topCluster:Y}},[t]),I=v.useMemo(()=>{const P=new Set;return t.forEach($=>($.tags||[]).forEach(j=>P.add(j))),[...P].sort()},[t]),E=v.useMemo(()=>t.filter(P=>{var $;if(s.tag&&!(($=P.tags)!=null&&$.includes(s.tag))||s.status&&(P.status||"").split(/\s+/)[0]!==s.status||s.priority&&P.priority!==s.priority)return!1;if(s.search){const j=s.search.toLowerCase();if(!`${P.title} ${P.description} ${P.id} ${(P.tags||[]).join(" ")}`.toLowerCase().includes(j))return!1}return!0}),[t,s]),F=v.useMemo(()=>{const P=new Map,$=[];E.forEach(Y=>{Y.cluster?(P.has(Y.cluster)||P.set(Y.cluster,[]),P.get(Y.cluster).push(Y)):$.push(Y)});const j=Y=>[...Y].sort((J,D)=>Ix(J.priority)-Ix(D.priority)),T=[];for(const[Y,J]of P)T.push({cluster:Y,ideas:j(J)});return $.length>0&&T.push({cluster:null,ideas:j($)}),T},[E]),z=v.useMemo(()=>t.find(P=>P.id===i)||e.find(P=>P.id===i)||null,[t,e,i]),W=v.useCallback((P,$)=>{b($),P.dataTransfer.effectAllowed="move"},[]),O=v.useCallback(()=>{b(null),_(null)},[]),M=v.useCallback((P,$)=>{P.preventDefault(),P.dataTransfer.dropEffect="move",_($)},[]),A=v.useCallback(async(P,$)=>{P.preventDefault(),C&&await a(C,$),b(null),_(null)},[C,a]);return c.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[c.jsxs("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx(hi,{className:"w-4 h-4 text-amber-400 shrink-0"}),c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Ideabox"}),r&&c.jsx(ll,{className:"w-3 h-3 text-muted-foreground animate-spin"}),c.jsx("div",{className:"flex-1"}),c.jsxs("div",{className:"flex items-center gap-0.5 border border-border/50 rounded-md p-0.5",children:[c.jsx("button",{onClick:()=>B("cards"),className:st("text-[10px] px-2 py-0.5 rounded transition-colors",w==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Cards"}),c.jsx("button",{onClick:()=>B("matrix"),className:st("text-[10px] px-2 py-0.5 rounded transition-colors",w==="matrix"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Matrix"})]}),c.jsx("button",{onClick:()=>o(),className:"text-[10px] text-muted-foreground/60 hover:text-muted-foreground transition-colors",title:"Refresh",children:c.jsx(ll,{className:"w-3 h-3"})}),c.jsxs(Ot,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:L.untriaged===0,children:["Triage (",L.untriaged,")"]})]}),c.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[L.newCount>0&&c.jsxs("span",{className:"text-emerald-400",children:[L.newCount," new"]}),c.jsxs("span",{children:[L.untriaged," untriaged"]}),L.p0Count>0&&c.jsxs("span",{className:"text-red-400",children:[L.p0Count," P0"]}),L.topCluster&&c.jsxs("span",{children:["top cluster: ",c.jsx("span",{className:"text-foreground",children:L.topCluster})]}),c.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),c.jsx(fU,{ideas:t,killed:e})]}),c.jsxs("div",{className:"px-4 py-2 border-b border-border shrink-0 flex items-center gap-2 flex-wrap",children:[c.jsx(FS,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),c.jsxs("select",{value:s.tag,onChange:P=>d({tag:P.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[c.jsx("option",{value:"",children:"All tags"}),I.map(P=>c.jsx("option",{value:P,children:P},P))]}),c.jsxs("select",{value:s.status,onChange:P=>d({status:P.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[c.jsx("option",{value:"",children:"All statuses"}),c.jsx("option",{value:"NEW",children:"New"}),c.jsx("option",{value:"DISCUSSING",children:"Discussing"}),c.jsx("option",{value:"PROMOTED",children:"Promoted"})]}),c.jsxs("select",{value:s.priority,onChange:P=>d({priority:P.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[c.jsx("option",{value:"",children:"All priorities"}),c.jsx("option",{value:"P0",children:"P0"}),c.jsx("option",{value:"P1",children:"P1"}),c.jsx("option",{value:"P2",children:"P2"}),c.jsx("option",{value:"—",children:"Untriaged"})]}),c.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[120px]",children:[c.jsx(Wn,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),c.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:P=>d({search:P.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)&&c.jsx("button",{onClick:()=>xs.getState().clearFilters(),className:"text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors",children:"Clear"})]}),c.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&c.jsx("div",{className:"mb-4 px-3 py-2 rounded border border-destructive/30 bg-destructive/10",children:c.jsx("p",{className:"text-[11px] text-destructive",children:n})}),w==="matrix"&&c.jsx(pU,{ideas:E,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:p}),w==="cards"&&E.length===0&&!r&&c.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-2",children:[c.jsx(hi,{className:"w-8 h-8 text-muted-foreground/30"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"No ideas yet."}),c.jsxs("p",{className:"text-[11px] text-muted-foreground/60",children:["Use the CLI: ",c.jsx("span",{className:"font-mono",children:'compose idea "Your idea title"'})]})]}),w==="cards"&&F.map(({cluster:P,ideas:$})=>c.jsxs("div",{className:"mb-6",children:[P&&c.jsxs("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold mb-3 flex items-center gap-2",children:[c.jsx("span",{children:P}),c.jsxs("span",{className:"text-muted-foreground/40 normal-case tracking-normal font-normal",children:["(",$.length,")"]})]}),c.jsx("div",{className:"grid grid-cols-4 gap-3",children:mU.map(j=>{const T=$.filter(J=>J.priority===j.key),Y=S===j.key&&C;return c.jsxs("div",{className:st("rounded-lg border p-2 min-h-[80px] transition-colors",j.bg,j.border,Y&&"ring-1 ring-accent"),onDragOver:J=>M(J,j.key),onDrop:J=>A(J,j.key),children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[c.jsx("span",{className:st("text-[10px] font-semibold uppercase tracking-wider",j.color),children:j.label}),c.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["(",T.length,")"]})]}),c.jsxs("div",{className:"space-y-1.5",children:[T.map(J=>c.jsx(xU,{idea:J,selected:i===J.id,onClick:u,onDragStart:W,onDragEnd:O},J.id)),T.length===0&&c.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},j.key)})})]},P||"__unclustered__")),w==="cards"&&c.jsx(bU,{killed:e,onResurrect:h})]})]}),z&&c.jsx(yU,{idea:z,onClose:()=>u(null),onPromote:P=>y(P),onKill:l,onSetPriority:a,onAddDiscussion:f}),m&&c.jsx(oU,{ideas:t.filter(P=>!P.priority||P.priority==="—"),onClose:()=>x(!1)}),g&&c.jsx(cU,{idea:g,onClose:()=>y(null)})]})}const kU=["A","B","C","D","E","F","G","H"];function vU({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)?kU[s]??t.id:t.id;return c.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)&&c.jsx("span",{className:"absolute top-2 right-2 text-accent",children:r?c.jsx(Xo,{style:{width:14,height:14}}):c.jsx(mT,{style:{width:14,height:14}})}),c.jsxs("span",{className:"block text-[12px] font-bold text-foreground",children:[o,". ",t.title]}),((a=t.bullets)==null?void 0:a.length)>0&&c.jsx("ul",{className:"mt-1.5 space-y-0.5 list-none pl-0",children:t.bullets.map((l,h)=>c.jsxs("li",{className:"text-[11px] text-muted-foreground leading-snug",children:[c.jsx("span",{className:"mr-1",children:"•"}),l]},h))})]})}function wU(){var z;const{session:t,messages:e,decisions:r,status:n,error:i,streamingMessage:s,designDocPath:o,hydrate:a,startSession:l,sendMessage:h,selectCard:u,completeDesign:d,connectSSE:f,disconnectSSE:p,reset:m}=In(),[x,g]=v.useState(""),[y,C]=v.useState(null),[b,S]=v.useState(""),_=v.useRef(null),w=Wx();v.useEffect(()=>(In.setState({scope:null,featureCode:null}),a(),()=>p()),[]),v.useEffect(()=>{var W;(W=_.current)==null||W.scrollIntoView({behavior:"smooth"})},[e,s]);const B=v.useCallback(()=>{x.trim()&&(h(x.trim()),g(""))},[x,h]),L=v.useCallback((W,O)=>{C({messageIndex:O,cardId:W})},[]),I=v.useCallback(()=>{y&&(u(y.cardId,b||null,y.messageIndex),C(null),S(""))},[y,b,u]),E=n==="streaming"||n==="summarizing",F=e.reduce((W,O,M)=>O.role==="assistant"&&O.content&&M2(O.content).parts.some(A=>A.type==="decision")?M:W,-1);return t?c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[i&&c.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"&&c.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:[c.jsx(tf,{style:{width:12,height:12},className:"text-green-400"}),c.jsx("span",{className:"text-green-400 font-medium",children:"Design complete."}),o&&c.jsxs("span",{className:"text-muted-foreground",children:["Document written to ",c.jsx("code",{className:"text-foreground",children:o})]}),c.jsx("div",{className:"flex-1"}),c.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"})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.map((W,O)=>c.jsx(Fx,{messageIndex:O,message:W,onCardSelect:L,selectedCard:y,isStreaming:E,cardsDisabled:E||O!==F},O)),s&&c.jsx(Fx,{message:s,onCardSelect:L,selectedCard:y,isStreaming:E}),!i&&(n==="active"||n==="streaming")&&!s&&e.length>0&&((z=e[e.length-1])==null?void 0:z.role)==="human"&&c.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:c.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[c.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))"}}),c.jsx("span",{children:"Agent thinking..."})]})}),n==="summarizing"&&c.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:c.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[c.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))"}}),c.jsx("span",{children:"Generating design document..."})]})}),c.jsx("div",{ref:_})]}),n!=="complete"&&c.jsxs("div",{className:"border-t border-border p-3 shrink-0",children:[y?c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Selected: ",c.jsx("span",{className:"font-semibold text-foreground",children:y.cardId})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",value:b,onChange:W=>S(W.target.value),onKeyDown:W=>W.key==="Enter"&&I(),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"}),c.jsx("button",{onClick:I,disabled:E,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"}),c.jsx("button",{onClick:()=>{C(null),S("")},className:"px-3 py-1.5 text-[11px] rounded border border-border text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}):c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",value:x,onChange:W=>g(W.target.value),onKeyDown:W=>W.key==="Enter"&&!W.shiftKey&&B(),placeholder:E?"Waiting for response...":"Type a response...",disabled:E,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"}),c.jsx("button",{onClick:B,disabled:E||!x.trim(),className:"px-3 py-1.5 rounded bg-accent text-accent-foreground disabled:opacity-50 transition-opacity",children:c.jsx(kd,{style:{width:14,height:14}})})]}),n==="active"&&r.length>=2&&c.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:[c.jsx(tf,{style:{width:12,height:12}}),"Complete Design"]})]})]}):c.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8",children:[c.jsx(nc,{className:"text-muted-foreground",style:{width:48,height:48}}),c.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:"Start a Design Conversation"}),c.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&&c.jsx("p",{className:"text-[11px] text-red-400 text-center max-w-md",children:i}),c.jsxs("div",{className:"flex gap-2",children:[c.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"}),c.jsx("button",{onClick:async()=>{const W=await w({title:"Feature code",required:!0});W&&l("feature",W)},className:"px-4 py-2 text-[11px] font-medium rounded border border-border text-foreground hover:bg-muted transition-colors",children:"Feature Design"})]})]})}function Fx({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,h;const o=t.role==="human",a=!o&&t.content?M2(t.content):null;return c.jsx("div",{className:st("flex",o?"justify-end":"justify-start"),children:c.jsx("div",{className:st("max-w-[85%] rounded-lg px-3 py-2 text-[12px]",o?"bg-accent/20 text-foreground":"bg-muted text-foreground"),children:o?c.jsx("div",{children:t.type==="card_select"?c.jsxs("span",{children:["Selected ",c.jsx("strong",{children:(l=t.content)==null?void 0:l.cardId}),(h=t.content)!=null&&h.comment?`: ${t.content.comment}`:""]}):c.jsx("span",{children:t.content})}):a?c.jsx("div",{className:"space-y-3",children:a.parts.map((u,d)=>{var f,p;return u.type==="text"?c.jsx("div",{className:"whitespace-pre-wrap",children:u.content},d):c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"flex flex-col gap-2 mt-2",children:(f=u.content.options)==null?void 0:f.map(m=>{var x;return c.jsx(vU,{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)})}),((p=u.content.recommendation)==null?void 0:p.rationale)&&c.jsx("div",{className:"text-[11px] text-muted-foreground italic mt-1",children:u.content.recommendation.rationale})]},d)})}):c.jsx("div",{className:"whitespace-pre-wrap",children:t.content})})})}const SU=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),TU=new Set(["WebSearch","web_search"]);function _U({expanded:t}){return c.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:c.jsx("path",{d:"M3 2L7 5L3 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function EU(){return c.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:[c.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--accent))",strokeWidth:"1.2"}),c.jsx("path",{d:"M3 5l1.5 1.5L7 3.5",stroke:"hsl(var(--accent))",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function jU(){return c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:c.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.2"})})}function qh({title:t,count:e,defaultExpanded:r,children:n}){const[i,s]=v.useState(r);return c.jsxs("div",{className:"border-b",style:{borderColor:"hsl(var(--sidebar-border))"},children:[c.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:[c.jsx(_U,{expanded:i}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider flex-1",style:{color:"hsl(var(--muted-foreground))"},children:t}),e>0&&c.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&&c.jsx("div",{className:"pb-1",children:n})]})}function Ha(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function Dx(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function NU({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>SU.has(o.tool)),n=t.filter(o=>TU.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return c.jsx(Dn,{className:"flex-1",children:c.jsxs("div",{children:[c.jsx(qh,{title:"Topic Outline",count:e.length,defaultExpanded:e.length>0,children:e.length===0?c.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No topics yet"}):c.jsx("ul",{className:"px-3 space-y-1 pt-0.5",children:e.map((o,a)=>c.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[c.jsx("span",{className:"mt-0.5",children:o.decided?c.jsx(EU,{}):c.jsx(jU,{})}),c.jsx("span",{className:"text-[11px] leading-snug",style:{color:o.decided?"hsl(var(--foreground))":"hsl(var(--muted-foreground))"},children:o.title})]},a))})}),c.jsx(qh,{title:"Codebase Refs",count:r.length,defaultExpanded:r.length>0,children:r.length===0?c.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No file references yet"}):c.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:i.map((o,a)=>c.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.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}),c.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:Ha(Dx(o.tool,o.input),50)})]}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ha(o.summary,100)})]},a))})}),c.jsx(qh,{title:"Web Searches",count:n.length,defaultExpanded:n.length>0,children:n.length===0?c.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No web searches yet"}):c.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:s.map((o,a)=>c.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[c.jsx("p",{className:"text-[10px] font-medium leading-snug",style:{color:"hsl(var(--foreground))"},children:Ha(Dx(o.tool,o.input),80)}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ha(o.summary,100)})]},a))})})]})})}function BU({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=v.useState("decisions"),o=t.filter(h=>!h.superseded).length,a=In(h=>h.researchItems)||[],l=In(h=>h.topicOutline)||[];return c.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:n??208},children:[c.jsx("div",{className:"p-3 pb-0",children:c.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--foreground))"},children:"Design"})}),c.jsxs("div",{className:"flex px-2 pt-2 gap-1",style:{borderBottom:"1px solid hsl(var(--sidebar-border))"},children:[c.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&&c.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})]}),c.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&&c.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"&&c.jsx(Dn,{className:"flex-1",children:t.length===0?c.jsx("div",{className:"px-3 py-6 text-center text-[11px]",style:{color:"hsl(var(--muted-foreground))"},children:"No decisions yet"}):c.jsx("div",{className:"px-2 pb-2 pt-1",children:t.map((h,u)=>{var d;return c.jsxs("button",{disabled:h.superseded||r,onClick:()=>!h.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 ${h.superseded||r?"cursor-not-allowed opacity-40":"cursor-pointer hover:bg-sidebar-accent/50"}`,children:[c.jsx("span",{className:"text-[11px] font-medium leading-tight",style:{color:"hsl(var(--foreground))",textDecoration:h.superseded?"line-through":void 0},children:((d=h.selectedOption)==null?void 0:d.title)||h.question}),h.comment&&c.jsx("span",{className:"text-[10px] leading-snug mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:h.comment}),h.superseded&&c.jsx("span",{className:"text-[9px] mt-0.5 uppercase tracking-wider font-medium",style:{color:"hsl(var(--muted-foreground))"},children:"superseded"})]},u)})})}),i==="research"&&c.jsx(NU,{researchItems:a,topicOutline:l})]})}function LU(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function AU(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 MU(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 IU=320,FU=40,DU={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function z2(t){return t?`compose:${t}:openLoopsCollapsed`:null}function Px(t){const e=z2(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function PU(t,e){const r=z2(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function OU({onConfirm:t,onCancel:e}){const[r,n]=v.useState("deferred"),[i,s]=v.useState(""),[o,a]=v.useState(""),l=h=>{h.preventDefault(),i.trim()&&t({kind:r,summary:i.trim(),ttl_days:o?parseInt(o,10):void 0})};return c.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:h=>{h.target===h.currentTarget&&e()},children:c.jsxs("form",{onSubmit:l,style:{background:"#1e1e2e",borderRadius:8,padding:24,width:360,display:"flex",flexDirection:"column",gap:12},children:[c.jsx("h3",{style:{margin:0,color:"#cdd6f4",fontSize:14},children:"Add Open Loop"}),c.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Kind",c.jsxs("select",{value:r,onChange:h=>n(h.target.value),style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px"},children:[c.jsx("option",{value:"deferred",children:"Deferred"}),c.jsx("option",{value:"blocked",children:"Blocked"}),c.jsx("option",{value:"open_question",children:"Open Question"})]})]}),c.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Summary (max 280 chars)",c.jsx("textarea",{"data-testid":"add-loop-summary",value:i,onChange:h=>s(h.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"}})]}),c.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["TTL days (optional, default 90)",c.jsx("input",{type:"number",value:o,onChange:h=>a(h.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"}})]}),c.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[c.jsx("button",{type:"button",onClick:e,style:{padding:"6px 16px",background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,cursor:"pointer"},children:"Cancel"}),c.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 $U({loop:t,onResolve:e,nowMs:r}){const n=MU(t,r),i=!!t.resolution;return c.jsxs("div",{"data-testid":`loop-row-${t.id}`,style:{padding:"8px 12px",borderBottom:"1px solid #313244",opacity:i?.5:1},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx("span",{style:{fontSize:10,color:"#6c7086",background:"#313244",borderRadius:3,padding:"1px 5px"},children:DU[t.kind]||t.kind}),n&&!i&&c.jsx("span",{"data-testid":`stale-badge-${t.id}`,style:{fontSize:10,color:"#f38ba8",background:"#3e1111",borderRadius:3,padding:"1px 5px"},children:">TTL"}),c.jsx("span",{style:{fontSize:10,color:"#6c7086",marginLeft:"auto"},children:AU(t.created_at,r)})]}),c.jsx("p",{style:{margin:"4px 0 6px",fontSize:12,color:n&&!i?"#f38ba8":"#cdd6f4",lineHeight:1.4},children:t.summary}),!i&&c.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&&c.jsx("span",{style:{fontSize:11,color:"#a6e3a1"},children:"Resolved"})]})}function RU({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var y,C;const i=Wx(),[s,o]=v.useState(()=>Px(t)),[a,l]=v.useState(!1),[h,u]=v.useState(()=>Date.now());v.useEffect(()=>{const b=setInterval(()=>u(Date.now()),6e4);return()=>clearInterval(b)},[]),v.useEffect(()=>{o(Px(t))},[t]);const d=v.useCallback(()=>{o(b=>{const S=!b;return PU(t,S),S})},[t]),f=v.useMemo(()=>!t||!e?null:e.find(b=>{var S;return((S=b.lifecycle)==null?void 0:S.featureCode)===t})??null,[t,e]),p=((C=(y=f==null?void 0:f.lifecycle)==null?void 0:y.lifecycle_ext)==null?void 0:C.open_loops)??[],m=v.useMemo(()=>LU(p.filter(b=>b.resolution==null)),[p]),x=v.useCallback(async b=>{if(l(!1),r)try{await r(t,b)}catch(S){console.error("[OpenLoopsPanel] addLoop failed:",S.message),je(`Could not add loop: ${S.message}`,"error")}},[t,r]),g=v.useCallback(async b=>{if(n){const S=await i({title:"Resolve note",label:"(optional)"});if(S===null)return;try{await n(t,b,{note:S})}catch(_){console.error("[OpenLoopsPanel] resolveLoop failed:",_.message),je(`Could not resolve loop: ${_.message}`,"error")}}},[t,n,i]);return t?s?c.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:FU,background:"#181825",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:12,borderLeft:"1px solid #313244",flexShrink:0},children:[c.jsx("button",{"data-testid":"open-loops-expand-btn",onClick:d,title:`Open loops (${m.length})`,style:{background:"none",border:"none",cursor:"pointer",color:"#a6adc8",fontSize:18},children:"↺"}),m.length>0&&c.jsx("span",{style:{fontSize:10,color:"#f5c2e7",marginTop:4},children:m.length})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{"data-testid":"open-loops-panel",style:{width:IU,background:"#181825",display:"flex",flexDirection:"column",borderLeft:"1px solid #313244",flexShrink:0,overflow:"hidden"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid #313244",gap:8},children:[c.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#cdd6f4",flex:1},children:["Open Loops ",m.length>0&&c.jsxs("span",{style:{color:"#a6adc8"},children:["(",m.length,")"]})]}),c.jsx("button",{"data-testid":"add-loop-btn",onClick:()=>l(!0),title:"Add open loop",style:{background:"none",border:"1px solid #45475a",color:"#a6e3a1",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12},children:"+"}),c.jsx("button",{"data-testid":"open-loops-collapse-btn",onClick:d,title:"Collapse",style:{background:"none",border:"none",cursor:"pointer",color:"#6c7086",fontSize:16},children:"›"})]}),c.jsx("div",{style:{flex:1,overflowY:"auto"},children:m.length===0?c.jsxs("div",{"data-testid":"open-loops-empty",style:{padding:"16px 12px",color:"#6c7086",fontSize:12,textAlign:"center"},children:["No open loops for this feature",c.jsx("br",{}),c.jsx("button",{onClick:()=>l(!0),style:{marginTop:8,background:"none",border:"1px solid #45475a",color:"#a6adc8",borderRadius:4,padding:"3px 10px",cursor:"pointer",fontSize:11},children:"+ Add loop"})]}):m.map(b=>c.jsx($U,{loop:b,onResolve:g,nowMs:h},b.id))})]}),a&&c.jsx(OU,{onConfirm:x,onCancel:()=>l(!1)})]}):null}const $i={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},zU=new Set(["blocks","informs"]);function Ox(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 WU(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function qU(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=$i.error;else if(o==="running"){const h=a&&a.endsWith("_gate"),u=Ox(e,s);h&&u&&n.some(f=>f.itemId===u.id&&!f.resolvedAt)?i[s]=$i.gate_pending:i[s]=$i.building}const l=Ox(e,s);if(l&&(i[s]===$i.building||i[s]===$i.gate_pending)){const h=new Set([l.id]),u=HU(h,r),d=new Map(e.map(f=>[f.id,WU(f)]));for(const f of u){const p=d.get(f);p&&!i[p]&&(i[p]=$i.blocked_downstream)}}return i}function HU(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)zU.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 UU(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 h=l.agentType||"claude",u=MT[h]||"#3b82f6";r.push({data:{id:`agent-${l.agentId}`,label:`${h}
681
- ${l.agentId.slice(0,6)}`,isAgentNode:!0,agentType:h,agentStatus:l.status||"running",agentColor:u,parent:"agent-topology"}});const f=l.parentSessionId&&i.has(l.parentSessionId)?`agent-${l.parentSessionId}`:"agent-session",p=`relay-${f}-agent-${l.agentId}`;n.has(p)||n.set(p,{data:{id:p,source:f,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 h=a(l.fromAgentId),u=a(l.toAgentId),d=l.direction==="dispatch"?`relay-${h}-${u}`:`relay-${u}-${h}`;o.add(d)}return{nodes:r,edges:[...n.values()],activeEdgeIds:o}}class yr extends Yt.Component{constructor(){super(...arguments);ee(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?c.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:[c.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"}),c.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)}),c.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 YU extends Yt.Component{constructor(){super(...arguments);ee(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.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:[c.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)]}),c.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"})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(c0,{})})]}):this.props.children}}const cd="compose:fontSize",GU="compose:theme",Lo=13,hd=10,ud=20;function VU(){try{const t=parseInt(localStorage.getItem(cd),10);return t>=hd&&t<=ud?t:Lo}catch{return Lo}}const $x=new URLSearchParams(window.location.search).get("popout");function XU(){return $x?c.jsx(RW,{path:$x}):c.jsx(YU,{children:c.jsx(QU,{})})}function KU({activeView:t,items:e,filteredItems:r,phaseFilteredItems:n,phaseFilteredGates:i,connections:s,filteredConnections:o,sessions:a,activeBuild:l,pipelineDraft:h,gates:u,settings:d,selectedPhase:f,selectedItemId:p,buildStateMap:m,agentOverlay:x,spawnedAgents:g,agentRelays:y,docsSelectedFile:C,onDocsSelectedFileChange:b,docsPreviousView:S,onDocsBack:_,visibleTracks:w,hiddenGroups:B,onSelect:L,onUpdate:I,onCreate:E,onDelete:F,onOpenGate:z,onCreateConnection:W,onDeleteConnection:O,onRefreshBuild:M,onSelectStep:A,onResolveGate:P,onUpdateSettings:$,onResetSettings:j,projectRoot:T,featureCode:Y,focusActive:J,onToggleFocus:D,sessionState:Q,agentActivity:ut,iterationStates:ct}){switch(t){case"dashboard":return c.jsx(rU,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:g,featureCode:Y,sessionState:Q,agentActivity:ut,iterationStates:ct,onSelect:L,onResolveGate:P,onOpenGate:z});case"tree":return c.jsx(Fy,{items:r,connections:o,selectedItemId:p,onSelect:L,onCreate:E,featureCode:Y,focusActive:J,onToggleFocus:D});case"graph":return c.jsx(Py,{items:e,connections:s,selectedItemId:p,onSelect:L,visibleTracks:w,hiddenGroups:B,buildStateMap:m,resolveGate:P,gates:u,spawnedAgents:g,agentRelays:y,agentOverlay:x,featureCode:Y,focusActive:J,onToggleFocus:D});case"pipeline":return c.jsx(g2,{activeBuild:l,pipelineDraft:h,onSelectStep:A,onRefresh:M});case"sessions":return c.jsx(v2,{sessions:a,items:e,onSelectItem:L,featureCode:Y,focusActive:J,onToggleFocus:D});case"gates":return c.jsx(d2,{gates:i,items:n,onResolve:P,onSelect:L,featureCode:Y,focusActive:J,onToggleFocus:D});case"docs":return c.jsx(h2,{items:n,selectedFile:C,onSelectedFileChange:b,previousView:S,onBack:_,featureCode:Y,focusActive:J,onToggleFocus:D});case"design":return c.jsx(wU,{},T);case"ideabox":return c.jsx(CU,{});case"settings":return c.jsx(m2,{settings:d,onSettingsChange:$,onReset:j});case"stratum":return c.jsx(VW,{});default:return c.jsxs("div",{className:"flex-1 flex items-center justify-center text-[12px] text-muted-foreground italic",children:["View “",t,"” not found."]})}}function QU(){const{refresh:t}=rS(),e=In(q=>q.decisions),r=In(q=>q.status),[n,i]=v.useState(VU),[s,o]=v.useState(()=>document.documentElement.classList.contains("dark")),[a]=v.useState(kH),[l,h]=v.useState(()=>vH(a)),[u,d]=v.useState(oq),[f,p]=v.useState(wH),[m,x]=v.useState(TH),[g,y]=v.useState(null),[C,b]=v.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[S,_]=v.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:w,connections:B,connected:L,uiCommand:I,clearUICommand:E,recentChanges:F,createItem:z,updateItem:W,deleteItem:O,createConnection:M,deleteConnection:A,agentActivity:P,agentErrors:$,spawnedAgents:j,agentRelays:T,sessionState:Y,registerSnapshotProvider:J,gates:D,gateEvent:Q,resolveGate:ut,settings:ct,updateSettings:$t,resetSettings:Et,activeBuild:ot,setActiveBuild:G,pipelineDraft:lt,sessions:kt,iterationStates:_t,selectedPhase:Rt,setSelectedPhase:se,statusSnapshots:ge,setStatusSnapshot:Qe}=pr(vi(q=>({items:q.items,connections:q.connections,connected:q.connected,uiCommand:q.uiCommand,clearUICommand:q.clearUICommand,recentChanges:q.recentChanges,createItem:q.createItem,updateItem:q.updateItem,deleteItem:q.deleteItem,createConnection:q.createConnection,deleteConnection:q.deleteConnection,agentActivity:q.agentActivity,agentErrors:q.agentErrors,spawnedAgents:q.spawnedAgents,agentRelays:q.agentRelays,sessionState:q.sessionState,registerSnapshotProvider:q.registerSnapshotProvider,gates:q.gates,gateEvent:q.gateEvent,resolveGate:q.resolveGate,settings:q.settings,updateSettings:q.updateSettings,resetSettings:q.resetSettings,activeBuild:q.activeBuild,setActiveBuild:q.setActiveBuild,pipelineDraft:q.pipelineDraft,sessions:q.sessions,iterationStates:q.iterationStates,selectedPhase:q.selectedPhase,setSelectedPhase:q.setSelectedPhase,statusSnapshots:q.statusSnapshots,setStatusSnapshot:q.setStatusSnapshot}))),Gt=(Y==null?void 0:Y.featureCode)||null;v.useEffect(()=>{Gt&&(ge&&ge[Gt]||Ft(`/api/lifecycle/status?featureCode=${encodeURIComponent(Gt)}`).then(q=>q.json()).then(q=>{q!=null&&q.snapshot&&Qe&&Qe(Gt,q.snapshot)}).catch(()=>{}))},[Gt,ge,Qe]);const[Ce,V]=v.useState(null),it=v.useRef(!!localStorage.getItem("compose:activeView")),[dt,wt]=v.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[rt,mt]=v.useState(""),U=v.useCallback(q=>{b(q),localStorage.setItem("compose:contextWidthPx",String(Math.round(q)))},[]),nt=v.useRef(!1),Tt=v.useCallback(q=>{q.preventDefault(),nt.current=!0;const yt=de=>{if(!nt.current)return;const ar=de.clientX-16,qs=Math.max(160,Math.min(window.innerWidth*.4,ar));_(qs),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(qs)))},vt=()=>{nt.current=!1,document.removeEventListener("mousemove",yt),document.removeEventListener("mouseup",vt)};document.addEventListener("mousemove",yt),document.addEventListener("mouseup",vt)},[]),[Pt,qt]=v.useState(null),[he,xe]=v.useState(null),[ce,Br]=v.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[De,ke]=v.useState(()=>{try{const q=localStorage.getItem("compose:visibleTracks");if(q){const yt=JSON.parse(q);return new Set(yt)}}catch{}return null}),[wr,ze]=v.useState(new Set),[wi,Sr]=v.useState(!1),kn=v.useCallback(q=>{ze(yt=>{const vt=new Set(yt);return vt.has(q)?vt.delete(q):vt.add(q),vt})},[]),[Si,Fs]=v.useState(null),[Mc,sn]=v.useState(!1),[Ds,Ps]=v.useState(!1),[Un,ua]=v.useState(!1),[Ic,ue]=v.useState(""),[on,da]=v.useState("");v.useEffect(()=>{Ft("/api/project").then(q=>q.json()).then(q=>{ue(q.name||""),da(q.targetRoot||"")}).catch(()=>{})},[]);const pa=v.useCallback(async q=>{try{const vt=await(await Ft("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:q})})).json();return vt.ok?(await t(),ue(vt.name),da(vt.targetRoot),!0):!1}catch{return!1}},[t]),Ti=u===Ye.MAXIMIZED,fa=v.useCallback(q=>{h(q),Tx(q),wt(q)},[]),Ze=v.useCallback(q=>{wt(q),h(q),Tx(q)},[]);v.useEffect(()=>{localStorage.setItem("compose:activeView",dt),dt!=="docs"&&(xe(null),qt(null))},[dt]),v.useEffect(()=>{ce?localStorage.setItem("compose:selectedTrack",ce):localStorage.removeItem("compose:selectedTrack")},[ce]),v.useEffect(()=>{Ce?sessionStorage.setItem("vision-selectedItemId",Ce):sessionStorage.removeItem("vision-selectedItemId")},[Ce]),v.useEffect(()=>{try{De?localStorage.setItem("compose:visibleTracks",JSON.stringify([...De])):localStorage.removeItem("compose:visibleTracks")}catch{}},[De]);const ma=v.useRef(!1);v.useEffect(()=>{var q;ma.current||it.current||(q=ct==null?void 0:ct.ui)!=null&&q.defaultView&&(Ze(ct.ui.defaultView),ma.current=!0)},[ct]),v.useEffect(()=>{I&&(I.view&&Ze(I.view),I.phase!==void 0&&se(I.phase),I.select!==void 0&&Ie(I.select),E())},[I,E]),v.useEffect(()=>{const q=()=>{var vt;return["INPUT","TEXTAREA","SELECT"].includes((vt=document.activeElement)==null?void 0:vt.tagName)},yt=vt=>{(vt.metaKey||vt.ctrlKey)&&vt.key==="k"&&(vt.preventDefault(),sn(de=>!de)),(vt.metaKey||vt.ctrlKey)&&vt.key==="n"&&(vt.preventDefault(),Ps(!0)),vt.key===","&&!vt.metaKey&&!vt.ctrlKey&&!q()&&ua(!0)};return window.addEventListener("keydown",yt),()=>window.removeEventListener("keydown",yt)},[]);const Pe=v.useMemo(()=>{let q=w;if(Rt&&(q=q.filter(yt=>yt.phase===Rt)),ce&&(q=q.filter(yt=>{const vt=(yt.description||"").match(/Track:\s*(\w+)/i);return vt&&vt[1].toLowerCase()===ce})),rt){const yt=rt.toLowerCase();q=q.filter(vt=>vt.title.toLowerCase().includes(yt)||(vt.description||"").toLowerCase().includes(yt))}return q},[w,Rt,ce,rt]),Lr=v.useMemo(()=>Rt?w.filter(q=>q.phase===Rt):w,[w,Rt]),Os=v.useMemo(()=>new Set(Lr.map(q=>q.id)),[Lr]),ga=v.useMemo(()=>Rt?D.filter(q=>Os.has(q.itemId)):D,[D,Os,Rt]),$s=v.useMemo(()=>{if(!Rt&&!ce&&!rt)return B;const q=new Set(Pe.map(yt=>yt.id));return B.filter(yt=>q.has(yt.fromId)&&q.has(yt.toId))},[B,Pe,Rt,ce,rt]),_i=v.useMemo(()=>qU(ot,w,B,D),[ot,w,B,D]),vn=v.useMemo(()=>UU(j,T),[j,T]),Me=v.useCallback(q=>{y(q)},[]),Ie=v.useCallback(q=>{V(yt=>yt===q?(Me(null),null):(Me({type:"item",id:q}),q))},[Me]),xa=v.useCallback(async q=>{try{const yt=await Ft(`/api/agent/${q}/stop`,{method:"POST",headers:Vi({"Content-Type":"application/json"})});yt.ok||je(`Could not stop agent (${yt.status})`,"error")}catch(yt){console.error(`[App] Failed to stop agent ${q}:`,yt.message),je(`Could not stop agent: ${yt.message}`,"error")}},[]),Rs=v.useRef(ot);v.useEffect(()=>{!Rs.current&&ot&&ot.featureItemId&&Ie(ot.featureItemId),Rs.current=ot},[ot]);const zs=v.useCallback(q=>{if(!q)return;const yt=w.find(vt=>{var de,ar;return((de=vt.lifecycle)==null?void 0:de.featureCode)===q||vt.featureCode===q||vt.feature_code===q||((ar=vt.title)==null?void 0:ar.includes(q))});yt&&Ie(yt.id)},[w,Ie]);v.useEffect(()=>{const q=yt=>{const{featureCode:vt}=yt.detail||{};vt&&zs(vt)};return window.addEventListener("compose:select-feature",q),()=>window.removeEventListener("compose:select-feature",q)},[zs]);const Yn=v.useCallback(q=>w.find(yt=>{var vt;return((vt=yt.lifecycle)==null?void 0:vt.featureCode)===q})||null,[w]),ya=v.useCallback(async(q,yt)=>{const vt=Yn(q);if(!vt)throw new Error(`No item found for feature ${q}`);const de=await Ft(`/api/vision/items/${vt.id}/loops`,{method:"POST",headers:Vi({"Content-Type":"application/json"}),body:JSON.stringify(yt)});if(!de.ok)throw new Error(`Add loop failed: ${de.status}`)},[Yn]),Ei=v.useCallback(async(q,yt,{note:vt})=>{const de=Yn(q);if(!de)throw new Error(`No item found for feature ${q}`);const ar=await Ft(`/api/vision/items/${de.id}/loops/${yt}/resolve`,{method:"POST",headers:Vi({"Content-Type":"application/json"}),body:JSON.stringify({note:vt})});if(!ar.ok)throw new Error(`Resolve loop failed: ${ar.status}`)},[Yn]);v.useEffect(()=>{J(()=>({activeView:dt,selectedPhase:Rt,searchQuery:rt,selectedItemId:Ce,totalItems:w.length,filteredCount:Pe.length,connected:L}))},[J,dt,Rt,rt,Ce,w.length,Pe.length,L]),v.useEffect(()=>{const q=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return q.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>q.disconnect()},[]),v.useEffect(()=>{g&&!m&&(x(!0),_x(!0))},[g]),v.useEffect(()=>{dt==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[dt]);const wn=v.useCallback(()=>{const q=s?"light":"dark";document.documentElement.classList.toggle("dark",q==="dark"),localStorage.setItem(GU,q),Ft("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:q}})}).catch(()=>{})},[s]),gt=v.useCallback(q=>{i(yt=>{const vt=Math.min(Math.max(yt+q,hd),ud);return localStorage.setItem(cd,vt),vt})},[]),R=v.useCallback(()=>{i(Lo),localStorage.setItem(cd,Lo)},[]),tt=v.useCallback(q=>{d(q),aq(q)},[]),ht=v.useCallback(()=>{p(q=>(SH(!q),!q))},[]),Zt=v.useCallback(()=>{x(q=>(_x(!q),!q))},[]),Wt=v.useCallback((q,yt)=>{W(q,yt)},[W]),ne=v.useCallback(async()=>{const yt=await z({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Rt||"vision"});yt&&yt.id&&Ie(yt.id)},[z,Rt]),ve=v.useCallback(async q=>{await O(q),Ce===q&&(V(null),Me(null))},[O,Ce,Me]),We=v.useCallback(q=>{const yt=D.find(vt=>vt.id===q);yt&&(V(yt.itemId),Me({type:"item",id:yt.itemId}))},[D,Me]),gr=v.useCallback(async q=>M(q),[M]),Ws=v.useCallback(async q=>A(q),[A]),Te=v.useCallback(()=>{Ft("/api/build/state").then(q=>q.json()).then(q=>G(q.state??null)).catch(()=>{})},[G]),ba=v.useCallback(q=>{Me({type:"step",id:q})},[Me]),Gn=v.useCallback(q=>{const yt=w.find(ar=>ar.id===q);if(!yt)return;const vt=(yt.description||"").match(/Track:\s*(\w+)/i),de=vt?vt[1].toLowerCase():null;ce&&de&&ce!==de&&Br(null),de&&De&&!De.has(de)&&ke(ar=>{const qs=new Set(ar);return qs.add(de),qs})},[w,ce,De]),W2=v.useCallback(q=>{Gn(q),V(q),Me({type:"item",id:q}),Ze("graph")},[Ze,Me,Gn]),q2=v.useCallback(q=>{Gn(q),V(q),Me({type:"item",id:q}),Ze("tree")},[Ze,Me,Gn]),H2=v.useCallback(q=>{xe(dt),qt(q),Ze("docs")},[dt,Ze]),U2=v.useCallback(()=>{he&&(Ze(he),xe(null),qt(null))},[he,Ze]);return c.jsx(hc.Provider,{value:F,children:c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[c.jsx(yr,{zone:"header",children:c.jsxs("header",{className:"h-9 flex items-center px-3 gap-3 shrink-0 justify-between",style:{borderBottom:"1px solid hsl(var(--border))"},children:[c.jsx(XW,{projectName:Ic,projectRoot:on,onSwitch:pa}),c.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:c.jsx(QW,{tabs:a,activeTab:l,onTabChange:fa,onOpenPalette:()=>sn(q=>!q),badges:{gates:D.filter(q=>!q.resolvedAt).length}})}),c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!L&&c.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),c.jsx("button",{className:"compose-btn-icon",onClick:wn,title:s?"Switch to light mode":"Switch to dark mode",children:s?"☀":"☾"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{className:"compose-btn-icon",onClick:()=>gt(-1),disabled:n<=hd,title:"Decrease font size",children:"A−"}),c.jsx("span",{className:"text-[10px] tabular-nums min-w-[20px] text-center text-muted-foreground",children:n}),c.jsx("button",{className:"compose-btn-icon",onClick:()=>gt(1),disabled:n>=ud,title:"Increase font size",children:"A+"})]}),c.jsx("button",{className:"compose-btn-icon",onClick:R,disabled:n===Lo,title:"Reset to default size",children:"100%"})]})]})}),c.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!Ti&&c.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[c.jsx(yr,{zone:"sidebar",children:c.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[c.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:ht,title:f?"Collapse sidebar":"Expand sidebar","aria-expanded":f,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:f?"‹":"›"}),f&&c.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0 order-last",onMouseDown:Tt}),f&&(dt==="design"?c.jsx(BU,{decisions:e,sessionComplete:r==="complete",onReviseDecision:q=>In.getState().reviseDecision(q),widthPx:S}):c.jsx(My,{items:w,gates:D,activeBuild:ot,onViewChange:Ze,selectedPhase:Rt,onPhaseSelect:se,selectedTrack:ce,onTrackSelect:Br,visibleTracks:De,onToggleVisibleTrack:(q,yt)=>ke(vt=>{if(!vt){const ar=new Set(yt);return ar.delete(q),ar}const de=new Set(vt);return de.has(q)?de.delete(q):de.add(q),yt&&de.size>=yt.length?null:de}),onShowAllTracks:()=>ke(null),hiddenGroups:wr,onToggleGroup:kn,searchQuery:rt,onSearchChange:mt,connected:L,agentActivity:P,agentErrors:$,spawnedAgents:j,agentRelays:T,sessionState:Y,onSelectItem:Ie,onStopAgent:xa,onThemeChange:$t,onNewItem:()=>Ps(!0),widthPx:S}))]})}),c.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[c.jsx(j2,{featureCode:Gt,snapshot:Gt?(ge==null?void 0:ge[Gt])??null:null}),Gt&&c.jsx(E2,{currentFeatureCode:Gt}),c.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:c.jsx(yr,{children:c.jsx(KU,{activeView:dt,items:w,filteredItems:Pe,phaseFilteredItems:Lr,phaseFilteredGates:ga,connections:B,filteredConnections:$s,sessions:kt,activeBuild:ot,pipelineDraft:lt,gates:D,settings:ct,selectedPhase:Rt,selectedItemId:Ce,onSelect:Ie,onUpdate:Wt,onCreate:ne,onDelete:ve,onOpenGate:We,onCreateConnection:gr,onDeleteConnection:Ws,onRefreshBuild:Te,onSelectStep:ba,onResolveGate:ut,onUpdateSettings:$t,onResetSettings:Et,visibleTracks:De,hiddenGroups:wr,buildStateMap:_i,agentOverlay:vn,spawnedAgents:j,agentRelays:T,docsSelectedFile:Pt,onDocsSelectedFileChange:qt,docsPreviousView:he,onDocsBack:U2,projectRoot:on,featureCode:Gt,focusActive:wi,onToggleFocus:()=>Sr(q=>!q),sessionState:Y,agentActivity:P,iterationStates:_t})})})]}),dt!=="docs"&&c.jsx(yr,{children:c.jsxs(pq,{isOpen:m,onToggle:Zt,widthPx:C,onResizePx:U,activeBuild:ot,gates:D,agentErrors:$,items:w,children:[(g==null?void 0:g.type)==="item"&&c.jsx(tH,{itemId:g.id,onSelect:q=>{y({type:"item",id:q}),V(q)},onClose:()=>{y(null),V(null)},onOpenFile:H2,onViewInGraph:W2,onViewInTree:q2}),(g==null?void 0:g.type)==="step"&&c.jsx(cH,{stepId:g.id,tierEvents:ot==null?void 0:ot.tierEvents,healthEvents:(ot==null?void 0:ot.health_score)!=null?[{score:ot.health_score,breakdown:ot.health_breakdown,missing:ot.health_missing}]:void 0,capabilityEvents:ot==null?void 0:ot.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&c.jsx(uH,{})]})}),Gt&&dt!=="docs"&&c.jsx(yr,{zone:"open loops panel",children:c.jsx(RU,{featureCode:Gt,items:w,onAddLoop:ya,onResolveLoop:Ei})})]}),c.jsx(yr,{zone:"ops strip",children:c.jsx(xH,{activeView:dt,onSelectFeature:zs})}),c.jsx(yr,{zone:"agent bar",children:c.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",Ti?"flex-1 min-h-0":sq(u)].join(" "),children:c.jsx(hq,{barState:u,onStateChange:tt})})})]}),c.jsx(yr,{zone:"notifications",children:c.jsx(p9,{})}),c.jsx(yr,{zone:"gate notifications",children:c.jsx(_2,{onOpenGate:We})}),c.jsx(yr,{zone:"challenge modal",children:Si&&(()=>{const q=w.find(yt=>yt.id===Si);return q?c.jsx(f2,{item:q,items:w,connections:B,onUpdate:Wt,onClose:()=>Fs(null)}):null})()}),c.jsx(p2,{event:Q,items:w,onNavigate:()=>Ze("gates")}),c.jsx(yr,{zone:"command palette",children:c.jsx(w2,{open:Mc,onClose:()=>sn(!1),onSelectItem:q=>{Ie(q),sn(!1)},onSelectGate:q=>{We(q),sn(!1)}})}),c.jsx(yr,{zone:"item form",children:c.jsx(S2,{open:Ds,onClose:()=>Ps(!1)})}),c.jsx(yr,{zone:"settings",children:c.jsx(T2,{open:Un,onClose:()=>ua(!1),settings:ct,onSettingsChange:$t})})]})})}const LY=Object.freeze(Object.defineProperty({__proto__:null,default:XU},Symbol.toStringTag,{value:"Module"}));export{ab as $,sY as A,An as B,zA as C,me as D,E3 as E,Ap as F,Xy as G,rO as H,oD as I,dP as J,AM as K,Fo as L,nY as M,vc as N,a3 as O,sb as P,Bm as Q,Q4 as R,Cu as S,eO as T,ea as U,Wr as V,X as W,K as X,m3 as Y,GP as Z,k as _,k3 as a,SY as a$,G4 as a0,hp as a1,cY as a2,dY as a3,Mi as a4,Km as a5,Xm as a6,fY as a7,pY as a8,uY as a9,wP as aA,bP as aB,_P as aC,RC as aD,vP as aE,IP as aF,MP as aG,AP as aH,DP as aI,FP as aJ,kP as aK,zC as aL,EP as aM,TP as aN,SP as aO,WC as aP,fP as aQ,or as aR,Zs as aS,Mp as aT,XC as aU,gi as aV,JC as aW,Ry as aX,YR as aY,_Y as aZ,jY as a_,aY as aa,lY as ab,hY as ac,gY as ad,mY as ae,H$ as af,ew as ag,EY as ah,It as ai,Qr as aj,bn as ak,la as al,x$ as am,g$ as an,Bp as ao,ft as ap,b$ as aq,Tp as ar,wp as as,el as at,LP as au,BP as av,NP as aw,jP as ax,CP as ay,$C as az,C3 as b,Ct as b0,TY as b1,kR as b2,gR as b3,mR as b4,V4 as b5,rY as b6,op as b7,Nn as b8,Oo as b9,qm as ba,EF as bb,bt as bc,tk as bd,dr as be,CF as bf,sp as bg,kb as bh,ia as bi,Sb as bj,oY as bk,RA as bl,LY as bm,Jt as c,Ut as d,ob as e,Le as f,w3 as g,mn as h,zr as i,xP as j,ra as k,et as l,QC as m,iY as n,BY as o,S3 as p,T3 as q,NY as r,v3 as s,pP as t,Pr as u,hR as v,sO as w,xY as x,ys as y,b3 as z};