@smartmemory/compose 0.2.50-beta → 0.2.51-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.
- package/.claude/skills/compose/SKILL.md +24 -1
- package/.claude/skills/compose/references/hermes-tools.md +80 -0
- package/README.md +1 -1
- package/bin/compose.js +310 -52
- package/dist/assets/App-CT0vXPgd.js +724 -0
- package/dist/assets/_baseUniq-CsOHc_iS.js +1 -0
- package/dist/assets/{arc-DeHak63Z.js → arc-BXht3LyE.js} +1 -1
- package/dist/assets/architectureDiagram-Q4EWVU46-BV1r86-w.js +36 -0
- package/dist/assets/blockDiagram-DXYQGD6D-BgcMJjAR.js +132 -0
- package/dist/assets/{browser-DW2JlJCC.js → browser-CnKiSnlr.js} +6 -6
- package/dist/assets/{c4Diagram-AAUBKEIU-BsFJmPuS.js → c4Diagram-AHTNJAMY-nBIRLJTv.js} +1 -1
- package/dist/assets/channel-Dd4XaiYv.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-XO4S2_89.js → chunk-4BX2VUAB-CNmGyhrp.js} +1 -1
- package/dist/assets/chunk-4TB4RGXK-MLT7I7w4.js +206 -0
- package/dist/assets/{chunk-55IACEB6-CtFSLInj.js → chunk-55IACEB6-D8KuKVLa.js} +1 -1
- package/dist/assets/{chunk-2J33WTMH-AEu6HIoY.js → chunk-EDXVE4YY-TPlt1bS2.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-BMGd_Y9a.js → chunk-FMBD7UC4-tYY8xcjr.js} +1 -1
- package/dist/assets/chunk-OYMX7WX6-yBPwT1AT.js +231 -0
- package/dist/assets/{chunk-QZHKN3VN-DHhUJ8RK.js → chunk-QZHKN3VN-B4Wfybww.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-BlrOECEr.js → chunk-YZCP3GAM-DE6_5aqh.js} +1 -1
- package/dist/assets/classDiagram-6PBFFD2Q-DshSQDF9.js +1 -0
- package/dist/assets/classDiagram-v2-HSJHXN6E-DshSQDF9.js +1 -0
- package/dist/assets/clone-CBsbNGAa.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-C3M0mZqk.js → cose-bilkent-S5V4N54A-DzzRyJtB.js} +1 -1
- package/dist/assets/dagre-KV5264BT-CTcTVGdU.js +4 -0
- package/dist/assets/diagram-5BDNPKRD-qR6mc8kJ.js +10 -0
- package/dist/assets/diagram-G4DWMVQ6-CUcGXyNb.js +24 -0
- package/dist/assets/diagram-MMDJMWI5-B68cPonH.js +43 -0
- package/dist/assets/diagram-TYMM5635-q8Id8eFG.js +24 -0
- package/dist/assets/{erDiagram-TEJ5UH35-AMDitV0b.js → erDiagram-SMLLAGMA-CtxJi57K.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-C0t2ZGQv.js → flowDiagram-DWJPFMVM-BzzO4JYU.js} +1 -1
- package/dist/assets/ganttDiagram-T4ZO3ILL-Dn0wIyhR.js +292 -0
- package/dist/assets/gitGraphDiagram-UUTBAWPF-tnNFXfMM.js +106 -0
- package/dist/assets/graph-DZe55uk8.js +331 -0
- package/dist/assets/graph-Tq_bs_r0.js +1 -0
- package/dist/assets/index-8UhRLbGq.js +123 -0
- package/dist/assets/index-CRqB9els.css +1 -0
- package/dist/assets/infoDiagram-42DDH7IO-BXLvLeS0.js +2 -0
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-CCBwgjFs.js → ishikawaDiagram-UXIWVN3A-DWx-7BBy.js} +5 -5
- package/dist/assets/{journeyDiagram-JHISSGLW-zUJN38EU.js → journeyDiagram-VCZTEJTY-C42hXNha.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-BNxWi-8J.js → kanban-definition-6JOO6SKY-CEq930ew.js} +1 -1
- package/dist/assets/katex-DkKDou_j.js +257 -0
- package/dist/assets/layout-qtUgN9BC.js +1 -0
- package/dist/assets/{linear-CRH9b4g7.js → linear-D158F7OT.js} +1 -1
- package/dist/assets/min-hESxN-c0.js +1 -0
- package/dist/assets/{mindmap-definition-RKZ34NQL-DolYwq7Y.js → mindmap-definition-QFDTVHPH-d9SSh2nG.js} +7 -7
- package/dist/assets/mobile-1gVCT0OK.css +1 -0
- package/dist/assets/mobile-Chw8RWyH.js +17 -0
- package/dist/assets/pieDiagram-DEJITSTG-gglmeMav.js +30 -0
- package/dist/assets/quadrantDiagram-34T5L4WZ-CqFC_htU.js +7 -0
- package/dist/assets/{requirementDiagram-4Y6WPE33-DsXZ05jo.js → requirementDiagram-MS252O5E-B1ZFIotK.js} +1 -1
- package/dist/assets/sankeyDiagram-XADWPNL6-BvItvZt5.js +10 -0
- package/dist/assets/sequenceDiagram-FGHM5R23-CAIn5Z3U.js +157 -0
- package/dist/assets/stateDiagram-FHFEXIEX-CyJrGzib.js +1 -0
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-DprhF_Ho.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-Bvnhw58e.js → timeline-definition-GMOUNBTQ-k_0vJQAK.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-5WnyjZqf.js → vennDiagram-DHZGUBPP-TZAW60b0.js} +4 -4
- package/dist/assets/wardley-RL74JXVD-DzQEoG6X.js +162 -0
- package/dist/assets/wardleyDiagram-NUSXRM2D-BAoVVIjZ.js +20 -0
- package/dist/assets/{xychartDiagram-2RQKCTM6-BCShes6B.js → xychartDiagram-5P7HB3ND-CynkZcUb.js} +1 -1
- package/dist/index.html +4 -4
- package/lib/build.js +272 -33
- package/lib/codex-preflight.js +151 -0
- package/lib/completion-writer.js +21 -1
- package/lib/feature-validator.js +5 -1
- package/lib/hooks-status.js +135 -0
- package/lib/install-agent-defs.js +22 -0
- package/lib/migrate-anon.js +277 -0
- package/lib/roadmap-parser.js +1 -1
- package/lib/test-bootstrap.js +165 -2
- package/lib/vocabulary-inject.js +103 -0
- package/package.json +2 -1
- package/pipelines/build-quick.stratum.yaml +433 -0
- package/pipelines/build.stratum.yaml +60 -3
- package/scripts/watch-server.sh +32 -0
- package/server/build-routes.js +89 -9
- package/server/build-stream-bridge.js +12 -0
- package/server/compose-mcp-tools.js +73 -1
- package/server/compose-mcp.js +27 -0
- package/server/feature-scaffold-routes.js +82 -0
- package/server/health-routes.js +261 -0
- package/server/qa-scope-routes.js +96 -0
- package/server/validate-routes.js +70 -0
- package/server/vision-routes.js +29 -0
- package/server/vision-server.js +21 -0
- package/dist/assets/App-Bxyif1yv.js +0 -706
- package/dist/assets/architectureDiagram-3BPJPVTR-C5Nkyl9y.js +0 -36
- package/dist/assets/blockDiagram-GPEHLZMM-BilnUBG2.js +0 -132
- package/dist/assets/channel-ZgbQ1k0u.js +0 -1
- package/dist/assets/chunk-727SXJPM-CZeBRpM9.js +0 -206
- package/dist/assets/chunk-AQP2D5EJ-_vmxcBc4.js +0 -231
- package/dist/assets/classDiagram-4FO5ZUOK-KXxOorUx.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-KXxOorUx.js +0 -1
- package/dist/assets/dagre-BM42HDAG-DJlm4fEk.js +0 -4
- package/dist/assets/diagram-2AECGRRQ-BmcONQG5.js +0 -43
- package/dist/assets/diagram-5GNKFQAL-5JbWGIwd.js +0 -10
- package/dist/assets/diagram-KO2AKTUF-DAnIvyI0.js +0 -3
- package/dist/assets/diagram-LMA3HP47-Bmh7tvmI.js +0 -24
- package/dist/assets/diagram-OG6HWLK6-hnHVMNnk.js +0 -24
- package/dist/assets/ganttDiagram-6RSMTGT7-BPlM-BEN.js +0 -292
- package/dist/assets/gitGraphDiagram-PVQCEYII-Lv_YTxnb.js +0 -106
- package/dist/assets/graph-BBXaecIU.js +0 -331
- package/dist/assets/graph-CAnANduQ.js +0 -1
- package/dist/assets/index-BwLfbbOu.css +0 -1
- package/dist/assets/index-COq21Zym.js +0 -119
- package/dist/assets/infoDiagram-5YYISTIA-Dul1vdUm.js +0 -2
- package/dist/assets/katex-C5jXJg4s.js +0 -257
- package/dist/assets/layout-DGIYPm2g.js +0 -1
- package/dist/assets/mobile-Cag5dHlF.css +0 -1
- package/dist/assets/mobile-DwmxS_O4.js +0 -17
- package/dist/assets/pieDiagram-4H26LBE5-oxNfr2TX.js +0 -30
- package/dist/assets/quadrantDiagram-W4KKPZXB-BmZCvD-z.js +0 -7
- package/dist/assets/sankeyDiagram-5OEKKPKP-DsnYaawP.js +0 -40
- package/dist/assets/sequenceDiagram-3UESZ5HK-Dt5mu3g8.js +0 -162
- package/dist/assets/stateDiagram-AJRCARHV-BFR5ZINQ.js +0 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-BDrQD8fR.js +0 -1
- package/dist/assets/wardley-L42UT6IY-CTxW4xow.js +0 -173
- package/dist/assets/wardleyDiagram-YWT4CUSO-K8Y1EOvb.js +0 -78
|
@@ -1,706 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-BM42HDAG-DJlm4fEk.js","assets/graph-CAnANduQ.js","assets/layout-DGIYPm2g.js","assets/mobile-DwmxS_O4.js","assets/mobile-Cag5dHlF.css","assets/index-COq21Zym.js","assets/index-BwLfbbOu.css","assets/graph-BBXaecIU.js","assets/cose-bilkent-S5V4N54A-C3M0mZqk.js","assets/c4Diagram-AAUBKEIU-BsFJmPuS.js","assets/chunk-ND2GUHAM-BlrOECEr.js","assets/flowDiagram-I6XJVG4X-C0t2ZGQv.js","assets/chunk-FMBD7UC4-BMGd_Y9a.js","assets/chunk-55IACEB6-CtFSLInj.js","assets/chunk-2J33WTMH-AEu6HIoY.js","assets/channel-ZgbQ1k0u.js","assets/erDiagram-TEJ5UH35-AMDitV0b.js","assets/gitGraphDiagram-PVQCEYII-Lv_YTxnb.js","assets/chunk-4BX2VUAB-XO4S2_89.js","assets/chunk-QZHKN3VN-DHhUJ8RK.js","assets/wardley-L42UT6IY-CTxW4xow.js","assets/ganttDiagram-6RSMTGT7-BPlM-BEN.js","assets/linear-CRH9b4g7.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-5YYISTIA-Dul1vdUm.js","assets/pieDiagram-4H26LBE5-oxNfr2TX.js","assets/arc-DeHak63Z.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-W4KKPZXB-BmZCvD-z.js","assets/xychartDiagram-2RQKCTM6-BCShes6B.js","assets/requirementDiagram-4Y6WPE33-DsXZ05jo.js","assets/sequenceDiagram-3UESZ5HK-Dt5mu3g8.js","assets/classDiagram-4FO5ZUOK-KXxOorUx.js","assets/chunk-727SXJPM-CZeBRpM9.js","assets/classDiagram-v2-Q7XG4LA2-KXxOorUx.js","assets/stateDiagram-AJRCARHV-BFR5ZINQ.js","assets/chunk-AQP2D5EJ-_vmxcBc4.js","assets/stateDiagram-v2-BHNVJYJU-BDrQD8fR.js","assets/journeyDiagram-JHISSGLW-zUJN38EU.js","assets/timeline-definition-PNZ67QCA-Bvnhw58e.js","assets/mindmap-definition-RKZ34NQL-DolYwq7Y.js","assets/kanban-definition-UN3LZRKU-BNxWi-8J.js","assets/sankeyDiagram-5OEKKPKP-DsnYaawP.js","assets/diagram-LMA3HP47-Bmh7tvmI.js","assets/diagram-2AECGRRQ-BmcONQG5.js","assets/blockDiagram-GPEHLZMM-BilnUBG2.js","assets/diagram-5GNKFQAL-5JbWGIwd.js","assets/architectureDiagram-3BPJPVTR-C5Nkyl9y.js","assets/diagram-KO2AKTUF-DAnIvyI0.js","assets/ishikawaDiagram-YF4QCWOH-CCBwgjFs.js","assets/vennDiagram-CIIHVFJN-5WnyjZqf.js","assets/diagram-OG6HWLK6-hnHVMNnk.js","assets/wardleyDiagram-YWT4CUSO-K8Y1EOvb.js","assets/browser-DW2JlJCC.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var wS=Object.defineProperty;var SS=(t,e,r)=>e in t?wS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var re=(t,e,r)=>SS(t,typeof e!="symbol"?e+"":e,r);import{a as k,j as c,d as Rt,i as f0,e as m0,f as TS,g as Dd,w as jt,h as _S,v as g0,k as Dr,n as se,l as jS,m as NS,P as jf,o as ES,N as BS}from"./mobile-DwmxS_O4.js";import{c as St,a as st,b as LS,u as Ls,P as As,d as Cc,e as AS,f as pi,g as li,h as MS,I as Od,B as Pt,X as tn,_ as Ht,i as x0,D as $d,j as Rd,k as zd,l as Wd,m as y0,r as IS,n as FS,o as b0,p as PS}from"./index-COq21Zym.js";import{c as la,b as C0,f as DS}from"./graph-BBXaecIU.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 OS=[["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"}]],qd=St("activity",OS);/**
|
|
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 $S=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],RS=St("arrow-down-to-line",$S);/**
|
|
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 zS=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],WS=St("arrow-left",zS);/**
|
|
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 qS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],k0=St("arrow-right",qS);/**
|
|
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=St("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 YS=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],v0=St("book-open",YS);/**
|
|
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 VS=[["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"}]],es=St("bot",VS);/**
|
|
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 GS=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],XS=St("chart-no-axes-column",GS);/**
|
|
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 KS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ca=St("check",KS);/**
|
|
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 QS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ms=St("chevron-down",QS);/**
|
|
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 ZS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],w0=St("chevron-left",ZS);/**
|
|
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 JS=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xi=St("chevron-right",JS);/**
|
|
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 tT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],S0=St("chevron-up",tT);/**
|
|
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 eT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],rT=St("circle-check-big",eT);/**
|
|
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 nT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Hd=St("circle-check",nT);/**
|
|
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 iT=[["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"}]],sT=St("circle-x",iT);/**
|
|
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 oT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aT=St("circle",oT);/**
|
|
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 lT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],T0=St("clock",lT);/**
|
|
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 cT=[["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"}]],Ud=St("cpu",cT);/**
|
|
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 hT=[["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"}]],_0=St("eye",hT);/**
|
|
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 uT=[["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"}]],ji=St("file-text",uT);/**
|
|
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 dT=[["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"}]],pT=St("folder-open",dT);/**
|
|
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 fT=[["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"}]],Yd=St("folder",fT);/**
|
|
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 mT=[["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"}]],gT=St("funnel",mT);/**
|
|
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 xT=[["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"}]],j0=St("git-branch",xT);/**
|
|
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 yT=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],fu=St("history",yT);/**
|
|
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 bT=[["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"}]],CT=St("inbox",bT);/**
|
|
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 kT=[["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"}]],vT=St("layers",kT);/**
|
|
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 wT=[["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"}]],ST=St("layout-dashboard",wT);/**
|
|
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 TT=[["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"}]],yi=St("lightbulb",TT);/**
|
|
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 _T=[["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"}]],jT=St("link-2",_T);/**
|
|
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 NT=[["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"}]],ET=St("list",NT);/**
|
|
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 BT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Sl=St("loader-circle",BT);/**
|
|
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 LT=[["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"}]],kc=St("message-square",LT);/**
|
|
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 AT=[["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"}]],MT=St("moon",AT);/**
|
|
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 IT=[["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"}]],FT=St("network",IT);/**
|
|
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 PT=[["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"}]],N0=St("pencil",PT);/**
|
|
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 DT=[["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"}]],OT=St("play",DT);/**
|
|
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 $T=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Tl=St("plus",$T);/**
|
|
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 RT=[["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"}]],Uo=St("refresh-cw",RT);/**
|
|
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 zT=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],WT=St("rotate-ccw",zT);/**
|
|
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 qT=[["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"}]],HT=St("save",qT);/**
|
|
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 UT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],bn=St("search",UT);/**
|
|
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 YT=[["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"}]],Vd=St("send",YT);/**
|
|
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 VT=[["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"}]],Is=St("shield-check",VT);/**
|
|
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 GT=[["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"}]],XT=St("shield",GT);/**
|
|
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 KT=[["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"}]],E0=St("skip-forward",KT);/**
|
|
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 QT=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],B0=St("smartphone",QT);/**
|
|
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 ZT=[["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"}]],Nf=St("sparkles",ZT);/**
|
|
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 JT=[["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"}]],t_=St("star",JT);/**
|
|
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 e_=[["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"}]],r_=St("sun",e_);/**
|
|
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 n_=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],i_=St("terminal",n_);/**
|
|
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 s_=[["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"}]],_l=St("trash-2",s_);/**
|
|
268
|
-
* @license lucide-react v0.563.0 - ISC
|
|
269
|
-
*
|
|
270
|
-
* This source code is licensed under the ISC license.
|
|
271
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
272
|
-
*/const o_=[["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"}]],vc=St("triangle-alert",o_);/**
|
|
273
|
-
* @license lucide-react v0.563.0 - ISC
|
|
274
|
-
*
|
|
275
|
-
* This source code is licensed under the ISC license.
|
|
276
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
-
*/const a_=[["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"}]],Gd=St("user",a_);/**
|
|
278
|
-
* @license lucide-react v0.563.0 - ISC
|
|
279
|
-
*
|
|
280
|
-
* This source code is licensed under the ISC license.
|
|
281
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
282
|
-
*/const l_=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],c_=St("wifi-off",l_);/**
|
|
283
|
-
* @license lucide-react v0.563.0 - ISC
|
|
284
|
-
*
|
|
285
|
-
* This source code is licensed under the ISC license.
|
|
286
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
287
|
-
*/const h_=[["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"}]],u_=St("workflow",h_);/**
|
|
288
|
-
* @license lucide-react v0.563.0 - ISC
|
|
289
|
-
*
|
|
290
|
-
* This source code is licensed under the ISC license.
|
|
291
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
292
|
-
*/const d_=[["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"}]],jl=St("zap",d_),gr={feature:"#3b82f6",bug:"#ef4444",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},qn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b",superseded:"#6b5b8a"},p_=["planned","ready","in_progress","review","complete","blocked","parked","killed","superseded"],L0=["vision","specification","planning","implementation","verification","release"],Nl={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},Xd=["Untested","Low","Moderate","High","Crystallized"],ke={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"},A0={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},M0=["claude","codex","gemini","human","unassigned"],Ef={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"},gn={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 Yo(t,e){const r=gn[t.stepId]??(t.fromPhase&&t.toPhase?`${ke[t.fromPhase]??t.fromPhase} → ${ke[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const Bf={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"}},f_={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%)"},Lf={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},m_={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"},g_={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"}},x_={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},Af=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],y_={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},b_={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},C_={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},Mf={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 k_(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function v_(t){return`violations (${Array.isArray(t)?t.length:0})`}function w_(t){return t?"▾":"▸"}function S_({violations:t=[],expanded:e,onToggle:r}){const[n,i]=k.useState(!1),s=e!==void 0,o=s?e:n,a=k_(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const h=w_(o),u=v_(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 T_({msg:t,mode:e="stream"}){const[r,n]=k.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(S_,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const __=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,If=20;function j_({summary:t,output:e}){const[r,n]=k.useState(!1),[i,s]=k.useState(!1),o=e?__.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
|
|
293
|
-
`):[],h=l.length>If,u=r&&!i&&h?l.slice(0,If):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(`
|
|
294
|
-
`),!i&&h&&c.jsxs(c.Fragment,{children:[`
|
|
295
|
-
`,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 N_={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 E_(t){return f_[N_[t]||"thinking"]}function B_(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function L_(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function A_({input:t}){const[e,r]=k.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 M_({block:t}){const e=E_(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(A_,{input:t.input})]})}function I_({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(Rt.Fragment,{children:[c.jsx(M_,{block:n}),s&&t._toolResult&&c.jsx(j_,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function F_({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:B_(t.duration_ms)}),t.total_cost_usd!=null&&c.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:L_(t.total_cost_usd)}),e&&t.errors&&c.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function P_({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 D_({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(T_,{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(I_,{msg:t}):t.type==="user"?c.jsx(P_,{msg:t}):t.type==="result"?c.jsx(F_,{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 O_({onSend:t,disabled:e=!1,placeholder:r="Message Claude…"}){const n=k.useRef(null);k.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 F0="compose:verboseStream",El={verboseStream:!1};function P0(){return El.verboseStream}function $_(t,e){El.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(F0,String(El.verboseStream))}catch{}}function R_(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(F0);r!==null&&(El.verboseStream=r==="true")}catch{}}function z_(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 W_(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 D0=parseInt("4002",10),q_="compose-agent-session",Ff=500,H_=8,U_=2e3,O0=3e4,Pf={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"},Y_={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};R_();const tt={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 V_(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=Pf[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=Pf[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 ah(t,e,r){const n=Date.now(),i=tt.agentStatus,s=tt.agentTool;if(tt._idleTimer&&(clearTimeout(tt._idleTimer),tt._idleTimer=null),i==="working"&&(t==="idle"||e!==s)){const a=tt.currentActivity;a&&(a.endTime=n,a.duration=n-a.startTime,tt.activityLog.push(a),tt.activityLog.length>H_&&tt.activityLog.shift())}t==="working"&&e!==s?tt.currentActivity={tool:e,category:r,startTime:n,endTime:null,duration:null}:t==="idle"&&(tt.currentActivity=null),tt.agentStatus=t,tt.agentTool=e,tt.agentCategory=r;const o={status:t,tool:e,category:r,activityLog:tt.activityLog,currentActivity:tt.currentActivity,parallelTasks:tt.parallelTasks};tt.onAgentStatusChange&&tt.onAgentStatusChange({...o}),window.dispatchEvent(new CustomEvent("compose:agent-status",{detail:o}))}function Df(){const t=tt.sourceStatus.build,e=tt.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?ah(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?ah(t.status,t.tool,t.category):tt._idleTimer=setTimeout(()=>{tt._idleTimer=null,ah("idle",null,null)},U_)}function mu(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("∥"))?(tt.parallelTasks||(tt.parallelTasks={total:0,completed:0,failed:0,active:0,tasks:{}}),tt.parallelTasks.total++,tt.parallelTasks.active++,tt.parallelTasks.tasks[t.stepId]="working"):t.subtype==="build_step_done"&&((o=(s=tt.parallelTasks)==null?void 0:s.tasks)!=null&&o[t.stepId])?(tt.parallelTasks.active=Math.max(0,tt.parallelTasks.active-1),tt.parallelTasks.completed++,tt.parallelTasks.tasks[t.stepId]="complete"):t.subtype==="build_step_done"&&tt.parallelTasks&&!((a=t.stepNum)!=null&&a.toString().startsWith("∥"))&&(tt.parallelTasks=null)),t._source==="build"&&t.type==="error"&&((h=(l=tt.parallelTasks)==null?void 0:l.tasks)!=null&&h[t.stepId])&&(tt.parallelTasks.active=Math.max(0,tt.parallelTasks.active-1),tt.parallelTasks.failed++,tt.parallelTasks.tasks[t.stepId]="failed");const e=V_(t);if(e){const u=e._source==="build"?"build":"interactive";tt.sourceStatus[u]=e,e.status==="idle"?(tt.parallelTasks=null,Df()):(tt._idleTimer&&(clearTimeout(tt._idleTimer),tt._idleTimer=null),Df())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(tt.sessionId=t.session_id,sessionStorage.setItem(q_,t.session_id));const{include:r,msg:n}=z_(t,P0());r&&(tt.messages=[...tt.messages,n],tt.messages.length>Ff&&(tt.messages=tt.messages.slice(-Ff)),tt.onMessagesChange&&tt.onMessagesChange(tt.messages))}function lh(){if(tt.es)return;const t=f0()?m0("/api/agent/proxy/stream"):`${window.location.protocol}//${window.location.hostname}:${D0}/api/agent/stream`,e=TS({url:t,namedEvents:["hydrate"],onOpen:()=>{tt.connected=!0,tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,tt.sourceStatus.build=null,tt.onConnectedChange&&tt.onConnectedChange(!0),tt.onStreamErrorChange&&tt.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})},onClose:()=>{tt.connected=!1,tt.onConnectedChange&&tt.onConnectedChange(!1)},onError:r=>{tt.streamError=(r==null?void 0:r.message)||"Connection error",tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:tt.retryInfo,stalled:tt.stalled})},onRetry:r=>{tt.retryInfo=r,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:r,stalled:tt.stalled})},onStall:()=>{tt.stalled=!0,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:tt.retryInfo,stalled:!0})},onExhausted:()=>{tt.es=null,tt.retryInfo=null,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:null,stalled:tt.stalled})},onEvent:(r,n)=>{if((tt.stalled||tt.streamError)&&(tt.stalled=!1,tt.streamError=null,tt.retryInfo=null,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})),n==="hydrate"){if(Array.isArray(r))for(const i of r)mu(i);return}mu(r)},maxBackoffMs:8e3,maxRetries:5,stallTimeoutMs:O0});tt.es=e}async function ch(t,e){const r=f0()?t.replace(/^\/api\/agent\//,"/api/agent/proxy/"):`${window.location.protocol}//${window.location.hostname}:${D0}${t}`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","x-compose-token":""},body:JSON.stringify(e)});if(!n.ok){const i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error||n.statusText)}return n.json()}function Of(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 $0(){var L;const[t,e]=k.useState(tt.connected),[r,n]=k.useState(tt.messages),[i,s]=k.useState({status:tt.agentStatus,tool:tt.agentTool,category:tt.agentCategory,activityLog:tt.activityLog,currentActivity:tt.currentActivity}),[o,a]=k.useState(!1),[l,h]=k.useState(null),[u,d]=k.useState({error:tt.streamError,retryInfo:tt.retryInfo,stalled:tt.stalled}),f=k.useRef(null),p=k.useRef(null),m=k.useRef(!1),x=r.length===0||r.every(A=>A.type==="system"&&(A.subtype==="init"||A.subtype==="connected"));k.useEffect(()=>(tt.onConnectedChange=e,tt.onMessagesChange=n,tt.onAgentStatusChange=s,tt.onStreamErrorChange=d,()=>{tt.onConnectedChange=null,tt.onMessagesChange=null,tt.onAgentStatusChange=null,tt.onStreamErrorChange=null}),[]),k.useEffect(()=>{lh()},[]);const g=k.useCallback(()=>{const A=p.current;if(!A)return;const j=A.scrollHeight-A.scrollTop-A.clientHeight<48;m.current=!j},[]);k.useEffect(()=>{var A;m.current||(A=f.current)==null||A.scrollIntoView({behavior:"smooth"})},[r.length]),k.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){h(null);return}const A=i.currentActivity.startTime,j=()=>h(Date.now()-A);j();const I=setInterval(j,1e3);return()=>clearInterval(I)},[i.status,(L=i.currentActivity)==null?void 0:L.startTime]);const y=k.useCallback(async A=>{a(!0);const j=A.match(/[A-Z]+-\d+/);j&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:j[0]}}));try{x||!tt.sessionId?await ch("/api/agent/session",{prompt:A}):await ch("/api/agent/message",{prompt:A})}catch(I){mu({type:"error",message:`Failed to send: ${I.message}`})}finally{a(!1)}},[x]),C=k.useCallback(async()=>{try{await ch("/api/agent/interrupt",{})}catch{}},[]),b=t&&(i.status==="working"||o),w=t?b?"#fbbf24":"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))",_=i.category?Y_[i.category]:null,S=t?b?_||"working":"ready":"offline",N=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&&N.length>0&&N.slice(-5).map((A,j)=>c.jsx("div",{className:"h-1 rounded-full",title:`${A.tool||"thinking"} — ${Of(A.duration)}`,style:{width:Math.max(6,Math.min(20,(A.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+j/5*.5}},j))}),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:w,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:S}),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:Of(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…"})]}),W_(r).map((A,j)=>c.jsx(D_,{msg:A},A.uuid||j)),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}),!tt.es&&u.error&&c.jsx("button",{onClick:()=>{tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),lh()},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 ",O0/1e3,"s — connection may be stalled."]}),c.jsx("button",{onClick:()=>{tt.es&&(tt.es.close(),tt.es=null),tt.connected=!1,tt.onConnectedChange&&tt.onConnectedChange(!1),tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),lh()},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(O_,{onSend:y,disabled:b||!t,placeholder:b?"Working…":"Message Claude…"})]})}function G_(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const X_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,K_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Q_={};function $f(t,e){return(Q_.jsx?K_:X_).test(t)}const Z_=/[ \t\n\f\r]/g;function J_(t){return typeof t=="object"?t.type==="text"?Rf(t.value):!1:Rf(t)}function Rf(t){return t.replace(Z_,"")===""}class ha{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}ha.prototype.normal={};ha.prototype.property={};ha.prototype.space=void 0;function R0(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new ha(r,n,e)}function gu(t){return t.toLowerCase()}class xr{constructor(e,r){this.attribute=r,this.property=e}}xr.prototype.attribute="";xr.prototype.booleanish=!1;xr.prototype.boolean=!1;xr.prototype.commaOrSpaceSeparated=!1;xr.prototype.commaSeparated=!1;xr.prototype.defined=!1;xr.prototype.mustUseProperty=!1;xr.prototype.number=!1;xr.prototype.overloadedBoolean=!1;xr.prototype.property="";xr.prototype.spaceSeparated=!1;xr.prototype.space=void 0;let tj=0;const Ft=Ni(),Te=Ni(),xu=Ni(),ot=Ni(),oe=Ni(),fi=Ni(),kr=Ni();function Ni(){return 2**++tj}const yu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ft,booleanish:Te,commaOrSpaceSeparated:kr,commaSeparated:fi,number:ot,overloadedBoolean:xu,spaceSeparated:oe},Symbol.toStringTag,{value:"Module"})),hh=Object.keys(yu);class Kd extends xr{constructor(e,r,n,i){let s=-1;if(super(e,r),zf(this,"space",i),typeof n=="number")for(;++s<hh.length;){const o=hh[s];zf(this,hh[s],(n&yu[o])===yu[o])}}}Kd.prototype.defined=!0;function zf(t,e,r){r&&(t[e]=r)}function Fs(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new Kd(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[gu(n)]=n,r[gu(s.attribute)]=n}return new ha(e,r,t.space)}const z0=Fs({properties:{ariaActiveDescendant:null,ariaAtomic:Te,ariaAutoComplete:null,ariaBusy:Te,ariaChecked:Te,ariaColCount:ot,ariaColIndex:ot,ariaColSpan:ot,ariaControls:oe,ariaCurrent:null,ariaDescribedBy:oe,ariaDetails:null,ariaDisabled:Te,ariaDropEffect:oe,ariaErrorMessage:null,ariaExpanded:Te,ariaFlowTo:oe,ariaGrabbed:Te,ariaHasPopup:null,ariaHidden:Te,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:oe,ariaLevel:ot,ariaLive:null,ariaModal:Te,ariaMultiLine:Te,ariaMultiSelectable:Te,ariaOrientation:null,ariaOwns:oe,ariaPlaceholder:null,ariaPosInSet:ot,ariaPressed:Te,ariaReadOnly:Te,ariaRelevant:null,ariaRequired:Te,ariaRoleDescription:oe,ariaRowCount:ot,ariaRowIndex:ot,ariaRowSpan:ot,ariaSelected:Te,ariaSetSize:ot,ariaSort:null,ariaValueMax:ot,ariaValueMin:ot,ariaValueNow:ot,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function W0(t,e){return e in t?t[e]:e}function q0(t,e){return W0(t,e.toLowerCase())}const ej=Fs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fi,acceptCharset:oe,accessKey:oe,action:null,allow:null,allowFullScreen:Ft,allowPaymentRequest:Ft,allowUserMedia:Ft,alpha:Ft,alt:null,as:null,async:Ft,autoCapitalize:null,autoComplete:oe,autoFocus:Ft,autoPlay:Ft,blocking:oe,capture:null,charSet:null,checked:Ft,cite:null,className:oe,closedBy:null,colorSpace:null,cols:ot,colSpan:ot,command:null,commandFor:null,content:null,contentEditable:Te,controls:Ft,controlsList:oe,coords:ot|fi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ft,defer:Ft,dir:null,dirName:null,disabled:Ft,download:xu,draggable:Te,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ft,formTarget:null,headers:oe,height:ot,hidden:xu,high:ot,href:null,hrefLang:null,htmlFor:oe,httpEquiv:oe,id:null,imageSizes:null,imageSrcSet:null,inert:Ft,inputMode:null,integrity:null,is:null,isMap:Ft,itemId:null,itemProp:oe,itemRef:oe,itemScope:Ft,itemType:oe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ft,low:ot,manifest:null,max:null,maxLength:ot,media:null,method:null,min:null,minLength:ot,multiple:Ft,muted:Ft,name:null,nonce:null,noModule:Ft,noValidate:Ft,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:Ft,optimum:ot,pattern:null,ping:oe,placeholder:null,playsInline:Ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ft,referrerPolicy:null,rel:oe,required:Ft,reversed:Ft,rows:ot,rowSpan:ot,sandbox:oe,scope:null,scoped:Ft,seamless:Ft,selected:Ft,shadowRootClonable:Ft,shadowRootCustomElementRegistry:Ft,shadowRootDelegatesFocus:Ft,shadowRootMode:null,shadowRootSerializable:Ft,shape:null,size:ot,sizes:null,slot:null,span:ot,spellCheck:Te,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ot,step:null,style:null,tabIndex:ot,target:null,title:null,translate:null,type:null,typeMustMatch:Ft,useMap:null,value:Te,width:ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:oe,axis:null,background:null,bgColor:null,border:ot,borderColor:null,bottomMargin:ot,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ft,declare:Ft,event:null,face:null,frame:null,frameBorder:null,hSpace:ot,leftMargin:ot,link:null,longDesc:null,lowSrc:null,marginHeight:ot,marginWidth:ot,noResize:Ft,noHref:Ft,noShade:Ft,noWrap:Ft,object:null,profile:null,prompt:null,rev:null,rightMargin:ot,rules:null,scheme:null,scrolling:Te,standby:null,summary:null,text:null,topMargin:ot,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ot,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ft,disablePictureInPicture:Ft,disableRemotePlayback:Ft,exportParts:fi,part:oe,prefix:null,property:null,results:ot,security:null,unselectable:null},space:"html",transform:q0}),rj=Fs({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:kr,accentHeight:ot,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ot,amplitude:ot,arabicForm:null,ascent:ot,attributeName:null,attributeType:null,azimuth:ot,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ot,by:null,calcMode:null,capHeight:ot,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:ot,diffuseConstant:ot,direction:null,display:null,dur:null,divisor:ot,dominantBaseline:null,download:Ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:ot,enableBackground:null,end:null,event:null,exponent:ot,externalResourcesRequired:null,fill:null,fillOpacity:ot,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:fi,g2:fi,glyphName:fi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ot,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ot,horizOriginX:ot,horizOriginY:ot,id:null,ideographic:ot,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ot,k:ot,k1:ot,k2:ot,k3:ot,k4:ot,kernelMatrix:kr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ot,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:ot,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:ot,overlineThickness:ot,paintOrder:null,panose1:null,path:null,pathLength:ot,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:oe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ot,pointsAtY:ot,pointsAtZ:ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kr,rev:kr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kr,requiredFeatures:kr,requiredFonts:kr,requiredFormats:kr,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:ot,specularExponent:ot,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ot,strikethroughThickness:ot,string:null,stroke:null,strokeDashArray:kr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ot,strokeOpacity:ot,strokeWidth:null,style:null,surfaceScale:ot,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kr,tabIndex:ot,tableValues:null,target:null,targetX:ot,targetY:ot,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ot,underlineThickness:ot,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ot,values:null,vAlphabetic:ot,vMathematical:ot,vectorEffect:null,vHanging:ot,vIdeographic:ot,version:null,vertAdvY:ot,vertOriginX:ot,vertOriginY:ot,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ot,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:W0}),H0=Fs({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()}}),U0=Fs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:q0}),Y0=Fs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),nj={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"},ij=/[A-Z]/g,Wf=/-[a-z]/g,sj=/^data[-\w.:]+$/i;function oj(t,e){const r=gu(e);let n=e,i=xr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&sj.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Wf,lj);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Wf.test(s)){let o=s.replace(ij,aj);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Kd}return new i(n,e)}function aj(t){return"-"+t.toLowerCase()}function lj(t){return t.charAt(1).toUpperCase()}const cj=R0([z0,ej,H0,U0,Y0],"html"),Qd=R0([z0,rj,H0,U0,Y0],"svg");function hj(t){return t.join(" ").trim()}var Di={},uh,qf;function uj(){if(qf)return uh;qf=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=`
|
|
296
|
-
`,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 w(D){var M=D.match(e);M&&(C+=M.length);var F=D.lastIndexOf(l);b=~F?D.length-F:b+D.length}function _(){var D={line:C,column:b};return function(M){return M.position=new S(D),A(),M}}function S(D){this.start=D,this.end={line:C,column:b},this.source=y.source}S.prototype.content=g;function N(D){var M=new Error(y.source+":"+C+":"+b+": "+D);if(M.reason=D,M.filename=y.source,M.line=C,M.column=b,M.source=g,!y.silent)throw M}function L(D){var M=D.exec(g);if(M){var F=M[0];return w(F),g=g.slice(F.length),M}}function A(){L(r)}function j(D){var M;for(D=D||[];M=I();)M!==!1&&D.push(M);return D}function I(){var D=_();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 N("End of comment missing");var F=g.slice(2,M-2);return b+=2,w(F),g=g.slice(M),b+=2,D({type:f,comment:F})}}function z(){var D=_(),M=L(n);if(M){if(I(),!L(i))return N("property missing ':'");var F=L(s),O=D({type:p,property:x(M[0].replace(t,d)),value:F?x(F[0].replace(t,d)):d});return L(o),O}}function W(){var D=[];j(D);for(var M;M=z();)M!==!1&&(D.push(M),j(D));return D}return A(),W()}function x(g){return g?g.replace(a,d):d}return uh=m,uh}var Hf;function dj(){if(Hf)return Di;Hf=1;var t=Di&&Di.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Di,"__esModule",{value:!0}),Di.default=r;const e=t(uj());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 Di}var Js={},Uf;function pj(){if(Uf)return Js;Uf=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.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 Js.camelCase=l,Js}var to,Yf;function fj(){if(Yf)return to;Yf=1;var t=to&&to.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(dj()),r=pj();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,to=n,to}var mj=fj();const gj=Dd(mj),V0=G0("end"),Zd=G0("start");function G0(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 xj(t){const e=Zd(t),r=V0(t);if(e&&r)return{start:e,end:r}}function Mo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Vf(t.position):"start"in t||"end"in t?Vf(t):"line"in t||"column"in t?bu(t):""}function bu(t){return Gf(t&&t.line)+":"+Gf(t&&t.column)}function Vf(t){return bu(t&&t.start)+"-"+bu(t&&t.end)}function Gf(t){return t&&typeof t=="number"?t:1}class Ke 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=Mo(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}}Ke.prototype.file="";Ke.prototype.name="";Ke.prototype.reason="";Ke.prototype.message="";Ke.prototype.stack="";Ke.prototype.column=void 0;Ke.prototype.line=void 0;Ke.prototype.ancestors=void 0;Ke.prototype.cause=void 0;Ke.prototype.fatal=void 0;Ke.prototype.place=void 0;Ke.prototype.ruleId=void 0;Ke.prototype.source=void 0;const Jd={}.hasOwnProperty,yj=new Map,bj=/[A-Z]/g,Cj=new Set(["table","tbody","thead","tfoot","tr"]),kj=new Set(["td","th"]),X0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vj(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=Bj(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=Ej(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"?Qd:cj,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=K0(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function K0(t,e,r){if(e.type==="element")return wj(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Sj(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return _j(t,e,r);if(e.type==="mdxjsEsm")return Tj(t,e);if(e.type==="root")return jj(t,e,r);if(e.type==="text")return Nj(t,e)}function wj(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Qd,t.schema=i),t.ancestors.push(e);const s=Z0(t,e.tagName,!1),o=Lj(t,e);let a=ep(t,e);return Cj.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!J_(l):!0})),Q0(t,o,s,e),tp(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function Sj(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)}Vo(t,e.position)}function Tj(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Vo(t,e.position)}function _j(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=Qd,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:Z0(t,e.name,!0),o=Aj(t,e),a=ep(t,e);return Q0(t,o,s,e),tp(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function jj(t,e,r){const n={};return tp(n,ep(t,e)),t.create(e,t.Fragment,n,r)}function Nj(t,e){return e.value}function Q0(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function tp(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function Ej(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 Bj(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=Zd(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 Lj(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&Jd.call(e.properties,i)){const s=Mj(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&kj.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 Aj(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 Vo(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 Vo(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function ep(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:yj;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=K0(t,s,o);a!==void 0&&r.push(a)}return r}function Mj(t,e,r){const n=oj(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?G_(r):hj(r)),n.property==="style"){let i=typeof r=="object"?r:Ij(t,String(r));return t.stylePropertyNameCase==="css"&&(i=Fj(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?nj[n.property]||n.property:n.attribute,r]}}function Ij(t,e){try{return gj(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Ke("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=X0+"#cannot-parse-style-attribute",i}}function Z0(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=$f(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=$f(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return Jd.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Vo(t)}function Vo(t,e){const r=new Ke("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=X0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Fj(t){const e={};let r;for(r in t)Jd.call(t,r)&&(e[Pj(r)]=t[r]);return e}function Pj(t){let e=t.replace(bj,Dj);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Dj(t){return"-"+t.toLowerCase()}const dh={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"]},Oj={};function rp(t,e){const r=Oj,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return J0(t,n,i)}function J0(t,e,r){if($j(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 Xf(t.children,e,r)}return Array.isArray(t)?Xf(t,e,r):""}function Xf(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=J0(t[i],e,r);return n.join("")}function $j(t){return!!(t&&typeof t=="object")}const Kf=document.createElement("i");function np(t){const e="&"+t+";";Kf.innerHTML=e;const r=Kf.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function vr(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 Nr(t,e){return t.length>0?(vr(t,t.length,0,e),t):e}const Qf={}.hasOwnProperty;function ty(t){const e={};let r=-1;for(;++r<t.length;)Rj(e,t[r]);return e}function Rj(t,e){let r;for(r in e){const i=(Qf.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Qf.call(i,o)||(i[o]=[]);const a=s[o];zj(i[o],Array.isArray(a)?a:a?[a]:[])}}}function zj(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);vr(t,0,0,n)}function ey(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 rr=Kn(/[A-Za-z]/),Ge=Kn(/[\dA-Za-z]/),Wj=Kn(/[#-'*+\--9=?A-Z^-~]/);function Bl(t){return t!==null&&(t<32||t===127)}const Cu=Kn(/\d/),qj=Kn(/[\dA-Fa-f]/),Hj=Kn(/[!-/:-@[-`{-~]/);function Nt(t){return t!==null&&t<-2}function le(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const wc=Kn(new RegExp("\\p{P}|\\p{S}","u")),bi=Kn(/\s/);function Kn(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Ps(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 Gt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return qt(l)?(t.enter(r),a(l)):e(l)}function a(l){return qt(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const Uj={tokenize:Yj};function Yj(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"),Gt(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 Vj={tokenize:Gj},Zf={tokenize:Xj};function Gj(t){const e=this,r=[];let n=0,i,s,o;return a;function a(b){if(n<r.length){const w=r[n];return e.containerState=w[1],t.attempt(w[0].continuation,l,h)(b)}return h(b)}function l(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&C();const w=e.events.length;let _=w,S;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){S=e.events[_][1].end;break}y(n);let N=w;for(;N<e.events.length;)e.events[N][1].end={...S},N++;return vr(e.events,_+1,0,e.events.slice(w)),e.events.length=N,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(Zf,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(Zf,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,w){const _=e.sliceStream(b);if(w&&_.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(_),e.parser.lazy[b.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<o&&(!i.events[S][1].end||i.events[S][1].end.offset>o))return;const N=e.events.length;let L=N,A,j;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(A){j=e.events[L][1].end;break}A=!0}for(y(n),S=N;S<e.events.length;)e.events[S][1].end={...j},S++;vr(e.events,L+1,0,e.events.slice(N)),e.events.length=S}}function y(b){let w=r.length;for(;w-- >b;){const _=r[w];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 Xj(t,e,r){return Gt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Cs(t){if(t===null||le(t)||bi(t))return 1;if(wc(t))return 2}function Sc(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 ku={name:"attention",resolveAll:Kj,tokenize:Qj};function Kj(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};Jf(d,-l),Jf(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=Nr(h,[["enter",t[n][1],e],["exit",t[n][1],e]])),h=Nr(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=Nr(h,Sc(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),h=Nr(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=Nr(h,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,vr(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 Qj(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Cs(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=Cs(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 Jf(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Zj={name:"autolink",tokenize:Jj};function Jj(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 rr(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||Bl(p)?r(p):(t.consume(p),l)}function h(p){return p===64?(t.consume(p),u):Wj(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 ua={partial:!0,tokenize:tN};function tN(t,e,r){return n;function n(s){return qt(s)?Gt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Nt(s)?e(s):r(s)}}const ry={continuation:{tokenize:rN},exit:nN,name:"blockQuote",tokenize:eN};function eN(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 qt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function rN(t,e,r){const n=this;return i;function i(o){return qt(o)?Gt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(ry,e,r)(o)}}function nN(t){t.exit("blockQuote")}const ny={name:"characterEscape",tokenize:iN};function iN(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 Hj(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const iy={name:"characterReference",tokenize:sN};function sN(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=qj,u):(t.enter("characterReferenceValue"),s=7,o=Cu,u(d))}function u(d){if(d===59&&i){const f=t.exit("characterReferenceValue");return o===Ge&&!np(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 tm={partial:!0,tokenize:aN},em={concrete:!0,name:"codeFenced",tokenize:oN};function oN(t,e,r){const n=this,i={partial:!0,tokenize:_};let s=0,o=0,a;return l;function l(S){return h(S)}function h(S){const N=n.events[n.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=S,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(S)}function u(S){return S===a?(o++,t.consume(S),u):o<3?r(S):(t.exit("codeFencedFenceSequence"),qt(S)?Gt(t,d,"whitespace")(S):d(S))}function d(S){return S===null||Nt(S)?(t.exit("codeFencedFence"),n.interrupt?e(S):t.check(tm,x,w)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(S))}function f(S){return S===null||Nt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(S)):qt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Gt(t,p,"whitespace")(S)):S===96&&S===a?r(S):(t.consume(S),f)}function p(S){return S===null||Nt(S)?d(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||Nt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(S)):S===96&&S===a?r(S):(t.consume(S),m)}function x(S){return t.attempt(i,w,g)(S)}function g(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),y}function y(S){return s>0&&qt(S)?Gt(t,C,"linePrefix",s+1)(S):C(S)}function C(S){return S===null||Nt(S)?t.check(tm,x,w)(S):(t.enter("codeFlowValue"),b(S))}function b(S){return S===null||Nt(S)?(t.exit("codeFlowValue"),C(S)):(t.consume(S),b)}function w(S){return t.exit("codeFenced"),e(S)}function _(S,N,L){let A=0;return j;function j(M){return S.enter("lineEnding"),S.consume(M),S.exit("lineEnding"),I}function I(M){return S.enter("codeFencedFence"),qt(M)?Gt(S,z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):z(M)}function z(M){return M===a?(S.enter("codeFencedFenceSequence"),W(M)):L(M)}function W(M){return M===a?(A++,S.consume(M),W):A>=o?(S.exit("codeFencedFenceSequence"),qt(M)?Gt(S,D,"whitespace")(M):D(M)):L(M)}function D(M){return M===null||Nt(M)?(S.exit("codeFencedFence"),N(M)):L(M)}}}function aN(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 ph={name:"codeIndented",tokenize:cN},lN={partial:!0,tokenize:hN};function cN(t,e,r){const n=this;return i;function i(h){return t.enter("codeIndented"),Gt(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(lN,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 hN(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):Gt(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 uN={name:"codeText",previous:pN,resolve:dN,tokenize:fN};function dN(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 pN(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fN(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 mN{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&&eo(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),eo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eo(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);eo(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);eo(this.left,r.reverse())}}}function eo(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 sy(t){const e={};let r=-1,n,i,s,o,a,l,h;const u=new mN(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,gN(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 vr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!h}function gN(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 xN={resolve:bN,tokenize:CN},yN={partial:!0,tokenize:kN};function bN(t){return sy(t),t}function CN(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(yN,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 kN(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Gt(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 oy(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||Bl(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||Bl(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 ay(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=!qt(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(t.consume(p),a++,d):d(p)}}function ly(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"),Gt(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 Io(t,e){let r;return n;function n(i){return Nt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):qt(i)?Gt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const vN={name:"definition",tokenize:SN},wN={partial:!0,tokenize:TN};function SN(t,e,r){const n=this;let i;return s;function s(p){return t.enter("definition"),o(p)}function o(p){return ay.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)?Io(t,h)(p):h(p)}function h(p){return oy(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(wN,d,d)(p)}function d(p){return qt(p)?Gt(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 TN(t,e,r){return n;function n(a){return le(a)?Io(t,i)(a):r(a)}function i(a){return ly(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return qt(a)?Gt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Nt(a)?e(a):r(a)}}const _N={name:"hardBreakEscape",tokenize:jN};function jN(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 NN={name:"headingAtx",resolve:EN,tokenize:BN};function EN(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"},vr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function BN(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)):qt(u)?Gt(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 LN=["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"],rm=["pre","script","style","textarea"],AN={concrete:!0,name:"htmlFlow",resolveTo:FN,tokenize:PN},MN={partial:!0,tokenize:ON},IN={partial:!0,tokenize:DN};function FN(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 PN(t,e,r){const n=this;let i,s,o,a,l;return h;function h(P){return u(P)}function u(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),d}function d(P){return P===33?(t.consume(P),f):P===47?(t.consume(P),s=!0,x):P===63?(t.consume(P),i=3,n.interrupt?e:T):rr(P)?(t.consume(P),o=String.fromCharCode(P),g):r(P)}function f(P){return P===45?(t.consume(P),i=2,p):P===91?(t.consume(P),i=5,a=0,m):rr(P)?(t.consume(P),i=4,n.interrupt?e:T):r(P)}function p(P){return P===45?(t.consume(P),n.interrupt?e:T):r(P)}function m(P){const X="CDATA[";return P===X.charCodeAt(a++)?(t.consume(P),a===X.length?n.interrupt?e:z:m):r(P)}function x(P){return rr(P)?(t.consume(P),o=String.fromCharCode(P),g):r(P)}function g(P){if(P===null||P===47||P===62||le(P)){const X=P===47,ut=o.toLowerCase();return!X&&!s&&rm.includes(ut)?(i=1,n.interrupt?e(P):z(P)):LN.includes(o.toLowerCase())?(i=6,X?(t.consume(P),y):n.interrupt?e(P):z(P)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(P):s?C(P):b(P))}return P===45||Ge(P)?(t.consume(P),o+=String.fromCharCode(P),g):r(P)}function y(P){return P===62?(t.consume(P),n.interrupt?e:z):r(P)}function C(P){return qt(P)?(t.consume(P),C):j(P)}function b(P){return P===47?(t.consume(P),j):P===58||P===95||rr(P)?(t.consume(P),w):qt(P)?(t.consume(P),b):j(P)}function w(P){return P===45||P===46||P===58||P===95||Ge(P)?(t.consume(P),w):_(P)}function _(P){return P===61?(t.consume(P),S):qt(P)?(t.consume(P),_):b(P)}function S(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(t.consume(P),l=P,N):qt(P)?(t.consume(P),S):L(P)}function N(P){return P===l?(t.consume(P),l=null,A):P===null||Nt(P)?r(P):(t.consume(P),N)}function L(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||le(P)?_(P):(t.consume(P),L)}function A(P){return P===47||P===62||qt(P)?b(P):r(P)}function j(P){return P===62?(t.consume(P),I):r(P)}function I(P){return P===null||Nt(P)?z(P):qt(P)?(t.consume(P),I):r(P)}function z(P){return P===45&&i===2?(t.consume(P),F):P===60&&i===1?(t.consume(P),O):P===62&&i===4?(t.consume(P),V):P===63&&i===3?(t.consume(P),T):P===93&&i===5?(t.consume(P),B):Nt(P)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(MN,rt,W)(P)):P===null||Nt(P)?(t.exit("htmlFlowData"),W(P)):(t.consume(P),z)}function W(P){return t.check(IN,D,rt)(P)}function D(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),M}function M(P){return P===null||Nt(P)?W(P):(t.enter("htmlFlowData"),z(P))}function F(P){return P===45?(t.consume(P),T):z(P)}function O(P){return P===47?(t.consume(P),o="",$):z(P)}function $(P){if(P===62){const X=o.toLowerCase();return rm.includes(X)?(t.consume(P),V):z(P)}return rr(P)&&o.length<8?(t.consume(P),o+=String.fromCharCode(P),$):z(P)}function B(P){return P===93?(t.consume(P),T):z(P)}function T(P){return P===62?(t.consume(P),V):P===45&&i===2?(t.consume(P),T):z(P)}function V(P){return P===null||Nt(P)?(t.exit("htmlFlowData"),rt(P)):(t.consume(P),V)}function rt(P){return t.exit("htmlFlow"),e(P)}}function DN(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 ON(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(ua,e,r)}}const $N={name:"htmlText",tokenize:RN};function RN(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):rr(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):rr(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,O(T)):(t.consume(T),d)}function f(T){return T===45?(t.consume(T),p):d(T)}function p(T){return T===62?F(T):T===45?f(T):d(T)}function m(T){const V="CDATA[";return T===V.charCodeAt(s++)?(t.consume(T),s===V.length?x:m):r(T)}function x(T){return T===null?r(T):T===93?(t.consume(T),g):Nt(T)?(o=x,O(T)):(t.consume(T),x)}function g(T){return T===93?(t.consume(T),y):x(T)}function y(T){return T===62?F(T):T===93?(t.consume(T),y):x(T)}function C(T){return T===null||T===62?F(T):Nt(T)?(o=C,O(T)):(t.consume(T),C)}function b(T){return T===null?r(T):T===63?(t.consume(T),w):Nt(T)?(o=b,O(T)):(t.consume(T),b)}function w(T){return T===62?F(T):b(T)}function _(T){return rr(T)?(t.consume(T),S):r(T)}function S(T){return T===45||Ge(T)?(t.consume(T),S):N(T)}function N(T){return Nt(T)?(o=N,O(T)):qt(T)?(t.consume(T),N):F(T)}function L(T){return T===45||Ge(T)?(t.consume(T),L):T===47||T===62||le(T)?A(T):r(T)}function A(T){return T===47?(t.consume(T),F):T===58||T===95||rr(T)?(t.consume(T),j):Nt(T)?(o=A,O(T)):qt(T)?(t.consume(T),A):F(T)}function j(T){return T===45||T===46||T===58||T===95||Ge(T)?(t.consume(T),j):I(T)}function I(T){return T===61?(t.consume(T),z):Nt(T)?(o=I,O(T)):qt(T)?(t.consume(T),I):A(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,O(T)):qt(T)?(t.consume(T),z):(t.consume(T),D)}function W(T){return T===i?(t.consume(T),i=void 0,M):T===null?r(T):Nt(T)?(o=W,O(T)):(t.consume(T),W)}function D(T){return T===null||T===34||T===39||T===60||T===61||T===96?r(T):T===47||T===62||le(T)?A(T):(t.consume(T),D)}function M(T){return T===47||T===62||le(T)?A(T):r(T)}function F(T){return T===62?(t.consume(T),t.exit("htmlTextData"),t.exit("htmlText"),e):r(T)}function O(T){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),$}function $(T){return qt(T)?Gt(t,B,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):B(T)}function B(T){return t.enter("htmlTextData"),o(T)}}const ip={name:"labelEnd",resolveAll:HN,resolveTo:UN,tokenize:YN},zN={tokenize:VN},WN={tokenize:GN},qN={tokenize:XN};function HN(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&&vr(t,0,t.length,r),t}function UN(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=Nr(a,t.slice(s+1,s+n+3)),a=Nr(a,[["enter",u,e]]),a=Nr(a,Sc(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Nr(a,[["exit",u,e],t[o-2],t[o-1],["exit",h,e]]),a=Nr(a,t.slice(o+1)),a=Nr(a,[["exit",l,e]]),vr(t,s,t.length,a),t}function YN(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(zN,u,o?u:d)(f):f===91?t.attempt(WN,u,o?h:d)(f):o?u(f):d(f)}function h(f){return t.attempt(qN,u,d)(f)}function u(f){return e(f)}function d(f){return s._balanced=!0,r(f)}}function VN(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)?Io(t,s)(d):s(d)}function s(d){return d===41?u(d):oy(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return le(d)?Io(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?ly(t,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function h(d){return le(d)?Io(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 GN(t,e,r){const n=this;return i;function i(a){return ay.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 XN(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 KN={name:"labelStartImage",resolveAll:ip.resolveAll,tokenize:QN};function QN(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 ZN={name:"labelStartLink",resolveAll:ip.resolveAll,tokenize:JN};function JN(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 fh={name:"lineEnding",tokenize:t5};function t5(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Gt(t,e,"linePrefix")}}const ll={name:"thematicBreak",tokenize:e5};function e5(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"),qt(h)?Gt(t,a,"whitespace")(h):a(h))}}const hr={continuation:{tokenize:s5},exit:a5,name:"list",tokenize:i5},r5={partial:!0,tokenize:l5},n5={partial:!0,tokenize:o5};function i5(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:Cu(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(ll,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 Cu(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(ua,n.interrupt?r:u,t.attempt(r5,f,d))}function u(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return qt(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 s5(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(ua,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Gt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!qt(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(n5,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Gt(t,t.attempt(hr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function o5(t,e,r){const n=this;return Gt(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 a5(t){t.exit(this.containerState.type)}function l5(t,e,r){const n=this;return Gt(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!qt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const nm={name:"setextUnderline",resolveTo:c5,tokenize:h5};function c5(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 h5(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"),qt(h)?Gt(t,l,"lineSuffix")(h):l(h))}function l(h){return h===null||Nt(h)?(t.exit("setextHeadingLine"),e(h)):r(h)}}const u5={tokenize:d5};function d5(t){const e=this,r=t.attempt(ua,n,t.attempt(this.parser.constructs.flowInitial,i,Gt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(xN,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 p5={resolveAll:hy()},f5=cy("string"),m5=cy("text");function cy(t){return{resolveAll:hy(t==="text"?g5: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 hy(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 g5(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 x5={42:hr,43:hr,45:hr,48:hr,49:hr,50:hr,51:hr,52:hr,53:hr,54:hr,55:hr,56:hr,57:hr,62:ry},y5={91:vN},b5={[-2]:ph,[-1]:ph,32:ph},C5={35:NN,42:ll,45:[nm,ll],60:AN,61:nm,95:ll,96:em,126:em},k5={38:iy,92:ny},v5={[-5]:fh,[-4]:fh,[-3]:fh,33:KN,38:iy,42:ku,60:[Zj,$N],91:ZN,92:[_N,ny],93:ip,95:ku,96:uN},w5={null:[ku,p5]},S5={null:[42,95]},T5={null:[]},_5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:S5,contentInitial:y5,disable:T5,document:x5,flow:C5,flowInitial:b5,insideSpan:w5,string:k5,text:v5},Symbol.toStringTag,{value:"Module"}));function j5(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:N(_),check:N(S),consume:C,enter:b,exit:w,interrupt:N(S,{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(I){return o=Nr(o,I),g(),o[o.length-1]!==null?[]:(L(e,0),h.events=Sc(s,h.events,h),h.events)}function f(I,z){return E5(p(I),z)}function p(I){return N5(o,I)}function m(){const{_bufferIndex:I,_index:z,line:W,column:D,offset:M}=n;return{_bufferIndex:I,_index:z,line:W,column:D,offset:M}}function x(I){i[I.line]=I.column,j()}function g(){let I;for(;n._index<o.length;){const z=o[n._index];if(typeof z=="string")for(I=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===I&&n._bufferIndex<z.length;)y(z.charCodeAt(n._bufferIndex));else y(z)}}function y(I){u=u(I)}function C(I){Nt(I)?(n.line++,n.column=1,n.offset+=I===-3?2:1,j()):I!==-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=I}function b(I,z){const W=z||{};return W.type=I,W.start=m(),h.events.push(["enter",W,h]),a.push(W),W}function w(I){const z=a.pop();return z.end=m(),h.events.push(["exit",z,h]),z}function _(I,z){L(I,z.from)}function S(I,z){z.restore()}function N(I,z){return W;function W(D,M,F){let O,$,B,T;return Array.isArray(D)?rt(D):"tokenize"in D?rt([D]):V(D);function V(xt){return Dt;function Dt(Wt){const lt=Wt!==null&&xt[Wt],K=Wt!==null&&xt.null,it=[...Array.isArray(lt)?lt:lt?[lt]:[],...Array.isArray(K)?K:K?[K]:[]];return rt(it)(Wt)}}function rt(xt){return O=xt,$=0,xt.length===0?F:P(xt[$])}function P(xt){return Dt;function Dt(Wt){return T=A(),B=xt,xt.partial||(h.currentConstruct=xt),xt.name&&h.parser.constructs.disable.null.includes(xt.name)?ut():xt.tokenize.call(z?Object.assign(Object.create(h),z):h,l,X,ut)(Wt)}}function X(xt){return I(B,T),M}function ut(xt){return T.restore(),++$<O.length?P(O[$]):F}}}function L(I,z){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&vr(h.events,z,h.events.length-z,I.resolve(h.events.slice(z),h)),I.resolveTo&&(h.events=I.resolveTo(h.events,h))}function A(){const I=m(),z=h.previous,W=h.currentConstruct,D=h.events.length,M=Array.from(a);return{from:D,restore:F};function F(){n=I,h.previous=z,h.currentConstruct=W,h.events.length=D,a=M,j()}}function j(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function N5(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 E5(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=`
|
|
297
|
-
`;break}case-3:{o=`\r
|
|
298
|
-
`;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 B5(t){const n={constructs:ty([_5,...(t||{}).extensions||[]]),content:i(Uj),defined:[],document:i(Vj),flow:i(u5),lazy:{},string:i(f5),text:i(m5)};return n;function i(s){return o;function o(a){return j5(n,s,a)}}}function L5(t){for(;!sy(t););return t}const im=/[\0\t\n\r]/g;function A5(){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(im.lastIndex=d,h=im.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 M5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I5(t){return t.replace(M5,F5)}function F5(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return ey(r.slice(s?2:1),s?16:10)}return np(r)||t}const uy={}.hasOwnProperty;function P5(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),D5(r)(L5(B5(r).document().write(A5()(t,e,!0))))}function D5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(yr),autolinkProtocol:A,autolinkEmail:A,atxHeading:s(It),blockQuote:s(K),characterEscape:A,characterReference:A,codeFenced:s(it),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(it,o),codeText:s(wt,o),codeTextData:A,data:A,codeFlowValue:A,definition:s(gt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Jt),hardBreakEscape:s(Xt),hardBreakTrailing:s(Xt),htmlFlow:s(Ae,o),htmlFlowData:A,htmlText:s(Ae,o),htmlTextData:A,image:s(Kt),label:o,link:s(yr),listItem:s(Ie),listItemValue:f,listOrdered:s(he,d),listUnordered:s(he),paragraph:s(We),reference:P,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(It),strong:s(ue),thematicBreak:s(J)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:lt,autolinkProtocol:Wt,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:ut,characterReferenceMarkerNumeric:ut,characterReferenceValue:xt,characterReference:Dt,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:j,codeIndented:l(y),codeText:l(M),codeTextData:j,data:j,definition:l(),definitionDestinationString:w,definitionLabelString:C,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(W),htmlFlowData:j,htmlText:l(D),htmlTextData:j,image:l(O),label:B,labelText:$,lineEnding:I,link:l(F),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:X,resourceDestinationString:T,resourceTitleString:V,resource:rt,setextHeading:l(L),setextHeadingLineSequence:N,setextHeadingText:S,strong:l(),thematicBreak:l()}};dy(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(H){let et={type:"root",children:[]};const at={stack:[et],tokenStack:[],config:e,enter:a,exit:h,buffer:o,resume:u,data:r},ft=[];let _t=-1;for(;++_t<H.length;)if(H[_t][1].type==="listOrdered"||H[_t][1].type==="listUnordered")if(H[_t][0]==="enter")ft.push(_t);else{const te=ft.pop();_t=i(H,te,_t)}for(_t=-1;++_t<H.length;){const te=e[H[_t][0]];uy.call(te,H[_t][1].type)&&te[H[_t][1].type].call(Object.assign({sliceSerialize:H[_t][2].sliceSerialize},at),H[_t][1])}if(at.tokenStack.length>0){const te=at.tokenStack[at.tokenStack.length-1];(te[1]||sm).call(at,void 0,te[0])}for(et.position={start:Bn(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Bn(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},_t=-1;++_t<e.transforms.length;)et=e.transforms[_t](et)||et;return et}function i(H,et,at){let ft=et-1,_t=-1,te=!1,fe,we,qe,me;for(;++ft<=at;){const ge=H[ft];switch(ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ge[0]==="enter"?_t++:_t--,me=void 0;break}case"lineEndingBlank":{ge[0]==="enter"&&(fe&&!me&&!_t&&!qe&&(qe=ft),me=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:me=void 0}if(!_t&&ge[0]==="enter"&&ge[1].type==="listItemPrefix"||_t===-1&&ge[0]==="exit"&&(ge[1].type==="listUnordered"||ge[1].type==="listOrdered")){if(fe){let ce=ft;for(we=void 0;ce--;){const Fe=H[ce];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;we&&(H[we][1].type="lineEndingBlank",te=!0),Fe[1].type="lineEnding",we=ce}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}qe&&(!we||qe<we)&&(fe._spread=!0),fe.end=Object.assign({},we?H[we][1].start:ge[1].end),H.splice(we||ft,0,["exit",fe,ge[2]]),ft++,at++}if(ge[1].type==="listItemPrefix"){const ce={type:"listItem",_spread:!1,start:Object.assign({},ge[1].start),end:void 0};fe=ce,H.splice(ft,0,["enter",ce,ge[2]]),ft++,at++,qe=void 0,me=!0}}}return H[et][1]._spread=te,at}function s(H,et){return at;function at(ft){a.call(this,H(ft),ft),et&&et.call(this,ft)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(H,et,at){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([et,at||void 0]),H.position={start:Bn(et.start),end:void 0}}function l(H){return et;function et(at){H&&H.call(this,at),h.call(this,at)}}function h(H,et){const at=this.stack.pop(),ft=this.tokenStack.pop();if(ft)ft[0].type!==H.type&&(et?et.call(this,H,ft[0]):(ft[1]||sm).call(this,H,ft[0]));else throw new Error("Cannot close `"+H.type+"` ("+Mo({start:H.start,end:H.end})+"): it’s not open");at.position.end=Bn(H.end)}function u(){return rp(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(H){if(this.data.expectingFirstListItemValue){const et=this.stack[this.stack.length-2];et.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),et=this.stack[this.stack.length-1];et.lang=H}function m(){const H=this.resume(),et=this.stack[this.stack.length-1];et.meta=H}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const H=this.resume(),et=this.stack[this.stack.length-1];et.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const H=this.resume(),et=this.stack[this.stack.length-1];et.value=H.replace(/(\r?\n|\r)$/g,"")}function C(H){const et=this.resume(),at=this.stack[this.stack.length-1];at.label=et,at.identifier=Or(this.sliceSerialize(H)).toLowerCase()}function b(){const H=this.resume(),et=this.stack[this.stack.length-1];et.title=H}function w(){const H=this.resume(),et=this.stack[this.stack.length-1];et.url=H}function _(H){const et=this.stack[this.stack.length-1];if(!et.depth){const at=this.sliceSerialize(H).length;et.depth=at}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function N(H){const et=this.stack[this.stack.length-1];et.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function A(H){const at=this.stack[this.stack.length-1].children;let ft=at[at.length-1];(!ft||ft.type!=="text")&&(ft=q(),ft.position={start:Bn(H.start),end:void 0},at.push(ft)),this.stack.push(ft)}function j(H){const et=this.stack.pop();et.value+=this.sliceSerialize(H),et.position.end=Bn(H.end)}function I(H){const et=this.stack[this.stack.length-1];if(this.data.atHardBreak){const at=et.children[et.children.length-1];at.position.end=Bn(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(et.type)&&(A.call(this,H),j.call(this,H))}function z(){this.data.atHardBreak=!0}function W(){const H=this.resume(),et=this.stack[this.stack.length-1];et.value=H}function D(){const H=this.resume(),et=this.stack[this.stack.length-1];et.value=H}function M(){const H=this.resume(),et=this.stack[this.stack.length-1];et.value=H}function F(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const et=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=et,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function O(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const et=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=et,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function $(H){const et=this.sliceSerialize(H),at=this.stack[this.stack.length-2];at.label=I5(et),at.identifier=Or(et).toLowerCase()}function B(){const H=this.stack[this.stack.length-1],et=this.resume(),at=this.stack[this.stack.length-1];if(this.data.inReference=!0,at.type==="link"){const ft=H.children;at.children=ft}else at.alt=et}function T(){const H=this.resume(),et=this.stack[this.stack.length-1];et.url=H}function V(){const H=this.resume(),et=this.stack[this.stack.length-1];et.title=H}function rt(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function X(H){const et=this.resume(),at=this.stack[this.stack.length-1];at.label=et,at.identifier=Or(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function ut(H){this.data.characterReferenceType=H.type}function xt(H){const et=this.sliceSerialize(H),at=this.data.characterReferenceType;let ft;at?(ft=ey(et,at==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ft=np(et);const _t=this.stack[this.stack.length-1];_t.value+=ft}function Dt(H){const et=this.stack.pop();et.position.end=Bn(H.end)}function Wt(H){j.call(this,H);const et=this.stack[this.stack.length-1];et.url=this.sliceSerialize(H)}function lt(H){j.call(this,H);const et=this.stack[this.stack.length-1];et.url="mailto:"+this.sliceSerialize(H)}function K(){return{type:"blockquote",children:[]}}function it(){return{type:"code",lang:null,meta:null,value:""}}function wt(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Jt(){return{type:"emphasis",children:[]}}function It(){return{type:"heading",depth:0,children:[]}}function Xt(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function yr(){return{type:"link",title:null,url:"",children:[]}}function he(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ie(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function We(){return{type:"paragraph",children:[]}}function ue(){return{type:"strong",children:[]}}function q(){return{type:"text",value:""}}function J(){return{type:"thematicBreak"}}}function Bn(t){return{line:t.line,column:t.column,offset:t.offset}}function dy(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?dy(t,n):O5(t,n)}}function O5(t,e){let r;for(r in e)if(uy.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 sm(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Mo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Mo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Mo({start:e.start,end:e.end})+") is still open")}function $5(t){const e=this;e.parser=r;function r(n){return P5(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function R5(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 z5(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
299
|
-
`}]}function W5(t,e){const r=e.value?e.value+`
|
|
300
|
-
`:"",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 q5(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function H5(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function U5(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Ps(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 Y5(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 V5(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function py(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 G5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return py(t,e);const i={src:Ps(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 X5(t,e){const r={src:Ps(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 K5(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 Q5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return py(t,e);const i={href:Ps(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 Z5(t,e){const r={href:Ps(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 J5(t,e,r){const n=t.all(e),i=r?tE(r):fy(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:`
|
|
301
|
-
`}),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:`
|
|
302
|
-
`});const h={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,h),t.applyData(e,h)}function tE(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=fy(r[n])}return e}function fy(t){const e=t.spread;return e??t.children.length>1}function eE(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 rE(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function nE(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function iE(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function sE(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=Zd(e.children[1]),l=V0(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 oE(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 aE(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const om=9,am=32;function lE(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(lm(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(lm(e.slice(i),i>0,!1)),s.join("")}function lm(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===om||s===am;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===om||s===am;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function cE(t,e){const r={type:"text",value:lE(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function hE(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const uE={blockquote:R5,break:z5,code:W5,delete:q5,emphasis:H5,footnoteReference:U5,heading:Y5,html:V5,imageReference:G5,image:X5,inlineCode:K5,linkReference:Q5,link:Z5,listItem:J5,list:eE,paragraph:rE,root:nE,strong:iE,table:sE,tableCell:aE,tableRow:oE,text:cE,thematicBreak:hE,toml:Pa,yaml:Pa,definition:Pa,footnoteDefinition:Pa};function Pa(){}const my=-1,Tc=0,Fo=1,Ll=2,sp=3,op=4,ap=5,lp=6,gy=7,xy=8,dE=typeof self=="object"?self:globalThis,cm=(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 dE[t](e)},pE=(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 Tc:case my:return r(o,i);case Fo:{const a=r([],i);for(const l of o)a.push(n(l));return a}case Ll:{const a=r({},i);for(const[l,h]of o)a[n(l)]=n(h);return a}case sp:return r(new Date(o),i);case op:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case ap:{const a=r(new Map,i);for(const[l,h]of o)a.set(n(l),n(h));return a}case lp:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case gy:{const{name:a,message:l}=o;return r(cm(a,l),i)}case xy:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return r(new DataView(a),o)}}return r(cm(s,o),i)};return n},hm=t=>pE(new Map,t)(0),Oi="",{toString:fE}={},{keys:mE}=Object,ro=t=>{const e=typeof t;if(e!=="object"||!t)return[Tc,e];const r=fE.call(t).slice(8,-1);switch(r){case"Array":return[Fo,Oi];case"Object":return[Ll,Oi];case"Date":return[sp,Oi];case"RegExp":return[op,Oi];case"Map":return[ap,Oi];case"Set":return[lp,Oi];case"DataView":return[Fo,r]}return r.includes("Array")?[Fo,r]:r.includes("Error")?[gy,r]:[Ll,r]},Da=([t,e])=>t===Tc&&(e==="function"||e==="symbol"),gE=(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]=ro(o);switch(a){case Tc:{let u=o;switch(l){case"bigint":a=xy,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([my],o)}return i([a,u],o)}case Fo:{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 Ll:{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 mE(o))(t||!Da(ro(o[f])))&&u.push([s(f),s(o[f])]);return d}case sp:return i([a,o.toISOString()],o);case op:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case ap:{const u=[],d=i([a,u],o);for(const[f,p]of o)(t||!(Da(ro(f))||Da(ro(p))))&&u.push([s(f),s(p)]);return d}case lp:{const u=[],d=i([a,u],o);for(const f of o)(t||!Da(ro(f)))&&u.push(s(f));return d}}const{message:h}=o;return i([a,{name:l,message:h}],o)};return s},um=(t,{json:e,lossy:r}={})=>{const n=[];return gE(!(e||r),!!e,new Map,n)(t),n},Al=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?hm(um(t,e)):structuredClone(t):(t,e)=>hm(um(t,e));function xE(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 yE(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function bE(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||xE,n=t.options.footnoteBackLabel||yE,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=Ps(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:{...Al(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
303
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
|
|
304
|
-
`}]}}const _c=(function(t){if(t==null)return wE;if(typeof t=="function")return jc(t);if(typeof t=="object")return Array.isArray(t)?CE(t):kE(t);if(typeof t=="string")return vE(t);throw new Error("Expected function, string, or object as test")});function CE(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=_c(t[r]);return jc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function kE(t){const e=t;return jc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function vE(t){return jc(e);function e(r){return r&&r.type===t}}function jc(t){return e;function e(r,n,i){return!!(SE(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function wE(){return!0}function SE(t){return t!==null&&typeof t=="object"&&"type"in t}const yy=[],TE=!0,vu=!1,_E="skip";function by(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=_c(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=yy,m,x,g;if((!e||s(l,h,u[u.length-1]||void 0))&&(p=jE(r(l,u)),p[0]===vu))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==_E)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]===vu)return m;x=typeof m[1]=="number"?m[1]:x+o}}return p}}}function jE(t){return Array.isArray(t)?t:typeof t=="number"?[TE,t]:t==null?yy:[t]}function cp(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),by(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 wu={}.hasOwnProperty,NE={};function EE(t,e){const r=e||NE,n=new Map,i=new Map,s=new Map,o={...uE,...r.handlers},a={all:h,applyData:LE,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:BE,wrap:ME};return cp(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(wu.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=Al(g);return y.children=a.all(u),y}return Al(u)}return(a.options.unknownHandler||AE)(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=dm(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=dm(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function BE(t,e){t.position&&(e.position=xj(t))}function LE(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,Al(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function AE(t,e){const r=e.data||{},n="value"in e&&!(wu.call(r,"hProperties")||wu.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 ME(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
|
|
305
|
-
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
306
|
-
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
307
|
-
`}),r}function dm(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function pm(t,e){const r=EE(t,e),n=r.one(t,void 0),i=bE(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
308
|
-
`},i),s}function IE(t,e){return t&&"run"in t?async function(r,n){const i=pm(r,{file:n,...e});await t.run(i,n)}:function(r,n){return pm(r,{file:n,...t||e})}}function fm(t){if(t)throw t}var mh,mm;function FE(){if(mm)return mh;mm=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 mh=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},mh}var PE=FE();const gh=Dd(PE);function Su(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 DE(){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?OE(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 OE(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 Xr={basename:$E,dirname:RE,extname:zE,join:WE,sep:"/"};function $E(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');da(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 RE(t){if(da(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 zE(t){da(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 WE(...t){let e=-1,r;for(;++e<t.length;)da(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":qE(r)}function qE(t){da(t);const e=t.codePointAt(0)===47;let r=HE(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function HE(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 da(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const UE={cwd:YE};function YE(){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 VE(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 GE(t)}function GE(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 xh=["history","path","basename","stem","extname","dirname"];class Cy{constructor(e){let r;e?Tu(e)?r={path:e}:typeof e=="string"||XE(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":UE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xh.length;){const s=xh[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)xh.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Xr.basename(this.path):void 0}set basename(e){bh(e,"basename"),yh(e,"basename"),this.path=Xr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Xr.dirname(this.path):void 0}set dirname(e){gm(this.basename,"dirname"),this.path=Xr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Xr.extname(this.path):void 0}set extname(e){if(yh(e,"extname"),gm(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=Xr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Tu(e)&&(e=VE(e)),bh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Xr.basename(this.path,this.extname):void 0}set stem(e){bh(e,"stem"),yh(e,"stem"),this.path=Xr.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 Ke(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 yh(t,e){if(t&&t.includes(Xr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Xr.sep+"`")}function bh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function gm(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function XE(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const KE=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),QE={}.hasOwnProperty;class hp extends KE{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=DE()}copy(){const e=new hp;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(gh(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(vh("data",this.frozen),this.namespace[e]=r,this):QE.call(this.namespace,e)&&this.namespace[e]||void 0:e?(vh("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=Oa(e),n=this.parser||this.Parser;return Ch("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Ch("process",this.parser||this.Parser),kh("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=Oa(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);tB(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(),Ch("processSync",this.parser||this.Parser),kh("processSync",this.compiler||this.Compiler),this.process(e,i),ym("processSync","process",r),n;function i(s,o){r=!0,fm(s),n=o}}run(e,r,n){xm(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=Oa(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),ym("runSync","run",n),i;function s(o,a){fm(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=Oa(r),i=this.compiler||this.Compiler;return kh("stringify",i),xm(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(vh("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=gh(!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];Su(x)&&Su(p)&&(p=gh(!0,x,p)),n[f]=[h,p,...m]}}}}const ZE=new hp().freeze();function Ch(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function kh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function vh(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 xm(t){if(!Su(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function ym(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Oa(t){return JE(t)?t:new Cy(t)}function JE(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function tB(t){return typeof t=="string"||eB(t)}function eB(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const rB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bm=[],Cm={allowDangerousHtml:!0},nB=/^(https?|ircs?|mailto|xmpp)$/i,iB=[{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 up(t){const e=sB(t),r=oB(t);return aB(e.runSync(e.parse(r),r),t)}function sB(t){const e=t.rehypePlugins||bm,r=t.remarkPlugins||bm,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Cm}:Cm;return ZE().use($5).use(r).use(IE,n).use(e)}function oB(t){const e=t.children||"",r=new Cy;return typeof e=="string"&&(r.value=e),r}function aB(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||lB;for(const u of iB)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+rB+u.id,void 0);return cp(t,h),vj(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 dh)if(Object.hasOwn(dh,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],x=dh[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 lB(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||nB.test(t.slice(0,e))?t:""}function km(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 cB(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function hB(t,e,r){const i=_c((r||{}).ignore||[]),s=uB(e);let o=-1;for(;++o<s.length;)by(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 w=b.index,_={index:b.index,input:b.input,stack:[...u,h]};let S=p(...b,_);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?f.lastIndex=w+1:(m!==w&&C.push({type:"text",value:h.value.slice(m,w)}),Array.isArray(S)?C.push(...S):S&&C.push(S),m=w+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 uB(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([dB(i[0]),pB(i[1])])}return e}function dB(t){return typeof t=="string"?new RegExp(cB(t),"g"):t}function pB(t){return typeof t=="function"?t:function(){return t}}const wh="phrasing",Sh=["autolink","link","image","label"];function fB(){return{transforms:[kB],enter:{literalAutolink:gB,literalAutolinkEmail:Th,literalAutolinkHttp:Th,literalAutolinkWww:Th},exit:{literalAutolink:CB,literalAutolinkEmail:bB,literalAutolinkHttp:xB,literalAutolinkWww:yB}}}function mB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:wh,notInConstruct:Sh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:wh,notInConstruct:Sh},{character:":",before:"[ps]",after:"\\/",inConstruct:wh,notInConstruct:Sh}]}}function gB(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Th(t){this.config.enter.autolinkProtocol.call(this,t)}function xB(t){this.config.exit.autolinkProtocol.call(this,t)}function yB(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 bB(t){this.config.exit.autolinkEmail.call(this,t)}function CB(t){this.exit(t)}function kB(t){hB(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,vB],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),wB]],{ignore:["link","linkReference"]})}function vB(t,e,r,n,i){let s="";if(!ky(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!SB(r)))return!1;const o=TB(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 wB(t,e,r,n){return!ky(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function SB(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 TB(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=km(t,"(");let s=km(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 ky(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||bi(r)||wc(r))&&(!e||r!==47)}vy.peek=IB;function _B(){this.buffer()}function jB(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function NB(){this.buffer()}function EB(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function BB(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 LB(t){this.exit(t)}function AB(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 MB(t){this.exit(t)}function IB(){return"["}function vy(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 FB(){return{enter:{gfmFootnoteCallString:_B,gfmFootnoteCall:jB,gfmFootnoteDefinitionLabelString:NB,gfmFootnoteDefinition:EB},exit:{gfmFootnoteCallString:BB,gfmFootnoteCall:LB,gfmFootnoteDefinitionLabelString:AB,gfmFootnoteDefinition:MB}}}function PB(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:vy},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?`
|
|
309
|
-
`:" ")+s.indentLines(s.containerFlow(n,a.current()),e?wy:DB))),h(),l}}function DB(t,e,r){return e===0?t:wy(t,e,r)}function wy(t,e,r){return(r?"":" ")+t}const OB=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Sy.peek=qB;function $B(){return{canContainEols:["delete"],enter:{strikethrough:zB},exit:{strikethrough:WB}}}function RB(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:OB}],handlers:{delete:Sy}}}function zB(t){this.enter({type:"delete",children:[]},t)}function WB(t){this.exit(t)}function Sy(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 qB(){return"~"}function HB(t){return t.length}function UB(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||HB,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=YB(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]=vm(n[d]);else{const x=vm(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="",w="";if(r.alignDelimiters!==!1){const _=l[d]-(g[d]||0),S=s[d];S===114?b=" ".repeat(_):S===99?_%2?(b=" ".repeat(_/2+.5),w=" ".repeat(_/2-.5)):(b=" ".repeat(_/2),w=b):w=" ".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(w),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(`
|
|
310
|
-
`)}function YB(t){return t==null?"":String(t)}function vm(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 VB(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()),GB);return i(),o}function GB(t,e,r){return">"+(r?"":" ")+t}function XB(t,e){return wm(t,e.inConstruct,!0)&&!wm(t,e.notInConstruct,!1)}function wm(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 Sm(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
311
|
-
`&&XB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
312
|
-
`}function KB(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 QB(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 ZB(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 JB(t,e,r,n){const i=ZB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(QB(t,r)){const d=r.enter("codeIndented"),f=r.indentLines(s,tL);return d(),f}const a=r.createTracker(n),l=i.repeat(Math.max(KB(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:`
|
|
313
|
-
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
|
|
314
|
-
`),s&&(u+=a.move(s+`
|
|
315
|
-
`)),u+=a.move(l),h(),u}function tL(t,e,r){return(r?"":" ")+t}function dp(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 eL(t,e,r,n){const i=dp(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?" ":`
|
|
316
|
-
`,...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 rL(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 Go(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ml(t,e,r){const n=Cs(t),i=Cs(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}}Ty.peek=nL;function Ty(t,e,r,n){const i=rL(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=Go(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)+Go(d));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function nL(t,e,r){return r.options.emphasis||"*"}function iL(t,e){let r=!1;return cp(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,vu}),!!((!t.depth||t.depth<3)&&rp(t)&&(e.options.setext||r))}function sL(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(iL(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),f=r.containerPhrasing(t,{...s.current(),before:`
|
|
317
|
-
`,after:`
|
|
318
|
-
`});return d(),u(),f+`
|
|
319
|
-
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
320
|
-
`))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let h=r.containerPhrasing(t,{before:"# ",after:`
|
|
321
|
-
`,...s.current()});return/^[\t ]/.test(h)&&(h=Go(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,r.options.closeAtx&&(h+=" "+o),l(),a(),h}_y.peek=oL;function _y(t){return t.value||""}function oL(){return"<"}jy.peek=aL;function jy(t,e,r,n){const i=dp(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 aL(){return"!"}Ny.peek=lL;function Ny(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 lL(){return"!"}Ey.peek=cL;function Ey(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 cL(){return"`"}function By(t,e){const r=rp(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))}Ly.peek=hL;function Ly(t,e,r,n){const i=dp(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(By(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 hL(t,e,r){return By(t,r)?"<":"["}Ay.peek=uL;function Ay(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 uL(){return"["}function pp(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 dL(t){const e=pp(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 pL(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 My(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 fL(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?pL(r):pp(r);const a=t.ordered?o==="."?")":".":dL(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),My(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 mL(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 gL(t,e,r,n){const i=mL(r);let s=r.bulletCurrent||pp(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 xL(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const yL=_c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function bL(t,e,r,n){return(t.children.some(function(o){return yL(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function CL(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=kL;function Iy(t,e,r,n){const i=CL(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=Go(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)+Go(d));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function kL(t,e,r){return r.options.strong||"*"}function vL(t,e,r,n){return r.safe(t.value,n)}function wL(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 SL(t,e,r){const n=(My(r)+(r.options.ruleSpaces?" ":"")).repeat(wL(r));return r.options.ruleSpaces?n.slice(0,-1):n}const Fy={blockquote:VB,break:Sm,code:JB,definition:eL,emphasis:Ty,hardBreak:Sm,heading:sL,html:_y,image:jy,imageReference:Ny,inlineCode:Ey,link:Ly,linkReference:Ay,list:fL,listItem:gL,paragraph:xL,root:bL,strong:Iy,text:vL,thematicBreak:SL};function TL(){return{enter:{table:_L,tableData:Tm,tableHeader:Tm,tableRow:NL},exit:{codeText:EL,table:jL,tableData:_h,tableHeader:_h,tableRow:_h}}}function _L(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 jL(t){this.exit(t),this.data.inTable=void 0}function NL(t){this.enter({type:"tableRow",children:[]},t)}function _h(t){this.exit(t)}function Tm(t){this.enter({type:"tableCell",children:[]},t)}function EL(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,BL));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function BL(t,e){return e==="|"?e:t}function LL(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
322
|
-
`,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(`
|
|
323
|
-
`))}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 UB(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=Fy.inlineCode(p,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function AL(){return{exit:{taskListCheckValueChecked:_m,taskListCheckValueUnchecked:_m,paragraph:IL}}}function ML(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:FL}}}function _m(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function IL(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 FL(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=Fy.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 PL(){return[fB(),FB(),$B(),TL(),AL()]}function DL(t){return{extensions:[mB(),PB(t),RB(),LL(t),ML()]}}const OL={tokenize:HL,partial:!0},Py={tokenize:UL,partial:!0},Dy={tokenize:YL,partial:!0},Oy={tokenize:VL,partial:!0},$L={tokenize:GL,partial:!0},$y={name:"wwwAutolink",tokenize:WL,previous:zy},Ry={name:"protocolAutolink",tokenize:qL,previous:Wy},Cn={name:"emailAutolink",tokenize:zL,previous:qy},en={};function RL(){return{text:en}}let ei=48;for(;ei<123;)en[ei]=Cn,ei++,ei===58?ei=65:ei===91&&(ei=97);en[43]=Cn;en[45]=Cn;en[46]=Cn;en[95]=Cn;en[72]=[Cn,Ry];en[104]=[Cn,Ry];en[87]=[Cn,$y];en[119]=[Cn,$y];function zL(t,e,r){const n=this;let i,s;return o;function o(d){return!_u(d)||!qy.call(n,n.previous)||fp(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return _u(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check($L,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&&rr(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function WL(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!zy.call(n,n.previous)||fp(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(OL,t.attempt(Py,t.attempt(Dy,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function qL(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&Wy.call(n,n.previous)&&!fp(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(rr(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||Bl(d)||le(d)||bi(d)||wc(d)?r(d):t.attempt(Py,t.attempt(Dy,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function HL(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 UL(t,e,r){let n,i,s;return o;function o(h){return h===46||h===95?t.check(Oy,l,a)(h):h===null||le(h)||bi(h)||h!==45&&wc(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 YL(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(Oy,e,s)(o):o===null||le(o)||bi(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function VL(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)||bi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||le(a)||bi(a)?e(a):n(a)}function s(a){return rr(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):rr(a)?(t.consume(a),o):r(a)}}function GL(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ge(s)?r(s):e(s)}}function zy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||le(t)}function Wy(t){return!rr(t)}function qy(t){return!(t===47||_u(t))}function _u(t){return t===43||t===45||t===46||t===95||Ge(t)}function fp(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 XL={tokenize:nA,partial:!0};function KL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:tA,continuation:{tokenize:eA},exit:rA}},text:{91:{name:"gfmFootnoteCall",tokenize:JL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QL,resolveTo:ZL}}}}function QL(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 ZL(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 JL(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 tA(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),Gt(t,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return e(m)}}function eA(t,e,r){return t.check(ua,e,t.attempt(XL,e,r))}function rA(t){t.exit("gfmFootnoteDefinition")}function nA(t,e,r){const n=this;return Gt(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 iA(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&&vr(f,f.length,0,Sc(p,o.slice(h+1,l),a)),vr(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),vr(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=Cs(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=Cs(m);return g._open=!y||y===2&&!!x,g._close=!x||x===2&&!!y,a(m)}}}class sA{constructor(){this.map=[]}add(e,r,n){oA(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 oA(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 aA(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 lA(){return{flow:{null:{name:"table",tokenize:cA,resolveAll:hA}}}}function cA(t,e,r){const n=this;let i=0,s=0,o;return a;function a(j){let I=n.events.length-1;for(;I>-1;){const D=n.events[I][1].type;if(D==="lineEnding"||D==="linePrefix")I--;else break}const z=I>-1?n.events[I][1].type:null,W=z==="tableHead"||z==="tableRow"?S:l;return W===S&&n.parser.lazy[n.now().line]?r(j):W(j)}function l(j){return t.enter("tableHead"),t.enter("tableRow"),h(j)}function h(j){return j===124||(o=!0,s+=1),u(j)}function u(j){return j===null?r(j):Nt(j)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),p):r(j):qt(j)?Gt(t,u,"whitespace")(j):(s+=1,o&&(o=!1,i+=1),j===124?(t.enter("tableCellDivider"),t.consume(j),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(j)))}function d(j){return j===null||j===124||le(j)?(t.exit("data"),u(j)):(t.consume(j),j===92?f:d)}function f(j){return j===92||j===124?(t.consume(j),d):d(j)}function p(j){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(j):(t.enter("tableDelimiterRow"),o=!1,qt(j)?Gt(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):m(j))}function m(j){return j===45||j===58?g(j):j===124?(o=!0,t.enter("tableCellDivider"),t.consume(j),t.exit("tableCellDivider"),x):_(j)}function x(j){return qt(j)?Gt(t,g,"whitespace")(j):g(j)}function g(j){return j===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(j),t.exit("tableDelimiterMarker"),y):j===45?(s+=1,y(j)):j===null||Nt(j)?w(j):_(j)}function y(j){return j===45?(t.enter("tableDelimiterFiller"),C(j)):_(j)}function C(j){return j===45?(t.consume(j),C):j===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(j),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(j))}function b(j){return qt(j)?Gt(t,w,"whitespace")(j):w(j)}function w(j){return j===124?m(j):j===null||Nt(j)?!o||i!==s?_(j):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(j)):_(j)}function _(j){return r(j)}function S(j){return t.enter("tableRow"),N(j)}function N(j){return j===124?(t.enter("tableCellDivider"),t.consume(j),t.exit("tableCellDivider"),N):j===null||Nt(j)?(t.exit("tableRow"),e(j)):qt(j)?Gt(t,N,"whitespace")(j):(t.enter("data"),L(j))}function L(j){return j===null||j===124||le(j)?(t.exit("data"),N(j)):(t.consume(j),j===92?A:L)}function A(j){return j===92||j===124?(t.consume(j),L):L(j)}}function hA(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 sA;for(;++r<t.length;){const p=t[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(jm(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=$a(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=$a(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=$a(f,e,s,i,r,d)):o[1]!==0&&(d=$a(f,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&jm(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=aA(e.events,r))}return t}function $a(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Vi(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=Vi(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=Vi(e.events,r[2]),u=Vi(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({},Vi(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function jm(t,e,r,n,i){const s=[],o=Vi(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 Vi(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const uA={name:"tasklistCheck",tokenize:pA};function dA(){return{text:{91:uA}}}function pA(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):qt(l)?t.check({tokenize:fA},e,r)(l):r(l)}}function fA(t,e,r){return Gt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function mA(t){return ty([RL(),KL(),iA(t),lA(),dA()])}const gA={};function mp(t){const e=this,r=t||gA,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(mA(r)),s.push(PL()),o.push(DL(r))}const Nc=k.createContext({newIds:new Set,changedIds:new Set}),Nm=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},xA=(t=>t?Nm(t):Nm),yA=t=>t;function bA(t,e=yA){const r=Rt.useSyncExternalStore(t.subscribe,Rt.useCallback(()=>e(t.getState()),[t,e]),Rt.useCallback(()=>e(t.getInitialState()),[t,e]));return Rt.useDebugValue(r),r}const Em=t=>{const e=xA(t),r=n=>bA(e,n);return Object.assign(r,e),r},gp=(t=>t?Em(t):Em),no=new Map;function CA(t,e,r){var O,$;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:w,setSettings:_,setPipelineDraft:S,setActiveBuild:N,setSessions:L,setIterationStates:A,setFeatureTimeline:j,EMPTY_CHANGES:I,appendDecisionEvent:z,setDecisionEventsSnapshot:W,setStatusSnapshot:D,clearStatusSnapshots:M}=r,F=j?B=>{j(T=>T.some(V=>V.id===B.id)?T:[...T,B])}:null;if(t.type==="visionState"||t.type==="hydrate"){const B=t.items||[];if(n.current){const T=n.current,V=new Set,rt=new Set;for(const P of B){const X=T.get(P.id);X?(X.status!==P.status||X.confidence!==P.confidence||X.title!==P.title)&&rt.add(P.id):V.add(P.id)}(V.size>0||rt.size>0)&&(m({newIds:V,changedIds:rt}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(I),800))}n.current=new Map(B.map(T=>[T.id,T])),u(B),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")D&&t.featureCode&&t.snapshot&&D(t.featureCode,t.snapshot);else if(t.type==="visionUI")x(t);else if(t.type==="agentActivity")g(B=>{const T=[...B,{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(B=>B!=null&&B.active?{...B,toolCount:(B.toolCount||0)+1}:B);else if(t.type==="agentSpawned")b(B=>[...B,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")b(B=>B.map(T=>T.agentId===t.agentId?{...T,silent:!0,silentSinceMs:t.silentSinceMs}:T));else if(t.type==="agentKilled")b(B=>B.map(T=>T.agentId===t.agentId?{...T,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:T));else if(t.type==="agentGC")((O=t.removed)==null?void 0:O.length)>0&&g(B=>{const T=[...B,{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(B=>B.map(T=>T.agentId===t.agentId?T.status==="killed"?T:{...T,status:t.status,completedAt:new Date().toISOString()}:T));else if(t.type==="agentRelay")w(B=>[...B,t].slice(-50));else if(t.type==="sessionStart")l.current&&(clearTimeout(l.current),l.current=null),b(()=>[]),w(()=>[]),C(B=>B&&B.id===t.sessionId?{...B,active:!0}:{id:t.sessionId,active:!0,startedAt:t.timestamp,source:t.source,toolCount:0,errorCount:0,summaries:[],featureCode:null,featureItemId:null,phaseAtBind:null,boundAt:null}),F&&F({id:`session-start-${t.sessionId}`,timestamp:t.timestamp,category:"session",title:"Session started",detail:t.source?`Source: ${t.source}`:null,severity:"info",sessionId:t.sessionId,meta:{source:t.source}});else if(t.type==="sessionEnd")l.current&&(clearTimeout(l.current),l.current=null),C(B=>B?{...B,active:!1,endedAt:t.timestamp,toolCount:t.toolCount,duration:t.duration,journalSpawned:t.journalSpawned,featureCode:t.featureCode||(B==null?void 0:B.featureCode)||null,phaseAtEnd:t.phaseAtEnd||null}:null),l.current=setTimeout(()=>{C(null),l.current=null},3e3),F&&F({id:`session-end-${t.sessionId||Date.now()}`,timestamp:t.timestamp,category:"session",title:`Session ended (${t.toolCount??0} tools)`,detail:null,severity:"info",sessionId:t.sessionId||null,meta:{toolCount:t.toolCount,duration:t.duration}});else if(t.type==="sessionSummary")C(B=>B&&{...B,summaries:[...B.summaries||[],{summary:t.summary,intent:t.intent,component:t.component,timestamp:t.timestamp}].slice(-5)});else if(t.type==="sessionBound")C(B=>B&&{...B,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(B=>{const T=[...B,{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(B=>B!=null&&B.active?{...B,errorCount:(B.errorCount||0)+1}:B),F&&F({id:`error-${t.timestamp}-${Math.random().toString(36).slice(2,6)}`,timestamp:t.timestamp||new Date().toISOString(),category:"error",title:t.message||`${t.errorType} error`,detail:t.tool?`Tool: ${t.tool}`:null,severity:t.severity==="error"?"error":"warning",sessionId:null,meta:{type:t.errorType,tool:t.tool}});else if(t.type==="gateCreated"||t.type==="gatePending")p({type:"pending",gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}),F&&F({id:`gate-created-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:t.fromPhase&&t.toPhase?`Gate: ${t.fromPhase} → ${t.toPhase}`:"Gate created",detail:null,severity:"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}});else if(t.type==="gateResolved"){if(f(V=>V.map(rt=>rt.id===t.gateId?{...rt,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:rt)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const V=t.itemId??(($=s.current.find(rt=>rt.id===t.gateId))==null?void 0:$.itemId)??t.gateId;p({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:V})}const B=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,T={approve:"success",revise:"warning",kill:"error"};F&&F({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${B}`,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(B=>{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 V=[...B,{tool:"iteration",category:t.loopType||"iteration",detail:T,items:[],timestamp:t.timestamp}];return V.length>20?V.slice(-20):V}),t.type==="iterationStarted")no.has(t.loopId)&&(clearTimeout(no.get(t.loopId)),no.delete(t.loopId)),A(B=>{const T=new Map(B);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")A(B=>{const T=B.get(t.loopId);if(!T)return B;const V=new Map(B);return V.set(t.loopId,{...T,count:t.count,maxIterations:t.maxIterations}),V});else if(t.type==="iterationComplete"){A(T=>{const V=T.get(t.loopId);if(!V)return T;const rt=new Map(T);return rt.set(t.loopId,{...V,status:"complete",outcome:t.outcome,count:t.finalCount??V.count}),rt});const B=setTimeout(()=>{A(T=>{const V=new Map(T);return V.delete(t.loopId),V}),no.delete(t.loopId)},5e3);no.set(t.loopId,B)}if(t.type==="iterationComplete"&&(t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit")){const B={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 V=[...T,{errorType:"iteration_limit",severity:"warning",message:B[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return V.length>10?V.slice(-10):V}),C(T=>T!=null&&T.active?{...T,errorCount:(T.errorCount||0)+1}:T)}if(F&&(t.type==="iterationStarted"||t.type==="iterationComplete")){const B=t.type==="iterationStarted"?`${t.loopType} loop started (0/${t.maxIterations})`:`${t.loopType??"loop"} loop ${t.outcome} (${t.finalCount} iterations)`;F({id:`iteration-${t.loopId}-${t.type}`,timestamp:t.timestamp,category:"iteration",title:B,detail:null,severity:t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit"?"warning":t.type==="iterationComplete"?"success":"info",sessionId:null,meta:{loopId:t.loopId,loopType:t.loopType}})}}else if(t.type==="lifecycleStarted")F&&F({id:`lifecycle-started-${t.itemId}`,timestamp:t.timestamp,category:"phase",title:`Lifecycle started: ${t.phase}`,detail:t.featureCode?`Feature: ${t.featureCode}`:null,severity:"success",sessionId:null,meta:{itemId:t.itemId,phase:t.phase,featureCode:t.featureCode}});else if(t.type==="lifecycleTransition"){const B=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",T=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";F&&F({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${B}`,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(B=>B.map(T=>{if(T.id!==t.itemId)return T;const V=T.lifecycle?{...T.lifecycle}:{};return V.lifecycle_ext={...V.lifecycle_ext||{},open_loops:t.loops},{...T,lifecycle:V}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(B=>B.map(T=>{if(T.id!==t.itemId)return T;const V=T.lifecycle?{...T.lifecycle}:{};return V.lifecycle_ext={...V.lifecycle_ext||{},drift_axes:t.drift_axes},{...T,lifecycle:V}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:B,itemId:T,...V}=t;u(rt=>rt.map(P=>{if(P.id!==T)return P;const X=P.lifecycle?{...P.lifecycle}:{};return X.lifecycle_ext={...X.lifecycle_ext||{},branch_lineage:V},{...P,lifecycle:X}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")_&&_(t.settings||null);else if(t.type==="buildState")N&&N(B=>{const T=(B==null?void 0:B.flowId)&&t.flowId&&B.flowId===t.flowId;return{...t,tierEvents:T?B.tierEvents??[]:[],capabilityEvents:T?B.capabilityEvents??[]:[],...T&&(B==null?void 0:B.health_score)!=null?{health_score:B.health_score,health_breakdown:B.health_breakdown,health_missing:B.health_missing}:{}}});else if(t.type==="pipelineDraft")S&&S(t);else if(t.type==="pipelineDraftResolved")S&&S(null);else if(t.type==="system"&&t.subtype==="health_score")N&&N(B=>B&&{...B,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"))N&&N(B=>B&&{...B,tierEvents:[...B.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")N&&N(B=>B&&{...B,capabilityEvents:[...B.capabilityEvents||[],t].slice(-200)});else if(t.type==="devicePaired")try{window.dispatchEvent(new CustomEvent("compose:devicePaired",{detail:{device_id:t.device_id,name:t.name,timestamp:t.timestamp}}))}catch{}else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:B}=e,T=i.current?i.current():{},V=B?B():{},rt=h.current;rt&&rt.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...T,dom:V,timestamp:new Date().toISOString()}}))}}function kA(){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 xe={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},Bm={newIds:new Set,changedIds:new Set},fr=gp((t,e)=>{async function r(o,a){const l=await jt(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}),jt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),jt("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),jt("/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);CA(a,{prevItemMapRef:{get current(){return xe.prevItemMap},set current(l){xe.prevItemMap=l}},snapshotProviderRef:{get current(){return xe.snapshotProvider},set current(l){xe.snapshotProvider=l}},gatesRef:{get current(){return xe.gates},set current(l){xe.gates=l}},pendingResolveIdsRef:{get current(){return xe.pendingResolveIds},set current(l){xe.pendingResolveIds=l}},changeTimerRef:{get current(){return xe.changeTimer},set current(l){xe.changeTimer=l}},sessionEndTimerRef:{get current(){return xe.sessionEndTimer},set current(l){xe.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=xe.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:kA},{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 xe.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:Bm})}catch{}}function s(){xe.disposed||xe.ws||(xe.ws=_S({url:()=>g0(),onOpen:n,onMessage:i,onClose:()=>t({connected:!1})}))}return jt("/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")),xe.buildPollInterval=setInterval(()=>{jt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),xe.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:Bm,agentActivity:[],agentErrors:[],recentErrors:[],spawnedAgents:[],agentRelays:[],sessionState:null,gates:[],gateEvent:null,settings:null,pipelineDraft:null,activeBuild:null,iterationStates:new Map,sessions:[],buildHistory:[],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=>{xe.snapshotProvider=o},setActiveBuild:o=>t({activeBuild:o}),setBuildHistory:o=>t({buildHistory:Array.isArray(o)?o:[]}),fetchBuildHistory:async()=>{try{const a=await(await jt("/api/builds")).json();t({buildHistory:Array.isArray(a.builds)?a.builds:[]})}catch{t({buildHistory:[]})}},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)=>{xe.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&&xe.pendingResolveIds.delete(o),h}catch{return xe.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}:{})})}}),vA=LS("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 mr({className:t,variant:e,...r}){return c.jsx("div",{className:st(vA({variant:e}),t),...r})}var wA=k.createContext(void 0);function SA(t){const e=k.useContext(wA);return t||e||"ltr"}function TA(t,[e,r]){return Math.min(r,Math.max(e,t))}function _A(t,e){return k.useReducer((r,n)=>e[r][n]??r,t)}var xp="ScrollArea",[Hy]=AS(xp),[jA,Br]=Hy(xp),Uy=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=k.useState(null),[h,u]=k.useState(null),[d,f]=k.useState(null),[p,m]=k.useState(null),[x,g]=k.useState(null),[y,C]=k.useState(0),[b,w]=k.useState(0),[_,S]=k.useState(!1),[N,L]=k.useState(!1),A=Ls(e,I=>l(I)),j=SA(i);return c.jsx(jA,{scope:r,type:n,dir:j,scrollHideDelay:s,scrollArea:a,viewport:h,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:S,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:L,onCornerWidthChange:C,onCornerHeightChange:w,children:c.jsx(As.div,{dir:j,...o,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...t.style}})})});Uy.displayName=xp;var Yy="ScrollAreaViewport",Vy=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Br(Yy,r),a=k.useRef(null),l=Ls(e,a,o.onViewportChange);return c.jsxs(c.Fragment,{children:[c.jsx(NA,{nonce:i}),c.jsx(As.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})})]})});Vy.displayName=Yy;var NA=k.memo(({nonce:t})=>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:t}),(t,e)=>t.nonce===e.nonce),rn="ScrollAreaScrollbar",yp=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Br(rn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return k.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?c.jsx(EA,{...n,ref:e,forceMount:r}):i.type==="scroll"?c.jsx(BA,{...n,ref:e,forceMount:r}):i.type==="auto"?c.jsx(Gy,{...n,ref:e,forceMount:r}):i.type==="always"?c.jsx(bp,{...n,ref:e,"data-state":"visible"}):null});yp.displayName=rn;var EA=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Br(rn,t.__scopeScrollArea),[s,o]=k.useState(!1);return k.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(Cc,{present:r||s,children:c.jsx(Gy,{"data-state":s?"visible":"hidden",...n,ref:e})})}),BA=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Br(rn,t.__scopeScrollArea),s=t.orientation==="horizontal",o=Bc(()=>l("SCROLL_END"),100),[a,l]=_A("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 k.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,i.scrollHideDelay,l]),k.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(Cc,{present:r||a!=="hidden",children:c.jsx(bp,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:pi(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:pi(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Gy=k.forwardRef((t,e)=>{const r=Br(rn,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=k.useState(!1),a=t.orientation==="horizontal",l=Bc(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?h:u)}},10);return ks(r.viewport,l),ks(r.content,l),c.jsx(Cc,{present:n||s,children:c.jsx(bp,{"data-state":s?"visible":"hidden",...i,ref:e})})}),bp=k.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Br(rn,t.__scopeScrollArea),s=k.useRef(null),o=k.useRef(0),[a,l]=k.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=Jy(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 PA(f,o.current,a,p)}return r==="horizontal"?c.jsx(LA,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollLeft,p=Lm(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(AA,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollTop,p=Lm(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}),LA=k.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Br(rn,t.__scopeScrollArea),[o,a]=k.useState(),l=k.useRef(null),h=Ls(e,l,s.onScrollbarXChange);return k.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Ky,{"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":Ec(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),eb(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:Fl(o.paddingLeft),paddingEnd:Fl(o.paddingRight)}})}})}),AA=k.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Br(rn,t.__scopeScrollArea),[o,a]=k.useState(),l=k.useRef(null),h=Ls(e,l,s.onScrollbarYChange);return k.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Ky,{"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":Ec(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),eb(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:Fl(o.paddingTop),paddingEnd:Fl(o.paddingBottom)}})}})}),[MA,Xy]=Hy(rn),Ky=k.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=Br(rn,r),[m,x]=k.useState(null),g=Ls(e,A=>x(A)),y=k.useRef(null),C=k.useRef(""),b=p.viewport,w=n.content-n.viewport,_=li(u),S=li(l),N=Bc(d,10);function L(A){if(y.current){const j=A.clientX-y.current.left,I=A.clientY-y.current.top;h({x:j,y:I})}}return k.useEffect(()=>{const A=j=>{const I=j.target;(m==null?void 0:m.contains(I))&&_(j,w)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[b,m,w,_]),k.useEffect(S,[n,S]),ks(m,N),ks(p.content,N),c.jsx(MA,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:li(s),onThumbPointerUp:li(o),onThumbPositionChange:S,onThumbPointerDown:li(a),children:c.jsx(As.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:pi(t.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),y.current=m.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),L(A))}),onPointerMove:pi(t.onPointerMove,L),onPointerUp:pi(t.onPointerUp,A=>{const j=A.target;j.hasPointerCapture(A.pointerId)&&j.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=C.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Il="ScrollAreaThumb",Qy=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Xy(Il,t.__scopeScrollArea);return c.jsx(Cc,{present:r||i.hasThumb,children:c.jsx(IA,{ref:e,...n})})}),IA=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Br(Il,r),o=Xy(Il,r),{onThumbPositionChange:a}=o,l=Ls(e,d=>o.onThumbChange(d)),h=k.useRef(void 0),u=Bc(()=>{h.current&&(h.current(),h.current=void 0)},100);return k.useEffect(()=>{const d=s.viewport;if(d){const f=()=>{if(u(),!h.current){const p=DA(d,a);h.current=p,a()}};return a(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[s.viewport,u,a]),c.jsx(As.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:pi(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:pi(t.onPointerUp,o.onThumbPointerUp)})});Qy.displayName=Il;var Cp="ScrollAreaCorner",Zy=k.forwardRef((t,e)=>{const r=Br(Cp,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?c.jsx(FA,{...t,ref:e}):null});Zy.displayName=Cp;var FA=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Br(Cp,r),[s,o]=k.useState(0),[a,l]=k.useState(0),h=!!(s&&a);return ks(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),l(u)}),ks(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),h?c.jsx(As.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 Fl(t){return t?parseInt(t,10):0}function Jy(t,e){const r=t/e;return isNaN(r)?0:r}function Ec(t){const e=Jy(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function PA(t,e,r,n="ltr"){const i=Ec(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 tb([l,h],d)(t)}function Lm(t,e,r="ltr"){const n=Ec(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=TA(t,l);return tb([0,o],[0,a])(h)}function tb(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 eb(t,e){return t>0&&t<e}var DA=(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 Bc(t,e){const r=li(t),n=k.useRef(0);return k.useEffect(()=>()=>window.clearTimeout(n.current),[]),k.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function ks(t,e){const r=li(e);MS(()=>{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 rb=Uy,OA=Vy,$A=Zy;const Hn=k.forwardRef(({className:t,children:e,...r},n)=>c.jsxs(rb,{ref:n,className:st("relative overflow-hidden",t),...r,children:[c.jsx(OA,{className:"h-full w-full rounded-[inherit]",children:e}),c.jsx(nb,{}),c.jsx($A,{})]}));Hn.displayName=rb.displayName;const nb=k.forwardRef(({className:t,orientation:e="vertical",...r},n)=>c.jsx(yp,{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(Qy,{className:"relative flex-1 rounded-full bg-border"})}));nb.displayName=yp.displayName;var RA="Separator",Am="horizontal",zA=["horizontal","vertical"],ib=k.forwardRef((t,e)=>{const{decorative:r,orientation:n=Am,...i}=t,s=WA(n)?n:Am,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return c.jsx(As.div,{"data-orientation":s,...a,...i,ref:e})});ib.displayName=RA;function WA(t){return zA.includes(t)}var sb=ib;const Pl=k.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>c.jsx(sb,{ref:i,decorative:r,orientation:e,className:st("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Pl.displayName=sb.displayName;function qA({agentId:t,status:e}){const[r,n]=k.useState(""),[i,s]=k.useState(""),o=k.useRef(null),a=k.useRef(!1),l=k.useCallback(()=>{const d=o.current;d&&(a.current=d.scrollTop+d.clientHeight<d.scrollHeight-20)},[]);k.useEffect(()=>{const d=o.current;d&&!a.current&&(d.scrollTop=d.scrollHeight)},[r,i]),k.useEffect(()=>{if(!t)return;const d=async()=>{try{const f=await jt(`/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 HA=Rt.memo(qA);function UA(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 YA({agentId:t,relays:e}){const r=k.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:UA(n.timestamp)})]},n.id||i)})})]})}const VA=Rt.memo(YA),GA={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},Mm={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function jh(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 XA=Rt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Rt.useState(0);Rt.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 KA({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,C;const[a,l]=Rt.useState(null),[h,u]=Rt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Rt.useState(0),[f,p]=Rt.useState([]),m=Rt.useRef(null);return Rt.useEffect(()=>{const b=w=>u(w.detail);return window.addEventListener("compose:agent-status",b),()=>window.removeEventListener("compose:agent-status",b)},[]),Rt.useEffect(()=>{if(h.status!=="working")return;const b=setInterval(()=>d(w=>w+1),1e3);return()=>clearInterval(b)},[h.status]),Rt.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]),Rt.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:w=>{w.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(HA,{agentId:a,status:(x=i.find(b=>b.agentId===a))==null?void 0:x.status}),c.jsx(VA,{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(XA,{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"?GA[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:jh(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,w,_)=>c.jsx("div",{className:"h-1 rounded-full",title:`${b.tool||"thinking"} — ${jh(b.duration)}`,style:{width:Math.max(4,Math.min(16,(b.duration||0)/1e3*2)),background:Mf[b.category]||(h.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+w/_.length*.6}},w))}),t&&t.length>0&&c.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((b,w)=>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:Mf[b.category]},children:b.category}),b.error?c.jsx("span",{className:"truncate",title:b.error.type,children:Mm[b.error.type]||b.error.type}):b.detail?c.jsx("span",{className:"truncate opacity-60",title:b.detail,children:b.detail.split("/").pop()}):null]},w))}),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,w)=>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:Mm[b.errorType]||b.errorType}),c.jsx("span",{className:"truncate opacity-70",title:b.message,children:b.message})]},w))]}),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:jh(Date.now()-new Date(b.startedAt).getTime())})]},b.agentId))]})]})})]})]})}const QA=Rt.memo(KA),Po={DECISION:1,PENDING_GATE:2,BLOCKED:3};function ob(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,Po.BLOCKED,"Blocked"),r.has(s.id)&&i(s,Po.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,Po.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function ZA(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 ab(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=ob(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function JA(t,e){return t&&t===e?null:e}const t3={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"}},e3={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function kp({status:t,className:e}){const r=t3[t]||e3,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 r3={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"},n3="text-slate-400 bg-slate-500/10 border-slate-500/20";function i3({phase:t,className:e}){const r=r3[t]||n3;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 Ln(t,e={}){const r=await jt(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let Nh=null;function lb(t){if(Nh)return;const e=new WebSocket(g0());Nh=e,e.onmessage=r=>{try{const n=JSON.parse(r.data);n.type==="ideaboxUpdated"&&t(n)}catch{}},e.onclose=()=>{Nh=null,setTimeout(()=>{lb(t)},3e3)},e.onerror=()=>{}}const vs=gp((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{lb(()=>{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 Ln("/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 Ln("/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 Ln(`/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 Ln(`/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 Ln(`/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 Ln(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await Ln(`/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 Ln(`/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 s3({activeBuild:t}){const e=ZA(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(jl,{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 o3({items:t,gates:e,onSelectItem:r}){const n=Rt.useMemo(()=>ob(t,e),[t,e]),[i,s]=Rt.useState(!1);if(n.length===0)return null;const o=i?n:n.slice(0,5),a=n.length-5,l=h=>h===Po.BLOCKED?c.jsx(vc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):h===Po.PENDING_GATE?c.jsx(XT,{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"}),o.map(({item:h,priority:u,reason:d})=>c.jsxs("button",{onClick:()=>r==null?void 0:r(h.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:d,children:[l(u),c.jsx("span",{className:"truncate flex-1 text-left",children:h.title}),h.phase&&c.jsx(i3,{phase:h.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),c.jsx(kp,{status:h.status,className:"shrink-0"})]},h.id)),a>0&&c.jsx("button",{onClick:()=>s(h=>!h),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:i?"Show less":`+${a} more`})]})}function a3({items:t,gates:e}){const r=Rt.useMemo(()=>ab(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 l3=new Set(["planned","ready","in_progress","review","blocked","parked"]);function c3({items:t,hiddenGroups:e,onToggleGroup:r}){const n=Rt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!l3.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 h3({onViewChange:t}){const e=vs(n=>n.ideas),r=Rt.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(yi,{className:"h-3 w-3 shrink-0 text-amber-400"}),c.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function cb({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:w,onSelectItem:_,onStopAgent:S,onThemeChange:N,onNewItem:L,widthPx:A}){const j=t||[],I=e||[],z=Rt.useMemo(()=>ab(j,I),[j,I]),[W,D]=Rt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Rt.useEffect(()=>{if(typeof document>"u")return;const F=new MutationObserver(()=>{D(document.documentElement.classList.contains("dark"))});return F.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>F.disconnect()},[]);const M=Rt.useCallback(()=>{const F=!W,O=F?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",F);try{localStorage.setItem("compose:theme",O)}catch{}N&&N({ui:{theme:O}})},[W,N]);return Rt.useCallback(F=>{s&&s(JA(i,F))},[s,i]),c.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:A??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(Tl,{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(r_,{className:"h-3.5 w-3.5"}):c.jsx(MT,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(a3,{items:j,gates:I})]}),c.jsx(s3,{activeBuild:r}),c.jsx(QA,{agentActivity:g,agentErrors:y,sessionState:w,onSelectItem:_,onStopAgent:S,spawnedAgents:C,agentRelays:b}),z.attentionCount>0&&c.jsxs(c.Fragment,{children:[c.jsx(Pl,{className:"bg-sidebar-border"}),c.jsx(o3,{items:j,gates:I,onSelectItem:_,onViewChange:n})]}),c.jsx(h3,{onViewChange:n}),c.jsx("div",{className:"px-3 pb-2",children:c.jsxs("div",{className:"relative",children:[c.jsx(bn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(Od,{placeholder:"Search...",value:p,onChange:F=>m(F.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),c.jsx(Pl,{className:"bg-sidebar-border"}),c.jsx(Hn,{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(c3,{items:j,hiddenGroups:d,onToggleGroup:f})]})})]})}function u3({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 pa({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}function Lc({icon:t=CT,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(Pt,{variant:"outline",size:"sm",onClick:i,children:n})]})}const Im=[{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"]}],d3=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function Fm({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 hb({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=gr[t.type]||gr.task,d=qn[t.status]||qn.planned,{newIds:f,changedIds:p}=k.useContext(Nc),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(Ms,{className:"h-3.5 w-3.5"}):c.jsx(xi,{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(u3,{level:t.confidence||0}),t.phase&&c.jsx(mr,{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(hb,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function ub({items:t,connections:e,selectedItemId:r,onSelect:n,onCreate:i,onCreateFeature:s,isEmptyProject:o,featureCode:a,focusActive:l,onToggleFocus:h}){const[u,d]=k.useState(()=>new Set),[f,p]=k.useState(""),[m,x]=k.useState("all"),[g,y]=k.useState("all"),C=k.useCallback(N=>{d(L=>{const A=new Set(L);return A.has(N)?A.delete(N):A.add(N),A})},[]),b=k.useMemo(()=>{let N=t;const L=Im.find(A=>A.key===m);if(L!=null&&L.statuses&&(N=N.filter(A=>L.statuses.includes(A.status||"planned"))),g!=="all"&&(N=N.filter(A=>A.type===g)),f){const A=f.toLowerCase();N=N.filter(j=>(j.title||"").toLowerCase().includes(A)||(j.description||"").toLowerCase().includes(A)||(j.type||"").toLowerCase().includes(A)||(j.phase||"").toLowerCase().includes(A))}return l&&a&&(N=N.filter(A=>{var j;return A.featureCode===a||((j=A.lifecycle)==null?void 0:j.featureCode)===a||(A.title||"").includes(a)})),N},[t,f,m,g,l,a]),w=k.useMemo(()=>{const N=new Set(b.map(z=>z.id)),L=new Map;for(const z of b)L.set(z.id,{...z,_children:[]});const A=new Map;for(const z of e)!N.has(z.fromId)||!N.has(z.toId)||(z.type==="informs"?A.has(z.toId)||A.set(z.toId,z.fromId):(z.type==="supports"||z.type==="blocks")&&(A.has(z.fromId)||A.set(z.fromId,z.toId)));for(const z of t)z.parentId&&L.has(z.parentId)&&A.set(z.id,z.parentId);for(const[z]of A){const W=new Set;let D=z;for(;D&&A.has(D);){if(W.has(D)){A.delete(D);break}W.add(D),D=A.get(D)}}const j=[];for(const z of L.values()){const W=A.get(z.id);W&&L.has(W)?L.get(W)._children.push(z):j.push(z)}const I=z=>{z.sort((W,D)=>(W.confidence||0)-(D.confidence||0));for(const W of z)W._children.length>0&&I(W._children)};return I(j),j},[b,e]);Rt.useEffect(()=>{if(f){const N=new Set,L=A=>{for(const j of A)j._children.length>0&&(N.add(j.id),L(j._children))};L(w),d(N)}else u.size===0&&w.length>0&&d(new Set(w.map(N=>N.id)))},[w,f]),Rt.useEffect(()=>{if(!r||w.length===0)return;const N=[],L=(A,j)=>{for(const I of A){if(I.id===j)return!0;if(I._children.length>0&&L(I._children,j))return N.push(I.id),!0}return!1};L(w,r),N.length>0&&d(A=>{const j=new Set(A);for(const I of N)j.add(I);return j}),requestAnimationFrame(()=>{const A=document.querySelector(`[data-item-id="${r}"]`);A&&A.scrollIntoView({block:"center",behavior:"smooth"})})},[r,w]);const _=k.useCallback(()=>{const N=new Set,L=A=>{for(const j of A)j._children.length>0&&(N.add(j.id),L(j._children))};L(w),d(N)},[w]),S=k.useCallback(()=>{d(new Set)},[]);return w.filter(N=>N._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(pa,{featureCode:a,active:l,onToggle:h}),c.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[c.jsx(bn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(Od,{placeholder:"Search items...",value:f,onChange:N=>p(N.target.value),className:"h-7 pl-7 pr-7 text-xs"}),f&&c.jsx("button",{onClick:()=>p(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c.jsx(tn,{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:"}),Im.map(N=>c.jsx(Fm,{active:m===N.key,onClick:()=>x(N.key),children:N.label},N.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:"}),d3.map(N=>c.jsx(Fm,{active:g===N.key,onClick:()=>y(N.key),children:N.label},N.key))]}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[b.length,f||m!=="all"||g!=="all"?`/${t.length}`:""]}),c.jsx("div",{className:"flex-1"}),c.jsx("button",{onClick:_,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(Tl,{className:"h-3.5 w-3.5"})})]}),c.jsx(Hn,{className:"flex-1",children:c.jsx("div",{className:"py-1",children:w.length===0?o?c.jsx(Lc,{icon:Tl,title:"No items yet",description:"Create your first feature to start building in the cockpit.",action:s?"Create your first feature":void 0,onAction:s,className:"py-8"}):c.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No items match the current filters"}):w.map(N=>c.jsx(hb,{item:N,children:N._children,depth:0,selectedItemId:r,onSelect:n,onToggle:C,expandedIds:u},N.id))})})]})}try{la.use(C0)}catch{}try{la.use(DS)}catch{}const Dl={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},p3=Object.fromEntries(Object.entries(gr).map(([t,e])=>{const r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16),s=[15,23,42],o=.15,a=[Math.round(s[0]*(1-o)+r*o),Math.round(s[1]*(1-o)+n*o),Math.round(s[2]*(1-o)+i*o)];return[t,`#${a.map(l=>l.toString(16).padStart(2,"0")).join("")}`]})),f3=[1,1.5,2,2.5,3],ju={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"}},Pm=[{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 wo(t){return t.group||"other"}const Dm=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,Eh=24;function m3(t){if(!t||t.length<=Eh)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>Eh-1)break;r=i}return(r||t.slice(0,Eh-1))+"…"}function g3(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&Dm.test(e))return e;if(t.id&&Dm.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?m3(t.slug):t.id?t.id.slice(0,12):"item"}function Om(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(`
|
|
324
|
-
`)}function x3(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=>wo(f)).filter(Boolean))].map(f=>{const p=t.filter(y=>wo(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=>wo(g)===f&&a.has(g.id));s.push({data:{id:`group-${f}`,label:`${Om(f)}
|
|
325
|
-
(${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=Om(g3(u),14),p=wo(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=ju[u.type]||ju.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 y3(){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(Dl).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(p3).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...f3.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 b3({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=Dl[n.status]||Dl.planned,s=gr[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(Bh,{color:i,children:(n.status||"planned").replace("_"," ")}),c.jsx(Bh,{color:s,children:n.itemType}),n.phase&&c.jsx(Bh,{color:"#94a3b8",children:Nl[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:[Xd[n.confidence||0]," confidence"]})]})}function C3({data:t,onApply:e,onClose:r}){const{x:n,y:i,currentGroup:s}=t,[o,a]=k.useState(s||""),l=k.useRef(null);k.useEffect(()=>{var f,p;(f=l.current)==null||f.focus(),(p=l.current)==null||p.select()},[]),k.useEffect(()=>{const f=p=>{p.key==="Escape"&&r()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[r]),k.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 Bh({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 db={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function io({active:t,onClick:e,children:r}){return c.jsx("button",{onClick:e,style:{...db,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function so({onClick:t,children:e,title:r}){return c.jsx("button",{onClick:t,title:r,style:{...db,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function oo(){return c.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const k3=["build-building","build-gate-pending","build-blocked-downstream","build-error"],v3={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 w3({badge:t,onClick:e}){const r=v3[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 S3({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 pb({items:t,connections:e,selectedItemId:r,onSelect:n,onCreateFeature:i,isEmptyProject:s,visibleTracks:o,hiddenGroups:a,buildStateMap:l,resolveGate:h,gates:u,spawnedAgents:d,agentRelays:f,agentOverlay:p,featureCode:m,focusActive:x,onToggleFocus:g}){const y=k.useRef(null),C=k.useRef(null),b=k.useRef({}),w=k.useRef(!1),_=k.useRef({}),S=k.useRef(null),[N,L]=k.useState(null),[A,j]=k.useState("active"),[I,z]=k.useState(!0),[W,D]=k.useState(!1),[M,F]=k.useState(null),[O,$]=k.useState(null),[B,T]=k.useState([]),[V,rt]=k.useState(!1),[P,X]=k.useState(!1),ut=vs(q=>q.ideas);k.useEffect(()=>{let q=!1;return jt("/api/graph/layout").then(J=>J.ok?J.json():{positions:{}}).then(J=>{if(q)return;b.current=J.positions||{},w.current=!0;const H=C.current;H&&Wt(H)}).catch(()=>{w.current=!0}),()=>{q=!0}},[]);const xt=k.useCallback(()=>{const q=_.current;_.current={},S.current=null,Object.keys(q).length&&jt("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:q})}).catch(J=>console.warn("[graph-layout] save failed:",J))},[]),Dt=k.useCallback(q=>{Object.assign(_.current,q),Object.assign(b.current,q),S.current&&clearTimeout(S.current),S.current=setTimeout(xt,500)},[xt]),Wt=k.useCallback(q=>{const J=b.current,H={};q.nodes("node[status]").forEach(et=>{const at=et.data();if(at.isAgentNode||at.isIdeaNode)return;const ft=et.id(),_t=J[ft];if(_t&&Number.isFinite(_t.x)&&Number.isFinite(_t.y))et.position({x:_t.x,y:_t.y});else{const te=et.position();Number.isFinite(te.x)&&Number.isFinite(te.y)&&(H[ft]={x:te.x,y:te.y})}}),Object.keys(H).length&&Dt(H)},[Dt]),lt=k.useRef(!1);k.useEffect(()=>{const q=d==null?void 0:d.some(J=>J.status==="running");q&&!lt.current?rt(!0):!q&<.current&&(d==null?void 0:d.length)>0&&rt(!1),lt.current=!!q},[d]);const K=k.useMemo(()=>t.filter(q=>{const J=q.title||"";return!J.startsWith("`docs/")&&!J.startsWith("docs/")}),[t]),it=k.useMemo(()=>{let q=K;const J=Pm.find(H=>H.key===A);if(J!=null&&J.statuses&&(q=q.filter(H=>J.statuses.includes(H.status||"planned"))),o){const H=et=>{const at=(et.description||"").match(/Track:\s*(\w+)/i);return at?at[1].toLowerCase():et.type||"other"};q=q.filter(et=>o.has(H(et)))}return(a==null?void 0:a.size)>0&&(q=q.filter(H=>!a.has(wo(H)))),q},[K,A,o,a]),wt=k.useMemo(()=>{const q=new Set(it.map(J=>J.id));return e.filter(J=>q.has(J.fromId)&&q.has(J.toId))},[e,it]),gt=k.useMemo(()=>!p||!p.nodes.length?[]:[...p.nodes,...p.edges],[d]),Jt=k.useMemo(()=>{if(!P)return[];new Set(it.map(J=>J.id));const q=[];for(const J of ut){if(!J.mapsTo)continue;const H=`idea-${J.id}`;q.push({data:{id:H,label:`${J.id}
|
|
326
|
-
${J.title.slice(0,20)}${J.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:J.id},classes:"idea-node"});const et=J.mapsTo.split(",").map(at=>at.trim()).filter(Boolean);for(const at of et){const ft=it.find(_t=>{var te;return((te=_t.lifecycle)==null?void 0:te.featureCode)===at||_t.featureCode===at||(_t.title||"").startsWith(at)});ft&&q.push({data:{id:`idea-edge-${J.id}-${ft.id}`,source:H,target:ft.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return q},[P,ut,it]),It=k.useMemo(()=>{let J=x3(it,wt,I,x,m);return V&>.length>0&&(J=[...J,...gt]),P&&Jt.length>0&&(J=[...J,...Jt]),J},[it,wt,I,V,gt,P,Jt,x,m]),Xt=k.useMemo(()=>y3(),[]);k.useEffect(()=>{if(!y.current)return;C.current&&(C.current.destroy(),C.current=null);const q=la({container:y.current,elements:It,style:Xt,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(C.current=q,q.one("layoutstop",()=>{w.current&&Wt(q),q.fit(void 0,30)}),q.fit(void 0,30),q.on("dragfree","node[status]",J=>{const H=J.target,et=H.data();if(et.isAgentNode||et.isIdeaNode)return;const at=H.position();!Number.isFinite(at.x)||!Number.isFinite(at.y)||Dt({[H.id()]:{x:at.x,y:at.y}})}),r){const J=q.$id(r);J.length&&Lh(q,J)}return q.on("mouseover","node[status]",J=>{const H=J.renderedPosition||J.position,et=q.container().getBoundingClientRect();L({x:et.left+H.x,y:et.top+H.y,item:J.target.data()})}),q.on("mousemove","node[status]",J=>{const H=J.renderedPosition||J.position,et=q.container().getBoundingClientRect();L(at=>at?{x:et.left+H.x,y:et.top+H.y,item:at.item}:null)}),q.on("mouseout","node[status]",()=>L(null)),q.on("tap","node[status]",J=>{Ae.current=!0,Lh(q,J.target),n(J.target.id())}),q.on("tap",J=>{J.target===q&&q.elements().removeClass("dimmed highlighted")}),q.on("cxttap","node[status]",J=>{var ft;const H=J.target.data();if(H.isAgentNode||H.isIdeaNode||H.isGroup)return;try{(ft=J.originalEvent)==null||ft.preventDefault()}catch{}const et=J.renderedPosition||J.position,at=q.container().getBoundingClientRect();$({x:at.left+et.x,y:at.top+et.y,itemId:J.target.id(),currentGroup:H.group||""}),L(null)}),q.container().addEventListener("contextmenu",J=>J.preventDefault()),()=>{S.current&&(clearTimeout(S.current),xt()),q.destroy(),C.current=null}},[It,Xt]);const Ae=k.useRef(!1);k.useEffect(()=>{const q=C.current;if(!q||!r)return;const J=q.$id(r);J.length&&(q.elements().removeClass("dimmed highlighted"),Lh(q,J),Ae.current||q.animate({center:{eles:J},duration:200}),Ae.current=!1)},[r]),k.useEffect(()=>{const q=C.current;if(q&&(q.nodes().removeClass(k3.join(" ")),!(!l||Object.keys(l).length===0)))for(const[J,H]of Object.entries(l)){const et=`build-${H.replace(/_/g,"-")}`,at=q.nodes().filter(ft=>{const _t=ft.data();return _t.slug===J||_t.title===J||_t.featureCode===J});at.length&&at.addClass(et)}},[l]),k.useEffect(()=>{const q=C.current;if(!q||!l||!Object.values(l).includes("building"))return;let H=!0;const et=setInterval(()=>{const at=q.nodes(".build-building");at.length&&(H=!H,at.style("shadow-blur",H?12:4),at.style("shadow-opacity",H?.6:.2))},800);return()=>clearInterval(et)},[l]),k.useEffect(()=>{var at;const q=C.current;if(!q||(q.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!V||!((at=p==null?void 0:p.activeEdgeIds)!=null&&at.size)))return;const J=new Set((d||[]).map(ft=>ft.agentId)),H=ft=>ft==="session"?"agent-session":J.has(ft)?`agent-${ft}`:"agent-session";for(const ft of p.activeEdgeIds){const _t=q.getElementById(ft);if(_t.length){const te=f==null?void 0:f.findLast(fe=>{const we=H(fe.fromAgentId),qe=H(fe.toAgentId);return(fe.direction==="dispatch"?`relay-${we}-${qe}`:`relay-${qe}-${we}`)===ft});_t.addClass((te==null?void 0:te.direction)==="result"?"relay-result":"relay-active")}}const et=setInterval(()=>{const ft=q.edges(".relay-active, .relay-result");if(!ft.length)return;const _t=Date.now()/20%100;ft.style("line-dash-offset",-_t)},50);return()=>clearInterval(et)},[V,p==null?void 0:p.activeEdgeIds,f]);const Kt=k.useCallback(()=>{const q=C.current;if(!q||!l||Object.keys(l).length===0){T([]);return}const J=[];for(const[H,et]of Object.entries(l)){if(et!=="gate_pending"&&et!=="error"&&et!=="building")continue;const at=q.nodes().filter(te=>{const fe=te.data();return fe.slug===H||fe.title===H||fe.featureCode===H});if(!at.length)continue;const ft=at.renderedPosition(),_t=at.renderedOuterWidth();J.push({featureCode:H,state:et,x:ft.x+_t/2-6,y:ft.y-at.renderedOuterHeight()/2-6,nodeId:at.id()})}T(J)},[l]);k.useEffect(()=>{const q=C.current;if(q)return q.on("render pan zoom",Kt),Kt(),()=>{q.removeListener("render pan zoom",Kt)}},[Kt]);const yr=k.useCallback(()=>{var q;return(q=C.current)==null?void 0:q.fit(void 0,40)},[]),he=k.useCallback(()=>{const q=C.current;q&&q.zoom({level:q.zoom()*1.3,renderedPosition:{x:q.width()/2,y:q.height()/2}})},[]),Ie=k.useCallback(()=>{const q=C.current;q&&q.zoom({level:q.zoom()/1.3,renderedPosition:{x:q.width()/2,y:q.height()/2}})},[]),We=k.useCallback(()=>{window.open("/api/export/roadmap-graph","_blank","noopener")},[]),ue=k.useCallback(async()=>{try{const q=await jt("/api/export/roadmap-graph/save",{method:"POST",headers:Dr({"Content-Type":"application/json"})}),J=await q.json().catch(()=>({}));q.ok&&J.ok?se(`Saved ${J.path}`,"info"):se(J.error||`Export save failed (HTTP ${q.status})`,"error")}catch(q){se(`Export save failed: ${q.message}`,"error")}},[]);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(pa,{featureCode:m,active:x,onToggle:g}),m&&c.jsx(oo,{}),c.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),Pm.map(q=>c.jsx(io,{active:A===q.key,onClick:()=>j(q.key),children:q.label},q.key)),c.jsx(oo,{}),c.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[it.length," items · ",wt.length," edges"]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(io,{active:I,onClick:()=>z(!I),children:"Group"}),c.jsx(io,{active:V,onClick:()=>rt(q=>!q),title:"Show/hide agent topology",children:"Agents"}),c.jsx(io,{active:P,onClick:()=>X(q=>!q),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),c.jsx(oo,{}),c.jsx(so,{onClick:Ie,title:"Zoom out",children:"−"}),c.jsx(so,{onClick:yr,title:"Fit to view",children:"Fit"}),c.jsx(so,{onClick:he,title:"Zoom in",children:"+"}),c.jsx(oo,{}),c.jsx(so,{onClick:We,title:"Open roadmap graph HTML export in a new tab",children:"Export"}),c.jsx(so,{onClick:ue,title:"Save roadmap graph export to docs/roadmap-graph.html",children:"Save HTML"}),c.jsx(oo,{}),c.jsx(io,{active:W,onClick:()=>D(!W),children:"Legend"})]})]})}),it.length===0&&!V?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("div",{style:{textAlign:"center"},children:s?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items yet"}),c.jsx("div",{style:{fontSize:11,color:"#475569",marginBottom:10},children:"Create your first feature to start building in the cockpit."}),i&&c.jsx("button",{onClick:i,style:{fontSize:11,color:"#e2e8f0",background:"#1e293b",border:"1px solid #334155",borderRadius:6,padding:"5px 12px",cursor:"pointer"},children:"Create your first feature"})]}):c.jsxs(c.Fragment,{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:y,className:"w-full h-full"}),W&&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(Ah,{title:"Types",children:Object.entries(gr).map(([q,J])=>c.jsxs(Ih,{children:[c.jsx($m,{color:J}),q]},q))}),c.jsx(Mh,{}),c.jsx(Ah,{title:"Status",children:Object.entries(Dl).map(([q,J])=>c.jsxs(Ih,{children:[c.jsx($m,{color:J}),q.replace("_"," ")]},q))}),c.jsx(Mh,{}),c.jsx(Ah,{title:"Edges",children:Object.entries(ju).map(([q,J])=>c.jsxs(Ih,{children:[c.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:c.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:J.color,strokeWidth:"1.5",strokeDasharray:J.style==="dashed"?"6,3":"none"})}),q]},q))}),c.jsx(Mh,{}),c.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",c.jsx("br",{}),"Click node to trace deps"]})]}),c.jsx(b3,{data:N}),O&&c.jsx(C3,{data:O,onClose:()=>$(null),onApply:q=>{const J=O.itemId;$(null),jt(`/api/vision/items/${J}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:q||null})}).catch(H=>console.warn("[graph] group update failed:",H))}}),B.map(q=>c.jsx(w3,{badge:q,onClick:q.state==="gate_pending"?()=>F(M===q.featureCode?null:q.featureCode):q.state==="error"?()=>n(q.nodeId):void 0},q.featureCode)),M&&c.jsx(S3,{featureCode:M,gates:u,items:t,badgePositions:B,onResolve:(q,J)=>{h&&h(q,J),F(null)},onClose:()=>F(null)})]})]})}function Lh(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 Ah({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 Mh(){return c.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function Ih({children:t}){return c.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function $m({color:t}){return c.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var cl={exports:{}},T3=cl.exports,Rm;function _3(){return Rm||(Rm=1,(function(t,e){(function(r,n){t.exports=n()})(T3,(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(D){var M=["th","st","nd","rd"],F=D%100;return"["+D+(M[(F-20)%10]||M[F]||M[0])+"]"}},b=function(D,M,F){var O=String(D);return!O||O.length>=M?D:""+Array(M+1-O.length).join(F)+D},w={s:b,z:function(D){var M=-D.utcOffset(),F=Math.abs(M),O=Math.floor(F/60),$=F%60;return(M<=0?"+":"-")+b(O,2,"0")+":"+b($,2,"0")},m:function D(M,F){if(M.date()<F.date())return-D(F,M);var O=12*(F.year()-M.year())+(F.month()-M.month()),$=M.clone().add(O,d),B=F-$<0,T=M.clone().add(O+(B?-1:1),d);return+(-(O+(F-$)/(B?$-T:T-$))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:d,y:p,w:u,d:h,D:m,h:l,m:a,s:o,ms:s,Q:f}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},_="en",S={};S[_]=C;var N="$isDayjsObject",L=function(D){return D instanceof z||!(!D||!D[N])},A=function D(M,F,O){var $;if(!M)return _;if(typeof M=="string"){var B=M.toLowerCase();S[B]&&($=B),F&&(S[B]=F,$=B);var T=M.split("-");if(!$&&T.length>1)return D(T[0])}else{var V=M.name;S[V]=M,$=V}return!O&&$&&(_=$),$||!O&&_},j=function(D,M){if(L(D))return D.clone();var F=typeof M=="object"?M:{};return F.date=D,F.args=arguments,new z(F)},I=w;I.l=A,I.i=L,I.w=function(D,M){return j(D,{locale:M.$L,utc:M.$u,x:M.$x,$offset:M.$offset})};var z=(function(){function D(F){this.$L=A(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[N]=!0}var M=D.prototype;return M.parse=function(F){this.$d=(function(O){var $=O.date,B=O.utc;if($===null)return new Date(NaN);if(I.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var T=$.match(g);if(T){var V=T[2]-1||0,rt=(T[7]||"0").substring(0,3);return B?new Date(Date.UTC(T[1],V,T[3]||1,T[4]||0,T[5]||0,T[6]||0,rt)):new Date(T[1],V,T[3]||1,T[4]||0,T[5]||0,T[6]||0,rt)}}return new Date($)})(F),this.init()},M.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},M.$utils=function(){return I},M.isValid=function(){return this.$d.toString()!==x},M.isSame=function(F,O){var $=j(F);return this.startOf(O)<=$&&$<=this.endOf(O)},M.isAfter=function(F,O){return j(F)<this.startOf(O)},M.isBefore=function(F,O){return this.endOf(O)<j(F)},M.$g=function(F,O,$){return I.u(F)?this[O]:this.set($,F)},M.unix=function(){return Math.floor(this.valueOf()/1e3)},M.valueOf=function(){return this.$d.getTime()},M.startOf=function(F,O){var $=this,B=!!I.u(O)||O,T=I.p(F),V=function(lt,K){var it=I.w($.$u?Date.UTC($.$y,K,lt):new Date($.$y,K,lt),$);return B?it:it.endOf(h)},rt=function(lt,K){return I.w($.toDate()[lt].apply($.toDate("s"),(B?[0,0,0,0]:[23,59,59,999]).slice(K)),$)},P=this.$W,X=this.$M,ut=this.$D,xt="set"+(this.$u?"UTC":"");switch(T){case p:return B?V(1,0):V(31,11);case d:return B?V(1,X):V(0,X+1);case u:var Dt=this.$locale().weekStart||0,Wt=(P<Dt?P+7:P)-Dt;return V(B?ut-Wt:ut+(6-Wt),X);case h:case m:return rt(xt+"Hours",0);case l:return rt(xt+"Minutes",1);case a:return rt(xt+"Seconds",2);case o:return rt(xt+"Milliseconds",3);default:return this.clone()}},M.endOf=function(F){return this.startOf(F,!1)},M.$set=function(F,O){var $,B=I.p(F),T="set"+(this.$u?"UTC":""),V=($={},$[h]=T+"Date",$[m]=T+"Date",$[d]=T+"Month",$[p]=T+"FullYear",$[l]=T+"Hours",$[a]=T+"Minutes",$[o]=T+"Seconds",$[s]=T+"Milliseconds",$)[B],rt=B===h?this.$D+(O-this.$W):O;if(B===d||B===p){var P=this.clone().set(m,1);P.$d[V](rt),P.init(),this.$d=P.set(m,Math.min(this.$D,P.daysInMonth())).$d}else V&&this.$d[V](rt);return this.init(),this},M.set=function(F,O){return this.clone().$set(F,O)},M.get=function(F){return this[I.p(F)]()},M.add=function(F,O){var $,B=this;F=Number(F);var T=I.p(O),V=function(X){var ut=j(B);return I.w(ut.date(ut.date()+Math.round(X*F)),B)};if(T===d)return this.set(d,this.$M+F);if(T===p)return this.set(p,this.$y+F);if(T===h)return V(1);if(T===u)return V(7);var rt=($={},$[a]=n,$[l]=i,$[o]=r,$)[T]||1,P=this.$d.getTime()+F*rt;return I.w(P,this)},M.subtract=function(F,O){return this.add(-1*F,O)},M.format=function(F){var O=this,$=this.$locale();if(!this.isValid())return $.invalidDate||x;var B=F||"YYYY-MM-DDTHH:mm:ssZ",T=I.z(this),V=this.$H,rt=this.$m,P=this.$M,X=$.weekdays,ut=$.months,xt=$.meridiem,Dt=function(K,it,wt,gt){return K&&(K[it]||K(O,B))||wt[it].slice(0,gt)},Wt=function(K){return I.s(V%12||12,K,"0")},lt=xt||function(K,it,wt){var gt=K<12?"AM":"PM";return wt?gt.toLowerCase():gt};return B.replace(y,(function(K,it){return it||(function(wt){switch(wt){case"YY":return String(O.$y).slice(-2);case"YYYY":return I.s(O.$y,4,"0");case"M":return P+1;case"MM":return I.s(P+1,2,"0");case"MMM":return Dt($.monthsShort,P,ut,3);case"MMMM":return Dt(ut,P);case"D":return O.$D;case"DD":return I.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return Dt($.weekdaysMin,O.$W,X,2);case"ddd":return Dt($.weekdaysShort,O.$W,X,3);case"dddd":return X[O.$W];case"H":return String(V);case"HH":return I.s(V,2,"0");case"h":return Wt(1);case"hh":return Wt(2);case"a":return lt(V,rt,!0);case"A":return lt(V,rt,!1);case"m":return String(rt);case"mm":return I.s(rt,2,"0");case"s":return String(O.$s);case"ss":return I.s(O.$s,2,"0");case"SSS":return I.s(O.$ms,3,"0");case"Z":return T}return null})(K)||T.replace(":","")}))},M.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},M.diff=function(F,O,$){var B,T=this,V=I.p(O),rt=j(F),P=(rt.utcOffset()-this.utcOffset())*n,X=this-rt,ut=function(){return I.m(T,rt)};switch(V){case p:B=ut()/12;break;case d:B=ut();break;case f:B=ut()/3;break;case u:B=(X-P)/6048e5;break;case h:B=(X-P)/864e5;break;case l:B=X/i;break;case a:B=X/n;break;case o:B=X/r;break;default:B=X}return $?B:I.a(B)},M.daysInMonth=function(){return this.endOf(d).$D},M.$locale=function(){return S[this.$L]},M.locale=function(F,O){if(!F)return this.$L;var $=this.clone(),B=A(F,O,!0);return B&&($.$L=B),$},M.clone=function(){return I.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()},D})(),W=z.prototype;return j.prototype=W,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",h],["$M",d],["$y",p],["$D",m]].forEach((function(D){W[D[1]]=function(M){return this.$g(M,D[0],D[1])}})),j.extend=function(D,M){return D.$i||(D(M,z,j),D.$i=!0),j},j.locale=A,j.isDayjs=L,j.unix=function(D){return j(1e3*D)},j.en=S[_],j.Ls=S,j.p={},j}))})(cl)),cl.exports}var j3=_3();const N3=Dd(j3);var fb=Object.defineProperty,v=(t,e)=>fb(t,"name",{value:e,configurable:!0}),E3=(t,e)=>{for(var r in e)fb(t,r,{get:e[r],enumerable:!0})},hn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},nt={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},vp=v(function(t="fatal"){let e=hn.fatal;typeof t=="string"?t.toLowerCase()in hn&&(e=hn[t]):typeof t=="number"&&(e=t),nt.trace=()=>{},nt.debug=()=>{},nt.info=()=>{},nt.warn=()=>{},nt.error=()=>{},nt.fatal=()=>{},e<=hn.fatal&&(nt.fatal=console.error?console.error.bind(console,jr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",jr("FATAL"))),e<=hn.error&&(nt.error=console.error?console.error.bind(console,jr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",jr("ERROR"))),e<=hn.warn&&(nt.warn=console.warn?console.warn.bind(console,jr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",jr("WARN"))),e<=hn.info&&(nt.info=console.info?console.info.bind(console,jr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",jr("INFO"))),e<=hn.debug&&(nt.debug=console.debug?console.debug.bind(console,jr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",jr("DEBUG"))),e<=hn.trace&&(nt.trace=console.debug?console.debug.bind(console,jr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",jr("TRACE")))},"setLogLevel"),jr=v(t=>`%c${N3().format("ss.SSS")} : ${t} : `,"format");const hl={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 hl.hue2rgb(s,i,t+1/3)*255;case"g":return hl.hue2rgb(s,i,t)*255;case"b":return hl.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}}},B3={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},L3={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Mt={channel:hl,lang:B3,unit:L3},Fn={};for(let t=0;t<=255;t++)Fn[t]=Mt.unit.dec2hex(t);const Ue={ALL:0,RGB:1,HSL:2};class A3{constructor(){this.type=Ue.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=Ue.ALL}is(e){return this.type===e}}class M3{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new A3}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=Ue.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Mt.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Mt.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Mt.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Mt.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Mt.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Mt.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(Ue.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(Ue.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(Ue.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(Ue.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(Ue.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(Ue.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Ue.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Ue.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(Ue.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Ue.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Ue.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Ue.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const Ac=new M3({r:0,g:0,b:0,a:0},"transparent"),rs={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(rs.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 Ac.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?`#${Fn[Math.round(e)]}${Fn[Math.round(r)]}${Fn[Math.round(n)]}${Fn[Math.round(i*255)]}`:`#${Fn[Math.round(e)]}${Fn[Math.round(r)]}${Fn[Math.round(n)]}`}},ci={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(ci.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Mt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Mt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Mt.channel.clamp.h(parseFloat(r)*360)}}return Mt.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(ci.re);if(!r)return;const[,n,i,s,o,a]=r;return Ac.set({h:ci._hue2deg(n),s:Mt.channel.clamp.s(parseFloat(i)),l:Mt.channel.clamp.l(parseFloat(s)),a:o?Mt.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(${Mt.lang.round(e)}, ${Mt.lang.round(r)}%, ${Mt.lang.round(n)}%, ${i})`:`hsl(${Mt.lang.round(e)}, ${Mt.lang.round(r)}%, ${Mt.lang.round(n)}%)`}},Do={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=Do.colors[t];if(e)return rs.parse(e)},stringify:t=>{const e=rs.stringify(t);for(const r in Do.colors)if(Do.colors[r]===e)return r}},So={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(So.re);if(!r)return;const[,n,i,s,o,a,l,h,u]=r;return Ac.set({r:Mt.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Mt.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:Mt.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:h?Mt.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(${Mt.lang.round(e)}, ${Mt.lang.round(r)}, ${Mt.lang.round(n)}, ${Mt.lang.round(i)})`:`rgb(${Mt.lang.round(e)}, ${Mt.lang.round(r)}, ${Mt.lang.round(n)})`}},Zr={format:{keyword:Do,hex:rs,rgb:So,rgba:So,hsl:ci,hsla:ci},parse:t=>{if(typeof t!="string")return t;const e=rs.parse(t)||So.parse(t)||ci.parse(t)||Do.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Ue.HSL)||t.data.r===void 0?ci.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?So.stringify(t):rs.stringify(t)},mb=(t,e)=>{const r=Zr.parse(t);for(const n in e)r[n]=Mt.channel.clamp[n](e[n]);return Zr.stringify(r)},Rn=(t,e,r=0,n=1)=>{if(typeof t!="number")return mb(t,{a:e});const i=Ac.set({r:Mt.channel.clamp.r(t),g:Mt.channel.clamp.g(e),b:Mt.channel.clamp.b(r),a:Mt.channel.clamp.a(n)});return Zr.stringify(i)},I3=t=>{const{r:e,g:r,b:n}=Zr.parse(t),i=.2126*Mt.channel.toLinear(e)+.7152*Mt.channel.toLinear(r)+.0722*Mt.channel.toLinear(n);return Mt.lang.round(i)},F3=t=>I3(t)>=.5,Wr=t=>!F3(t),gb=(t,e,r)=>{const n=Zr.parse(t),i=n[e],s=Mt.channel.clamp[e](i+r);return i!==s&&(n[e]=s),Zr.stringify(n)},Q=(t,e)=>gb(t,"l",e),Z=(t,e)=>gb(t,"l",-e),E=(t,e)=>{const r=Zr.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return mb(t,n)},P3=(t,e,r=50)=>{const{r:n,g:i,b:s,a:o}=Zr.parse(t),{r:a,g:l,b:h,a:u}=Zr.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,w=o*d+u*(1-d);return Rn(y,C,b,w)},Y=(t,e=100)=>{const r=Zr.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,P3(r,t,e)};/*! @license DOMPurify 3.4.10 | (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.10/LICENSE */function zm(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 D3(t){if(Array.isArray(t))return t}function O3(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 $3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
327
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R3(t,e){return D3(t)||O3(t,e)||z3(t,e)||$3()}function z3(t,e){if(t){if(typeof t=="string")return zm(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)?zm(t,e):void 0}}const xb=Object.entries,Wm=Object.setPrototypeOf,W3=Object.isFrozen,q3=Object.getPrototypeOf,H3=Object.getOwnPropertyDescriptor;let Re=Object.freeze,ze=Object.seal,Gi=Object.create,yb=typeof Reflect<"u"&&Reflect,Nu=yb.apply,Eu=yb.construct;Re||(Re=function(e){return e});ze||(ze=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)});Eu||(Eu=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 ao=je(Array.prototype.forEach),U3=je(Array.prototype.lastIndexOf),qm=je(Array.prototype.pop),$i=je(Array.prototype.push),Y3=je(Array.prototype.splice),Dn=Array.isArray,To=je(String.prototype.toLowerCase),Fh=je(String.prototype.toString),Hm=je(String.prototype.match),lo=je(String.prototype.replace),Um=je(String.prototype.indexOf),V3=je(String.prototype.trim),G3=je(Number.prototype.toString),X3=je(Boolean.prototype.toString),Ym=typeof BigInt>"u"?null:je(BigInt.prototype.toString),Vm=typeof Symbol>"u"?null:je(Symbol.prototype.toString),er=je(Object.prototype.hasOwnProperty),co=je(Object.prototype.toString),De=je(RegExp.prototype.test),ri=K3(TypeError);function je(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 K3(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Eu(t,r)}}function Vt(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:To;if(Wm&&Wm(t,null),!Dn(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(W3(e)||(e[n]=s),i=s)}t[i]=!0}return t}function Q3(t){for(let e=0;e<t.length;e++)er(t,e)||(t[e]=null);return t}function tr(t){const e=Gi(null);for(const n of xb(t)){var r=R3(n,2);const i=r[0],s=r[1];er(t,i)&&(Dn(s)?e[i]=Q3(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=tr(s):e[i]=s)}return e}function Z3(t){switch(typeof t){case"string":return t;case"number":return G3(t);case"boolean":return X3(t);case"bigint":return Ym?Ym(t):"0";case"symbol":return Vm?Vm(t):"Symbol()";case"undefined":return co(t);case"function":case"object":{if(t===null)return co(t);const e=t,r=Yr(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:co(n)}return co(t)}default:return co(t)}}function Yr(t,e){for(;t!==null;){const n=H3(t,e);if(n){if(n.get)return je(n.get);if(typeof n.value=="function")return je(n.value)}t=q3(t)}function r(){return null}return r}function J3(t){try{return De(t,""),!0}catch{return!1}}const Gm=Re(["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"]),Ph=Re(["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"]),Dh=Re(["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"]),tM=Re(["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"]),Oh=Re(["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"]),eM=Re(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Xm=Re(["#text"]),Km=Re(["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"]),$h=Re(["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"]),Qm=Re(["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"]),Ra=Re(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rM=ze(/{{[\w\W]*|^[\w\W]*}}/g),nM=ze(/<%[\w\W]*|^[\w\W]*%>/g),iM=ze(/\${[\w\W]*/g),sM=ze(/^data-[\-\w.\u00B7-\uFFFF]+$/),oM=ze(/^aria-[\-\w]+$/),Zm=ze(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),aM=ze(/^(?:\w+script|data):/i),lM=ze(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),cM=ze(/^html$/i),hM=ze(/^[a-z][.\w]*(-[.\w]+)+$/i),Jm=ze(/<[/\w!]/g),uM=ze(/<[/\w]/g),dM=ze(/<\/no(script|embed|frames)/i),pM=ze(/\/>/i),Ur={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},fM=function(){return typeof window>"u"?null:window},mM=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}},tg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},An=function(e,r,n,i){return er(e,r)&&Dn(e[r])?Vt(i.base?tr(i.base):{},e[r],i.transform):n};function bb(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fM();const e=ht=>bb(ht);if(e.version="3.4.10",e.removed=[],!t||!t.document||t.document.nodeType!==Ur.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=Yr(f,"cloneNode"),m=Yr(f,"remove"),x=Yr(f,"nextSibling"),g=Yr(f,"childNodes"),y=Yr(f,"parentNode"),C=Yr(f,"shadowRoot"),b=Yr(f,"attributes"),w=o&&o.prototype?Yr(o.prototype,"nodeType"):null,_=o&&o.prototype?Yr(o.prototype,"nodeName"):null;if(typeof s=="function"){const ht=r.createElement("template");ht.content&&ht.content.ownerDocument&&(r=ht.content.ownerDocument)}let S,N="",L,A=!1,j=0;const I=function(){if(j>0)throw ri('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},z=function(R){I(),j++;try{return S.createHTML(R)}finally{j--}},W=function(R){I(),j++;try{return S.createScriptURL(R)}finally{j--}},D=function(){return A||(L=mM(d,i),A=!0),L},M=r,F=M.implementation,O=M.createNodeIterator,$=M.createDocumentFragment,B=M.getElementsByTagName,T=n.importNode;let V=tg();e.isSupported=typeof xb=="function"&&typeof y=="function"&&F&&F.createHTMLDocument!==void 0;const rt=rM,P=nM,X=iM,ut=sM,xt=oM,Dt=aM,Wt=lM,lt=hM;let K=Zm,it=null;const wt=Vt({},[...Gm,...Ph,...Dh,...Oh,...Xm]);let gt=null;const Jt=Vt({},[...Km,...$h,...Qm,...Ra]);let It=Object.seal(Gi(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}})),Xt=null,Ae=null;const Kt=Object.seal(Gi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let yr=!0,he=!0,Ie=!1,We=!0,ue=!1,q=!0,J=!1,H=!1,et=!1,at=!1,ft=!1,_t=!1,te=!0,fe=!1;const we="user-content-";let qe=!0,me=!1,ge={},ce=null;const Fe=Vt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ws=null;const Sa=Vt({},["audio","video","img","source","image","track"]);let qs=null;const Li=Vt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ai="http://www.w3.org/1998/Math/MathML",Zn="http://www.w3.org/2000/svg",Tr="http://www.w3.org/1999/xhtml";let Sn=Tr,an=!1,Hs=null;const Mi=Vt({},[Ai,Zn,Tr],Fh),Ta=Re(["mi","mo","mn","ms","mtext"]);let Ii=Vt({},Ta);const _a=Re(["annotation-xml"]);let Fi=Vt({},_a);const Jc=Vt({},["title","style","font","a","script"]);let Tn=null;const th=["application/xhtml+xml","text/html"],ja="text/html";let de=null,ln=null;const eh=r.createElement("form"),Us=function(R){return R instanceof RegExp||R instanceof Function},Ys=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ln&&ln===R)return;(!R||typeof R!="object")&&(R={}),R=tr(R),Tn=th.indexOf(R.PARSER_MEDIA_TYPE)===-1?ja:R.PARSER_MEDIA_TYPE,de=Tn==="application/xhtml+xml"?Fh:To,it=An(R,"ALLOWED_TAGS",wt,{transform:de}),gt=An(R,"ALLOWED_ATTR",Jt,{transform:de}),Hs=An(R,"ALLOWED_NAMESPACES",Mi,{transform:Fh}),qs=An(R,"ADD_URI_SAFE_ATTR",Li,{transform:de,base:Li}),Ws=An(R,"ADD_DATA_URI_TAGS",Sa,{transform:de,base:Sa}),ce=An(R,"FORBID_CONTENTS",Fe,{transform:de}),Xt=An(R,"FORBID_TAGS",tr({}),{transform:de}),Ae=An(R,"FORBID_ATTR",tr({}),{transform:de}),ge=er(R,"USE_PROFILES")?R.USE_PROFILES&&typeof R.USE_PROFILES=="object"?tr(R.USE_PROFILES):R.USE_PROFILES:!1,yr=R.ALLOW_ARIA_ATTR!==!1,he=R.ALLOW_DATA_ATTR!==!1,Ie=R.ALLOW_UNKNOWN_PROTOCOLS||!1,We=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ue=R.SAFE_FOR_TEMPLATES||!1,q=R.SAFE_FOR_XML!==!1,J=R.WHOLE_DOCUMENT||!1,at=R.RETURN_DOM||!1,ft=R.RETURN_DOM_FRAGMENT||!1,_t=R.RETURN_TRUSTED_TYPE||!1,et=R.FORCE_BODY||!1,te=R.SANITIZE_DOM!==!1,fe=R.SANITIZE_NAMED_PROPS||!1,qe=R.KEEP_CONTENT!==!1,me=R.IN_PLACE||!1,K=J3(R.ALLOWED_URI_REGEXP)?R.ALLOWED_URI_REGEXP:Zm,Sn=typeof R.NAMESPACE=="string"?R.NAMESPACE:Tr,Ii=er(R,"MATHML_TEXT_INTEGRATION_POINTS")&&R.MATHML_TEXT_INTEGRATION_POINTS&&typeof R.MATHML_TEXT_INTEGRATION_POINTS=="object"?tr(R.MATHML_TEXT_INTEGRATION_POINTS):Vt({},Ta),Fi=er(R,"HTML_INTEGRATION_POINTS")&&R.HTML_INTEGRATION_POINTS&&typeof R.HTML_INTEGRATION_POINTS=="object"?tr(R.HTML_INTEGRATION_POINTS):Vt({},_a);const G=er(R,"CUSTOM_ELEMENT_HANDLING")&&R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING=="object"?tr(R.CUSTOM_ELEMENT_HANDLING):Gi(null);if(It=Gi(null),er(G,"tagNameCheck")&&Us(G.tagNameCheck)&&(It.tagNameCheck=G.tagNameCheck),er(G,"attributeNameCheck")&&Us(G.attributeNameCheck)&&(It.attributeNameCheck=G.attributeNameCheck),er(G,"allowCustomizedBuiltInElements")&&typeof G.allowCustomizedBuiltInElements=="boolean"&&(It.allowCustomizedBuiltInElements=G.allowCustomizedBuiltInElements),ze(It),ue&&(he=!1),ft&&(at=!0),ge&&(it=Vt({},Xm),gt=Gi(null),ge.html===!0&&(Vt(it,Gm),Vt(gt,Km)),ge.svg===!0&&(Vt(it,Ph),Vt(gt,$h),Vt(gt,Ra)),ge.svgFilters===!0&&(Vt(it,Dh),Vt(gt,$h),Vt(gt,Ra)),ge.mathMl===!0&&(Vt(it,Oh),Vt(gt,Qm),Vt(gt,Ra))),Kt.tagCheck=null,Kt.attributeCheck=null,er(R,"ADD_TAGS")&&(typeof R.ADD_TAGS=="function"?Kt.tagCheck=R.ADD_TAGS:Dn(R.ADD_TAGS)&&(it===wt&&(it=tr(it)),Vt(it,R.ADD_TAGS,de))),er(R,"ADD_ATTR")&&(typeof R.ADD_ATTR=="function"?Kt.attributeCheck=R.ADD_ATTR:Dn(R.ADD_ATTR)&&(gt===Jt&&(gt=tr(gt)),Vt(gt,R.ADD_ATTR,de))),er(R,"ADD_URI_SAFE_ATTR")&&Dn(R.ADD_URI_SAFE_ATTR)&&Vt(qs,R.ADD_URI_SAFE_ATTR,de),er(R,"FORBID_CONTENTS")&&Dn(R.FORBID_CONTENTS)&&(ce===Fe&&(ce=tr(ce)),Vt(ce,R.FORBID_CONTENTS,de)),er(R,"ADD_FORBID_CONTENTS")&&Dn(R.ADD_FORBID_CONTENTS)&&(ce===Fe&&(ce=tr(ce)),Vt(ce,R.ADD_FORBID_CONTENTS,de)),qe&&(it["#text"]=!0),J&&Vt(it,["html","head","body"]),it.table&&(Vt(it,["tbody"]),delete Xt.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw ri('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ri('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ct=S;S=R.TRUSTED_TYPES_POLICY;try{N=z("")}catch(bt){throw S=ct,bt}}else R.TRUSTED_TYPES_POLICY===null?(S=void 0,N=""):(S===void 0&&(S=D()),S&&typeof N=="string"&&(N=z("")));(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&it===wt&&(it=tr(it)),V.uponSanitizeAttribute.length>0&>===Jt&&(gt=tr(gt)),Re&&Re(R),ln=R},Ne=Vt({},[...Ph,...Dh,...tM]),Vs=Vt({},[...Oh,...eM]),Jn=function(R,G,ct){return G.namespaceURI===Tr?R==="svg":G.namespaceURI===Ai?R==="svg"&&(ct==="annotation-xml"||Ii[ct]):!!Ne[R]},Gs=function(R,G,ct){return G.namespaceURI===Tr?R==="math":G.namespaceURI===Zn?R==="math"&&Fi[ct]:!!Vs[R]},Na=function(R,G,ct){return G.namespaceURI===Zn&&!Fi[ct]||G.namespaceURI===Ai&&!Ii[ct]?!1:!Vs[R]&&(Jc[R]||!Ne[R])},rh=function(R){let G=y(R);(!G||!G.tagName)&&(G={namespaceURI:Sn,tagName:"template"});const ct=To(R.tagName),bt=To(G.tagName);return Hs[R.namespaceURI]?R.namespaceURI===Zn?Jn(ct,G,bt):R.namespaceURI===Ai?Gs(ct,G,bt):R.namespaceURI===Tr?Na(ct,G,bt):!!(Tn==="application/xhtml+xml"&&Hs[R.namespaceURI]):!1},Hr=function(R){$i(e.removed,{element:R});try{y(R).removeChild(R)}catch{if(m(R),!y(R))throw ri("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ea=function(R){const G=g(R);if(G){const bt=[];ao(G,$t=>{$i(bt,$t)}),ao(bt,$t=>{try{m($t)}catch{}})}const ct=b(R);if(ct)for(let bt=ct.length-1;bt>=0;--bt){const $t=ct[bt],Ut=$t&&$t.name;if(typeof Ut=="string")try{R.removeAttribute(Ut)}catch{}}},cn=function(R,G){try{$i(e.removed,{attribute:G.getAttributeNode(R),from:G})}catch{$i(e.removed,{attribute:null,from:G})}if(G.removeAttribute(R),R==="is")if(at||ft)try{Hr(G)}catch{}else try{G.setAttribute(R,"")}catch{}},Ze=function(R){const G=b(R);if(G)for(let ct=G.length-1;ct>=0;--ct){const bt=G[ct],$t=bt&&bt.name;if(!(typeof $t!="string"||gt[de($t)]))try{R.removeAttribute($t)}catch{}}},or=function(R){const G=[R];for(;G.length>0;){const ct=G.pop();(w?w(ct):ct.nodeType)===Ur.element&&Ze(ct);const $t=g(ct);if($t)for(let Ut=$t.length-1;Ut>=0;--Ut)G.push($t[Ut])}},Ba=function(R){let G=null,ct=null;if(et)R="<remove></remove>"+R;else{const Ut=Hm(R,/^[\r\n\t ]+/);ct=Ut&&Ut[0]}Tn==="application/xhtml+xml"&&Sn===Tr&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const bt=S?z(R):R;if(Sn===Tr)try{G=new u().parseFromString(bt,Tn)}catch{}if(!G||!G.documentElement){G=F.createDocument(Sn,"template",null);try{G.documentElement.innerHTML=an?N:bt}catch{}}const $t=G.body||G.documentElement;return R&&ct&&$t.insertBefore(r.createTextNode(ct),$t.childNodes[0]||null),Sn===Tr?B.call(G,J?"html":"body")[0]:J?G.documentElement:$t},Xs=function(R){return O.call(R.ownerDocument||R,R,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},_n=function(R){return R=lo(R,rt," "),R=lo(R,P," "),R=lo(R,X," "),R},jn=function(R){var G;R.normalize();const ct=O.call(R.ownerDocument||R,R,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let bt=ct.nextNode();for(;bt;)bt.data=_n(bt.data),bt=ct.nextNode();const $t=(G=R.querySelectorAll)===null||G===void 0?void 0:G.call(R,"template");$t&&ao($t,Ut=>{Nn(Ut.content)&&jn(Ut.content)})},Pi=function(R){const G=_?_(R):null;return typeof G!="string"||de(G)!=="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!==w(R)||R.childNodes!==g(R)},Nn=function(R){if(!w||typeof R!="object"||R===null)return!1;try{return w(R)===Ur.documentFragment}catch{return!1}},ti=function(R){if(!w||typeof R!="object"||R===null)return!1;try{return typeof w(R)=="number"}catch{return!1}};function _r(ht,R,G){ht.length!==0&&ao(ht,ct=>{ct.call(e,R,G,ln)})}const nh=function(R,G){return!!(q&&R.hasChildNodes()&&!ti(R.firstElementChild)&&De(Jm,R.textContent)&&De(Jm,R.innerHTML)||q&&R.namespaceURI===Tr&&G==="style"&&ti(R.firstElementChild)||R.nodeType===Ur.processingInstruction||q&&R.nodeType===Ur.comment&&De(uM,R.data))},ih=function(R,G){if(!Xt[G]&&Ia(G)&&(It.tagNameCheck instanceof RegExp&&De(It.tagNameCheck,G)||It.tagNameCheck instanceof Function&&It.tagNameCheck(G)))return!1;if(qe&&!ce[G]){const ct=y(R),bt=g(R);if(bt&&ct){const $t=bt.length;for(let Ut=$t-1;Ut>=0;--Ut){const Se=me?bt[Ut]:p(bt[Ut],!0);ct.insertBefore(Se,x(R))}}}return Hr(R),!0},La=function(R){if(_r(V.beforeSanitizeElements,R,null),Pi(R))return Hr(R),!0;const G=de(_?_(R):R.nodeName);if(_r(V.uponSanitizeElement,R,{tagName:G,allowedTags:it}),nh(R,G))return Hr(R),!0;if(Xt[G]||!(Kt.tagCheck instanceof Function&&Kt.tagCheck(G))&&!it[G])return ih(R,G);if((w?w(R):R.nodeType)===Ur.element&&!rh(R)||(G==="noscript"||G==="noembed"||G==="noframes")&&De(dM,R.innerHTML))return Hr(R),!0;if(ue&&R.nodeType===Ur.text){const bt=_n(R.textContent);R.textContent!==bt&&($i(e.removed,{element:R.cloneNode()}),R.textContent=bt)}return _r(V.afterSanitizeElements,R,null),!1},Aa=function(R,G,ct){if(Ae[G]||te&&(G==="id"||G==="name")&&(ct in r||ct in eh))return!1;const bt=gt[G]||Kt.attributeCheck instanceof Function&&Kt.attributeCheck(G,R);if(!(he&&De(ut,G))){if(!(yr&&De(xt,G))){if(bt){if(!qs[G]){if(!De(K,lo(ct,Wt,""))){if(!((G==="src"||G==="xlink:href"||G==="href")&&R!=="script"&&Um(ct,"data:")===0&&Ws[R])){if(!(Ie&&!De(Dt,lo(ct,Wt,"")))){if(ct)return!1}}}}}else if(!(Ia(R)&&(It.tagNameCheck instanceof RegExp&&De(It.tagNameCheck,R)||It.tagNameCheck instanceof Function&&It.tagNameCheck(R))&&(It.attributeNameCheck instanceof RegExp&&De(It.attributeNameCheck,G)||It.attributeNameCheck instanceof Function&&It.attributeNameCheck(G,R))||G==="is"&&It.allowCustomizedBuiltInElements&&(It.tagNameCheck instanceof RegExp&&De(It.tagNameCheck,ct)||It.tagNameCheck instanceof Function&&It.tagNameCheck(ct))))return!1}}return!0},Ma=Vt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ia=function(R){return!Ma[To(R)]&&De(lt,R)},sh=function(R,G,ct,bt){if(S&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!ct)switch(d.getAttributeType(R,G)){case"TrustedHTML":return z(bt);case"TrustedScriptURL":return W(bt)}return bt},oh=function(R,G,ct,bt){try{ct?R.setAttributeNS(ct,G,bt):R.setAttribute(G,bt),Pi(R)?Hr(R):qm(e.removed)}catch{cn(G,R)}},Fa=function(R){_r(V.beforeSanitizeAttributes,R,null);const G=R.attributes;if(!G||Pi(R))return;const ct={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:gt,forceKeepAttr:void 0};let bt=G.length;const $t=de(R.nodeName);for(;bt--;){const Ut=G[bt],Se=Ut.name,be=Ut.namespaceURI,ar=Ut.value,He=de(Se),Qs=ar;let Pe=Se==="value"?Qs:V3(Qs);if(ct.attrName=He,ct.attrValue=Pe,ct.keepAttr=!0,ct.forceKeepAttr=void 0,_r(V.uponSanitizeAttribute,R,ct),Pe=ct.attrValue,fe&&(He==="id"||He==="name")&&Um(Pe,we)!==0&&(cn(Se,R),Pe=we+Pe),q&&De(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){cn(Se,R);continue}if(He==="attributename"&&Hm(Pe,"href")){cn(Se,R);continue}if(!ct.forceKeepAttr){if(!ct.keepAttr){cn(Se,R);continue}if(!We&&De(pM,Pe)){cn(Se,R);continue}if(ue&&(Pe=_n(Pe)),!Aa($t,He,Pe)){cn(Se,R);continue}Pe=sh($t,He,be,Pe),Pe!==Qs&&oh(R,Se,be,Pe)}}_r(V.afterSanitizeAttributes,R,null)},En=function(R){let G=null;const ct=Xs(R);for(_r(V.beforeSanitizeShadowDOM,R,null);G=ct.nextNode();)if(_r(V.uponSanitizeShadowNode,G,null),La(G),Fa(G),Nn(G.content)&&En(G.content),(w?w(G):G.nodeType)===Ur.element){const $t=C(G);Nn($t)&&(Ks($t),En($t))}_r(V.afterSanitizeShadowDOM,R,null)},Ks=function(R){const G=[{node:R,shadow:null}];for(;G.length>0;){const ct=G.pop();if(ct.shadow){En(ct.shadow);continue}const bt=ct.node,Ut=(w?w(bt):bt.nodeType)===Ur.element,Se=g(bt);if(Se)for(let be=Se.length-1;be>=0;--be)G.push({node:Se[be],shadow:null});if(Ut){const be=_?_(bt):null;if(typeof be=="string"&&de(be)==="template"){const ar=bt.content;Nn(ar)&&G.push({node:ar,shadow:null})}}if(Ut){const be=C(bt);Nn(be)&&G.push({node:null,shadow:be},{node:be,shadow:null})}}};return e.sanitize=function(ht){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G=null,ct=null,bt=null,$t=null;if(an=!ht,an&&(ht="<!-->"),typeof ht!="string"&&!ti(ht)&&(ht=Z3(ht),typeof ht!="string"))throw ri("dirty is not a string, aborting");if(!e.isSupported)return ht;H||Ys(R),e.removed=[];const Ut=me&&typeof ht!="string"&&ti(ht);if(Ut){const ar=_?_(ht):ht.nodeName;if(typeof ar=="string"){const He=de(ar);if(!it[He]||Xt[He])throw ri("root node is forbidden and cannot be sanitized in-place")}if(Pi(ht))throw ri("root node is clobbered and cannot be sanitized in-place");try{Ks(ht)}catch(He){throw Ea(ht),He}}else if(ti(ht))G=Ba("<!---->"),ct=G.ownerDocument.importNode(ht,!0),ct.nodeType===Ur.element&&ct.nodeName==="BODY"||ct.nodeName==="HTML"?G=ct:G.appendChild(ct),Ks(ct);else{if(!at&&!ue&&!J&&ht.indexOf("<")===-1)return S&&_t?z(ht):ht;if(G=Ba(ht),!G)return at?null:_t?N:""}G&&et&&Hr(G.firstChild);const Se=Xs(Ut?ht:G);try{for(;bt=Se.nextNode();)La(bt),Fa(bt),Nn(bt.content)&&En(bt.content)}catch(ar){throw Ut&&Ea(ht),ar}if(Ut)return ao(e.removed,ar=>{ar.element&&or(ar.element)}),ue&&jn(ht),ht;if(at){if(ue&&jn(G),ft)for($t=$.call(G.ownerDocument);G.firstChild;)$t.appendChild(G.firstChild);else $t=G;return(gt.shadowroot||gt.shadowrootmode)&&($t=T.call(n,$t,!0)),$t}let be=J?G.outerHTML:G.innerHTML;return J&&it["!doctype"]&&G.ownerDocument&&G.ownerDocument.doctype&&G.ownerDocument.doctype.name&&De(cM,G.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+G.ownerDocument.doctype.name+`>
|
|
328
|
-
`+be),ue&&(be=_n(be)),S&&_t?z(be):be},e.setConfig=function(){let ht=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ys(ht),H=!0},e.clearConfig=function(){ln=null,H=!1,S=L,N=""},e.isValidAttribute=function(ht,R,G){ln||Ys({});const ct=de(ht),bt=de(R);return Aa(ct,bt,G)},e.addHook=function(ht,R){typeof R=="function"&&$i(V[ht],R)},e.removeHook=function(ht,R){if(R!==void 0){const G=U3(V[ht],R);return G===-1?void 0:Y3(V[ht],G,1)[0]}return qm(V[ht])},e.removeHooks=function(ht){V[ht]=[]},e.removeAllHooks=function(){V=tg()},e}var ws=bb(),Cb=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Oo=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,gM=/\s*%%.*\n/gm,os,kb=(os=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(os,"UnknownDiagramError"),os),Ci={},wp=v(function(t,e){t=t.replace(Cb,"").replace(Oo,"").replace(gM,`
|
|
329
|
-
`);for(const[r,{detector:n}]of Object.entries(Ci))if(n(t,e))return r;throw new kb(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),Bu=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)vb(e,r,n)},"registerLazyLoadedDiagrams"),vb=v((t,e,r)=>{Ci[t]&&nt.warn(`Detector with key ${t} already exists. Overwriting.`),Ci[t]={detector:e,loader:r},nt.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),xM=v(t=>Ci[t].loader,"getDiagramLoader"),Lu=v((t,e,{depth:r=2,clobber:n=!1}={})=>{const i={depth:r,clobber:n};return Array.isArray(e)&&!Array.isArray(t)?(e.forEach(s=>Lu(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]=Lu(t[s],e[s],{depth:r-1,clobber:n})):(n||typeof t[s]!="object"&&typeof e[s]!="object")&&(t[s]=e[s])}),t)},"assignWithDepth"),Be=Lu,nn="#ffffff",sn="#f2f2f2",At=v((t,e)=>e?E(t,{s:-40,l:10}):E(t,{s:-40,l:-10}),"mkBorder"),as,yM=(as=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,w,_,S,N,L,A,j,I,z,W,D,M,F,O,$,B;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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?Z(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||Z(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Y(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||Q(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||Z(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Z(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Q(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Q(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||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.darkMode)for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=Z(this["cScale"+T],75);else for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=Z(this["cScale"+T],25);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleInv"+T]=this["cScaleInv"+T]||Y(this["cScale"+T]);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this.darkMode?this["cScalePeer"+T]=this["cScalePeer"+T]||Q(this["cScale"+T],10):this["cScalePeer"+T]=this["cScalePeer"+T]||Z(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]||E(this.mainBkg,{h:180,s:-15,l:e*(5+T*3)}),this["surfacePeer"+T]=this["surfacePeer"+T]||E(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||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(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||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(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??E(this.primaryColor,{l:-30}),this.venn2=this.venn2??E(this.secondaryColor,{l:-30}),this.venn3=this.venn3??E(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??E(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??E(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??E(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??E(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??E(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:((w=this.wardley)==null?void 0:w.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((_=this.wardley)==null?void 0:_.annotationStroke)||this.lineColor,annotationTextColor:((S=this.wardley)==null?void 0:S.annotationTextColor)||this.primaryTextColor,annotationFill:((N=this.wardley)==null?void 0:N.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||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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:((A=this.xyChart)==null?void 0:A.titleColor)||this.primaryTextColor,dataLabelColor:((j=this.xyChart)==null?void 0:j.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((I=this.xyChart)==null?void 0:I.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:((D=this.xyChart)==null?void 0:D.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((M=this.xyChart)==null?void 0:M.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((F=this.xyChart)==null?void 0:F.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((O=this.xyChart)==null?void 0:O.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:(($=this.xyChart)==null?void 0:$.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((B=this.xyChart)==null?void 0:B.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?Z(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||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(as,"Theme"),as),bM=v(t=>{const e=new yM;return e.calculate(t),e},"getThemeVariables"),ls,CM=(ls=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.lineColor=Y(this.background),this.textColor=Y(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(Y("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Rn(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=Z("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Z(this.sectionBkgColor,10),this.taskBorderColor=Rn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Rn(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||Q(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Z(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,w,_,S,N,L,A,j,I,z,W,D,M,F,O,$;this.secondBkg=Q(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=Q(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=Q(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=Y(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=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(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||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330});for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||Y(this["cScale"+B]);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScalePeer"+B]=this["cScalePeer"+B]||Q(this["cScale"+B],10);for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{h:30,s:-30,l:-(-10+B*4)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{h:30,s:-30,l:-(-7+B*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||this.scaleLabelColor;for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["pie"+B]=this["cScale"+B];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 B=0;B<8;B++)this["venn"+(B+1)]=this["venn"+(B+1)]??Q(this["cScale"+B],30);this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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:((w=this.radar)==null?void 0:w.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((S=this.radar)==null?void 0:S.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#ff6b6b",this.wardley={backgroundColor:((N=this.wardley)==null?void 0:N.backgroundColor)||this.background,axisColor:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((A=this.wardley)==null?void 0:A.axisTextColor)||this.primaryTextColor,gridColor:((j=this.wardley)==null?void 0:j.gridColor)||this.gridColor,componentFill:((I=this.wardley)==null?void 0:I.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:((D=this.wardley)==null?void 0:D.linkStroke)||this.lineColor,evolutionStroke:((M=this.wardley)==null?void 0:M.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((F=this.wardley)==null?void 0:F.annotationStroke)||this.lineColor,annotationTextColor:((O=this.wardley)==null?void 0:O.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?Z(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Q(this.secondaryColor,20),this.git1=Q(this.pie2||this.secondaryColor,20),this.git2=Q(this.pie3||this.tertiaryColor,20),this.git3=Q(this.pie4||E(this.primaryColor,{h:-30}),20),this.git4=Q(this.pie5||E(this.primaryColor,{h:-60}),20),this.git5=Q(this.pie6||E(this.primaryColor,{h:-90}),10),this.git6=Q(this.pie7||E(this.primaryColor,{h:60}),10),this.git7=Q(this.pie8||E(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Y(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Y(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||Q("#5a3d5c",10),this.emProcessorStroke=this.emProcessorStroke||"#8a6d8c",this.emReadModelFill=this.emReadModelFill||Q("#3d5a2d",10),this.emReadModelStroke=this.emReadModelStroke||"#6d8c5c",this.emCommandFill=this.emCommandFill||Q("#2d3d5a",10),this.emCommandStroke=this.emCommandStroke||"#5c6d8c",this.emEventFill=this.emEventFill||Q("#5a452d",10),this.emEventStroke=this.emEventStroke||"#8c755c",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||Q(this.background,5),this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||Q(this.background,12),this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Q(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Q(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ls,"Theme"),ls),kM=v(t=>{const e=new CM;return e.calculate(t),e},"getThemeVariables"),cs,vM=(cs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=E(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=At(this.primaryColor,this.darkMode),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.lineColor=Y(this.background),this.textColor=Y(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=At(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=Rn(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,w,_,S,N,L,A,j,I,z,W,D,M,F,O,$;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Z(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Z(this.tertiaryColor,40);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScale"+B]=Z(this["cScale"+B],10),this["cScalePeer"+B]=this["cScalePeer"+B]||Z(this["cScale"+B],25);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||E(this["cScale"+B],{h:180});for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{h:30,l:-(5+B*5)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{h:30,l:-(7+B*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||Y(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||Y(this.labelTextColor);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||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||Q(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Q(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=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||E(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-30}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||E(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||E(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??E(this.primaryColor,{l:-30}),this.venn2=this.venn2??E(this.secondaryColor,{l:-30}),this.venn3=this.venn3??E(this.tertiaryColor,{l:-40}),this.venn4=this.venn4??E(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??E(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??E(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??E(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??E(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||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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:((w=this.wardley)==null?void 0:w.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((S=this.wardley)==null?void 0:S.annotationFill)||this.background},this.xyChart={backgroundColor:((N=this.xyChart)==null?void 0:N.backgroundColor)||this.background,titleColor:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((A=this.xyChart)==null?void 0:A.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((j=this.xyChart)==null?void 0:j.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((I=this.xyChart)==null?void 0:I.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:((D=this.xyChart)==null?void 0:D.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((F=this.xyChart)==null?void 0:F.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((O=this.xyChart)==null?void 0:O.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||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Z(Y(this.git0),25),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Y(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(Object.keys(this).forEach(n=>{this[n]==="calculated"&&(this[n]=void 0)}),typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(cs,"Theme"),cs),wM=v(t=>{const e=new vM;return e.calculate(t),e},"getThemeVariables"),hs,SM=(hs=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=Q("#cde498",10),this.primaryBorderColor=At(this.primaryColor,this.darkMode),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.primaryColor),this.lineColor=Y(this.background),this.textColor=Y(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,w,_,S,N,L,A,j,I,z,W,D,M,F,O,$;this.actorBorder=Z(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||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Z(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Z(this.tertiaryColor,40);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScale"+B]=Z(this["cScale"+B],10),this["cScalePeer"+B]=this["cScalePeer"+B]||Z(this["cScale"+B],25);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||E(this["cScale"+B],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||this.scaleLabelColor;for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{h:30,s:-30,l:-(5+B*5)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{h:30,s:-30,l:-(8+B*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||Q(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Q(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=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(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||E(this.primaryColor,{l:-30}),this.pie5=this.pie5||E(this.secondaryColor,{l:-30}),this.pie6=this.pie6||E(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||E(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??E(this.primaryColor,{l:-30}),this.venn2=this.venn2??E(this.secondaryColor,{l:-30}),this.venn3=this.venn3??E(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??E(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??E(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??E(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??E(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??E(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||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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:((w=this.wardley)==null?void 0:w.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((S=this.wardley)==null?void 0:S.annotationFill)||this.background},this.xyChart={backgroundColor:((N=this.xyChart)==null?void 0:N.backgroundColor)||this.background,titleColor:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((A=this.xyChart)==null?void 0:A.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((j=this.xyChart)==null?void 0:j.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((I=this.xyChart)==null?void 0:I.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:((D=this.xyChart)==null?void 0:D.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((F=this.xyChart)==null?void 0:F.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((O=this.xyChart)==null?void 0:O.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||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Y(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(hs,"Theme"),hs),TM=v(t=>{const e=new SM;return e.calculate(t),e},"getThemeVariables"),us,_M=(us=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Q(this.contrast,55),this.background="#ffffff",this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=At(this.primaryColor,this.darkMode),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.lineColor=Y(this.background),this.textColor=Y(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||Q(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,w,_,S,N,L,A,j,I,z,W,D,M,F,O,$;this.secondBkg=Q(this.contrast,55),this.border2=this.contrast,this.actorBorder=Q(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 B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||Y(this["cScale"+B]);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this.darkMode?this["cScalePeer"+B]=this["cScalePeer"+B]||Q(this["cScale"+B],10):this["cScalePeer"+B]=this["cScalePeer"+B]||Z(this["cScale"+B],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||this.scaleLabelColor;for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{l:-(5+B*5)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{l:-(8+B*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=Q(this.contrast,30),this.sectionBkgColor2=Q(this.contrast,30),this.taskBorderColor=Z(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=Q(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=Z(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=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(this.secondaryColor,{h:128});for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["pie"+B]=this["cScale"+B];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 B=0;B<8;B++)this["venn"+(B+1)]=this["venn"+(B+1)]??this["cScale"+B];this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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:((w=this.radar)==null?void 0:w.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((S=this.radar)==null?void 0:S.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((N=this.wardley)==null?void 0:N.backgroundColor)||this.background,axisColor:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((A=this.wardley)==null?void 0:A.axisTextColor)||this.primaryTextColor,gridColor:((j=this.wardley)==null?void 0:j.gridColor)||this.gridColor,componentFill:((I=this.wardley)==null?void 0:I.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:((D=this.wardley)==null?void 0:D.linkStroke)||this.lineColor,evolutionStroke:((M=this.wardley)==null?void 0:M.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((F=this.wardley)==null?void 0:F.annotationStroke)||this.lineColor,annotationTextColor:((O=this.wardley)==null?void 0:O.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=Z(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||E(this.primaryColor,{h:-30}),this.git4=this.pie5||E(this.primaryColor,{h:-60}),this.git5=this.pie6||E(this.primaryColor,{h:-90}),this.git6=this.pie7||E(this.primaryColor,{h:60}),this.git7=this.pie8||E(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(us,"Theme"),us),jM=v(t=>{const e=new _M;return e.calculate(t),e},"getThemeVariables"),ds,NM=(ds=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=At(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||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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?Z(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||Z(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Y(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=E(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||Q(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||E(e,{h:30}),this.cScale4=this.cScale4||E(e,{h:60}),this.cScale5=this.cScale5||E(e,{h:90}),this.cScale6=this.cScale6||E(e,{h:120}),this.cScale7=this.cScale7||E(e,{h:150}),this.cScale8=this.cScale8||E(e,{h:210,l:150}),this.cScale9=this.cScale9||E(e,{h:270}),this.cScale10=this.cScale10||E(e,{h:300}),this.cScale11=this.cScale11||E(e,{h:330}),this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Z(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Z(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||Y(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Q(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||Z(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]||E(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||E(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||E(e,{h:64}),this.fillType3=this.fillType3||E(r,{h:64}),this.fillType4=this.fillType4||E(e,{h:-64}),this.fillType5=this.fillType5||E(r,{h:-64}),this.fillType6=this.fillType6||E(e,{h:128}),this.fillType7=this.fillType7||E(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||E(e,{l:-10}),this.pie5=this.pie5||E(r,{l:-10}),this.pie6=this.pie6||E(n,{l:-10}),this.pie7=this.pie7||E(e,{h:60,l:-10}),this.pie8=this.pie8||E(e,{h:-60,l:-10}),this.pie9=this.pie9||E(e,{h:120,l:0}),this.pie10=this.pie10||E(e,{h:60,l:-20}),this.pie11=this.pie11||E(e,{h:-60,l:-20}),this.pie12=this.pie12||E(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||E(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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?Z(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||E(e,{h:-30}),this.git4=this.git4||E(e,{h:-60}),this.git5=this.git5||E(e,{h:-90}),this.git6=this.git6||E(e,{h:60}),this.git7=this.git7||E(e,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ds,"Theme"),ds),EM=v(t=>{const e=new NM;return e.calculate(t),e},"getThemeVariables"),ps,BM=(ps=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(Y("#323D47"),10),this.border1="#ccc",this.border2=Rn(255,255,255,.25),this.arrowheadColor=Y(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||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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?Z(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||Z(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Y(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||Q(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||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.darkMode)for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=Z(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=Z(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||Y(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||Q(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||Z(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]||E(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||E(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||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(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||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(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||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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?Z(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=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ps,"Theme"),ps),LM=v(t=>{const e=new BM;return e.calculate(t),e},"getThemeVariables"),fs,AM=(fs=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=At("#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||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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?Z(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||Z(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Y(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=E(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||Q(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]=Z(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Z(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||Y(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Q(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||Z(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]||E(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||E(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||E(e,{h:64}),this.fillType3=this.fillType3||E(r,{h:64}),this.fillType4=this.fillType4||E(e,{h:-64}),this.fillType5=this.fillType5||E(r,{h:-64}),this.fillType6=this.fillType6||E(e,{h:128}),this.fillType7=this.fillType7||E(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||E(e,{l:-10}),this.pie5=this.pie5||E(r,{l:-10}),this.pie6=this.pie6||E(n,{l:-10}),this.pie7=this.pie7||E(e,{h:60,l:-10}),this.pie8=this.pie8||E(e,{h:-60,l:-10}),this.pie9=this.pie9||E(e,{h:120,l:0}),this.pie10=this.pie10||E(e,{h:60,l:-20}),this.pie11=this.pie11||E(e,{h:-60,l:-20}),this.pie12=this.pie12||E(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||E(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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?Z(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||E(e,{h:-30}),this.git4=this.git4||E(e,{h:-60}),this.git5=this.git5||E(e,{h:-90}),this.git6=this.git6||E(e,{h:60}),this.git7=this.git7||E(e,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(fs,"Theme"),fs),MM=v(t=>{const e=new AM;return e.calculate(t),e},"getThemeVariables"),ms,IM=(ms=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(Y("#323D47"),10),this.border1="#ccc",this.border2=Rn(255,255,255,.25),this.arrowheadColor=Y(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||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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?Z(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||Z(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Y(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||Q(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||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.darkMode)for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=Z(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=Z(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||Y(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||Q(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||Z(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]||E(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||E(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||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(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||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(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||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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?Z(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||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ms,"Theme"),ms),FM=v(t=>{const e=new IM;return e.calculate(t),e},"getThemeVariables"),gs,PM=(gs=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=At(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||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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?Z(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||Z(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Y(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=E(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||Q(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]||Y(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Q(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||Z(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]||E(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||E(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||E(e,{h:64}),this.fillType3=this.fillType3||E(r,{h:64}),this.fillType4=this.fillType4||E(e,{h:-64}),this.fillType5=this.fillType5||E(r,{h:-64}),this.fillType6=this.fillType6||E(e,{h:128}),this.fillType7=this.fillType7||E(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||E(e,{l:-10}),this.pie5=this.pie5||E(r,{l:-10}),this.pie6=this.pie6||E(n,{l:-10}),this.pie7=this.pie7||E(e,{h:60,l:-10}),this.pie8=this.pie8||E(e,{h:-60,l:-10}),this.pie9=this.pie9||E(e,{h:120,l:0}),this.pie10=this.pie10||E(e,{h:60,l:-20}),this.pie11=this.pie11||E(e,{h:-60,l:-20}),this.pie12=this.pie12||E(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||E(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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?Z(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||E(e,{h:-30}),this.git4=this.git4||E(e,{h:-60}),this.git5=this.git5||E(e,{h:-90}),this.git6=this.git6||E(e,{h:60}),this.git7=this.git7||E(e,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(gs,"Theme"),gs),DM=v(t=>{const e=new PM;return e.calculate(t),e},"getThemeVariables"),xs,OM=(xs=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(Y("#323D47"),10),this.border1="#ccc",this.border2=Rn(255,255,255,.25),this.arrowheadColor=Y(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||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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?Z(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||Z(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Y(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||Q(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]||Y(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||Q(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||Z(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=Z(this["cScale"+p],75);const e=this.darkMode?-4:-1;for(let p=0;p<5;p++)this["surface"+p]=this["surface"+p]||E(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||E(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||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(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||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(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||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Wr(this.quadrant1Fill)?Q(this.quadrant1Fill):Z(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?Z(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||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=Z(this.git0,25),this.git1=Z(this.git1,25),this.git2=Z(this.git2,25),this.git3=Z(this.git3,25),this.git4=Z(this.git4,25),this.git5=Z(this.git5,25),this.git6=Z(this.git6,25),this.git7=Z(this.git7,25)),this.gitInv0=this.gitInv0||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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||nn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||sn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(xs,"Theme"),xs),$M=v(t=>{const e=new OM;return e.calculate(t),e},"getThemeVariables"),fn={base:{getThemeVariables:bM},dark:{getThemeVariables:kM},default:{getThemeVariables:wM},forest:{getThemeVariables:TM},neutral:{getThemeVariables:jM},neo:{getThemeVariables:EM},"neo-dark":{getThemeVariables:LM},redux:{getThemeVariables:MM},"redux-dark":{getThemeVariables:FM},"redux-color":{getThemeVariables:DM},"redux-dark-color":{getThemeVariables:$M}},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},wb={...Je,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:fn.default.getThemeVariables(),sequence:{...Je.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Je.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Je.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Je.flowchart,inheritDir:!1},external_personFont:v(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:v(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:v(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:v(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:v(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:v(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:v(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:v(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:v(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:v(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:v(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:v(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:v(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:v(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:v(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:v(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:v(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:v(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:v(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:v(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...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}},Sb=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...Sb(t[n],"")]:[...r,e+n],[]),"keyify"),RM=new Set(Sb(wb,"")),Tb=wb,Ol=v(t=>{if(nt.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>Ol(e));return}for(const e of Object.keys(t)){if(nt.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!RM.has(e)||t[e]==null){nt.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]))&&(nt.debug("sanitize deleting invalid color:",i,t[e][i]),delete t[e][i])}else nt.debug("sanitizing object",e),Ol(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(nt.debug("sanitizing css option",e),t[e]=_b(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]="")}nt.debug("After sanitization",t)}},"sanitizeDirective"),_b=v(t=>{let e=0,r=0;for(const n of t){if(e<r)return"{ /* ERROR: Unbalanced CSS */ }";n==="{"?e++:n==="}"&&r++}return e!==r?"{ /* ERROR: Unbalanced CSS */ }":t},"sanitizeCss"),Ss=Object.freeze(Tb),kn=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),ur=Be({},Ss),$l,ki=[],$o=Be({},Ss),Mc=v((t,e)=>{let r=Be({},t),n={};for(const i of e)Eb(i),n=Be(n,i);if(r=Be(r,n),n.theme&&n.theme in fn){const i=Be({},$l),s=Be(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in fn&&(r.themeVariables=fn[r.theme].getThemeVariables(s))}return $o=r,Lb($o),$o},"updateCurrentConfig"),zM=v(t=>(ur=Be({},Ss),ur=Be(ur,t),t.theme&&fn[t.theme]&&(ur.themeVariables=fn[t.theme].getThemeVariables(t.themeVariables)),Mc(ur,ki),ur),"setSiteConfig"),WM=v(t=>{$l=Be({},t)},"saveConfigFromInitialize"),qM=v(t=>(ur=Be(ur,t),Mc(ur,ki),ur),"updateSiteConfig"),jb=v(()=>Be({},ur),"getSiteConfig"),Nb=v(t=>(Lb(t),Be($o,t),ye()),"setConfig"),ye=v(()=>Be({},$o),"getConfig"),Eb=v(t=>{t&&(["secure",...ur.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(nt.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"&&Eb(t[e])}))},"sanitize"),HM=v(t=>{var e;Ol(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),ki.push(t),Mc(ur,ki)},"addDirective"),Rl=v((t=ur)=>{ki=[],Mc(t,ki)},"reset"),UM={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."},eg={},Bb=v(t=>{eg[t]||(nt.warn(UM[t]),eg[t]=!0)},"issueWarning"),Lb=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&Bb("LAZY_LOAD_DEPRECATED")},"checkConfig"),iV=v(()=>{let t={};$l&&(t=Be(t,$l));for(const e of ki)t=Be(t,e);return t},"getUserDefinedConfig"),sr=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&Bb("FLOWCHART_HTML_LABELS_DEPRECATED"),kn(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),fa=/<br\s*\/?>/gi,YM=v(t=>t?Ib(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),VM=(()=>{let t=!1;return()=>{t||(Ab(),t=!0)}})();function Ab(){const t="data-temp-href-target";ws.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),ws.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute(t)&&(e.setAttribute("target",e.getAttribute(t)??""),e.removeAttribute(t),e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener"))})}v(Ab,"setupDompurifyHooks");var Mb=v(t=>(VM(),ws.sanitize(t)),"removeScript"),rg=v((t,e)=>{if(sr(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=Mb(t):r!=="loose"&&(t=Ib(t),t=t.replace(/</g,"<").replace(/>/g,">"),t=t.replace(/=/g,"="),t=QM(t))}return t},"sanitizeMore"),zr=v((t,e)=>t&&(e.dompurifyConfig?t=ws.sanitize(rg(t,e),e.dompurifyConfig).toString():t=ws.sanitize(rg(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),GM=v((t,e)=>typeof t=="string"?zr(t,e):t.flat().map(r=>zr(r,e)),"sanitizeTextOrArray"),XM=v(t=>fa.test(t),"hasBreaks"),KM=v(t=>t.split(fa),"splitBreaks"),QM=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),Ib=v(t=>t.replace(fa,"#br#"),"breakToPlaceholder"),ZM=v(t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=CSS.escape(e)),e},"getUrl"),JM=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),tI=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),ng=v(function(t){const e=t.split(/(,)/),r=[];for(let n=0;n<e.length;n++){let i=e[n];if(i===","&&n>0&&n+1<e.length){const s=e[n-1],o=e[n+1];eI(s,o)&&(i=s+","+o,n++,r.pop())}r.push(rI(i))}return r.join("")},"parseGenericTypes"),Au=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),eI=v((t,e)=>{const r=Au(t,"~"),n=Au(e,"~");return r===1&&n===1},"shouldCombineSets"),rI=v(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"),ig=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Mu=/\$\$(.*)\$\$/g,Xo=v(t=>{var e;return(((e=t.match(Mu))==null?void 0:e.length)??0)>0},"hasKatex"),sV=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await Fb(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"),nI=v(async(t,e)=>{if(!Xo(t))return t;if(!(ig()||e.legacyMathML||e.forceLegacyMathML))return t.replace(Mu,"MathML is unsupported in this environment.");{const{default:r}=await Ht(async()=>{const{default:i}=await import("./katex-C5jXJg4s.js");return{default:i}},[]),n=e.forceLegacyMathML||!ig()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(fa).map(i=>Xo(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(Mu,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),Fb=v(async(t,e)=>zr(await nI(t,e),e),"renderKatexSanitized"),ma={getRows:YM,sanitizeText:zr,sanitizeTextOrArray:GM,hasBreaks:XM,splitBreaks:KM,lineBreakRegex:fa,removeScript:Mb,getUrl:ZM,evaluate:kn,getMax:JM,getMin:tI},iI=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),sI=v(function(t,e,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${e}px;`)):(n.set("height",t),n.set("width",e)),n},"calculateSvgSizeAttrs"),Pb=v(function(t,e,r,n){const i=sI(e,r,n);iI(t,i)},"configureSvgSize"),oI=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;nt.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;nt.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,nt.info(`Calculated bounds: ${a}x${l}`),Pb(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"),ul={};function Iu(t){return[...t.cssRules].map(e=>e.cssText).join(`
|
|
330
|
-
`)}v(Iu,"cssStyleSheetToString");var aI=v((t,e,r,n)=>{let i="";return t in ul&&ul[t]?i=ul[t]({...r,svgId:n}):nt.warn(`No theme found for ${t}`),` & {
|
|
331
|
-
font-family: ${r.fontFamily};
|
|
332
|
-
font-size: ${r.fontSize};
|
|
333
|
-
fill: ${r.textColor}
|
|
334
|
-
}
|
|
335
|
-
@keyframes edge-animation-frame {
|
|
336
|
-
from {
|
|
337
|
-
stroke-dashoffset: 0;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
@keyframes dash {
|
|
341
|
-
to {
|
|
342
|
-
stroke-dashoffset: 0;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
& .edge-animation-slow {
|
|
346
|
-
stroke-dasharray: 9,5 !important;
|
|
347
|
-
stroke-dashoffset: 900;
|
|
348
|
-
animation: dash 50s linear infinite;
|
|
349
|
-
stroke-linecap: round;
|
|
350
|
-
}
|
|
351
|
-
& .edge-animation-fast {
|
|
352
|
-
stroke-dasharray: 9,5 !important;
|
|
353
|
-
stroke-dashoffset: 900;
|
|
354
|
-
animation: dash 20s linear infinite;
|
|
355
|
-
stroke-linecap: round;
|
|
356
|
-
}
|
|
357
|
-
/* Classes common for multiple diagrams */
|
|
358
|
-
|
|
359
|
-
& .error-icon {
|
|
360
|
-
fill: ${r.errorBkgColor};
|
|
361
|
-
}
|
|
362
|
-
& .error-text {
|
|
363
|
-
fill: ${r.errorTextColor};
|
|
364
|
-
stroke: ${r.errorTextColor};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
& .edge-thickness-normal {
|
|
368
|
-
stroke-width: ${r.strokeWidth??1}px;
|
|
369
|
-
}
|
|
370
|
-
& .edge-thickness-thick {
|
|
371
|
-
stroke-width: 3.5px
|
|
372
|
-
}
|
|
373
|
-
& .edge-pattern-solid {
|
|
374
|
-
stroke-dasharray: 0;
|
|
375
|
-
}
|
|
376
|
-
& .edge-thickness-invisible {
|
|
377
|
-
stroke-width: 0;
|
|
378
|
-
fill: none;
|
|
379
|
-
}
|
|
380
|
-
& .edge-pattern-dashed{
|
|
381
|
-
stroke-dasharray: 3;
|
|
382
|
-
}
|
|
383
|
-
.edge-pattern-dotted {
|
|
384
|
-
stroke-dasharray: 2;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
& .marker {
|
|
388
|
-
fill: ${r.lineColor};
|
|
389
|
-
stroke: ${r.lineColor};
|
|
390
|
-
}
|
|
391
|
-
& .marker.cross {
|
|
392
|
-
stroke: ${r.lineColor};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
& svg {
|
|
396
|
-
font-family: ${r.fontFamily};
|
|
397
|
-
font-size: ${r.fontSize};
|
|
398
|
-
}
|
|
399
|
-
& p {
|
|
400
|
-
margin: 0
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
${i}
|
|
404
|
-
.node .neo-node {
|
|
405
|
-
stroke: ${r.nodeBorder};
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
[data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
|
|
409
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
410
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
[data-look="neo"].node path {
|
|
415
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
416
|
-
stroke-width: ${r.strokeWidth??1}px;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
[data-look="neo"].node .outer-path {
|
|
420
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
[data-look="neo"].node .neo-line path {
|
|
424
|
-
stroke: ${r.nodeBorder};
|
|
425
|
-
filter: none;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
[data-look="neo"].node circle{
|
|
429
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
430
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
[data-look="neo"].node circle .state-start{
|
|
434
|
-
fill: #000000;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
[data-look="neo"].icon-shape .icon {
|
|
438
|
-
fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
439
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
[data-look="neo"].icon-shape .icon-neo path {
|
|
443
|
-
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
444
|
-
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
${e}
|
|
448
|
-
`},"getStyles"),lI=v((t,e)=>{e!==void 0&&(ul[t]=e)},"addStylesForDiagram"),cI=aI,Db={};E3(Db,{clear:()=>hI,getAccDescription:()=>fI,getAccTitle:()=>dI,getDiagramTitle:()=>gI,setAccDescription:()=>pI,setAccTitle:()=>uI,setDiagramTitle:()=>mI});var Sp="",Tp="",_p="",jp=v(t=>zr(t,ye()),"sanitizeText"),hI=v(()=>{Sp="",_p="",Tp=""},"clear"),uI=v(t=>{Sp=jp(t).replace(/^\s+/g,"")},"setAccTitle"),dI=v(()=>Sp,"getAccTitle"),pI=v(t=>{_p=jp(t).replace(/\n\s+/g,`
|
|
449
|
-
`)},"setAccDescription"),fI=v(()=>_p,"getAccDescription"),mI=v(t=>{Tp=jp(t)},"setDiagramTitle"),gI=v(()=>Tp,"getDiagramTitle"),sg=nt,xI=vp,Qt=ye,oV=Nb,aV=Ss,Np=v(t=>zr(t,Qt()),"sanitizeText"),yI=oI,bI=v(()=>Db,"getCommonDb"),zl={},Wl=v((t,e,r)=>{var n;zl[t]&&sg.warn(`Diagram with id ${t} already registered. Overwriting.`),zl[t]=e,r&&vb(t,r),lI(t,e.styles),(n=e.injectUtils)==null||n.call(e,sg,xI,Qt,Np,yI,bI(),()=>{})},"registerDiagram"),Fu=v(t=>{if(t in zl)return zl[t];throw new CI(t)},"getDiagram"),ys,CI=(ys=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(ys,"DiagramNotFoundError"),ys),kI={value:()=>{}};function Ob(){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 dl(r)}function dl(t){this._=t}function vI(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}})}dl.prototype=Ob.prototype={constructor:dl,on:function(t,e){var r=this._,n=vI(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=wI(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]=og(r[i],t.name,e);else if(e==null)for(i in r)r[i]=og(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 dl(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 wI(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function og(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=kI,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var Pu="http://www.w3.org/1999/xhtml";const ag={svg:"http://www.w3.org/2000/svg",xhtml:Pu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ic(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),ag.hasOwnProperty(e)?{space:ag[e],local:t}:t}function SI(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Pu&&e.documentElement.namespaceURI===Pu?e.createElement(t):e.createElementNS(r,t)}}function TI(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function $b(t){var e=Ic(t);return(e.local?TI:SI)(e)}function _I(){}function Ep(t){return t==null?_I:function(){return this.querySelector(t)}}function jI(t){typeof t!="function"&&(t=Ep(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 Sr(n,this._parents)}function NI(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function EI(){return[]}function Rb(t){return t==null?EI:function(){return this.querySelectorAll(t)}}function BI(t){return function(){return NI(t.apply(this,arguments))}}function LI(t){typeof t=="function"?t=BI(t):t=Rb(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 Sr(n,i)}function zb(t){return function(){return this.matches(t)}}function Wb(t){return function(e){return e.matches(t)}}var AI=Array.prototype.find;function MI(t){return function(){return AI.call(this.children,t)}}function II(){return this.firstElementChild}function FI(t){return this.select(t==null?II:MI(typeof t=="function"?t:Wb(t)))}var PI=Array.prototype.filter;function DI(){return Array.from(this.children)}function OI(t){return function(){return PI.call(this.children,t)}}function $I(t){return this.selectAll(t==null?DI:OI(typeof t=="function"?t:Wb(t)))}function RI(t){typeof t!="function"&&(t=zb(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 Sr(n,this._parents)}function qb(t){return new Array(t.length)}function zI(){return new Sr(this._enter||this._groups.map(qb),this._parents)}function ql(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}ql.prototype={constructor:ql,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 WI(t){return function(){return t}}function qI(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 ql(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function HI(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 ql(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&h.get(f[a])===l&&(i[a]=l)}function UI(t){return t.__data__}function YI(t,e){if(!arguments.length)return Array.from(this,UI);var r=e?HI:qI,n=this._parents,i=this._groups;typeof t!="function"&&(t=WI(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=VI(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,w,_;C<m;++C)if(w=x[C]){for(C>=b&&(b=C+1);!(_=g[b])&&++b<m;);w._next=_||null}}return o=new Sr(o,n),o._enter=a,o._exit=l,o}function VI(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function GI(){return new Sr(this._exit||this._groups.map(qb),this._parents)}function XI(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 KI(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 Sr(a,this._parents)}function QI(){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 ZI(t){t||(t=JI);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 Sr(i,this._parents).order()}function JI(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function tF(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function eF(){return Array.from(this)}function rF(){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 nF(){let t=0;for(const e of this)++t;return t}function iF(){return!this.node()}function sF(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 oF(t){return function(){this.removeAttribute(t)}}function aF(t){return function(){this.removeAttributeNS(t.space,t.local)}}function lF(t,e){return function(){this.setAttribute(t,e)}}function cF(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function hF(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function uF(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 dF(t,e){var r=Ic(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?aF:oF:typeof e=="function"?r.local?uF:hF:r.local?cF:lF)(r,e))}function Hb(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function pF(t){return function(){this.style.removeProperty(t)}}function fF(t,e,r){return function(){this.style.setProperty(t,e,r)}}function mF(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function gF(t,e,r){return arguments.length>1?this.each((e==null?pF:typeof e=="function"?mF:fF)(t,e,r??"")):Ts(this.node(),t)}function Ts(t,e){return t.style.getPropertyValue(e)||Hb(t).getComputedStyle(t,null).getPropertyValue(e)}function xF(t){return function(){delete this[t]}}function yF(t,e){return function(){this[t]=e}}function bF(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function CF(t,e){return arguments.length>1?this.each((e==null?xF:typeof e=="function"?bF:yF)(t,e)):this.node()[t]}function Ub(t){return t.trim().split(/^|\s+/)}function Bp(t){return t.classList||new Yb(t)}function Yb(t){this._node=t,this._names=Ub(t.getAttribute("class")||"")}Yb.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 Vb(t,e){for(var r=Bp(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function Gb(t,e){for(var r=Bp(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function kF(t){return function(){Vb(this,t)}}function vF(t){return function(){Gb(this,t)}}function wF(t,e){return function(){(e.apply(this,arguments)?Vb:Gb)(this,t)}}function SF(t,e){var r=Ub(t+"");if(arguments.length<2){for(var n=Bp(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?wF:e?kF:vF)(r,e))}function TF(){this.textContent=""}function _F(t){return function(){this.textContent=t}}function jF(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function NF(t){return arguments.length?this.each(t==null?TF:(typeof t=="function"?jF:_F)(t)):this.node().textContent}function EF(){this.innerHTML=""}function BF(t){return function(){this.innerHTML=t}}function LF(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function AF(t){return arguments.length?this.each(t==null?EF:(typeof t=="function"?LF:BF)(t)):this.node().innerHTML}function MF(){this.nextSibling&&this.parentNode.appendChild(this)}function IF(){return this.each(MF)}function FF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function PF(){return this.each(FF)}function DF(t){var e=typeof t=="function"?t:$b(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function OF(){return null}function $F(t,e){var r=typeof t=="function"?t:$b(t),n=e==null?OF:typeof e=="function"?e:Ep(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function RF(){var t=this.parentNode;t&&t.removeChild(this)}function zF(){return this.each(RF)}function WF(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qF(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function HF(t){return this.select(t?qF:WF)}function UF(t){return arguments.length?this.property("__data__",t):this.node().__data__}function YF(t){return function(e){t.call(this,e,this.__data__)}}function VF(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 GF(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 XF(t,e,r){return function(){var n=this.__on,i,s=YF(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 KF(t,e,r){var n=VF(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?XF:GF,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function Xb(t,e,r){var n=Hb(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 QF(t,e){return function(){return Xb(this,t,e)}}function ZF(t,e){return function(){return Xb(this,t,e.apply(this,arguments))}}function JF(t,e){return this.each((typeof e=="function"?ZF:QF)(t,e))}function*t4(){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 Kb=[null];function Sr(t,e){this._groups=t,this._parents=e}function ga(){return new Sr([[document.documentElement]],Kb)}function e4(){return this}Sr.prototype=ga.prototype={constructor:Sr,select:jI,selectAll:LI,selectChild:FI,selectChildren:$I,filter:RI,data:YI,enter:zI,exit:GI,join:XI,merge:KI,selection:e4,order:QI,sort:ZI,call:tF,nodes:eF,node:rF,size:nF,empty:iF,each:sF,attr:dF,style:gF,property:CF,classed:SF,text:NF,html:AF,raise:IF,lower:PF,append:DF,insert:$F,remove:zF,clone:HF,datum:UF,on:KF,dispatch:JF,[Symbol.iterator]:t4};function zt(t){return typeof t=="string"?new Sr([[document.querySelector(t)]],[document.documentElement]):new Sr([[t]],Kb)}function Lp(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Qb(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function xa(){}var Ko=.7,Hl=1/Ko,ns="\\s*([+-]?\\d+)\\s*",Qo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",r4=/^#([0-9a-f]{3,8})$/,n4=new RegExp(`^rgb\\(${ns},${ns},${ns}\\)$`),i4=new RegExp(`^rgb\\(${Qr},${Qr},${Qr}\\)$`),s4=new RegExp(`^rgba\\(${ns},${ns},${ns},${Qo}\\)$`),o4=new RegExp(`^rgba\\(${Qr},${Qr},${Qr},${Qo}\\)$`),a4=new RegExp(`^hsl\\(${Qo},${Qr},${Qr}\\)$`),l4=new RegExp(`^hsla\\(${Qo},${Qr},${Qr},${Qo}\\)$`),lg={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};Lp(xa,Zo,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:cg,formatHex:cg,formatHex8:c4,formatHsl:h4,formatRgb:hg,toString:hg});function cg(){return this.rgb().formatHex()}function c4(){return this.rgb().formatHex8()}function h4(){return Zb(this).formatHsl()}function hg(){return this.rgb().formatRgb()}function Zo(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=r4.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?ug(e):r===3?new pr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?za(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?za(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=n4.exec(t))?new pr(e[1],e[2],e[3],1):(e=i4.exec(t))?new pr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=s4.exec(t))?za(e[1],e[2],e[3],e[4]):(e=o4.exec(t))?za(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=a4.exec(t))?fg(e[1],e[2]/100,e[3]/100,1):(e=l4.exec(t))?fg(e[1],e[2]/100,e[3]/100,e[4]):lg.hasOwnProperty(t)?ug(lg[t]):t==="transparent"?new pr(NaN,NaN,NaN,0):null}function ug(t){return new pr(t>>16&255,t>>8&255,t&255,1)}function za(t,e,r,n){return n<=0&&(t=e=r=NaN),new pr(t,e,r,n)}function u4(t){return t instanceof xa||(t=Zo(t)),t?(t=t.rgb(),new pr(t.r,t.g,t.b,t.opacity)):new pr}function Du(t,e,r,n){return arguments.length===1?u4(t):new pr(t,e,r,n??1)}function pr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Lp(pr,Du,Qb(xa,{brighter(t){return t=t==null?Hl:Math.pow(Hl,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Ko:Math.pow(Ko,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new pr(mi(this.r),mi(this.g),mi(this.b),Ul(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:dg,formatHex:dg,formatHex8:d4,formatRgb:pg,toString:pg}));function dg(){return`#${hi(this.r)}${hi(this.g)}${hi(this.b)}`}function d4(){return`#${hi(this.r)}${hi(this.g)}${hi(this.b)}${hi((isNaN(this.opacity)?1:this.opacity)*255)}`}function pg(){const t=Ul(this.opacity);return`${t===1?"rgb(":"rgba("}${mi(this.r)}, ${mi(this.g)}, ${mi(this.b)}${t===1?")":`, ${t})`}`}function Ul(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function mi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function hi(t){return t=mi(t),(t<16?"0":"")+t.toString(16)}function fg(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Fr(t,e,r,n)}function Zb(t){if(t instanceof Fr)return new Fr(t.h,t.s,t.l,t.opacity);if(t instanceof xa||(t=Zo(t)),!t)return new Fr;if(t instanceof Fr)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 Fr(o,a,l,t.opacity)}function p4(t,e,r,n){return arguments.length===1?Zb(t):new Fr(t,e,r,n??1)}function Fr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Lp(Fr,p4,Qb(xa,{brighter(t){return t=t==null?Hl:Math.pow(Hl,t),new Fr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Ko:Math.pow(Ko,t),new Fr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new pr(Rh(t>=240?t-240:t+120,i,n),Rh(t,i,n),Rh(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Fr(mg(this.h),Wa(this.s),Wa(this.l),Ul(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=Ul(this.opacity);return`${t===1?"hsl(":"hsla("}${mg(this.h)}, ${Wa(this.s)*100}%, ${Wa(this.l)*100}%${t===1?")":`, ${t})`}`}}));function mg(t){return t=(t||0)%360,t<0?t+360:t}function Wa(t){return Math.max(0,Math.min(1,t||0))}function Rh(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 Ap=t=>()=>t;function Jb(t,e){return function(r){return t+r*e}}function f4(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 lV(t,e){var r=e-t;return r?Jb(t,r>180||r<-180?r-360*Math.round(r/360):r):Ap(isNaN(t)?e:t)}function m4(t){return(t=+t)==1?t1:function(e,r){return r-e?f4(e,r,t):Ap(isNaN(e)?r:e)}}function t1(t,e){var r=e-t;return r?Jb(t,r):Ap(isNaN(t)?e:t)}const gg=(function t(e){var r=m4(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=t1(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 Pn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var Ou=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zh=new RegExp(Ou.source,"g");function g4(t){return function(){return t}}function x4(t){return function(e){return t(e)+""}}function y4(t,e){var r=Ou.lastIndex=zh.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=Ou.exec(t))&&(i=zh.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:Pn(n,i)})),r=zh.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?x4(l[0].x):g4(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 xg=180/Math.PI,$u={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function e1(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)*xg,skewX:Math.atan(l)*xg,scaleX:o,scaleY:a}}var qa;function b4(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?$u:e1(e.a,e.b,e.c,e.d,e.e,e.f)}function C4(t){return t==null||(qa||(qa=document.createElementNS("http://www.w3.org/2000/svg","g")),qa.setAttribute("transform",t),!(t=qa.transform.baseVal.consolidate()))?$u:(t=t.matrix,e1(t.a,t.b,t.c,t.d,t.e,t.f))}function r1(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:Pn(h,d)},{i:x-2,x:Pn(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:Pn(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:Pn(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:Pn(h,d)},{i:x-2,x:Pn(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 k4=r1(b4,"px, ","px)","deg)"),v4=r1(C4,", ",")",")"),_s=0,_o=0,ho=0,n1=1e3,Yl,jo,Vl=0,vi=0,Fc=0,Jo=typeof performance=="object"&&performance.now?performance:Date,i1=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Mp(){return vi||(i1(w4),vi=Jo.now()+Fc)}function w4(){vi=0}function Gl(){this._call=this._time=this._next=null}Gl.prototype=s1.prototype={constructor:Gl,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?Mp():+r)+(e==null?0:+e),!this._next&&jo!==this&&(jo?jo._next=this:Yl=this,jo=this),this._call=t,this._time=r,Ru()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ru())}};function s1(t,e,r){var n=new Gl;return n.restart(t,e,r),n}function S4(){Mp(),++_s;for(var t=Yl,e;t;)(e=vi-t._time)>=0&&t._call.call(void 0,e),t=t._next;--_s}function yg(){vi=(Vl=Jo.now())+Fc,_s=_o=0;try{S4()}finally{_s=0,_4(),vi=0}}function T4(){var t=Jo.now(),e=t-Vl;e>n1&&(Fc-=e,Vl=t)}function _4(){for(var t,e=Yl,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:Yl=r);jo=t,Ru(n)}function Ru(t){if(!_s){_o&&(_o=clearTimeout(_o));var e=t-vi;e>24?(t<1/0&&(_o=setTimeout(yg,t-Jo.now()-Fc)),ho&&(ho=clearInterval(ho))):(ho||(Vl=Jo.now(),ho=setInterval(T4,n1)),_s=1,i1(yg))}}function bg(t,e,r){var n=new Gl;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var j4=Ob("start","end","cancel","interrupt"),N4=[],o1=0,Cg=1,zu=2,pl=3,kg=4,Wu=5,fl=6;function Pc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;E4(t,r,{name:e,index:n,group:i,on:j4,tween:N4,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:o1})}function Ip(t,e){var r=qr(t,e);if(r.state>o1)throw new Error("too late; already scheduled");return r}function on(t,e){var r=qr(t,e);if(r.state>pl)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 E4(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=s1(s,0,r.time);function s(h){r.state=Cg,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!==Cg)return l();for(u in n)if(p=n[u],p.name===r.name){if(p.state===pl)return bg(o);p.state===kg?(p.state=fl,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete n[u]):+u<e&&(p.state=fl,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete n[u])}if(bg(function(){r.state===pl&&(r.state=kg,r.timer.restart(a,r.delay,r.time),a(h))}),r.state=zu,r.on.call("start",t,t.__data__,r.index,r.group),r.state===zu){for(r.state=pl,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=Wu,1),d=-1,f=i.length;++d<f;)i[d].call(t,u);r.state===Wu&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=fl,r.timer.stop(),delete n[e];for(var h in n)return;delete t.__transition}}function B4(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>zu&&n.state<Wu,n.state=fl,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function L4(t){return this.each(function(){B4(this,t)})}function A4(t,e){var r,n;return function(){var i=on(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 M4(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var s=on(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 I4(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?A4:M4)(r,t,e))}function Fp(t,e,r){var n=t._id;return t.each(function(){var i=on(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return qr(i,n).value[e]}}function a1(t,e){var r;return(typeof e=="number"?Pn:e instanceof Zo?gg:(r=Zo(e))?(e=r,gg):y4)(t,e)}function F4(t){return function(){this.removeAttribute(t)}}function P4(t){return function(){this.removeAttributeNS(t.space,t.local)}}function D4(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 O4(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 $4(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 R4(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 z4(t,e){var r=Ic(t),n=r==="transform"?v4:a1;return this.attrTween(t,typeof e=="function"?(r.local?R4:$4)(r,n,Fp(this,"attr."+t,e)):e==null?(r.local?P4:F4)(r):(r.local?O4:D4)(r,n,e))}function W4(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function q4(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function H4(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&q4(t,s)),r}return i._value=e,i}function U4(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&W4(t,s)),r}return i._value=e,i}function Y4(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=Ic(t);return this.tween(r,(n.local?H4:U4)(n,e))}function V4(t,e){return function(){Ip(this,t).delay=+e.apply(this,arguments)}}function G4(t,e){return e=+e,function(){Ip(this,t).delay=e}}function X4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?V4:G4)(e,t)):qr(this.node(),e).delay}function K4(t,e){return function(){on(this,t).duration=+e.apply(this,arguments)}}function Q4(t,e){return e=+e,function(){on(this,t).duration=e}}function Z4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?K4:Q4)(e,t)):qr(this.node(),e).duration}function J4(t,e){if(typeof e!="function")throw new Error;return function(){on(this,t).ease=e}}function tP(t){var e=this._id;return arguments.length?this.each(J4(e,t)):qr(this.node(),e).ease}function eP(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;on(this,t).ease=r}}function rP(t){if(typeof t!="function")throw new Error;return this.each(eP(this._id,t))}function nP(t){typeof t!="function"&&(t=zb(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 xn(n,this._parents,this._name,this._id)}function iP(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 xn(o,this._parents,this._name,this._id)}function sP(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 oP(t,e,r){var n,i,s=sP(e)?Ip:on;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function aP(t,e){var r=this._id;return arguments.length<2?qr(this.node(),r).on.on(t):this.each(oP(r,t,e))}function lP(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function cP(){return this.on("end.remove",lP(this._id))}function hP(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Ep(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,Pc(h[f],e,r,f,h,qr(u,r)));return new xn(s,this._parents,e,r)}function uP(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Rb(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])&&Pc(p,e,r,x,f,m);s.push(f),o.push(u)}return new xn(s,o,e,r)}var dP=ga.prototype.constructor;function pP(){return new dP(this._groups,this._parents)}function fP(t,e){var r,n,i;return function(){var s=Ts(this,t),o=(this.style.removeProperty(t),Ts(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function l1(t){return function(){this.style.removeProperty(t)}}function mP(t,e,r){var n,i=r+"",s;return function(){var o=Ts(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function gP(t,e,r){var n,i,s;return function(){var o=Ts(this,t),a=r(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),Ts(this,t))),o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a))}}function xP(t,e){var r,n,i,s="style."+e,o="end."+s,a;return function(){var l=on(this,t),h=l.on,u=l.value[s]==null?a||(a=l1(e)):void 0;(h!==r||i!==u)&&(n=(r=h).copy()).on(o,i=u),l.on=n}}function yP(t,e,r){var n=(t+="")=="transform"?k4:a1;return e==null?this.styleTween(t,fP(t,n)).on("end.style."+t,l1(t)):typeof e=="function"?this.styleTween(t,gP(t,n,Fp(this,"style."+t,e))).each(xP(this._id,t)):this.styleTween(t,mP(t,n,e),r).on("end.style."+t,null)}function bP(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function CP(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&bP(t,o,r)),n}return s._value=e,s}function kP(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,CP(t,e,r??""))}function vP(t){return function(){this.textContent=t}}function wP(t){return function(){var e=t(this);this.textContent=e??""}}function SP(t){return this.tween("text",typeof t=="function"?wP(Fp(this,"text",t)):vP(t==null?"":t+""))}function TP(t){return function(e){this.textContent=t.call(this,e)}}function _P(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&TP(i)),e}return n._value=t,n}function jP(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,_P(t))}function NP(){for(var t=this._name,e=this._id,r=c1(),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);Pc(l,t,r,h,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new xn(n,this._parents,t,r)}function EP(){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=on(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 BP=0;function xn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function c1(){return++BP}var un=ga.prototype;xn.prototype={constructor:xn,select:hP,selectAll:uP,selectChild:un.selectChild,selectChildren:un.selectChildren,filter:nP,merge:iP,selection:pP,transition:NP,call:un.call,nodes:un.nodes,node:un.node,size:un.size,empty:un.empty,each:un.each,on:aP,attr:z4,attrTween:Y4,style:yP,styleTween:kP,text:SP,textTween:jP,remove:cP,tween:I4,delay:X4,duration:Z4,ease:tP,easeVarying:rP,end:EP,[Symbol.iterator]:un[Symbol.iterator]};function LP(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var AP={time:null,delay:0,duration:250,ease:LP};function MP(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 IP(t){var e,r;t instanceof xn?(e=t._id,t=t._name):(e=c1(),(r=AP).time=Mp(),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])&&Pc(l,t,e,h,o,r||MP(l,e));return new xn(n,this._parents,t,e)}ga.prototype.interrupt=L4;ga.prototype.transition=IP;const qu=Math.PI,Hu=2*qu,si=1e-6,FP=Hu-si;function h1(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function PP(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return h1;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 DP{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?h1:PP(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>si)if(!(Math.abs(d*l-h*u)>si)||!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((qu-Math.acos((x+f-g)/(2*y*C)))/2),w=b/C,_=b/y;Math.abs(w-1)>si&&this._append`L${e+w*u},${r+w*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)>si||Math.abs(this._y1-u)>si)&&this._append`L${h},${u}`,n&&(f<0&&(f=f%Hu+Hu),f>FP?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>si&&this._append`A${n},${n},0,${+(f>=qu)},${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 Ri(t){return function(){return t}}const cV=Math.abs,hV=Math.atan2,uV=Math.cos,dV=Math.max,pV=Math.min,fV=Math.sin,mV=Math.sqrt,vg=1e-12,Pp=Math.PI,wg=Pp/2,gV=2*Pp;function xV(t){return t>1?0:t<-1?Pp:Math.acos(t)}function yV(t){return t>=1?wg:t<=-1?-wg:Math.asin(t)}function OP(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 DP(e)}function $P(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function u1(t){this._context=t}u1.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 Ro(t){return new u1(t)}function RP(t){return t[0]}function zP(t){return t[1]}function WP(t,e){var r=Ri(!0),n=null,i=Ro,s=null,o=OP(a);t=typeof t=="function"?t:t===void 0?RP:Ri(t),e=typeof e=="function"?e:e===void 0?zP:Ri(e);function a(l){var h,u=(l=$P(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:Ri(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Ri(+l),a):e},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Ri(!!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 d1{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 p1(t){return new d1(t,!0)}function f1(t){return new d1(t,!1)}function Un(){}function Xl(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 Dc(t){this._context=t}Dc.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:Xl(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:Xl(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Uu(t){return new Dc(t)}function m1(t){this._context=t}m1.prototype={areaStart:Un,areaEnd:Un,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:Xl(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function qP(t){return new m1(t)}function g1(t){this._context=t}g1.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:Xl(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function HP(t){return new g1(t)}function x1(t,e){this._basis=new Dc(t),this._beta=e}x1.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 UP=(function t(e){function r(n){return e===1?new Dc(n):new x1(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function Kl(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 Dp(t,e){this._context=t,this._k=(1-e)/6}Dp.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:Kl(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:Kl(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 y1=(function t(e){function r(n){return new Dp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function Op(t,e){this._context=t,this._k=(1-e)/6}Op.prototype={areaStart:Un,areaEnd:Un,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:Kl(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 YP=(function t(e){function r(n){return new Op(n,e)}return r.tension=function(n){return t(+n)},r})(0);function $p(t,e){this._context=t,this._k=(1-e)/6}$p.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:Kl(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 VP=(function t(e){function r(n){return new $p(n,e)}return r.tension=function(n){return t(+n)},r})(0);function Rp(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>vg){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>vg){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 b1(t,e){this._context=t,this._alpha=e}b1.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:Rp(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 C1=(function t(e){function r(n){return e?new b1(n,e):new Dp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function k1(t,e){this._context=t,this._alpha=e}k1.prototype={areaStart:Un,areaEnd:Un,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:Rp(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 GP=(function t(e){function r(n){return e?new k1(n,e):new Op(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function v1(t,e){this._context=t,this._alpha=e}v1.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:Rp(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 XP=(function t(e){function r(n){return e?new v1(n,e):new $p(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function w1(t){this._context=t}w1.prototype={areaStart:Un,areaEnd:Un,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 KP(t){return new w1(t)}function Sg(t){return t<0?-1:1}function Tg(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(Sg(s)+Sg(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function _g(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Wh(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 Ql(t){this._context=t}Ql.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:Wh(this,this._t0,_g(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,Wh(this,_g(this,r=Tg(this,t,e)),r);break;default:Wh(this,this._t0,r=Tg(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function S1(t){this._context=new T1(t)}(S1.prototype=Object.create(Ql.prototype)).point=function(t,e){Ql.prototype.point.call(this,e,t)};function T1(t){this._context=t}T1.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 _1(t){return new Ql(t)}function j1(t){return new S1(t)}function N1(t){this._context=t}N1.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=jg(t),i=jg(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 jg(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 E1(t){return new N1(t)}function Oc(t,e){this._context=t,this._t=e}Oc.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 B1(t){return new Oc(t,.5)}function L1(t){return new Oc(t,0)}function A1(t){return new Oc(t,1)}function No(t,e,r){this.k=t,this.x=e,this.y=r}No.prototype={constructor:No,scale:function(t){return t===1?this:new No(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new No(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+")"}};No.prototype;var QP=v(t=>{var i;const{securityLevel:e}=Qt();let r=zt("body");if(e==="sandbox"){const o=((i=zt(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=zt(o.body)}return r.select(`#${t}`)},"selectSvgElement");function zp(t){return typeof t>"u"||t===null}v(zp,"isNothing");function M1(t){return typeof t=="object"&&t!==null}v(M1,"isObject");function I1(t){return Array.isArray(t)?t:zp(t)?[]:[t]}v(I1,"toArray");function F1(t,e){var r,n,i,s;if(e)for(s=Object.keys(e),r=0,n=s.length;r<n;r+=1)i=s[r],t[i]=e[i];return t}v(F1,"extend");function P1(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(P1,"repeat");function D1(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(D1,"isNegativeZero");var ZP=zp,JP=M1,tD=I1,eD=P1,rD=D1,nD=F1,Le={isNothing:ZP,isObject:JP,toArray:tD,repeat:eD,isNegativeZero:rD,extend:nD};function Wp(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+=`
|
|
450
|
-
|
|
451
|
-
`+t.mark.snippet),n+" "+r):n}v(Wp,"formatError");function js(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=Wp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}v(js,"YAMLException$1");js.prototype=Object.create(Error.prototype);js.prototype.constructor=js;js.prototype.toString=v(function(e){return this.name+": "+Wp(this,e)},"toString");var dr=js;function ml(t,e,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-e>a&&(s=" ... ",e=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+t.slice(e,r).replace(/\t/g,"→")+o,pos:n-e+s.length}}v(ml,"getLine");function gl(t,e){return Le.repeat(" ",e-t.length)+t}v(gl,"padStart");function O1(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=ml(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Le.repeat(" ",e.indent)+gl((t.line-l+1).toString(),u)+" | "+h.str+`
|
|
452
|
-
`+a;for(h=ml(t.buffer,n[o],i[o],t.position,d),a+=Le.repeat(" ",e.indent)+gl((t.line+1).toString(),u)+" | "+h.str+`
|
|
453
|
-
`,a+=Le.repeat("-",e.indent+u+3+h.pos)+`^
|
|
454
|
-
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)h=ml(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Le.repeat(" ",e.indent)+gl((t.line+l+1).toString(),u)+" | "+h.str+`
|
|
455
|
-
`;return a.replace(/\n$/,"")}v(O1,"makeSnippet");var iD=O1,sD=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],oD=["scalar","sequence","mapping"];function $1(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v($1,"compileStyleAliases");function R1(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(sD.indexOf(r)===-1)throw new dr('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=$1(e.styleAliases||null),oD.indexOf(this.kind)===-1)throw new dr('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(R1,"Type$1");var Xe=R1;function Yu(t,e){var r=[];return t[e].forEach(function(n){var i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}v(Yu,"compileList");function z1(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,r;function n(i){i.multi?(t.multi[i.kind].push(i),t.multi.fallback.push(i)):t[i.kind][i.tag]=t.fallback[i.tag]=i}for(v(n,"collectType"),e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(n);return t}v(z1,"compileMap");function Zl(t){return this.extend(t)}v(Zl,"Schema$1");Zl.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Xe)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 dr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Xe))throw new dr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new dr("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 dr("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 Xe))throw new dr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Zl.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=Yu(i,"implicit"),i.compiledExplicit=Yu(i,"explicit"),i.compiledTypeMap=z1(i.compiledImplicit,i.compiledExplicit),i},"extend");var aD=Zl,lD=new Xe("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),cD=new Xe("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),hD=new Xe("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),uD=new aD({explicit:[lD,cD,hD]});function W1(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(W1,"resolveYamlNull");function q1(){return null}v(q1,"constructYamlNull");function H1(t){return t===null}v(H1,"isNull");var dD=new Xe("tag:yaml.org,2002:null",{kind:"scalar",resolve:W1,construct:q1,predicate:H1,represent:{canonical:v(function(){return"~"},"canonical"),lowercase:v(function(){return"null"},"lowercase"),uppercase:v(function(){return"NULL"},"uppercase"),camelcase:v(function(){return"Null"},"camelcase"),empty:v(function(){return""},"empty")},defaultStyle:"lowercase"});function U1(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}v(U1,"resolveYamlBoolean");function Y1(t){return t==="true"||t==="True"||t==="TRUE"}v(Y1,"constructYamlBoolean");function V1(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(V1,"isBoolean");var pD=new Xe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:U1,construct:Y1,predicate:V1,represent:{lowercase:v(function(t){return t?"true":"false"},"lowercase"),uppercase:v(function(t){return t?"TRUE":"FALSE"},"uppercase"),camelcase:v(function(t){return t?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function G1(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(G1,"isHexCode");function X1(t){return 48<=t&&t<=55}v(X1,"isOctCode");function K1(t){return 48<=t&&t<=57}v(K1,"isDecCode");function Q1(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(!G1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!X1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!K1(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(Q1,"resolveYamlInteger");function Z1(t){var e=t,r=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}v(Z1,"constructYamlInteger");function J1(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Le.isNegativeZero(t)}v(J1,"isInteger");var fD=new Xe("tag:yaml.org,2002:int",{kind:"scalar",resolve:Q1,construct:Z1,predicate:J1,represent:{binary:v(function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},"binary"),octal:v(function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},"octal"),decimal:v(function(t){return t.toString(10)},"decimal"),hexadecimal:v(function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),mD=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function tC(t){return!(t===null||!mD.test(t)||t[t.length-1]==="_")}v(tC,"resolveYamlFloat");function eC(t){var e,r;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}v(eC,"constructYamlFloat");var gD=/^[-+]?[0-9]+e/;function rC(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(Le.isNegativeZero(t))return"-0.0";return r=t.toString(10),gD.test(r)?r.replace("e",".e"):r}v(rC,"representYamlFloat");function nC(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Le.isNegativeZero(t))}v(nC,"isFloat");var xD=new Xe("tag:yaml.org,2002:float",{kind:"scalar",resolve:tC,construct:eC,predicate:nC,represent:rC,defaultStyle:"lowercase"}),iC=uD.extend({implicit:[dD,pD,fD,xD]}),yD=iC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),oC=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 aC(t){return t===null?!1:sC.exec(t)!==null||oC.exec(t)!==null}v(aC,"resolveYamlTimestamp");function lC(t){var e,r,n,i,s,o,a,l=0,h=null,u,d,f;if(e=sC.exec(t),e===null&&(e=oC.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}v(lC,"constructYamlTimestamp");function cC(t){return t.toISOString()}v(cC,"representYamlTimestamp");var bD=new Xe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:aC,construct:lC,instanceOf:Date,represent:cC});function hC(t){return t==="<<"||t===null}v(hC,"resolveYamlMerge");var CD=new Xe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:hC}),qp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
456
|
-
\r`;function uC(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=qp;for(r=0;r<i;r++)if(e=s.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}v(uC,"resolveYamlBinary");function dC(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=qp,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return r=i%4*6,r===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):r===18?(a.push(o>>10&255),a.push(o>>2&255)):r===12&&a.push(o>>4&255),new Uint8Array(a)}v(dC,"constructYamlBinary");function pC(t){var e="",r=0,n,i,s=t.length,o=qp;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]),r=(r<<8)+t[n];return i=s%3,i===0?(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]):i===2?(e+=o[r>>10&63],e+=o[r>>4&63],e+=o[r<<2&63],e+=o[64]):i===1&&(e+=o[r>>2&63],e+=o[r<<4&63],e+=o[64],e+=o[64]),e}v(pC,"representYamlBinary");function fC(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(fC,"isBinary");var kD=new Xe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:uC,construct:dC,predicate:fC,represent:pC}),vD=Object.prototype.hasOwnProperty,wD=Object.prototype.toString;function mC(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,wD.call(i)!=="[object Object]")return!1;for(s in i)if(vD.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}v(mC,"resolveYamlOmap");function gC(t){return t!==null?t:[]}v(gC,"constructYamlOmap");var SD=new Xe("tag:yaml.org,2002:omap",{kind:"sequence",resolve:mC,construct:gC}),TD=Object.prototype.toString;function xC(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],TD.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}v(xC,"resolveYamlPairs");function yC(t){if(t===null)return[];var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1)n=o[e],i=Object.keys(n),s[e]=[i[0],n[i[0]]];return s}v(yC,"constructYamlPairs");var _D=new Xe("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:xC,construct:yC}),jD=Object.prototype.hasOwnProperty;function bC(t){if(t===null)return!0;var e,r=t;for(e in r)if(jD.call(r,e)&&r[e]!==null)return!1;return!0}v(bC,"resolveYamlSet");function CC(t){return t!==null?t:{}}v(CC,"constructYamlSet");var ND=new Xe("tag:yaml.org,2002:set",{kind:"mapping",resolve:bC,construct:CC}),kC=yD.extend({implicit:[bD,CD],explicit:[kD,SD,_D,ND]}),Yn=Object.prototype.hasOwnProperty,Jl=1,vC=2,wC=3,tc=4,qh=1,ED=2,Ng=3,BD=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,LD=/[\x85\u2028\u2029]/,AD=/[,\[\]\{\}]/,SC=/^(?:!|!!|![a-z\-]+!)$/i,TC=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Vu(t){return Object.prototype.toString.call(t)}v(Vu,"_class");function $r(t){return t===10||t===13}v($r,"is_EOL");function zn(t){return t===9||t===32}v(zn,"is_WHITE_SPACE");function nr(t){return t===9||t===32||t===10||t===13}v(nr,"is_WS_OR_EOL");function ui(t){return t===44||t===91||t===93||t===123||t===125}v(ui,"is_FLOW_INDICATOR");function _C(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(_C,"fromHexCode");function jC(t){return t===120?2:t===117?4:t===85?8:0}v(jC,"escapedHexLen");function NC(t){return 48<=t&&t<=57?t-48:-1}v(NC,"fromDecimalCode");function Gu(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
|
|
457
|
-
`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"
":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}v(Gu,"simpleEscapeSequence");function EC(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v(EC,"charFromCodepoint");function Hp(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(Hp,"setProperty");var BC=new Array(256),LC=new Array(256);for(ni=0;ni<256;ni++)BC[ni]=Gu(ni)?1:0,LC[ni]=Gu(ni);var ni;function AC(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||kC,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}v(AC,"State$1");function Up(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=iD(r),new dr(e,r)}v(Up,"generateError");function Tt(t,e){throw Up(t,e)}v(Tt,"throwError");function ta(t,e){t.onWarning&&t.onWarning.call(null,Up(t,e))}v(ta,"throwWarning");var Eg={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&Tt(e,"duplication of %YAML directive"),n.length!==1&&Tt(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Tt(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Tt(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&ta(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&Tt(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],SC.test(i)||Tt(e,"ill-formed tag handle (first argument) of the TAG directive"),Yn.call(e.tagMap,i)&&Tt(e,'there is a previously declared suffix for "'+i+'" tag handle'),TC.test(s)||Tt(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Tt(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function mn(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||Tt(t,"expected valid JSON character");else BD.test(a)&&Tt(t,"the stream contains non-printable characters");t.result+=a}}v(mn,"captureSegment");function Xu(t,e,r,n){var i,s,o,a;for(Le.isObject(r)||Tt(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],Yn.call(e,s)||(Hp(e,s,r[s]),n[s]=!0)}v(Xu,"mergeMappings");function di(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])&&Tt(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)Xu(t,e,s[h],r);else Xu(t,e,s,r);else!t.json&&!Yn.call(r,i)&&Yn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,Tt(t,"duplicated mapping key")),Hp(e,i,s),delete r[i];return e}v(di,"storeMappingPair");function $c(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++):Tt(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v($c,"readLineBreak");function ve(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;zn(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($c(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&&ta(t,"deficient indentation"),n}v(ve,"skipSeparationSpace");function ya(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||nr(r)))}v(ya,"testDocumentSeparator");function Rc(t,e){e===1?t.result+=" ":e>1&&(t.result+=Le.repeat(`
|
|
458
|
-
`,e-1))}v(Rc,"writeFoldedLines");function MC(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),nr(p)||ui(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),nr(i)||r&&ui(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),nr(i)||r&&ui(i))break}else if(p===35){if(n=t.input.charCodeAt(t.position-1),nr(n))break}else{if(t.position===t.lineStart&&ya(t)||r&&ui(p))break;if($r(p))if(l=t.line,h=t.lineStart,u=t.lineIndent,ve(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&&(mn(t,s,o,!1),Rc(t,t.line-l),s=o=t.position,a=!1),zn(p)||(o=t.position+1),p=t.input.charCodeAt(++t.position)}return mn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=f,!1)}v(MC,"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(mn(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)?(mn(t,n,i,!0),Rc(t,ve(t,!1,e)),n=i=t.position):t.position===t.lineStart&&ya(t)?Tt(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);Tt(t,"unexpected end of the stream within a single quoted scalar")}v(IC,"readSingleQuotedScalar");function FC(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 mn(t,r,t.position,!0),t.position++,!0;if(a===92){if(mn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),$r(a))ve(t,!1,e);else if(a<256&&BC[a])t.result+=LC[a],t.position++;else if((o=jC(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=_C(a))>=0?s=(s<<4)+o:Tt(t,"expected hexadecimal character");t.result+=EC(s),t.position++}else Tt(t,"unknown escape sequence");r=n=t.position}else $r(a)?(mn(t,r,n,!0),Rc(t,ve(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ya(t)?Tt(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}Tt(t,"unexpected end of the stream within a double quoted scalar")}v(FC,"readDoubleQuotedScalar");function PC(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(ve(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&&Tt(t,"expected the node content, but found ','"):Tt(t,"missed comma between flow collection entries"),g=x=y=null,d=f=!1,C===63&&(h=t.input.charCodeAt(t.position+1),nr(h)&&(d=f=!0,t.position++,ve(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,wi(t,e,Jl,!1,!0),g=t.tag,x=t.result,ve(t,!0,e),C=t.input.charCodeAt(t.position),(f||t.line===n)&&C===58&&(d=!0,C=t.input.charCodeAt(++t.position),ve(t,!0,e),wi(t,e,Jl,!1,!0),y=t.result),p?di(t,a,m,g,x,y,n,i,s):d?a.push(di(t,null,m,g,x,y,n,i,s)):a.push(x),ve(t,!0,e),C=t.input.charCodeAt(t.position),C===44?(r=!0,C=t.input.charCodeAt(++t.position)):r=!1}Tt(t,"unexpected end of the stream within a flow collection")}v(PC,"readFlowCollection");function DC(t,e){var r,n,i=qh,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)qh===i?i=d===43?Ng:ED:Tt(t,"repeat of a chomping mode identifier");else if((u=NC(d))>=0)u===0?Tt(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Tt(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(zn(d)){do d=t.input.charCodeAt(++t.position);while(zn(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!$r(d)&&d!==0)}for(;d!==0;){for($c(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===Ng?t.result+=Le.repeat(`
|
|
459
|
-
`,s?1+l:l):i===qh&&s&&(t.result+=`
|
|
460
|
-
`);break}for(n?zn(d)?(h=!0,t.result+=Le.repeat(`
|
|
461
|
-
`,s?1+l:l)):h?(h=!1,t.result+=Le.repeat(`
|
|
462
|
-
`,l+1)):l===0?s&&(t.result+=" "):t.result+=Le.repeat(`
|
|
463
|
-
`,l):t.result+=Le.repeat(`
|
|
464
|
-
`,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!$r(d)&&d!==0;)d=t.input.charCodeAt(++t.position);mn(t,r,t.position,!1)}return!0}v(DC,"readBlockScalar");function Ku(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,Tt(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!nr(o))));){if(a=!0,t.position++,ve(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,wi(t,e,wC,!1,!0),s.push(t.result),ve(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)Tt(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return a?(t.tag=n,t.anchor=i,t.kind="sequence",t.result=s,!0):!1}v(Ku,"readBlockSequence");function OC(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,Tt(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(C===63||C===58)&&nr(n))C===63?(g&&(di(t,d,f,p,m,null,o,a,l),p=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):Tt(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,!wi(t,r,vC,!1,!0))break;if(t.line===s){for(C=t.input.charCodeAt(t.position);zn(C);)C=t.input.charCodeAt(++t.position);if(C===58)C=t.input.charCodeAt(++t.position),nr(C)||Tt(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(di(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)Tt(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=h,t.anchor=u,!0}else if(y)Tt(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),wi(t,e,tc,!0,i)&&(g?m=t.result:x=t.result),g||(di(t,d,f,p,m,x,o,a,l),p=m=x=null),ve(t,!0,-1),C=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&C!==0)Tt(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&di(t,d,f,p,m,null,o,a,l),y&&(t.tag=h,t.anchor=u,t.kind="mapping",t.result=d),y}v(OC,"readBlockMapping");function $C(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&&Tt(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)):Tt(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!nr(o);)o===33&&(n?Tt(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),SC.test(i)||Tt(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),AD.test(s)&&Tt(t,"tag suffix cannot contain flow indicator characters")}s&&!TC.test(s)&&Tt(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Tt(t,"tag name is malformed: "+s)}return r?t.tag=s:Yn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:Tt(t,'undeclared tag handle "'+i+'"'),!0}v($C,"readTagProperty");function RC(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&Tt(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!nr(r)&&!ui(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&Tt(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(RC,"readAnchorProperty");function zC(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&&!nr(n)&&!ui(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&Tt(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Yn.call(t.anchorMap,r)||Tt(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],ve(t,!0,-1),!0}v(zC,"readAlias");function wi(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=tc===r||wC===r,n&&ve(t,!0,-1)&&(h=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;$C(t)||RC(t);)ve(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||tc===r)&&(Jl===r||vC===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&(Ku(t,g)||OC(t,g,x))||PC(t,x)?u=!0:(o&&DC(t,x)||IC(t,x)||FC(t,x)?u=!0:zC(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&Tt(t,"alias node should not have any properties")):MC(t,x,Jl===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&Ku(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"&&Tt(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(Yn.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||Tt(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&Tt(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)):Tt(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||u}v(wi,"composeNode");function WC(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&&(ve(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&&!nr(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&Tt(t,"directive name must not be less than one character in length");o!==0;){for(;zn(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&&!nr(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&$c(t),Yn.call(Eg,n)?Eg[n](t,n,i):ta(t,'unknown document directive "'+n+'"')}if(ve(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,ve(t,!0,-1)):s&&Tt(t,"directives end mark is expected"),wi(t,t.lineIndent-1,tc,!1,!0),ve(t,!0,-1),t.checkLineBreaks&&LD.test(t.input.slice(e,t.position))&&ta(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&ya(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,ve(t,!0,-1));return}if(t.position<t.length-1)Tt(t,"end of the stream or a document separator is expected");else return}v(WC,"readDocument");function Yp(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
|
|
465
|
-
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new AC(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,Tt(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;)WC(r);return r.documents}v(Yp,"loadDocuments");function MD(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=Yp(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(MD,"loadAll$1");function qC(t,e){var r=Yp(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new dr("expected a single document in the stream, but found more")}}v(qC,"load$1");var ID=qC,FD={load:ID},HC=Object.prototype.toString,UC=Object.prototype.hasOwnProperty,Vp=65279,PD=9,ea=10,DD=13,OD=32,$D=33,RD=34,Qu=35,zD=37,WD=38,qD=39,HD=42,YC=44,UD=45,ec=58,YD=61,VD=62,GD=63,XD=64,VC=91,GC=93,KD=96,XC=123,QD=124,KC=125,Qe={};Qe[0]="\\0";Qe[7]="\\a";Qe[8]="\\b";Qe[9]="\\t";Qe[10]="\\n";Qe[11]="\\v";Qe[12]="\\f";Qe[13]="\\r";Qe[27]="\\e";Qe[34]='\\"';Qe[92]="\\\\";Qe[133]="\\N";Qe[160]="\\_";Qe[8232]="\\L";Qe[8233]="\\P";var ZD=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],JD=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function QC(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&&UC.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}v(QC,"compileStyleMap");function ZC(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 dr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Le.repeat("0",n-e.length)+e}v(ZC,"encodeHex");var tO=1,ra=2;function JC(t){this.schema=t.schema||kC,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Le.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=QC(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==='"'?ra:tO,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}v(JC,"State");function Zu(t,e){for(var r=Le.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
|
|
466
|
-
`,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
|
|
467
|
-
`&&(s+=r),s+=o;return s}v(Zu,"indentString");function rc(t,e){return`
|
|
468
|
-
`+Le.repeat(" ",t.indent*e)}v(rc,"generateNextLine");function tk(t,e){var r,n,i;for(r=0,n=t.implicitTypes.length;r<n;r+=1)if(i=t.implicitTypes[r],i.resolve(e))return!0;return!1}v(tk,"testImplicitResolving");function na(t){return t===OD||t===PD}v(na,"isWhitespace");function Ns(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==Vp||65536<=t&&t<=1114111}v(Ns,"isPrintable");function Ju(t){return Ns(t)&&t!==Vp&&t!==DD&&t!==ea}v(Ju,"isNsCharOrWhitespace");function td(t,e,r){var n=Ju(t),i=n&&!na(t);return(r?n:n&&t!==YC&&t!==VC&&t!==GC&&t!==XC&&t!==KC)&&t!==Qu&&!(e===ec&&!i)||Ju(e)&&!na(e)&&t===Qu||e===ec&&i}v(td,"isPlainSafe");function ek(t){return Ns(t)&&t!==Vp&&!na(t)&&t!==UD&&t!==GD&&t!==ec&&t!==YC&&t!==VC&&t!==GC&&t!==XC&&t!==KC&&t!==Qu&&t!==WD&&t!==HD&&t!==$D&&t!==QD&&t!==YD&&t!==VD&&t!==qD&&t!==RD&&t!==zD&&t!==XD&&t!==KD}v(ek,"isPlainSafeFirst");function rk(t){return!na(t)&&t!==ec}v(rk,"isPlainSafeLast");function Zi(t,e){var r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}v(Zi,"codePointAt");function Gp(t){var e=/^\n* /;return e.test(t)}v(Gp,"needIndentIndicator");var nk=1,ed=2,ik=3,sk=4,Xi=5;function ok(t,e,r,n,i,s,o,a){var l,h=0,u=null,d=!1,f=!1,p=n!==-1,m=-1,x=ek(Zi(t,0))&&rk(Zi(t,t.length-1));if(e||o)for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Zi(t,l),!Ns(h))return Xi;x=x&&td(h,u,a),u=h}else{for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Zi(t,l),h===ea)d=!0,p&&(f=f||l-m-1>n&&t[m+1]!==" ",m=l);else if(!Ns(h))return Xi;x=x&&td(h,u,a),u=h}f=f||p&&l-m-1>n&&t[m+1]!==" "}return!d&&!f?x&&!o&&!i(t)?nk:s===ra?Xi:ed:r>9&&Gp(t)?Xi:o?s===ra?Xi:ed:f?sk:ik}v(ok,"chooseScalarStyle");function ak(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===ra?'""':"''";if(!t.noCompatMode&&(ZD.indexOf(e)!==-1||JD.test(e)))return t.quotingType===ra?'"'+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 tk(t,h)}switch(v(l,"testAmbiguity"),ok(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case nk:return e;case ed:return"'"+e.replace(/'/g,"''")+"'";case ik:return"|"+rd(e,t.indent)+nd(Zu(e,s));case sk:return">"+rd(e,t.indent)+nd(Zu(lk(e,o),s));case Xi:return'"'+ck(e)+'"';default:throw new dr("impossible error: invalid scalar style")}})()}v(ak,"writeScalar");function rd(t,e){var r=Gp(t)?String(e):"",n=t[t.length-1]===`
|
|
469
|
-
`,i=n&&(t[t.length-2]===`
|
|
470
|
-
`||t===`
|
|
471
|
-
`),s=i?"+":n?"":"-";return r+s+`
|
|
472
|
-
`}v(rd,"blockHeader");function nd(t){return t[t.length-1]===`
|
|
473
|
-
`?t.slice(0,-1):t}v(nd,"dropEndingNewline");function lk(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var h=t.indexOf(`
|
|
474
|
-
`);return h=h!==-1?h:t.length,r.lastIndex=h,id(t.slice(0,h),e)})(),i=t[0]===`
|
|
475
|
-
`||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
|
|
476
|
-
`:"")+id(l,e),i=s}return n}v(lk,"foldString");function id(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+=`
|
|
477
|
-
`+t.slice(i,s),i=s+1),o=a;return l+=`
|
|
478
|
-
`,t.length-i>e&&o>i?l+=t.slice(i,o)+`
|
|
479
|
-
`+t.slice(o+1):l+=t.slice(i),l.slice(1)}v(id,"foldLine");function ck(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=Zi(t,i),n=Qe[r],!n&&Ns(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||ZC(r);return e}v(ck,"escapeString");function hk(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)),(Jr(t,e,a,!1,!1)||typeof a>"u"&&Jr(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}v(hk,"writeFlowSequence");function sd(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)),(Jr(t,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&Jr(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=rc(t,e)),t.dump&&ea===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v(sd,"writeBlockSequence");function uk(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)),Jr(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Jr(t,e,h,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}v(uk,"writeFlowMapping");function dk(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 dr("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!n||i!=="")&&(f+=rc(t,e)),h=o[a],u=r[h],t.replacer&&(u=t.replacer.call(r,h,u)),Jr(t,e+1,h,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&ea===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,d&&(f+=rc(t,e)),Jr(t,e+1,u,!0,d)&&(t.dump&&ea===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,i+=f));t.tag=s,t.dump=i||"{}"}v(dk,"writeBlockMapping");function od(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,HC.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(UC.call(a.represent,l))n=a.represent[l](e,l);else throw new dr("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}v(od,"detectType");function Jr(t,e,r,n,i,s,o){t.tag=null,t.dump=r,od(t,r,!1)||od(t,r,!0);var a=HC.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?(dk(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(uk(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?sd(t,e-1,t.dump,i):sd(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(hk(t,e,t.dump),f&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&ak(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new dr("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}v(Jr,"writeNode");function pk(t,e){var r=[],n=[],i,s;for(nc(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v(pk,"getDuplicateReferences");function nc(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)nc(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)nc(t[n[i]],e,r)}v(nc,"inspectNode");function eO(t,e){e=e||{};var r=new JC(e);r.noRefs||pk(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Jr(r,0,n,!0,!0)?r.dump+`
|
|
480
|
-
`:""}v(eO,"dump$1");function rO(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}v(rO,"renamed");var nO=iC,iO=FD.load;/*! Bundled license information:
|
|
481
|
-
|
|
482
|
-
js-yaml/dist/js-yaml.mjs:
|
|
483
|
-
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
484
|
-
*/var uo=v((t,e)=>{if(e)return"translate("+-t.width/2+", "+-t.height/2+")";const r=t.x??0,n=t.y??0;return"translate("+-(r+t.width/2)+", "+-(n+t.height/2)+")"},"computeLabelTransform"),Ye={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},Bg={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function Eo(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}}v(Eo,"calculateDeltaAndAngle");var pe=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),sO=v(t=>({x:v(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(Ye,t.arrowTypeStart)){const{angle:p,deltaX:m}=Eo(n[0],n[1]);i=Ye[t.arrowTypeStart]*Math.cos(p)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ye,t.arrowTypeEnd)){const{angle:p,deltaX:m}=Eo(n[n.length-1],n[n.length-2]);i=Ye[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=Ye[t.arrowTypeStart],d=Ye[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:v(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(Ye,t.arrowTypeStart)){const{angle:p,deltaY:m}=Eo(n[0],n[1]);i=Ye[t.arrowTypeStart]*Math.abs(Math.sin(p))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ye,t.arrowTypeEnd)){const{angle:p,deltaY:m}=Eo(n[n.length-1],n[n.length-2]);i=Ye[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=Ye[t.arrowTypeStart],d=Ye[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"),Ha={},Ee={},Lg;function oO(){return Lg||(Lg=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.BLANK_URL=Ee.relativeFirstCharacters=Ee.whitespaceEscapeCharsRegex=Ee.urlSchemeRegex=Ee.ctrlCharactersRegex=Ee.htmlCtrlEntityRegex=Ee.htmlEntitiesRegex=Ee.invalidProtocolRegex=void 0,Ee.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,Ee.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,Ee.htmlCtrlEntityRegex=/&(newline|tab);/gi,Ee.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Ee.urlSchemeRegex=/^.+(:|:)/gim,Ee.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Ee.relativeFirstCharacters=[".","/"],Ee.BLANK_URL="about:blank"),Ee}var Ag;function aO(){if(Ag)return Ha;Ag=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.sanitizeUrl=s;var t=oO();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 Ha}var lO=aO();function Hh(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 cO(){}function fk(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Xp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const hO="[object RegExp]",mk="[object String]",gk="[object Number]",xk="[object Boolean]",yk="[object Arguments]",uO="[object Symbol]",dO="[object Date]",pO="[object Map]",fO="[object Set]",mO="[object Array]",gO="[object ArrayBuffer]",xO="[object Object]",yO="[object DataView]",bO="[object Uint8Array]",CO="[object Uint8ClampedArray]",kO="[object Uint16Array]",vO="[object Uint32Array]",wO="[object Int8Array]",SO="[object Int16Array]",TO="[object Int32Array]",_O="[object Float32Array]",jO="[object Float64Array]",Mg=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Kp(t){return typeof Mg.Buffer<"u"&&Mg.Buffer.isBuffer(t)}function NO(t){return Number.isSafeInteger(t)&&t>=0}function bk(t){return t!=null&&typeof t!="function"&&NO(t.length)}function EO(t){return t==="__proto__"}function Qp(t){return t==null||typeof t!="object"&&typeof t!="function"}function Zp(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function BO(t,e){return Ji(t,void 0,t,new Map,e)}function Ji(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(Qp(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]=Ji(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,Ji(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(Ji(a,void 0,r,n,i));return o}if(Kp(t))return t.subarray();if(Zp(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Ji(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),Ar(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),Ar(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),Ar(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,Ar(o,t,r,n,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return n.set(t,o),Ar(o,t,r,n,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return n.set(t,o),Ar(o,t,r,n,i),o}if(t instanceof String){const o=new String(t.valueOf());return n.set(t,o),Ar(o,t,r,n,i),o}if(typeof t=="object"&&LO(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),Ar(o,t,r,n,i),o}return t}function Ar(t,e,r=t,n,i){const s=[...Object.keys(e),...fk(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=Ji(e[a],a,r,n,i))}}function LO(t){switch(Xp(t)){case yk:case mO:case gO:case yO:case xk:case dO:case _O:case jO:case wO:case SO:case TO:case pO:case gk:case xO:case hO:case fO:case mk:case uO:case bO:case CO:case kO:case vO:return!0;default:return!1}}function AO(t,e){return BO(t,(r,n,i,s)=>{if(typeof t=="object"){if(Xp(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Ar(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case gk:case mk:case xk:{const o=new t.constructor(t==null?void 0:t.valueOf());return Ar(o,t),o}case yk:{const o={};return Ar(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Ig(t){return AO(t)}function ad(t){return t!==null&&typeof t=="object"&&Xp(t)==="[object Arguments]"}function ld(t){return typeof t=="object"&&t!==null}function MO(t){return ld(t)&&bk(t)}function ba(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(ba.Cache||Map),r}ba.Cache=Map;function xl(t){return Zp(t)}function IO(t){const e=t==null?void 0:t.constructor;return t===(typeof e=="function"?e.prototype:Object.prototype)}function FO(t){if(Qp(t))return t;if(Array.isArray(t)||Zp(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 PO(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=yl(i,o,n,new Map)}return i}function yl(t,e,r,n){if(Qp(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return FO(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),...fk(e)];for(let s=0;s<i.length;s++){const o=i[s];if(EO(o))continue;let a=e[o],l=t[o];if(ad(a)&&(a={...a}),ad(l)&&(l={...l}),Kp(a)&&(a=Ig(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(MO(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)||ld(l)&&ld(a)&&(Hh(l)||Hh(a)||xl(l)||xl(a))?t[o]=yl(l,a,r,n):l==null&&Hh(a)?t[o]=yl({},a,r,n):l==null&&xl(a)?t[o]=Ig(a):(l===void 0||a!==void 0)&&(t[o]=a)}return t}function DO(t,...e){return PO(t,...e,cO)}function Fg(t){if(t==null)return!0;if(bk(t))return typeof t.splice!="function"&&typeof t!="string"&&!Kp(t)&&!xl(t)&&!ad(t)?!1:t.length===0;if(typeof t=="object"||typeof t=="function"){if(t instanceof Map||t instanceof Set)return t.size===0;const e=Object.keys(t);return IO(t)?e.filter(r=>r!=="constructor").length===0:e.length===0}return!0}var OO="",$O={curveBasis:Uu,curveBasisClosed:qP,curveBasisOpen:HP,curveBumpX:p1,curveBumpY:f1,curveBundle:UP,curveCardinalClosed:YP,curveCardinalOpen:VP,curveCardinal:y1,curveCatmullRomClosed:GP,curveCatmullRomOpen:XP,curveCatmullRom:C1,curveLinear:Ro,curveLinearClosed:KP,curveMonotoneX:_1,curveMonotoneY:j1,curveNatural:E1,curveStep:B1,curveStepAfter:A1,curveStepBefore:L1},RO=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,zO=v(function(t,e){const r=Ck(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);Ol(o),n=Be(n,[...o])}else n=r.args;if(!n)return;let i=wp(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),Ck=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${RO.source})(?=[}][%]{2}).*
|
|
485
|
-
`,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),nt.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=Oo.exec(t))!==null;)if(s.index===Oo.lastIndex&&Oo.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 nt.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),WO=v(function(t){return t.replace(Oo,"")},"removeDirectives"),qO=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function Jp(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return $O[r]??e}v(Jp,"interpolateToCurve");function kk(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?lO.sanitizeUrl(r):r}v(kk,"formatUrl");var HO=v((t,...e)=>{const r=t.split("."),n=r.length-1,i=r[n];let s=window;for(let o=0;o<n;o++)if(s=s[r[o]],!s){nt.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function tf(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(tf,"distance");function vk(t){let e,r=0;t.forEach(i=>{r+=tf(i,e),e=i});const n=r/2;return ef(t,n)}v(vk,"traverseEdge");function wk(t){return t.length===1?t[0]:vk(t)}v(wk,"calcLabelPosition");var Pg=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),ef=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=tf(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:Pg((1-o)*r.x+o*i.x,5),y:Pg((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),UO=v((t,e,r)=>{nt.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=ef(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 Sk(t,e,r){const n=structuredClone(r);nt.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=ef(n,i),o=10+t*.5,a=Math.atan2(n[0].y-s.y,n[0].x-s.x),l={x:0,y:0};return e==="start_left"?(l.x=Math.sin(a+Math.PI)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a+Math.PI)*o+(n[0].y+s.y)/2):e==="end_right"?(l.x=Math.sin(a-Math.PI)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a-Math.PI)*o+(n[0].y+s.y)/2-5):e==="end_left"?(l.x=Math.sin(a)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2-5):(l.x=Math.sin(a)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2),l}v(Sk,"calcTerminalLabelPosition");function Tk(t){let e="",r="";for(const n of t)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":e=e+n+";");return{style:e,labelStyle:r}}v(Tk,"getStylesFromArray");var Dg=0,YO=v(()=>(Dg++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Dg),"generateId");function _k(t){let e="";const r="0123456789abcdef",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}v(_k,"makeRandomHex");var VO=v(t=>_k(t.length),"random"),GO=v(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),XO=v(function(t,e){const r=e.text.replace(ma.lineBreakRegex," "),[,n]=zc(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"),KO=ba((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),ma.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const l=yn(`${o} `,r),h=yn(s,r);if(l>e){const{hyphenatedStrings:f,remainingWord:p}=QO(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}`),QO=ba((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(yn(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 jk(t,e){return rf(t,e).height}v(jk,"calculateTextHeight");function yn(t,e){return rf(t,e).width}v(yn,"calculateTextWidth");var rf=ba((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=zc(r),o=["sans-serif",n],a=t.split(ma.lineBreakRegex),l=[],h=zt("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=GO();g.text=x||OO;const y=XO(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}`),bs,ZO=(bs=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},v(bs,"InitIDGenerator"),bs),Ua,JO=v(function(t){return Ua=Ua||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Ua.innerHTML=t,unescape(Ua.textContent)},"entityDecode");function nf(t){return"str"in t}v(nf,"isDetailedError");var t$=v((t,e,r,n)=>{var s;if(!n)return;const i=(s=t.node())==null?void 0:s.getBBox();i&&t.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",e)},"insertTitle"),zc=v(t=>{if(typeof t=="number")return[t,t+"px"];const e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");function sf(t,e){return DO({},t,e)}v(sf,"cleanAndMerge");var Pr={assignWithDepth:Be,wrapLabel:KO,calculateTextHeight:jk,calculateTextWidth:yn,calculateTextDimensions:rf,cleanAndMerge:sf,detectInit:zO,detectDirective:Ck,isSubstringInArray:qO,interpolateToCurve:Jp,calcLabelPosition:wk,calcCardinalityPosition:UO,calcTerminalLabelPosition:Sk,formatUrl:kk,getStylesFromArray:Tk,generateId:YO,random:VO,runFunc:HO,entityDecode:JO,insertTitle:t$,isLabelCoordinateInPath:Nk,parseFontSize:zc,InitIDGenerator:ZO},e$=v(function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){const n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"fl°°"+n+"¶ß":"fl°"+n+"¶ß"}),e},"encodeEntities"),Si=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),bV=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function Me(t){return t??null}v(Me,"handleUndefinedAttr");function Nk(t,e){const r=Math.round(t.x),n=Math.round(t.y),i=e.replace(/(\d+\.\d+)/g,s=>Math.round(parseFloat(s)).toString());return i.includes(r.toString())||i.includes(n.toString())}v(Nk,"isLabelCoordinateInPath");var of=v(({flowchart:t})=>{var i,s;const e=((i=t==null?void 0:t.subGraphTitleMargin)==null?void 0:i.top)??0,r=((s=t==null?void 0:t.subGraphTitleMargin)==null?void 0:s.bottom)??0,n=e+r;return{subGraphTitleTopMargin:e,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins");async function Ek(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=Qt().fontSize?Qt().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[h=Tb.fontSize]=zc(a),u=h*l+"px";i.style.minWidth=u,i.style.maxWidth=u}else i.style.width="100%";s(i)}v(o,"setupImage"),setTimeout(()=>{i.complete&&o()}),i.addEventListener("error",o),i.addEventListener("load",o)})))}v(Ek,"configureLabelImages");var r$=v(t=>{const{handDrawnSeed:e}=Qt();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Ds=v(t=>{const e=n$([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),n$=v(t=>{const e=new Map;return t.forEach(r=>{const[n,i]=r.split(":");e.set(n.trim(),i==null?void 0:i.trim())}),e},"styles2Map"),Bk=v(t=>t==="color"||t==="font-size"||t==="font-family"||t==="font-weight"||t==="font-style"||t==="text-decoration"||t==="text-align"||t==="text-transform"||t==="line-height"||t==="letter-spacing"||t==="word-spacing"||t==="text-shadow"||t==="text-overflow"||t==="white-space"||t==="word-wrap"||t==="word-break"||t==="overflow-wrap"||t==="hyphens","isLabelStyle"),kt=v(t=>{const{stylesArray:e}=Ds(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];Bk(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"),Ct=v((t,e)=>{var l;const{themeVariables:r,handDrawnSeed:n}=Qt(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Ds(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:i$(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),i$=v(t=>{if(!t)return[0,0];const e=t.trim().split(/\s+/).map(Number);if(e.length===1){const i=isNaN(e[0])?0:e[0];return[i,i]}const r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?0:e[1];return[r,n]},"getStrokeDashArray");const s$=Object.freeze({left:0,top:0,width:16,height:16}),ic=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Lk=Object.freeze({...s$,...ic}),o$=Object.freeze({...Lk,body:"",hidden:!1}),a$=Object.freeze({width:null,height:null}),l$=Object.freeze({...a$,...ic}),c$=(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 Uh(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 Uh(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return Uh(a,r)?a:null}return null},Uh=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function h$(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 Og(t,e){const r=h$(t,e);for(const n in o$)n in ic?n in t&&!(n in r)&&(r[n]=ic[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function u$(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 $g(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=Og(n[a]||i[a],s)}return o(e),r.forEach(o),Og(t,s)}function d$(t,e){if(t.icons[e])return $g(t,e,[]);const r=u$(t,[e])[e];return r?$g(t,e,r):null}const p$=/(-?[0-9.]*[0-9]+[0-9.]*)/g,f$=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Rg(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(p$);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=f$.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 m$(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 g$(t,e){return t?"<defs>"+t+"</defs>"+e:e}function x$(t,e,r){const n=m$(t);return g$(n.defs,e+n.content+r)}const y$=t=>t==="unset"||t==="undefined"||t==="none";function b$(t,e){const r={...Lk,...t},n={...l$,...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 w;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:w=i.height/2+i.top,g.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:w=i.width/2+i.left,g.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}b%2===1&&(i.left!==i.top&&(w=i.left,i.left=i.top,i.top=w),i.width!==i.height&&(w=i.width,i.width=i.height,i.height=w)),g.length&&(s=x$(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=Rg(d,l/h)):(u=o==="auto"?l:o,d=a===null?Rg(u,h/l):a==="auto"?h:a);const f={},p=(x,g)=>{y$(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 C$=/\sid="(\S+)"/g,zg=new Map;function k$(t){t=t.replace(/[0-9]+$/,"")||"a";const e=zg.get(t)||0;return zg.set(t,e+1),e?`${t}${e}`:t}function v$(t){const e=[];let r;for(;r=C$.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=k$(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 w$(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 af(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ei=af();function Ak(t){Ei=t}var zo={exec:()=>null};function Zt(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(ir.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var S$=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ir={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")},T$=/^(?:[ \t]*(?:\n|$))+/,_$=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,j$=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ca=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,N$=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lf=/(?:[*+-]|\d{1,9}[.)])/,Mk=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ik=Zt(Mk).replace(/bull/g,lf).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(),E$=Zt(Mk).replace(/bull/g,lf).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(),cf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,B$=/^[^\n]+/,hf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,L$=Zt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",hf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),A$=Zt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lf).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",uf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,M$=Zt("^ {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",uf).replace("tag",Wc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Fk=Zt(cf).replace("hr",Ca).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(),I$=Zt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Fk).getRegex(),df={blockquote:I$,code:_$,def:L$,fences:j$,heading:N$,hr:Ca,html:M$,lheading:Ik,list:A$,newline:T$,paragraph:Fk,table:zo,text:B$},Wg=Zt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ca).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(),F$={...df,lheading:E$,table:Wg,paragraph:Zt(cf).replace("hr",Ca).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Wg).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()},P$={...df,html:Zt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",uf).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:zo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Zt(cf).replace("hr",Ca).replace("heading",` *#{1,6} *[^
|
|
486
|
-
]`).replace("lheading",Ik).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},D$=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,O$=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Pk=/^( {2,}|\\)\n(?!\s*$)/,$$=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,qc=/[\p{P}\p{S}]/u,pf=/[\s\p{P}\p{S}]/u,Dk=/[^\s\p{P}\p{S}]/u,R$=Zt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,pf).getRegex(),Ok=/(?!~)[\p{P}\p{S}]/u,z$=/(?!~)[\s\p{P}\p{S}]/u,W$=/(?:[^\s\p{P}\p{S}]|~)/u,q$=Zt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",S$?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$k=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,H$=Zt($k,"u").replace(/punct/g,qc).getRegex(),U$=Zt($k,"u").replace(/punct/g,Ok).getRegex(),Rk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Y$=Zt(Rk,"gu").replace(/notPunctSpace/g,Dk).replace(/punctSpace/g,pf).replace(/punct/g,qc).getRegex(),V$=Zt(Rk,"gu").replace(/notPunctSpace/g,W$).replace(/punctSpace/g,z$).replace(/punct/g,Ok).getRegex(),G$=Zt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Dk).replace(/punctSpace/g,pf).replace(/punct/g,qc).getRegex(),X$=Zt(/\\(punct)/,"gu").replace(/punct/g,qc).getRegex(),K$=Zt(/^<(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(),Q$=Zt(uf).replace("(?:-->|$)","-->").getRegex(),Z$=Zt("^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",Q$).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),sc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,J$=Zt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",sc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zk=Zt(/^!?\[(label)\]\[(ref)\]/).replace("label",sc).replace("ref",hf).getRegex(),Wk=Zt(/^!?\[(ref)\](?:\[\])?/).replace("ref",hf).getRegex(),tR=Zt("reflink|nolink(?!\\()","g").replace("reflink",zk).replace("nolink",Wk).getRegex(),qg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ff={_backpedal:zo,anyPunctuation:X$,autolink:K$,blockSkip:q$,br:Pk,code:O$,del:zo,emStrongLDelim:H$,emStrongRDelimAst:Y$,emStrongRDelimUnd:G$,escape:D$,link:J$,nolink:Wk,punctuation:R$,reflink:zk,reflinkSearch:tR,tag:Z$,text:$$,url:zo},eR={...ff,link:Zt(/^!?\[(label)\]\((.*?)\)/).replace("label",sc).getRegex(),reflink:Zt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",sc).getRegex()},cd={...ff,emStrongRDelimAst:V$,emStrongLDelim:U$,url:Zt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",qg).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:Zt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",qg).getRegex()},rR={...cd,br:Zt(Pk).replace("{2,}","*").getRegex(),text:Zt(cd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ya={normal:df,gfm:F$,pedantic:P$},po={normal:ff,gfm:cd,breaks:rR,pedantic:eR},nR={"&":"&","<":"<",">":">",'"':""","'":"'"},Hg=t=>nR[t];function Vr(t,e){if(e){if(ir.escapeTest.test(t))return t.replace(ir.escapeReplace,Hg)}else if(ir.escapeTestNoEncode.test(t))return t.replace(ir.escapeReplaceNoEncode,Hg);return t}function Ug(t){try{t=encodeURI(t).replace(ir.percentDecode,"%")}catch{return null}return t}function Yg(t,e){var s;let r=t.replace(ir.findPipe,(o,a,l)=>{let h=!1,u=a;for(;--u>=0&&l[u]==="\\";)h=!h;return h?"|":" |"}),n=r.split(ir.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(ir.slashPipe,"|");return n}function fo(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 iR(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 Vg(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 sR(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
|
|
487
|
-
`).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(`
|
|
488
|
-
`)}var oc=class{constructor(e){re(this,"options");re(this,"rules");re(this,"lexer");this.options=e||Ei}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:fo(n,`
|
|
489
|
-
`)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=sR(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=fo(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:fo(r[0],`
|
|
490
|
-
`)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=fo(r[0],`
|
|
491
|
-
`).split(`
|
|
492
|
-
`),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(`
|
|
493
|
-
`),d=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
494
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
495
|
-
${u}`:u,s=s?`${s}
|
|
496
|
-
${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+`
|
|
497
|
-
`+n.join(`
|
|
498
|
-
`),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+`
|
|
499
|
-
`+n.join(`
|
|
500
|
-
`),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(`
|
|
501
|
-
`);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(`
|
|
502
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),p=e.split(`
|
|
503
|
-
`,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+`
|
|
504
|
-
`,e=e.substring(p.length+1),h=!0),!h){let C=this.rules.other.nextBulletRegex(x),b=this.rules.other.hrRegex(x),w=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),S=this.rules.other.htmlBeginRegex(x);for(;e;){let N=e.split(`
|
|
505
|
-
`,1)[0],L;if(p=N,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),L=p):L=p.replace(this.rules.other.tabCharGlobal," "),w.test(p)||_.test(p)||S.test(p)||C.test(p)||b.test(p))break;if(L.search(this.rules.other.nonSpaceChar)>=x||!p.trim())d+=`
|
|
506
|
-
`+L.slice(x);else{if(m||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(f)||_.test(f)||b.test(f))break;d+=`
|
|
507
|
-
`+p}!m&&!p.trim()&&(m=!0),u+=N+`
|
|
508
|
-
`,e=e.substring(N.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=Yg(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(`
|
|
509
|
-
`):[],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(Yg(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)===`
|
|
510
|
-
`?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=fo(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=iR(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)),Vg(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 Vg(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}}}},Mr=class hd{constructor(e){re(this,"tokens");re(this,"options");re(this,"state");re(this,"tokenizer");re(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ei,this.options.tokenizer=this.options.tokenizer||new oc,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:ir,block:Ya.normal,inline:po.normal};this.options.pedantic?(r.block=Ya.pedantic,r.inline=po.pedantic):this.options.gfm&&(r.block=Ya.gfm,this.options.breaks?r.inline=po.breaks:r.inline=po.gfm),this.tokenizer.rules=r}static get rules(){return{block:Ya,inline:po}}static lex(e,r){return new hd(r).lex(e)}static lexInline(e,r){return new hd(r).inlineTokens(e)}lex(e){e=e.replace(ir.carriageReturn,`
|
|
511
|
-
`),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(ir.tabCharGlobal," ").replace(ir.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+=`
|
|
512
|
-
`: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(`
|
|
513
|
-
`)?"":`
|
|
514
|
-
`)+a.raw,h.text+=`
|
|
515
|
-
`+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(`
|
|
516
|
-
`)?"":`
|
|
517
|
-
`)+a.raw,h.text+=`
|
|
518
|
-
`+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(`
|
|
519
|
-
`)?"":`
|
|
520
|
-
`)+a.raw,h.text+=`
|
|
521
|
-
`+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(`
|
|
522
|
-
`)?"":`
|
|
523
|
-
`)+a.raw,h.text+=`
|
|
524
|
-
`+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}},ac=class{constructor(e){re(this,"options");re(this,"parser");this.options=e||Ei}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(ir.notSpaceStart))==null?void 0:o[0],s=e.replace(ir.endingNewline,"")+`
|
|
525
|
-
`;return i?'<pre><code class="language-'+Vr(i)+'">'+(n?s:Vr(s,!0))+`</code></pre>
|
|
526
|
-
`:"<pre><code>"+(n?s:Vr(s,!0))+`</code></pre>
|
|
527
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
528
|
-
${this.parser.parse(e)}</blockquote>
|
|
529
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
|
|
530
|
-
`}hr(e){return`<hr>
|
|
531
|
-
`}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+`>
|
|
532
|
-
`+i+"</"+s+`>
|
|
533
|
-
`}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+" "+Vr(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>
|
|
534
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
535
|
-
`}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>
|
|
536
|
-
<thead>
|
|
537
|
-
`+r+`</thead>
|
|
538
|
-
`+i+`</table>
|
|
539
|
-
`}tablerow({text:e}){return`<tr>
|
|
540
|
-
${e}</tr>
|
|
541
|
-
`}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
|
|
542
|
-
`}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>${Vr(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=Ug(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+Vr(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=Ug(e);if(s===null)return Vr(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${Vr(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Vr(e.text)}},mf=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""}},Ir=class ud{constructor(e){re(this,"options");re(this,"renderer");re(this,"textRenderer");this.options=e||Ei,this.options.renderer=this.options.renderer||new ac,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mf}static parse(e,r){return new ud(r).parse(e)}static parseInline(e,r){return new ud(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+=`
|
|
543
|
-
`+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}},al,Bo=(al=class{constructor(e){re(this,"options");re(this,"block");this.options=e||Ei}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Mr.lex:Mr.lexInline}provideParser(){return this.block?Ir.parse:Ir.parseInline}},re(al,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),re(al,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),al),oR=class{constructor(...e){re(this,"defaults",af());re(this,"options",this.setOptions);re(this,"parse",this.parseMarkdown(!0));re(this,"parseInline",this.parseMarkdown(!1));re(this,"Parser",Ir);re(this,"Renderer",ac);re(this,"TextRenderer",mf);re(this,"Lexer",Mr);re(this,"Tokenizer",oc);re(this,"Hooks",Bo);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 ac(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 oc(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 Bo;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];Bo.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&Bo.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 Mr.lex(e,r??this.defaults)}parser(e,r){return Ir.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?Mr.lex:Mr.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?Ir.parse:Ir.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?Mr.lex:Mr.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?Ir.parse:Ir.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+=`
|
|
544
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Vr(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},Ti=new oR;function ne(t,e){return Ti.parse(t,e)}ne.options=ne.setOptions=function(t){return Ti.setOptions(t),ne.defaults=Ti.defaults,Ak(ne.defaults),ne};ne.getDefaults=af;ne.defaults=Ei;ne.use=function(...t){return Ti.use(...t),ne.defaults=Ti.defaults,Ak(ne.defaults),ne};ne.walkTokens=function(t,e){return Ti.walkTokens(t,e)};ne.parseInline=Ti.parseInline;ne.Parser=Ir;ne.parser=Ir.parse;ne.Renderer=ac;ne.TextRenderer=mf;ne.Lexer=Mr;ne.lexer=Mr.lex;ne.Tokenizer=oc;ne.Hooks=Bo;ne.parse=ne;ne.options;ne.setOptions;ne.use;ne.walkTokens;ne.parseInline;Ir.parse;Mr.lex;function qk(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(`
|
|
545
|
-
[ ]{`.concat(Math.min.apply(Math,i),"}"),"g");n=n.map(function(a){return a.replace(s,`
|
|
546
|
-
`)})}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(`
|
|
547
|
-
`)&&(d=String(a).split(`
|
|
548
|
-
`).map(function(f,p){return p===0?f:"".concat(u).concat(f)}).join(`
|
|
549
|
-
`)),o+=d+n[l+1]}),o}var aR={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},dd=new Map,Hk=new Map,lR=v(t=>{for(const e of t){if(!e.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(nt.debug("Registering icon pack:",e.name),"loader"in e)Hk.set(e.name,e.loader);else if("icons"in e)dd.set(e.name,e.icons);else throw nt.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),Uk=v(async(t,e)=>{const r=c$(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=dd.get(n);if(!i){const o=Hk.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},dd.set(n,i)}catch(a){throw nt.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=d$(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),cR=v(async t=>{try{return await Uk(t),!0}catch{return!1}},"isIconAvailable"),ka=v(async(t,e,r)=>{let n;try{n=await Uk(t,e==null?void 0:e.fallbackPrefix)}catch(o){nt.error(o),n=aR}const i=b$(n,e),s=w$(v$(i.body),{...i.attributes,...r});return zr(s,ye())},"getIconSVG");function Yk(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
|
|
550
|
-
`).replace(/\n{2,}/g,`
|
|
551
|
-
`);return qk(n)}v(Yk,"preprocessMarkdown");function Vk(t){return t.split(/\\n|\n|<br\s*\/?>/gi).map(e=>{var r;return((r=e.trim().match(/<[^>]+>|[^\s<>]+/g))==null?void 0:r.map(n=>({content:n,type:"normal"})))??[]})}v(Vk,"nonMarkdownToLines");function Gk(t,e={}){const r=Yk(t,e),n=ne.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
|
|
552
|
-
`).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(f=>{f=f.replace(/'/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 v(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}v(Gk,"markdownToLines");function Xk(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(Xk,"nonMarkdownToHTML");function Kk(t,{markdownAutoWrap:e}={}){const r=ne.lexer(t);function n(i){var s,o,a;return i.type==="text"?e===!1?i.text.replace(/\n */g,"<br/>").replace(/ /g," "):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:(nt.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(Kk,"markdownToHTML");function Qk(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(Qk,"splitTextToChars");function Zk(t,e){const r=Qk(e.content);return gf(t,[],r,e.type)}v(Zk,"splitWordToFitWidth");function gf(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}])?gf(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v(gf,"splitWordToFitWidthRecursion");function Jk(t,e){if(t.some(({content:r})=>r.includes(`
|
|
553
|
-
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return lc(t,e)}v(Jk,"splitLineToFitWidth");function lc(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 lc(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=Zk(e,s);r.push([a]),l.content&&t.unshift(l)}return lc(t,e,r)}v(lc,"splitLineToFitWidthRecursion");function pd(t,e){e&&t.attr("style",e)}v(pd,"applyStyle");var Gg=16384;async function tv(t,e,r,n,i=!1,s=ye()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,Gg)}px`),o.attr("height",`${Math.min(10*r,Gg)}px`);const a=o.append("xhtml:div"),l=Xo(e.label)?await Fb(e.label.replace(ma.lineBreakRegex,`
|
|
554
|
-
`),s):zr(e.label,s),h=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),pd(u,e.labelStyle),u.attr("class",`${h} ${n}`),pd(a,e.labelStyle),a.style("display","table-cell"),a.style("white-space","nowrap"),a.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(a.style("max-width",r+"px"),a.style("text-align","center")),a.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&a.attr("class","labelBkg");let d=a.node().getBoundingClientRect();return d.width===r&&(a.style("display","table"),a.style("white-space","break-spaces"),a.style("width",r+"px"),d=a.node().getBoundingClientRect()),o.node()}v(tv,"addHtmlSpan");function Hc(t,e,r,n=!1){const i=t.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*r-.1+"em").attr("dy",r+"em");return n&&i.attr("text-anchor","middle"),i}v(Hc,"createTspan");function ev(t,e,r){const n=t.append("text"),i=Hc(n,1,e);Uc(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(ev,"computeWidthOfText");function hR(t,e,r){var o;const n=t.append("text"),i=Hc(n,1,e);Uc(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(hR,"computeDimensionOfText");function rv(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=v(p=>ev(o,1.1,p)<=t,"checkWidth"),f=d(u)?[u]:Jk(u,d);for(const p of f){const m=Hc(l,h,1.1,i);Uc(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()}v(rv,"createFormattedText");function fd(t){const e=/&(amp|lt|gt);/g;return t.replace(e,(r,n)=>{switch(n){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return r}})}v(fd,"decodeHTMLEntities");function Uc(t,e){t.text(""),e.forEach((r,n)=>{const i=t.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?i.text(fd(r.content)):i.text(" "+fd(r.content))})}v(Uc,"updateTextContentAndStyles");async function nv(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await cR(a)?await ka(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()??"")}v(nv,"replaceIconSubstring");var vn=v(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(nt.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",h),s){const d=o?Kk(e,u):Xk(e),f=await nv(Si(d),u),p=e.replace(/\\\\/g,"\\"),m={isNode:a,label:Xo(e)?p:f,labelStyle:r.replace("fill:","color:")};return await tv(t,m,l,i,h,u)}else{const d=Si(e.replace(/<br\s*\/?>/g,"<br/>")),f=o?Gk(d.replace("<br>","<br/>"),u):Vk(d),p=rv(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:");zt(p).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");zt(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:");zt(p).select("text").attr("style",x)}return n?zt(p).selectAll("tspan.text-outer-tspan").classed("title-row",!0):zt(p).selectAll("tspan.text-outer-tspan").classed("row",!0),p}},"createText");function Yh(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 uR(t,e){return t[0]===e[0]&&t[1]===e[1]}function dR(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)Yh(h,a,i);const l=(function(h,u,d){const f=[];for(const C of h){const b=[...C];uR(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 w=C[b],_=C[b+1];if(w[1]!==_[1]){const S=Math.min(w[1],_[1]);m.push({ymin:S,ymax:Math.max(w[1],_[1]),x:S===w[1]?w[0]:_[0],islope:(_[0]-w[0])/(_[1]-w[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 w=x[C].edge,_=x[b].edge;p.push([[Math.round(w.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)Yh(h,a,-i);(function(h,u,d){const f=[];h.forEach((p=>f.push(...p))),Yh(f,u,d)})(l,a,-i)}return l}function va(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),dR(t,i,n,s||1)}class xf{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=va(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 Yc(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 pR extends xf{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=va(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)Yc([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 fR extends xf{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 mR{constructor(e){this.helper=e}fillPolygons(e,r){const n=va(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=Yc(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 gR{constructor(e){this.helper=e}fillPolygons(e,r){const n=va(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=Yc(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 xR{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=va(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=Yc(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 cr={};class yR{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const bR=0,Vh=1,Xg=2,Va={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 Gh(t,e){return t.type===e}function yf(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:bR,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:Vh,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:Xg,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!Gh(s,Xg);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return yf("M0,0"+t);i++,o=Va[s.text],n=s.text}else Gh(s,Vh)?o=Va[n]:(i++,o=Va[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(!Gh(h,Vh))throw new Error("Param not a number: "+n+","+h.text);a[a.length]=+h.text}if(typeof Va[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 iv(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 sv(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)&&(ov(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 mo(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function ov(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]=mo(t,e,-u),[r,n]=mo(r,n,-u);const W=(t-r)/2,D=(e-n)/2;let M=W*W/(i*i)+D*D/(s*s);M>1&&(M=Math.sqrt(M),i*=M,s*=M);const F=i*i,O=s*s,$=F*O-F*D*D-O*W*W,B=F*D*D+O*W*W,T=(a===l?-1:1)*Math.sqrt(Math.abs($/B));x=T*i*D/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,D=r,M=n;m=l&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=ov(r=x+i*Math.cos(m),n=g+s*Math.sin(m),D,M,i,s,o,0,l,[m,W,x,g])}y=m-p;const C=Math.cos(p),b=Math.sin(p),w=Math.cos(m),_=Math.sin(m),S=Math.tan(y/4),N=4/3*i*S,L=4/3*s*S,A=[t,e],j=[t+N*b,e-L*C],I=[r+N*_,n-L*w],z=[r,n];if(j[0]=2*A[0]-j[0],j[1]=2*A[1]-j[1],h)return[j,I,z].concat(f);{f=[j,I,z].concat(f);const W=[];for(let D=0;D<f.length;D+=3){const M=mo(f[D][0],f[D][1],u),F=mo(f[D+1][0],f[D+1][1],u),O=mo(f[D+2][0],f[D+2][1],u);W.push([M[0],M[1],F[0],F[1],O[0],O[1]])}return W}}const CR={randOffset:function(t,e){return Lt(t,e)},randOffsetWithRange:function(t,e,r){return cc(t,e,r)},ellipse:function(t,e,r,n,i){const s=lv(r,n,i);return md(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Vn(t,e,r,n,i,!0)}};function av(t,e,r,n,i){return{type:"path",ops:Vn(t,e,r,n,i)}}function bl(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Vn(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Vn(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?av(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function kR(t,e,r,n,i){return(function(s,o){return bl(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function Kg(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=Ga(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:Ga(r[0],1.5*(1+.22*e.roughness),Jg(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=Ga(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:Ga(o,1.5*(1+.22*e.roughness),Jg(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 lv(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+=Lt(o*l,r),a+=Lt(a*l,r),{increment:s,rx:o,ry:a}}function md(t,e,r,n){const[i,s]=tx(n.increment,t,e,n.rx,n.ry,1,n.increment*cc(.1,cc(.4,1,r),r),r);let o=hc(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=tx(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=hc(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function Qg(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+=Lt(.01*d,l),f+=Lt(.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=ex(g,h,u,d,f,p,m,1,l);if(!l.disableMultiStroke){const C=ex(g,h,u,d,f,p,m,1.5,l);y.push(...C)}return o&&(a?y.push(...Vn(h,u,h+d*Math.cos(p),u+f*Math.sin(p),l),...Vn(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 Zg(t,e){const r=sv(iv(yf(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(...Vn(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(...vR(l,h,u,d,f,p,s,e)),s=[f,p];break}case"Z":n.push(...Vn(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function Xh(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]+Lt(i,e),n[0][1]+Lt(i,e)]});for(let o=1;o<s;o++)r.push({op:"lineTo",data:[n[o][0]+Lt(i,e),n[o][1]+Lt(i,e)]})}}return{type:"fillPath",ops:r}}function zi(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!cr[i])switch(i){case"zigzag":cr[i]||(cr[i]=new pR(n));break;case"cross-hatch":cr[i]||(cr[i]=new fR(n));break;case"dots":cr[i]||(cr[i]=new mR(n));break;case"dashed":cr[i]||(cr[i]=new gR(n));break;case"zigzag-line":cr[i]||(cr[i]=new xR(n));break;default:i="hachure",cr[i]||(cr[i]=new xf(n))}return cr[i]})(e,CR).fillPolygons(t,e)}function Jg(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function cv(t){return t.randomizer||(t.randomizer=new yR(t.seed||0)),t.randomizer.next()}function cc(t,e,r,n=1){return r.roughness*n*(cv(r)*(e-t)+t)}function Lt(t,e,r=1){return cc(-t,t,e,r)}function Vn(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=gd(t,e,r,n,i,!0,!1);if(o)return a;const l=gd(t,e,r,n,i,!0,!0);return a.concat(l)}function gd(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*cv(i);let p=i.bowing*i.maxRandomnessOffset*(n-e)/200,m=i.bowing*i.maxRandomnessOffset*(t-r)/200;p=Lt(p,i,h),m=Lt(m,i,h);const x=[],g=()=>Lt(d,i,h),y=()=>Lt(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:Lt(u,i,h)),e+(C?0:Lt(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 Ga(t,e,r){if(!t.length)return[];const n=[];n.push([t[0][0]+Lt(e,r),t[0][1]+Lt(e,r)]),n.push([t[0][0]+Lt(e,r),t[0][1]+Lt(e,r)]);for(let i=1;i<t.length;i++)n.push([t[i][0]+Lt(e,r),t[i][1]+Lt(e,r)]),i===t.length-1&&n.push([t[i][0]+Lt(e,r),t[i][1]+Lt(e,r)]);return hc(n,null,r)}function hc(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(...gd(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function tx(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=Lt(.5,a)-Math.PI/2;h.push([Lt(s,a)+e+.9*n*Math.cos(u-t),Lt(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=[Lt(s,a)+e+n*Math.cos(f),Lt(s,a)+r+i*Math.sin(f)];l.push(p),h.push(p)}h.push([Lt(s,a)+e+n*Math.cos(u+2*Math.PI+.5*o),Lt(s,a)+r+i*Math.sin(u+2*Math.PI+.5*o)]),h.push([Lt(s,a)+e+.98*n*Math.cos(u+o),Lt(s,a)+r+.98*i*Math.sin(u+o)]),h.push([Lt(s,a)+e+.9*n*Math.cos(u+.5*o),Lt(s,a)+r+.9*i*Math.sin(u+.5*o)])}return[h,l]}function ex(t,e,r,n,i,s,o,a,l){const h=s+Lt(.1,l),u=[];u.push([Lt(a,l)+e+.9*n*Math.cos(h-t),Lt(a,l)+r+.9*i*Math.sin(h-t)]);for(let d=h;d<=o;d+=t)u.push([Lt(a,l)+e+n*Math.cos(d),Lt(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)]),hc(u,null,l)}function vR(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:Lt(h[0],a)),o[1]+(f?0:Lt(h[0],a))]}),u=f?[i,s]:[i+Lt(h[p],a),s+Lt(h[p],a)],l.push({op:"bcurveTo",data:[t+Lt(h[p],a),e+Lt(h[p],a),r+Lt(h[p],a),n+Lt(h[p],a),u[0],u[1]]});return l}function go(t){return[...t]}function rx(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(go(t[0]),go(t[1]),go(t[2]),go(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(go(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 Cl(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function wR(t,e,r){const n=Cl(e,r);if(n===0)return Cl(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)),Cl(t,oi(e,r,i))}function oi(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function xd(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(Cl(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=oi(l,h,.5),p=oi(h,u,.5),m=oi(u,d,.5),x=oi(f,p,.5),g=oi(p,m,.5),y=oi(x,g,.5);xd([l,f,x,y],0,r,i),xd([y,g,m,d],0,r,i)}var s,o;return i}function SR(t,e){return uc(t,0,t.length,e)}function uc(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=wR(t[u],o,a);d>l&&(l=d,h=u)}return Math.sqrt(l)>n?(uc(t,e,h+1,n,s),uc(t,h,r,n,s)):(s.length||s.push(o),s.push(a)),s}function Kh(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)xd(t,3*s,e,n);return r&&r>0?uc(n,0,n.length,r):n}const br="none";class dc{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",[av(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=kR(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(Xh([h],o)):a.push(zi([h],o))}return o.stroke!==br&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=lv(n,i,o),h=md(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=md(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push(zi([h.estimatedPoints],o));return o.stroke!==br&&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",[bl(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,l){const h=this._o(l),u=[],d=Qg(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=Qg(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,w=p;let _=Math.abs(m/2),S=Math.abs(x/2);_+=Lt(.01*_,C),S+=Lt(.01*S,C);let N=g,L=y;for(;N<0;)N+=2*Math.PI,L+=2*Math.PI;L-N>2*Math.PI&&(N=0,L=2*Math.PI);const A=(L-N)/C.curveStepCount,j=[];for(let I=N;I<=L;I+=A)j.push([b+_*Math.cos(I),w+S*Math.sin(I)]);return j.push([b+_*Math.cos(L),w+S*Math.sin(L)]),j.push([b,w]),zi([j],C)})(e,r,n,i,s,o,h));return h.stroke!==br&&u.push(d),this._d("arc",u,h)}curve(e,r){const n=this._o(r),i=[],s=Kg(e,n);if(n.fill&&n.fill!==br)if(n.fillStyle==="solid"){const o=Kg(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(...Kh(rx([h[0],h[0],h[1],h[2]]),10,(1+n.roughness)/2)):o.push(...Kh(rx(h),10,(1+n.roughness)/2))}o.length&&i.push(zi([o],n))}return n.stroke!==br&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=bl(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(Xh([e],n)):i.push(zi([e],n))),n.stroke!==br&&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!==br,o=n.stroke!==br,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,f){const p=sv(iv(yf(u))),m=[];let x=[],g=[0,0],y=[];const C=()=>{y.length>=4&&x.push(...Kh(y,d)),y=[]},b=()=>{C(),x.length&&(m.push(x),x=[])};for(const{key:_,data:S}of p)switch(_){case"M":b(),g=[S[0],S[1]],x.push(g);break;case"L":C(),x.push([S[0],S[1]]);break;case"C":if(!y.length){const N=x.length?x[x.length-1]:g;y.push([N[0],N[1]])}y.push([S[0],S[1]]),y.push([S[2],S[3]]),y.push([S[4],S[5]]);break;case"Z":C(),x.push([g[0],g[1]])}if(b(),!f)return m;const w=[];for(const _ of m){const S=SR(_,f);S.length&&w.push(S)}return w})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),h=Zg(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=Zg(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(Xh(l,n));else i.push(zi(l,n));return o&&(a?l.forEach((u=>{i.push(bl(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:br};break;case"fillPath":o={d:this.opsToPath(s),stroke:br,strokeWidth:0,fill:n.fill||br};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||br,strokeWidth:n,fill:br}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class TR{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new dc(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 Xa="http://www.w3.org/2000/svg";class _R{constructor(e,r){this.svg=e,this.gen=new dc(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(Xa,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(Xa,"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(Xa,"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(Xa,"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 yt={canvas:(t,e)=>new TR(t,e),svg:(t,e)=>new _R(t,e),generator:t=>new dc(t),newSeed:()=>dc.newSeed()},Bt=v(async(t,e,r)=>{var p,m;let n;const i=e.useHtmlLabels||kn((p=Qt())==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",Me(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 vn(o,zr(Si(a),Qt()),{useHtmlLabels:i,width:e.width||((m=Qt().flowchart)==null?void 0:m.wrappingWidth),classes:h?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:h},Qt());let d=u.getBBox();const f=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=zt(u);await Ek(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"),Qh=v(async(t,e,r)=>{var l,h;const n=r.useHtmlLabels??sr(Qt()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await vn(i,zr(Si(e),Qt()),{useHtmlLabels:n,width:r.width||((h=(l=Qt())==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(sr(Qt())){const u=s.children[0],d=zt(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"),vt=v((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),Et=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Yt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Yt,"createPathFromPoints");function Gn(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}v(Gn,"generateFullSineWavePoints");function ia(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}v(ia,"generateCirclePoints");function yd(t){const e=Array.from(t.childNodes).filter(l=>l.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=e.map(l=>l.getAttribute("d")).filter(l=>l!==null).join(" ");r.setAttribute("d",n);const i=e.find(l=>l.getAttribute("fill")!=="none"),s=e.find(l=>l.getAttribute("stroke")!=="none"),o=v((l,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}v(yd,"mergePaths");var jR=v((t,e)=>{var r=t.x,n=t.y,i=e.x-r,s=e.y-n,o=t.width/2,a=t.height/2,l,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"),Os=jR,NR=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=Qt(),a=sr(o);return await vn(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),On=NR,Qn=v((t,e,r,n,i)=>["M",t+i,e,"H",t+r-i,"A",i,i,0,0,1,t+r,e+i,"V",e+n-i,"A",i,i,0,0,1,t+r-i,e+n,"H",t+i,"A",i,i,0,0,1,t,e+n-i,"V",e+i,"A",i,i,0,0,1,t+i,e,"Z"].join(" "),"createRoundedRectPathD"),hv=v(async(t,e)=>{nt.info("Creating subgraph rect for ",e.id,e);const r=Qt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=kt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=sr(r),p=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await vn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width}):m=await On(p,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(sr(r)){const N=m.children[0],L=zt(m);x=N.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;nt.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const N=yt.svg(d),L=Ct(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),A=N.path(Qn(C,b,g,y,0),L);w=d.insert(()=>(nt.debug("Rough node insert CXC",A),A),":first-child"),w.select("path:nth-child(2)").attr("style",h.join(";")),w.select("path").attr("style",u.join(";").replace("fill","stroke"))}else w=d.insert("rect",":first-child"),w.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:_}=of(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const N=p.select("span");N&&N.attr("style",a)}const S=w.node().getBBox();return e.offsetX=0,e.width=S.width,e.height=S.height,e.offsetY=x.height-e.padding/2,e.intersect=function(N){return Os(e,N)},{cluster:d,labelBBox:x}},"rect"),ER=v((t,e)=>{const r=t.insert("g").attr("class","note-cluster").attr("id",e.domId),n=r.insert("rect",":first-child"),i=0*e.padding,s=i/2;n.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-s).attr("y",e.y-e.height/2-s).attr("width",e.width+i).attr("height",e.height+i).attr("fill","none");const o=n.node().getBBox();return e.width=o.width,e.height=o.height,e.intersect=function(a){return Os(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),BR=v(async(t,e)=>{const r=Qt(),{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 On(d,e.label,e.labelStyle,void 0,!0);let m=p.getBBox();if(sr(r)){const A=p.children[0],j=zt(p);m=A.getBoundingClientRect(),j.attr("width",m.width),j.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,w=e.x-y/2,_=e.y-C/2;e.width=y;const S=e.y-e.height/2-g+m.height+2;let N;if(e.look==="handDrawn"){const A=e.cssClasses.includes("statediagram-cluster-alt"),j=yt.svg(h),I=e.rx||e.ry?j.path(Qn(w,_,y,C,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):j.rectangle(w,_,y,C,{seed:i});N=h.insert(()=>I,":first-child");const z=j.rectangle(w,S,y,b,{fill:A?s:o,fillStyle:A?"hachure":"solid",stroke:l,seed:i});N=h.insert(()=>I,":first-child"),f=h.insert(()=>z)}else N=u.insert("rect",":first-child"),N.attr("class","outer").attr("x",w).attr("y",_).attr("width",y).attr("height",C).attr("data-look",e.look),f.attr("class","inner").attr("x",w).attr("y",S).attr("width",y).attr("height",b);d.attr("transform",`translate(${e.x-m.width/2}, ${_+1-(sr(r)?0:3)})`);const L=N.node().getBBox();return e.height=L.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(A){return Os(e,A)},{cluster:h,labelBBox:m}},"roundedWithTitle"),LR=v(async(t,e)=>{nt.info("Creating subgraph rect for ",e.id,e);const r=Qt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=kt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=sr(r),p=d.insert("g").attr("class","cluster-label "),m=await vn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width});let x=m.getBBox();if(sr(r)){const N=m.children[0],L=zt(m);x=N.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;nt.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const N=yt.svg(d),L=Ct(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),A=N.path(Qn(C,b,g,y,e.rx),L);w=d.insert(()=>(nt.debug("Rough node insert CXC",A),A),":first-child"),w.select("path:nth-child(2)").attr("style",h.join(";")),w.select("path").attr("style",u.join(";").replace("fill","stroke"))}else w=d.insert("rect",":first-child"),w.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:_}=of(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const N=p.select("span");N&&N.attr("style",a)}const S=w.node().getBBox();return e.offsetX=0,e.width=S.width,e.height=S.height,e.offsetY=x.height-e.padding/2,e.intersect=function(N){return Os(e,N)},{cluster:d,labelBBox:x}},"kanbanSection"),AR=v((t,e)=>{const r=Qt(),{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=yt.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 Os(e,x)},{cluster:o,labelBBox:{}}},"divider"),MR=hv,IR={rect:hv,squareRect:MR,roundedWithTitle:BR,noteGroup:ER,divider:AR,kanbanSection:LR},uv=new Map,FR=v(async(t,e)=>{const r=e.shape||"rect",n=await IR[r](t,e);return uv.set(e.id,n),n},"insertCluster"),TV=v(()=>{uv=new Map},"clear");function dv(t,e){return t.intersect(e)}v(dv,"intersectNode");var PR=dv;function pv(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}}v(pv,"intersectEllipse");var fv=pv;function mv(t,e,r){return fv(t,e,e,r)}v(mv,"intersectCircle");var DR=mv;function gv(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&&bd(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&&bd(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}}}v(gv,"intersectLine");function bd(t,e){return t*e>0}v(bd,"sameSign");var OR=gv;function xv(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=OR(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}v(xv,"intersectPolygon");var $R=xv,mt={node:PR,circle:DR,ellipse:fv,polygon:$R,rect:Os};function yv(t,e){const{labelStyles:r}=kt(e);e.labelStyle=r;const n=Et(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=yt.svg(s),h=Ct(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",Me(a)),vt(e,d),e.intersect=function(f){return nt.info("Circle intersect",e,o,f),mt.circle(e,o,f)},s}v(yv,"anchor");function Cd(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 S=[];for(let N=0;N<20;N++){const L=N/19,A=b+L*_,j=y+i*Math.cos(A),I=C+s*Math.sin(A);S.push({x:j,y:I})}return S}v(Cd,"generateArcPoints");function bv(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(bv,"calculateArcSagitta");async function Cv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=v(A=>A+o,"calcTotalHeight"),l=v(A=>{const j=A/2;return[j/(2.5+A/50),j]},"calcEllipseRadius"),{shapeSvg:h,bbox:u}=await Bt(t,e,Et(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[f,p]=l(d),m=bv(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},...Cd(-g/2,-y/2,-g/2,y/2,f,p,!1),{x:g/2,y:y/2},...Cd(g/2,y/2,g/2,-y/2,f,p,!0)],w=yt.svg(h),_=Ct(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const S=Yt(b),N=w.path(S,_),L=h.insert(()=>N,":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)`),vt(e,L),e.intersect=function(A){return mt.polygon(e,b,A)},h}v(Cv,"bowTieRect");function wn(t,e,r,n){return t.insert("polygon",":first-child").attr("points",n.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}v(wn,"insertPolygonShape");var Ka=12;async function kv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(e)),h=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s+Ka),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+Ka,y:p},{x:f,y:p},{x:f,y:m},{x:d,y:m},{x:d,y:p+Ka},{x:d+Ka,y:p}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const C=yt.svg(a),b=Ct(e,{}),w=Yt(x),_=C.path(w,b);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),y&&g.attr("style",y)}else g=wn(a,h,u,x);return n&&g.attr("style",n),vt(e,g),e.intersect=function(C){return mt.polygon(e,x,C)},a}v(kv,"card");function vv(t,e){const{nodeStyles:r}=kt(e);e.label="";const n=t.insert("g").attr("class",Et(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=yt.svg(n),l=Ct(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=Yt(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 mt.polygon(e,o,f)},n}v(vv,"choice");async function bf(t,e,r){const{labelStyles:n,nodeStyles:i}=kt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await Bt(t,e,Et(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=yt.svg(s),m=Ct(e,{}),x=p.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",Me(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 vt(e,d),e.calcIntersect=function(p,m){const x=p.width/2;return mt.circle(p,x,m)},e.intersect=function(p){return nt.info("Circle intersect",e,u,p),mt.circle(e,u,p)},s}v(bf,"circle");function wv(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}
|
|
555
|
-
M ${i.x},${i.y} L ${o.x},${o.y}`}v(wv,"createLine");function Sv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r,e.label="";const i=t.insert("g").attr("class",Et(e)).attr("id",e.domId??e.id),s=Math.max(30,(e==null?void 0:e.width)??0),{cssStyles:o}=e,a=yt.svg(i),l=Ct(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=a.circle(0,0,s*2,l),u=wv(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),vt(e,f),e.intersect=function(p){return nt.info("crossedCircle intersect",e,{radius:s,point:p}),mt.circle(e,s,p)},i}v(Sv,"crossedCircle");function dn(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}v(dn,"generateCirclePoints");async function Tv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(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=[...dn(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...dn(h/2+d*2,-d,d,20,-180,-270),...dn(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...dn(h/2,u/2,d,20,0,90)],m=[{x:h/2,y:-u/2-d},{x:-h/2,y:-u/2-d},...dn(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...dn(h/2+h*.1,-d,d,20,-180,-270),...dn(h/2+h*.1,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...dn(h/2,u/2,d,20,0,90),{x:-h/2,y:u/2+d},{x:h/2,y:u/2+d}],x=yt.svg(i),g=Ct(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Yt(p).replace("Z",""),b=x.path(C,g),w=Yt(m),_=x.path(w,{...g}),S=i.insert("g",":first-child");return S.insert(()=>_,":first-child").attr("stroke-opacity",0),S.insert(()=>b,":first-child"),S.attr("class","text"),f&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),S.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))})`),vt(e,S),e.intersect=function(N){return mt.polygon(e,m,N)},i}v(Tv,"curlyBraceLeft");function pn(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}v(pn,"generateCirclePoints");async function _v(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(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=[...pn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...pn(h/2+d*2,-d,d,20,-180,-270),...pn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...pn(h/2,u/2,d,20,0,90)],m=[{x:-h/2,y:-u/2-d},{x:h/2,y:-u/2-d},...pn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...pn(h/2+d*2,-d,d,20,-180,-270),...pn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...pn(h/2,u/2,d,20,0,90),{x:h/2,y:u/2+d},{x:-h/2,y:u/2+d}],x=yt.svg(i),g=Ct(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Yt(p).replace("Z",""),b=x.path(C,g),w=Yt(m),_=x.path(w,{...g}),S=i.insert("g",":first-child");return S.insert(()=>_,":first-child").attr("stroke-opacity",0),S.insert(()=>b,":first-child"),S.attr("class","text"),f&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),S.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))})`),vt(e,S),e.intersect=function(N){return mt.polygon(e,m,N)},i}v(_v,"curlyBraceRight");function Oe(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}v(Oe,"generateCirclePoints");async function jv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(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=[...Oe(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...Oe(h/2+d*2,-d,d,20,-180,-270),...Oe(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...Oe(h/2,u/2,d,20,0,90)],m=[...Oe(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...Oe(-h/2-d/2,-d,d,20,0,90),...Oe(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...Oe(-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},...Oe(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...Oe(h/2+d*2,-d,d,20,-180,-270),...Oe(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...Oe(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},...Oe(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...Oe(-h/2-d/2,-d,d,20,0,90),...Oe(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...Oe(-h/2+d+d/2,u/2,d,30,-180,-270)],g=yt.svg(i),y=Ct(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=Yt(p).replace("Z",""),w=g.path(b,y),S=Yt(m).replace("Z",""),N=g.path(S,y),L=Yt(x),A=g.path(L,{...y}),j=i.insert("g",":first-child");return j.insert(()=>A,":first-child").attr("stroke-opacity",0),j.insert(()=>w,":first-child"),j.insert(()=>N,":first-child"),j.attr("class","text"),f&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",n),j.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))})`),vt(e,j),e.intersect=function(I){return mt.polygon(e,x,I)},i}v(jv,"curlyBraces");async function Nv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(h),g=Ct(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,C=f,b=y-p,w=C/4,_=[{x:b,y:0},{x:w,y:0},{x:0,y:C/2},{x:w,y:C},{x:b,y:C},...ia(-b,-C/2,p,50,270,90)],S=Yt(_),N=x.path(S,g),L=h.insert(()=>N,":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})`),vt(e,L),e.intersect=function(A){return mt.polygon(e,_,A)},h}v(Nv,"curvedTrapezoid");var RR=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),zR=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),WR=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),nx=8,ix=8;async function Ev(t,e){const{labelStyles:r,nodeStyles:n}=kt(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<ix&&(e.width=ix);const C=g/2/(2.5+g/50);e.height=(e.height??0)-s-C*3,e.height<nx&&(e.height=nx)}const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,Et(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=yt.svg(a),y=zR(0,0,u,p,d,f),C=WR(0,f,u,p,d,f),b=Ct(e,{}),w=g.path(y,b),_=g.path(C,Ct(e,{fill:"none"}));m=a.insert(()=>_,":first-child"),m=a.insert(()=>w,":first-child"),m.attr("class","basic label-container"),x&&m.attr("style",x)}else{const g=RR(0,0,u,p,d,f);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",Me(x)).attr("style",n)}return m.attr("label-offset-y",f),m.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),vt(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=mt.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}v(Ev,"cylinder");async function $s(t,e,r){const{labelStyles:n,nodeStyles:i}=kt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await Bt(t,e,Et(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=yt.svg(s),g=Ct(e,{}),y=f||p?x.path(Qn(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",Me(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",Me(f)).attr("ry",Me(p)).attr("x",h).attr("y",u).attr("width",a).attr("height",l);return vt(e,d),e.calcIntersect=function(x,g){return mt.rect(x,g)},e.intersect=function(x){return mt.rect(e,x)},s}v($s,"drawRect");async function Bv(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 $s(t,e,l);if(e.look==="handDrawn"){const p=yt.svg(h),m=Ct(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}v(Bv,"datastore");async function Lv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(e)),h=a.width+i,u=a.height+s,d=u*.2,f=-h/2,p=-u/2-d/2,{cssStyles:m}=e,x=yt.svg(o),g=Ct(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(w=>[w.x,w.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))})`),vt(e,b),e.intersect=function(w){return mt.rect(e,w)},o}v(Lv,"dividedRectangle");async function Av(t,e){var p,m;const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(a),g=Ct(e,{roughness:.2,strokeWidth:2.5}),y=Ct(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",Me(e.cssClasses)).attr("style",Me(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 vt(e,d),e.intersect=function(x){return nt.info("DoubleCircle intersect",e,h,x),mt.circle(e,h,x)},a}v(Av,"doublecircle");function Mv(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=kt(e);e.label="",e.labelStyle=n;const s=t.insert("g").attr("class",Et(e)).attr("id",e.domId??e.id),o=7,{cssStyles:a}=e,l=yt.svg(s),{nodeBorder:h}=r,u=Ct(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),vt(e,f),e.intersect=function(p){return nt.info("filledCircle intersect",e,{radius:o,point:p}),mt.circle(e,o,p)},s}v(Mv,"filledCircle");var sx=10,ox=10;async function Iv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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<sx&&(e.height=sx),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<ox&&(e.width=ox));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(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=yt.svg(o),x=Ct(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Yt(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,vt(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 nt.info("Triangle intersect",e,f,b),mt.polygon(e,f,b)},o}v(Iv,"flippedTriangle");function Fv(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=kt(e);e.label="";const o=t.insert("g").attr("class",Et(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=yt.svg(o),p=Ct(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),vt(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 mt.rect(e,y)},o}v(Fv,"forkJoin");async function Pv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(l),x=Ct(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},...ia(-u/2+f,0,f,50,90,270),{x:u/2-f,y:d/2},{x:-u/2,y:d/2}],y=Yt(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),vt(e,b),e.intersect=function(w){return nt.info("Pill intersect",e,{radius:f,point:w}),mt.polygon(e,g,w)},l}v(Pv,"halfRoundedRectangle");var qR=v((t,e,r,n,i)=>[`M${t+i},${e}`,`L${t+r-i},${e}`,`L${t+r},${e-n/2}`,`L${t+r-i},${e-n}`,`L${t+i},${e-n}`,`L${t},${e-n/2}`,"Z"].join(" "),"createHexagonPathD");async function Dv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(u),b=Ct(e,{}),w=qR(0,0,m,f,p),_=C.path(w,b);g=u.insert(()=>_,":first-child").attr("transform",`translate(${-m/2}, ${f/2})`),y&&g.attr("style",y)}else g=wn(u,m,f,x);return n&&g.attr("style",n),e.width=m,e.height=f,vt(e,g),e.intersect=function(C){return mt.polygon(e,x,C)},u}v(Dv,"hexagon");async function Ov(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await Bt(t,e,Et(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=yt.svg(i),h=Ct(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=Yt(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})`),vt(e,p),e.intersect=function(m){return nt.info("Pill intersect",e,{points:u}),mt.polygon(e,u,m)},i}v(Ov,"hourglass");async function $v(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=kt(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 Bt(t,e,"icon-shape default"),f=e.pos==="t",p=a,m=a,{nodeBorder:x}=r,{stylesMap:g}=Ds(e),y=-m/2,C=-p/2,b=e.label?8:0,w=yt.svg(h),_=Ct(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const S=w.rectangle(y,C,m,p,_),N=Math.max(m,u.width),L=p+u.height+b,A=w.rectangle(-N/2,-L/2,N,L,{..._,fill:"transparent",stroke:"none"}),j=h.insert(()=>S,":first-child"),I=h.insert(()=>A);if(e.icon){const z=h.append("g");z.html(`<g>${await ka(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const W=z.node().getBBox(),D=W.width,M=W.height,F=W.x,O=W.y;z.attr("transform",`translate(${-D/2-F},${f?u.height/2+b/2-M/2-O:-u.height/2-b/2-M/2-O})`),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})`),j.attr("transform",`translate(0,${f?u.height/2+b/2:-u.height/2-b/2})`),vt(e,I),e.intersect=function(z){if(nt.info("iconSquare intersect",e,z),!e.label)return mt.rect(e,z);const W=e.x??0,D=e.y??0,M=e.height??0;let F=[];return f?F=[{x:W-u.width/2,y:D-M/2},{x:W+u.width/2,y:D-M/2},{x:W+u.width/2,y:D-M/2+u.height+b},{x:W+m/2,y:D-M/2+u.height+b},{x:W+m/2,y:D+M/2},{x:W-m/2,y:D+M/2},{x:W-m/2,y:D-M/2+u.height+b},{x:W-u.width/2,y:D-M/2+u.height+b}]:F=[{x:W-m/2,y:D-M/2},{x:W+m/2,y:D-M/2},{x:W+m/2,y:D-M/2+p},{x:W+u.width/2,y:D-M/2+p},{x:W+u.width/2/2,y:D+M/2},{x:W-u.width/2,y:D+M/2},{x:W-u.width/2,y:D-M/2+p},{x:W-m/2,y:D-M/2+p}],mt.polygon(e,F,z)},h}v($v,"icon");async function Rv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=kt(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 Bt(t,e,"icon-shape default"),f=20,p=e.label?8:0,m=e.pos==="t",{nodeBorder:x,mainBkg:g}=r,{stylesMap:y}=Ds(e),C=yt.svg(h),b=Ct(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const w=y.get("fill");b.stroke=w??g;const _=h.append("g");e.icon&&_.html(`<g>${await ka(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const S=_.node().getBBox(),N=S.width,L=S.height,A=S.x,j=S.y,I=Math.max(N,L)*Math.SQRT2+f*2,z=C.circle(0,0,I,b),W=Math.max(I,u.width),D=I+u.height+p,M=C.rectangle(-W/2,-D/2,W,D,{...b,fill:"transparent",stroke:"none"}),F=h.insert(()=>z,":first-child"),O=h.insert(()=>M);return _.attr("transform",`translate(${-N/2-A},${m?u.height/2+p/2-L/2-j:-u.height/2-p/2-L/2-j})`),_.attr("style",`color: ${y.get("stroke")??x};`),d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${m?-D/2:D/2-u.height})`),F.attr("transform",`translate(0,${m?u.height/2+p/2:-u.height/2-p/2})`),vt(e,O),e.intersect=function($){return nt.info("iconSquare intersect",e,$),mt.rect(e,$)},h}v(Rv,"iconCircle");async function zv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=kt(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 Bt(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:C}=Ds(e),b=-x/2,w=-m/2,_=e.label?8:0,S=yt.svg(h),N=Ct(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const L=C.get("fill");N.stroke=L??y;const A=S.path(Qn(b,w,x,m,5),N),j=Math.max(x,u.width),I=m+u.height+_,z=S.rectangle(-j/2,-I/2,j,I,{...N,fill:"transparent",stroke:"none"}),W=h.insert(()=>A,":first-child").attr("class","icon-shape2"),D=h.insert(()=>z);if(e.icon){const M=h.append("g");M.html(`<g>${await ka(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=M.node().getBBox(),O=F.width,$=F.height,B=F.x,T=F.y;M.attr("transform",`translate(${-O/2-B},${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?-I/2:I/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),vt(e,D),e.intersect=function(M){if(nt.info("iconSquare intersect",e,M),!e.label)return mt.rect(e,M);const F=e.x??0,O=e.y??0,$=e.height??0;let B=[];return p?B=[{x:F-u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2+u.height+_},{x:F+x/2,y:O-$/2+u.height+_},{x:F+x/2,y:O+$/2},{x:F-x/2,y:O+$/2},{x:F-x/2,y:O-$/2+u.height+_},{x:F-u.width/2,y:O-$/2+u.height+_}]:B=[{x:F-x/2,y:O-$/2},{x:F+x/2,y:O-$/2},{x:F+x/2,y:O-$/2+m},{x:F+u.width/2,y:O-$/2+m},{x:F+u.width/2/2,y:O+$/2},{x:F-u.width/2,y:O+$/2},{x:F-u.width/2,y:O-$/2+m},{x:F-x/2,y:O-$/2+m}],mt.polygon(e,B,M)},h}v(zv,"iconRounded");async function Wv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=kt(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 Bt(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:C}=Ds(e),b=-x/2,w=-m/2,_=e.label?8:0,S=yt.svg(h),N=Ct(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const L=C.get("fill");N.stroke=L??y;const A=S.path(Qn(b,w,x,m,.1),N),j=Math.max(x,u.width),I=m+u.height+_,z=S.rectangle(-j/2,-I/2,j,I,{...N,fill:"transparent",stroke:"none"}),W=h.insert(()=>A,":first-child"),D=h.insert(()=>z);if(e.icon){const M=h.append("g");M.html(`<g>${await ka(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=M.node().getBBox(),O=F.width,$=F.height,B=F.x,T=F.y;M.attr("transform",`translate(${-O/2-B},${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?-I/2:I/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),vt(e,D),e.intersect=function(M){if(nt.info("iconSquare intersect",e,M),!e.label)return mt.rect(e,M);const F=e.x??0,O=e.y??0,$=e.height??0;let B=[];return p?B=[{x:F-u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2+u.height+_},{x:F+x/2,y:O-$/2+u.height+_},{x:F+x/2,y:O+$/2},{x:F-x/2,y:O+$/2},{x:F-x/2,y:O-$/2+u.height+_},{x:F-u.width/2,y:O-$/2+u.height+_}]:B=[{x:F-x/2,y:O-$/2},{x:F+x/2,y:O-$/2},{x:F+x/2,y:O-$/2+m},{x:F+u.width/2,y:O-$/2+m},{x:F+u.width/2/2,y:O+$/2},{x:F-u.width/2,y:O+$/2},{x:F-u.width/2,y:O-$/2+m},{x:F-x/2,y:O-$/2+m}],mt.polygon(e,B,M)},h}v(Wv,"iconSquare");async function qv(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}=kt(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 Bt(t,e,"image-shape default"),m=e.pos==="t",x=-h/2,g=-u/2,y=e.label?8:0,C=yt.svg(d),b=Ct(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const w=C.rectangle(x,g,h,u,b),_=Math.max(h,f.width),S=u+f.height+y,N=C.rectangle(-_/2,-S/2,_,S,{...b,fill:"none",stroke:"none"}),L=d.insert(()=>w,":first-child"),A=d.insert(()=>N);if(e.img){const j=d.append("image");j.attr("href",e.img),j.attr("width",h),j.attr("height",u),j.attr("preserveAspectRatio","none"),j.attr("transform",`translate(${-h/2},${m?S/2-u:-S/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})`),vt(e,A),e.intersect=function(j){if(nt.info("iconSquare intersect",e,j),!e.label)return mt.rect(e,j);const I=e.x??0,z=e.y??0,W=e.height??0;let D=[];return m?D=[{x:I-f.width/2,y:z-W/2},{x:I+f.width/2,y:z-W/2},{x:I+f.width/2,y:z-W/2+f.height+y},{x:I+h/2,y:z-W/2+f.height+y},{x:I+h/2,y:z+W/2},{x:I-h/2,y:z+W/2},{x:I-h/2,y:z-W/2+f.height+y},{x:I-f.width/2,y:z-W/2+f.height+y}]:D=[{x:I-h/2,y:z-W/2},{x:I+h/2,y:z-W/2},{x:I+h/2,y:z-W/2+u},{x:I+f.width/2,y:z-W/2+u},{x:I+f.width/2/2,y:z+W/2},{x:I-f.width/2,y:z+W/2},{x:I-f.width/2,y:z-W/2+u},{x:I-h/2,y:z-W/2+u}],mt.polygon(e,D,j)},d}v(qv,"imageSquare");async function Hv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(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=yt.svg(a),x=Ct(e,{}),g=Yt(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=wn(a,h,u,d);return n&&f.attr("style",n),e.width=h,e.height=u,vt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(Hv,"inv_trapezoid");async function Uv(t,e){const{shapeSvg:r,bbox:n,label:i}=await Bt(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))})`),vt(e,s),e.intersect=function(l){return mt.rect(e,l)},r}v(Uv,"labelRect");async function Yv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(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=yt.svg(a),x=Ct(e,{}),g=Yt(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=wn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,vt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(Yv,"lean_left");async function Vv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(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=yt.svg(a),x=Ct(e,{}),g=Yt(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=wn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,vt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(Vv,"lean_right");function Gv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.label="",e.labelStyle=r;const i=t.insert("g").attr("class",Et(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=yt.svg(i),d=Ct(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=Yt(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})`),vt(e,m),e.intersect=function(x){return nt.info("lightningBolt intersect",e,x),mt.polygon(e,h,x)},i}v(Gv,"lightningBolt");var HR=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),UR=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),YR=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),ax=10,lx=10;async function Xv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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<lx&&(e.width=lx);const b=y/2/(2.5+y/50);e.height=(e.height??0)-o-b*3,e.height<ax&&(e.height=ax)}const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,Et(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=yt.svg(a),C=UR(0,0,u,p,d,f,m),b=YR(0,f,u,p,d,f),w=Ct(e,{}),_=y.path(C,w),S=y.path(b,w);a.insert(()=>S,":first-child").attr("class","line"),x=a.insert(()=>_,":first-child"),x.attr("class","basic label-container"),g&&x.attr("style",g)}else{const y=HR(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",Me(g)).attr("style",n)}return x.attr("label-offset-y",f),x.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),vt(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=mt.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 w=f*f*(1-b*b/(d*d));w>0&&(w=Math.sqrt(w)),w=f-w,y.y-(e.y??0)>0&&(w=-w),C.y+=w}return C},a}v(Xv,"linedCylinder");async function Kv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 w=e.width;e.width=(w??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 Bt(t,e,Et(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=yt.svg(a),g=Ct(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},...Gn(-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(w=>[w.x,w.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))})`),vt(e,b),e.intersect=function(w){return mt.polygon(e,y,w)},a}v(Kv,"linedWaveEdgedRect");async function Qv(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(l),b=Ct(e,{}),w=[{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 S=Yt(w);let N=C.path(S,b);const L=Yt(_);let A=C.path(L,b);e.look!=="handDrawn"&&(N=yd(N),A=yd(A));const j=l.insert("g",":first-child");return j.insert(()=>N),j.insert(()=>A),j.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&j.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))})`),vt(e,j),e.intersect=function(I){return mt.polygon(e,w,I)},l}v(Qv,"multiRect");async function Zv(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(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=Gn(x-y,g+m+y,x+d-y,g+m+y,p,.8),w=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:w.y-y},{x:x+d,y:w.y-y},{x:x+d,y:w.y-2*y},{x:x+d+y,y:w.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}],S=[{x,y:g+y},{x:x+d-y,y:g+y},{x:x+d-y,y:w.y-y},{x:x+d,y:w.y-y},{x:x+d,y:g},{x,y:g}],N=yt.svg(i),L=Ct(e,{});e.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const A=Yt(_),j=N.path(A,L),I=Yt(S),z=N.path(I,L),W=i.insert(()=>j,":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))})`),vt(e,W),e.intersect=function(D){return mt.polygon(e,_,D)},i}v(Zv,"multiWaveEdgedRectangle");async function Jv(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=kt(e);e.labelStyle=n,e.useHtmlLabels||sr(ye())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(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=yt.svg(o),x=Ct(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))})`),vt(e,y),e.intersect=function(C){return mt.rect(e,C)},o}v(Jv,"note");var VR=v((t,e,r)=>[`M${t+r/2},${e}`,`L${t+r},${e-r/2}`,`L${t+r/2},${e-r}`,`L${t},${e-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function tw(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Bt(t,e,Et(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=yt.svg(i),m=Ct(e,{}),x=VR(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=wn(i,l,l,u),d.attr("transform",`translate(${-l/2+h}, ${l/2})`);return n&&d.attr("style",n),vt(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=mt.polygon(p,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(p){return this.calcIntersect(e,p)},i}v(tw,"question");async function ew(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(a),C=Ct(e,{});e.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const b=Yt(x),w=y.path(b,C),_=a.insert(()=>w,":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))})`),vt(e,_),e.intersect=function(S){return mt.polygon(e,x,S)},a}v(ew,"rect_left_inv_arrow");async function rw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 On(a,h,e.labelStyle,!0,!0);let d={width:0,height:0};if(sr(Qt())){const L=u.children[0],A=zt(u);d=L.getBoundingClientRect(),A.attr("width",d.width),A.attr("height",d.height)}nt.info("Text 2",l);const f=l||[],p=u.getBBox(),m=await On(a,Array.isArray(f)?f.join("<br/>"):f,e.labelStyle,!0,!0),x=m.children[0],g=zt(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;zt(m).attr("transform","translate( "+(d.width>p.width?0:(p.width-d.width)/2)+", "+(p.height+y+5)+")"),zt(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),w=-d.width/2-y,_=-d.height/2-y;let S,N;if(e.look==="handDrawn"){const L=yt.svg(s),A=Ct(e,{}),j=L.path(Qn(w,_,C,b,e.rx||0),A),I=L.line(-d.width/2-y,-d.height/2-y+p.height+y,d.width/2+y,-d.height/2-y+p.height+y,A);N=s.insert(()=>(nt.debug("Rough node insert CXC",j),I),":first-child"),S=s.insert(()=>(nt.debug("Rough node insert CXC",j),j),":first-child")}else S=o.insert("rect",":first-child"),N=o.insert("line"),S.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)),N.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 vt(e,S),e.intersect=function(L){return mt.rect(e,L)},s}v(rw,"rectWithTitle");async function nw(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 $s(t,e,i)}v(nw,"roundedRect");var ii=8;async function iw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(e)),h=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?ii:ii*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=h-ii,f=u,p=ii-h/2,m=-u/2,{cssStyles:x}=e,g=yt.svg(o),y=Ct(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-ii,y:m+f},{x:p-ii,y:m},{x:p,y:m},{x:p,y:m+f}],b=g.polygon(C.map(_=>[_.x,_.y]),y),w=o.insert(()=>b,":first-child");return w.attr("class","basic label-container outer-path").attr("style",Me(x)),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),l.attr("transform",`translate(${ii/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),vt(e,w),e.intersect=function(_){return mt.rect(e,_)},o}v(iw,"shadedProcess");async function sw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(a),C=Ct(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}],w=Yt(b),_=y.path(w,C),S=a.insert(()=>_,":first-child");return S.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&S.selectChildren("path").attr("style",g),n&&e.look!=="handDrawn"&&S.selectChildren("path").attr("style",n),S.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))})`),vt(e,S),e.intersect=function(N){return mt.polygon(e,b,N)},a}v(sw,"slopedRect");async function ow(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 $s(t,e,s)}v(ow,"squareRect");async function aw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(a),m=Ct(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},...ia(-u/2+d,0,d,50,90,270),{x:u/2-d,y:h/2},...ia(u/2-d,0,d,50,270,450)],g=Yt(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),vt(e,C),e.intersect=function(b){return mt.polygon(e,x,b)},a}v(aw,"stadium");async function lw(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return $s(t,e,r)}v(lw,"state");function cw(t,e,{config:{themeVariables:r}}){var C,b;const{labelStyles:n,nodeStyles:i}=kt(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=yt.svg(u),f=Ct(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 w=((b=(C=t.node())==null?void 0:C.ownerSVGElement)==null?void 0:b.id)??"",_=w?`${w}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${_})`)}return vt(e,y),e.intersect=function(w){return mt.circle(e,(e.width??0)/2,w)},u}v(cw,"stateEnd");function hw(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=yt.svg(s).circle(0,0,e.width,r$(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 vt(e,o),e.intersect=function(h){return mt.circle(e,(e.width??7)/2,h)},s}v(hw,"stateStart");var Wi=8;async function uw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(e)),h=((e==null?void 0:e.width)??l.width)+2*Wi+s,u=((e==null?void 0:e.height)??l.height)+o,d=h-2*Wi,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=yt.svg(a),y=Ct(e,{}),C=g.rectangle(p,m,d+16,f,y),b=g.line(p+Wi,m,p+Wi,m+f,y),w=g.line(p+Wi+d,m,p+Wi+d,m+f,y);a.insert(()=>b,":first-child"),a.insert(()=>w,":first-child");const _=a.insert(()=>C,":first-child"),{cssStyles:S}=e;_.attr("class","basic label-container").attr("style",Me(S)),vt(e,_)}else{const g=wn(a,d,f,x);n&&g.attr("style",n),vt(e,g)}return e.intersect=function(g){return mt.polygon(e,x,g)},a}v(uw,"subroutine");var Zh=.2;async function dw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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-Zh*(e.height+o*2),10));const{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2,u=Zh*h,d=Zh*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=yt.svg(a),b=Ct(e,{}),w=[{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 S=Yt(w),N=C.path(S,b),L=Yt(_),A=C.path(L,{...b,fillStyle:"solid"}),j=a.insert(()=>A,":first-child");return j.insert(()=>N,":first-child"),j.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",n),vt(e,j),e.intersect=function(I){return mt.polygon(e,w,I)},a}v(dw,"taggedRect");async function pw(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(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=yt.svg(i),x=Ct(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:f/2},...Gn(-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},...Gn(y+a,(C+l)*1.25,y+a-u,(C+l)*1.3,-l*.02,.5)],w=Yt(g),_=m.path(w,x),S=Yt(b),N=m.path(S,{...x,fillStyle:"solid"}),L=i.insert(()=>N,":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))})`),vt(e,L),e.intersect=function(A){return mt.polygon(e,g,A)},i}v(pw,"taggedWaveEdgedRectangle");async function fw(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Bt(t,e,Et(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),vt(e,u),e.intersect=function(d){return mt.rect(e,d)},i}v(fw,"text");var GR=v((t,e,r,n,i,s)=>`M${t},${e}
|
|
556
|
-
a${i},${s} 0,0,1 0,${-n}
|
|
557
|
-
l${r},0
|
|
558
|
-
a${i},${s} 0,0,1 0,${n}
|
|
559
|
-
M${r},${-n}
|
|
560
|
-
a${i},${s} 0,0,0 0,${n}
|
|
561
|
-
l${-r},0`,"createCylinderPathD"),XR=v((t,e,r,n,i,s)=>[`M${t},${e}`,`M${t+r},${e}`,`a${i},${s} 0,0,0 0,${-n}`,`l${-r},0`,`a${i},${s} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),KR=v((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),cx=5,hx=10;async function mw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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<cx&&(e.height=cx);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<hx&&(e.width=hx)}const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(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=yt.svg(o),g=XR(0,0,f,h,d,u),y=KR(0,0,f,h,d,u),C=x.path(g,Ct(e,{})),b=x.path(y,Ct(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=GR(0,0,f,h,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",Me(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))})`),vt(e,m),e.intersect=function(x){const g=mt.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}v(mw,"tiltedCylinder");async function gw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(a),x=Ct(e,{}),g=Yt(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=wn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,vt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(gw,"trapezoid");async function xw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(h),x=Ct(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=Yt(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),vt(e,b),e.intersect=function(w){return mt.polygon(e,g,w)},h}v(xw,"trapezoidalPentagon");var ux=10,dx=10;async function yw(t,e){var w;const{labelStyles:r,nodeStyles:n}=kt(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<dx&&(e.width=dx),e.height=(e==null?void 0:e.height)??0,e.height<ux&&(e.height=ux));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(e)),h=kn((w=Qt().flowchart)==null?void 0:w.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=yt.svg(o),g=Ct(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Yt(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,vt(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 nt.info("Triangle intersect",e,p,_),mt.polygon(e,p,_)},o}v(yw,"triangle");async function bw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 Bt(t,e,Et(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=yt.svg(l),w=Ct(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const _=[{x:-d/2-C,y:m/2},...Gn(-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}],S=Yt(_),N=b.path(S,w),L=l.insert(()=>N,":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))})`),vt(e,L),e.intersect=function(A){return mt.polygon(e,_,A)},l}v(bw,"waveEdgedRectangle");async function Cw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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 w=Math.min(e.height*.2,e.height/4);e.height=Math.ceil(e.height-o-w*(20/9)),e.width=e.width-s*2}const{shapeSvg:a,bbox:l}=await Bt(t,e,Et(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=yt.svg(a),x=Ct(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-h/2,y:f/2},...Gn(-h/2,f/2,h/2,f/2,d,1),{x:h/2,y:-f/2},...Gn(h/2,-f/2,-h/2,-f/2,d,-1)],y=Yt(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),vt(e,b),e.intersect=function(w){return mt.polygon(e,g,w)},a}v(Cw,"waveRectangle");var Ce=10;async function kw(t,e){const{labelStyles:r,nodeStyles:n}=kt(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-Ce,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-Ce,10));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(e)),h=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+Ce,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+Ce,d=h-Ce,f=u-Ce,p=-d/2,m=-f/2,{cssStyles:x}=e,g=yt.svg(o),y=Ct(e,{}),C=[{x:p-Ce,y:m-Ce},{x:p-Ce,y:m+f},{x:p+d,y:m+f},{x:p+d,y:m-Ce}],b=`M${p-Ce},${m-Ce} L${p+d},${m-Ce} L${p+d},${m+f} L${p-Ce},${m+f} L${p-Ce},${m-Ce}
|
|
562
|
-
M${p-Ce},${m} L${p+d},${m}
|
|
563
|
-
M${p},${m-Ce} L${p},${m+f}`;e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const w=g.path(b,y),_=o.insert(()=>w,":first-child");return _.attr("transform",`translate(${Ce/2}, ${Ce/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)+Ce/2-(a.x-(a.left??0))}, ${-(a.height/2)+Ce/2-(a.y-(a.top??0))})`),vt(e,_),e.intersect=function(S){return mt.polygon(e,C,S)},o}v(kw,"windowPane");var px=new Set(["redux-color","redux-dark-color"]),QR=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function Cf(t,e){var xt,Dt,Wt,lt;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=ye(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:K}=ye(),{background:it}=K,wt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${it}`]};await Cf(t,wt)}const h=ye();e.useHtmlLabels=h.htmlLabels;let u=((xt=h.er)==null?void 0:xt.diagramPadding)??10,d=((Dt=h.er)==null?void 0:Dt.entityPadding)??6;const{cssStyles:f}=e,{labelStyles:p,nodeStyles:m}=kt(e);if(r.attributes.length===0&&e.label){const K={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};yn(e.label,h)+K.labelPaddingX*2<h.er.minEntityWidth&&(e.width=h.er.minEntityWidth);const it=await $s(t,e,K);if(n!=null&&px.has(n)){const wt=r.colorIndex??0;it.attr("data-color-id",`color-${wt%l.length}`)}if(!kn(h.htmlLabels)){const wt=it.select("text"),gt=(Wt=wt.node())==null?void 0:Wt.getBBox();wt.attr("transform",`translate(${-gt.width/2}, 0)`)}return it}h.htmlLabels||(u*=1.25,d*=1.25);let x=Et(e);x||(x="node default");const g=t.insert("g").attr("class",x).attr("id",e.domId||e.id),y=await Ki(g,e.label??"",h,0,0,["name"],p);y.height+=d;let C=0;const b=[],w=[];let _=0,S=0,N=0,L=0,A=!0,j=!0;for(const K of r.attributes){const it=await Ki(g,K.type,h,0,C,["attribute-type"],p);_=Math.max(_,it.width+u);const wt=await Ki(g,K.name,h,0,C,["attribute-name"],p);S=Math.max(S,wt.width+u);const gt=await Ki(g,K.keys.join(),h,0,C,["attribute-keys"],p);N=Math.max(N,gt.width+u);const Jt=await Ki(g,K.comment,h,0,C,["attribute-comment"],p);L=Math.max(L,Jt.width+u);const It=Math.max(it.height,wt.height,gt.height,Jt.height)+d;w.push({yOffset:C,rowHeight:It}),C+=It}let I=4;N<=u&&(A=!1,N=0,I--),L<=u&&(j=!1,L=0,I--);const z=g.node().getBBox();if(y.width+u*2-(_+S+N+L)>0){const K=y.width+u*2-(_+S+N+L);_+=K/I,S+=K/I,N>0&&(N+=K/I),L>0&&(L+=K/I)}const W=_+S+N+L,D=yt.svg(g),M=Ct(e,{});e.look!=="handDrawn"&&(M.roughness=0,M.fillStyle="solid");let F=0;w.length>0&&(F=w.reduce((K,it)=>K+((it==null?void 0:it.rowHeight)??0),0));const O=Math.max(z.width+u*2,(e==null?void 0:e.width)||0,W),$=Math.max((F??0)+y.height,(e==null?void 0:e.height)||0),B=-O/2,T=-$/2;if(g.selectAll("g:not(:first-child)").each((K,it,wt)=>{const gt=zt(wt[it]),Jt=gt.attr("transform");let It=0,Xt=0;if(Jt){const Kt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Jt);Kt&&(It=parseFloat(Kt[1]),Xt=parseFloat(Kt[2]),gt.attr("class").includes("attribute-name")?It+=_:gt.attr("class").includes("attribute-keys")?It+=_+S:gt.attr("class").includes("attribute-comment")&&(It+=_+S+N))}gt.attr("transform",`translate(${B+u/2+It}, ${Xt+T+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(T+d/2)+")"),n!=null&&px.has(n)){const K=r.colorIndex??0;g.attr("data-color-id",`color-${K%l.length}`)}const V=D.rectangle(B,T,O,$,M),rt=g.insert(()=>V,":first-child").attr("class","outer-path").attr("style",f.join(""));b.push(0);for(const[K,it]of w.entries()){const gt=(K+1)%2===0&&it.yOffset!==0,Jt=D.rectangle(B,y.height+T+(it==null?void 0:it.yOffset),O,it==null?void 0:it.rowHeight,{...M,fill:gt?s:o,stroke:a});g.insert(()=>Jt,"g.label").attr("style",f.join("")).attr("class",`row-rect-${gt?"even":"odd"}`)}const P=1e-4;let X=Qi(B,y.height+T,O+B,y.height+T,P),ut=D.polygon(X.map(K=>[K.x,K.y]),M);if(g.insert(()=>ut).attr("class","divider"),X=Qi(_+B,y.height+T,_+B,$+T,P),ut=D.polygon(X.map(K=>[K.x,K.y]),M),g.insert(()=>ut).attr("class","divider"),A){const K=_+S+B;X=Qi(K,y.height+T,K,$+T,P),ut=D.polygon(X.map(it=>[it.x,it.y]),M),g.insert(()=>ut).attr("class","divider")}if(j){const K=_+S+N+B;X=Qi(K,y.height+T,K,$+T,P),ut=D.polygon(X.map(it=>[it.x,it.y]),M),g.insert(()=>ut).attr("class","divider")}for(const K of b){const it=y.height+T+K;X=Qi(B,it,O+B,it,P),ut=D.polygon(X.map(wt=>[wt.x,wt.y]),M),g.insert(()=>ut).attr("class","divider")}if(vt(e,rt),m&&e.look!=="handDrawn")if(n!=null&&QR.has(n))g.selectAll("path").attr("style",m);else{const K=m.split(";"),it=(lt=K==null?void 0:K.filter(wt=>wt.includes("stroke")))==null?void 0:lt.map(wt=>`${wt}`).join("; ");g.selectAll("path").attr("style",it??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(K){return mt.rect(e,K)},g}v(Cf,"erBox");async function Ki(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!==ng(e)&&(e=ng(e),e=e.replaceAll("<","<").replaceAll(">",">"));const l=a.node().appendChild(await vn(a,e,{width:yn(e,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(e.includes("<")||e.includes(">")){let u=l.children[0];for(u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">")}let h=l.getBBox();if(kn(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const d=zt(l);h=u.getBoundingClientRect(),d.attr("width",h.width),d.attr("height",h.height)}return h}v(Ki,"addText");function Qi(t,e,r,n,i){return t===r?[{x:t-i/2,y:e},{x:t+i/2,y:e},{x:r+i/2,y:n},{x:r-i/2,y:n}]:[{x:t,y:e-i/2},{x:t,y:e+i/2},{x:r,y:n+i/2},{x:r,y:n-i/2}]}v(Qi,"lineToPolygon");async function vw(t,e,r,n,i=r.class.padding??12){const s=n?0:3,o=t.insert("g").attr("class",Et(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 Lo(a,{text:`«${C}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await Lo(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 Lo(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 Lo(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}}v(vw,"textHelper");async function Lo(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=ye();let o="useHtmlLabels"in e?e.useHtmlLabels:kn(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),Xo(a)&&(o=!0);const l=await vn(i,Np(Si(a)),{width:yn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let h,u=1;if(o){const d=l.children[0],f=zt(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)}v(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")&&zt(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const d=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(d.textContent=a[0]+a.substring(1).replaceAll(">",">").replaceAll("<","<").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}v(Lo,"addText");async function ww(t,e){var D,M;const r=Qt(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??kn(r.htmlLabels)??!0,l=e;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];const{shapeSvg:h,bbox:u}=await vw(t,e,r,a,o),{labelStyles:d,nodeStyles:f}=kt(e);e.labelStyle=d,e.cssStyles=l.styles||"";const p=((D=l.styles)==null?void 0:D.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=yt.svg(h),g=Ct(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 w=-y/2,_=-C/2;let S=m?s*2:l.members.length===0&&l.methods.length===0?-s:0;b&&(S=s*2);const N=x.rectangle(w-s,_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0),y+2*s,C+2*s+S,g),L=h.insert(()=>N,":first-child");L.attr("class","basic label-container outer-path");const A=L.node().getBBox(),j=h.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,I=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=(j+I+_+s-(_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(h.selectAll(".text").each((F,O,$)=>{var X,ut;const B=zt($[O]),T=B.attr("transform");let V=0;if(T){const Dt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(T);Dt&&(V=parseFloat(Dt[2]))}let rt=V+_+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(B.attr("class").includes("methods-group")){const xt=Math.max(z,o/2);b?rt=Math.max(W,j+I+xt+_+o*2+s)+o*2:rt=j+I+xt+_+o*4+s}l.members.length===0&&l.methods.length===0&&((X=r.class)!=null&&X.hideEmptyMembersBox)&&(l.annotations.length>0?rt=V-o:rt=V),a||(rt-=4);let P=w;(B.attr("class").includes("label-group")||B.attr("class").includes("annotation-group"))&&(P=-((ut=B.node())==null?void 0:ut.getBBox().width)/2||0,h.selectAll("text").each(function(xt,Dt,Wt){window.getComputedStyle(Wt[Dt]).textAnchor==="middle"&&(P=0)})),B.attr("transform",`translate(${P}, ${rt})`)}),l.members.length>0||l.methods.length>0||m){const F=j+I+_+s,O=x.line(A.x,F,A.x+A.width,F+.001,g);h.insert(()=>O).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(m||l.members.length>0||l.methods.length>0){const F=j+I+z+_+o*2+s,O=x.line(A.x,b?Math.max(W,F):F,A.x+A.width,(b?Math.max(W,F):F)+.001,g);h.insert(()=>O).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 F=RegExp(/color\s*:\s*([^;]*)/),O=F.exec(p);if(O){const $=O[0].replace("color","fill");h.selectAll("tspan").attr("style",$)}else if(d){const $=F.exec(d);if($){const B=$[0].replace("color","fill");h.selectAll("tspan").attr("style",B)}}}return vt(e,L),e.intersect=function(F){return mt.rect(e,F)},h}v(ww,"classBox");async function Sw(t,e){var A,j;const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,h=Et(e),{themeVariables:u}=Qt(),{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,`<<${i.type}>>`,0,e.labelStyle):m=await Gr(p,"<<Element>>",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 I=await Gr(p,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=I;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 I=await Gr(p,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=I,await Gr(p,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((A=p.node())==null?void 0:A.getBBox().width)??200)+o,C=(((j=p.node())==null?void 0:j.getBBox().height)??200)+o,b=-y/2,w=-C/2,_=yt.svg(p),S=Ct(e,{});e.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const N=_.rectangle(b,w,y,C,S),L=p.insert(()=>N,":first-child");if(L.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const I=e.colorIndex??0;p.attr("data-color-id",`color-${I%d.length}`)}if(p.selectAll(".label").each((I,z,W)=>{const D=zt(W[z]),M=D.attr("transform");let F=0,O=0;if(M){const V=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(M);V&&(F=parseFloat(V[1]),O=parseFloat(V[2]))}const $=O-C/2;let B=b+o/2;(z===0||z===1)&&(B=F),D.attr("transform",`translate(${B}, ${$+o})`)}),x>m+g+a){const I=w+m+g+a;let z;if(e.look==="neo"){const M=[[b,I],[b+y,I],[b+y,I+.001],[b,I+.001]];z=_.polygon(M,S)}else z=_.line(b,I,b+y,I,S);p.insert(()=>z).attr("class","divider")}return vt(e,L),e.intersect=function(I){return mt.rect(e,I)},n&&e.look!=="handDrawn"&&(f||d!=null&&d.length)&&p.selectAll("path").attr("style",n),p}v(Sw,"requirementBox");async function Gr(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=Qt(),o=s.htmlLabels??!0,a=await vn(i,Np(Si(e)),{width:yn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let l;if(o){const h=a.children[0],u=zt(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}v(Gr,"addText");var ZR=v(t=>{switch(t){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function Tw(t,e,{config:r}){var z,W;const{labelStyles:n,nodeStyles:i}=kt(e);e.labelStyle=n||"";const s=10,o=e.width;e.width=(e.width??200)-10;const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,Et(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 Qh(f,"ticket"in e&&e.ticket||"",p):{label:m,bbox:x}=await Qh(a,"ticket"in e&&e.ticket||"",p);const{label:g,bbox:y}=await Qh(a,"assigned"in e&&e.assigned||"",p);e.width=o;const C=10,b=(e==null?void 0:e.width)||0,w=Math.max(x.height,y.height)/2,_=Math.max(l.height+C*2,(e==null?void 0:e.height)||0)+w,S=-b/2,N=-_/2;h.attr("transform","translate("+(u-b/2)+", "+(-w-l.height/2)+")"),m.attr("transform","translate("+(u-b/2)+", "+(-w+l.height/2)+")"),g.attr("transform","translate("+(u+b/2-y.width-2*s)+", "+(-w+l.height/2)+")");let L;const{rx:A,ry:j}=e,{cssStyles:I}=e;if(e.look==="handDrawn"){const D=yt.svg(a),M=Ct(e,{}),F=A||j?D.path(Qn(S,N,b,_,A||0),M):D.rectangle(S,N,b,_,M);L=a.insert(()=>F,":first-child"),L.attr("class","basic label-container").attr("style",I||null)}else{L=a.insert("rect",":first-child"),L.attr("class","basic label-container __APA__").attr("style",i).attr("rx",A??5).attr("ry",j??5).attr("x",S).attr("y",N).attr("width",b).attr("height",_);const D="priority"in e&&e.priority;if(D){const M=a.append("line"),F=S+2,O=N+Math.floor((A??0)/2),$=N+_-Math.floor((A??0)/2);M.attr("x1",F).attr("y1",O).attr("x2",F).attr("y2",$).attr("stroke-width","4").attr("stroke",ZR(D))}}return vt(e,L),e.height=_,e.intersect=function(D){return mt.rect(e,D)},a}v(Tw,"kanbanItem");async function _w(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,Et(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
|
|
564
|
-
a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
|
|
565
|
-
a${u},${u} 1 0,0 ${m*.25},0
|
|
566
|
-
a${u},${u} 1 0,0 ${m*.25},0
|
|
567
|
-
a${u},${u} 1 0,0 ${m*.25},${x*.1}
|
|
568
|
-
|
|
569
|
-
a${u},${u} 1 0,0 ${m*.15},${x*.33}
|
|
570
|
-
a${u*.8},${u*.8} 1 0,0 0,${x*.34}
|
|
571
|
-
a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
|
|
572
|
-
|
|
573
|
-
a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
|
|
574
|
-
a${u},${u} 1 0,0 ${-1*m*.25},0
|
|
575
|
-
a${u},${u} 1 0,0 ${-1*m*.25},0
|
|
576
|
-
a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
|
|
577
|
-
|
|
578
|
-
a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
|
|
579
|
-
a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
|
|
580
|
-
a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
|
|
581
|
-
H0 V0 Z`;if(e.look==="handDrawn"){const C=yt.svg(i),b=Ct(e,{}),w=C.path(y,b);g=i.insert(()=>w,":first-child"),g.attr("class","basic label-container").attr("style",Me(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})`),vt(e,g),e.calcIntersect=function(C,b){return mt.rect(C,b)},e.intersect=function(C){return nt.info("Bang intersect",e,C),mt.rect(e,C)},i}v(_w,"bang");async function jw(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,Et(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
|
|
582
|
-
a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
|
|
583
|
-
a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
|
|
584
|
-
a${d},${d} 1 0,1 ${l*.35},${l*.2}
|
|
585
|
-
|
|
586
|
-
a${u},${u} 1 0,1 ${l*.15},${h*.35}
|
|
587
|
-
a${p},${p} 1 0,1 ${-1*l*.15},${h*.65}
|
|
588
|
-
|
|
589
|
-
a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
|
|
590
|
-
a${f},${f} 1 0,1 ${-1*l*.5},0
|
|
591
|
-
a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
|
|
592
|
-
|
|
593
|
-
a${u},${u} 1 0,1 ${-1*l*.1},${-1*h*.35}
|
|
594
|
-
a${p},${p} 1 0,1 ${l*.1},${-1*h*.65}
|
|
595
|
-
H0 V0 Z`;if(e.look==="handDrawn"){const y=yt.svg(i),C=Ct(e,{}),b=y.path(g,C);x=i.insert(()=>b,":first-child"),x.attr("class","basic label-container").attr("style",Me(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})`),vt(e,x),e.calcIntersect=function(y,C){return mt.rect(y,C)},e.intersect=function(y){return nt.info("Cloud intersect",e,y),mt.rect(e,y)},i}v(jw,"cloud");async function Nw(t,e){const{labelStyles:r,nodeStyles:n}=kt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,Et(e)),l=s.width+8*o,h=s.height+2*o,u=5,d=e.look==="neo"?`
|
|
596
|
-
M${-l/2} ${h/2-u}
|
|
597
|
-
v${-h+2*u}
|
|
598
|
-
q0,-${u} ${u},-${u}
|
|
599
|
-
h${l-2*u}
|
|
600
|
-
q${u},0 ${u},${u}
|
|
601
|
-
v${h-u}
|
|
602
|
-
H${-l/2}
|
|
603
|
-
Z
|
|
604
|
-
`:`
|
|
605
|
-
M${-l/2} ${h/2-u}
|
|
606
|
-
v${-h+2*u}
|
|
607
|
-
q0,-${u} ${u},-${u}
|
|
608
|
-
h${l-2*u}
|
|
609
|
-
q${u},0 ${u},${u}
|
|
610
|
-
v${h-2*u}
|
|
611
|
-
q0,${u} ${-u},${u}
|
|
612
|
-
h${-(l-2*u)}
|
|
613
|
-
q${-u},0 ${-u},${-u}
|
|
614
|
-
Z
|
|
615
|
-
`;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()),vt(e,f),e.calcIntersect=function(p,m){return mt.rect(p,m)},e.intersect=function(p){return mt.rect(e,p)},i}v(Nw,"defaultMindmapNode");async function Ew(t,e){const r={padding:e.padding??0};return bf(t,e,r)}v(Ew,"mindmapCircle");var JR=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:ow},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:nw},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:aw},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:uw},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Ev},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:Bv},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:bf},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:_w},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:jw},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:tw},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Dv},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Vv},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Yv},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:gw},{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:Hv},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Av},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:fw},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:kv},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:iw},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:hw},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:cw},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Fv},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Ov},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Tv},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:_v},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:jv},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Gv},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:bw},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Pv},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:mw},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:Xv},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Nv},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:Lv},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:yw},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:kw},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Mv},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:xw},{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:sw},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Zv},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Qv},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Cv},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Sv},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:pw},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:dw},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Cw},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:ew},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:Kv}],t6=v(()=>{const e=[...Object.entries({state:lw,choice:vv,note:Jv,rectWithTitle:rw,labelRect:Uv,iconSquare:Wv,iconCircle:Rv,icon:$v,iconRounded:zv,imageSquare:qv,anchor:yv,kanbanItem:Tw,mindmapCircle:Ew,defaultMindmapNode:Nw,classBox:ww,erBox:Cf,requirementBox:Sw}),...JR.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),Bw=t6();function e6(t){return t in Bw}v(e6,"isValidShape");var Vc=new Map;async function Lw(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?Bw[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",Me(e.look)),e.tooltip&&i.attr("title",e.tooltip),Vc.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(Lw,"insertNode");var _V=v((t,e)=>{Vc.set(e.id,t)},"setNodeElem"),jV=v(()=>{Vc.clear()},"clear"),NV=v(t=>{const e=Vc.get(t.id);nt.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"),r6=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&fx(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&fx(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),n6={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}},i6=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],fx=v((t,e,r,n,i,s,o=!1,a)=>{var m;const l=n6[r],h=l&&i6.includes(l.type);if(!l){nt.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(w=>{w.setAttribute("stroke",a),l.fill&&w.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"),s6=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=Qt())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),pc=new Map,$e=new Map,EV=v(()=>{pc.clear(),$e.clear()},"clear"),xo=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),o6=v(async(t,e)=>{const r=Qt();let n=sr(r);const{labelStyles:i}=kt(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 vn(t,e.label,{style:xo(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(h),nt.info("abc82",e,e.labelType);let u=h.getBBox(),d=u;if(n){const p=h.children[0],m=zt(h);u=p.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const p=zt(h).select("text").node();p&&typeof p.getBBox=="function"&&(d=p.getBBox())}o.attr("transform",uo(d,n)),pc.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 On(m,e.startLabelLeft,xo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=zt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",uo(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).startLeft=p,Ao(f,e.startLabelLeft)}if(e.startLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await On(m,e.startLabelRight,xo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=zt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",uo(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).startRight=p,Ao(f,e.startLabelRight)}if(e.endLabelLeft){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await On(p,e.endLabelLeft,xo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=zt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",uo(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).endLeft=p,Ao(f,e.endLabelLeft)}if(e.endLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await On(p,e.endLabelRight,xo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=zt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",uo(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).endRight=p,Ao(f,e.endLabelRight)}return h},"insertEdgeLabel");function Ao(t,e){sr(Qt())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v(Ao,"setTerminalWidth");var a6=v((t,e)=>{nt.debug("Moving label abc88 ",t.id,t.label,pc.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=Qt(),{subGraphTitleTotalMargin:i}=of(n);if(t.label){const s=pc.get(t.id);let o=t.x,a=t.y;if(r){const l=Pr.calcLabelPosition(r);nt.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=$e.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=$e.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=$e.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=$e.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"),l6=v((t,e)=>{const r=t.x,n=t.y,i=Math.abs(e.x-r),s=Math.abs(e.y-n),o=t.width/2,a=t.height/2;return i>=o||s>=a},"outsideNode"),c6=v((t,e,r)=>{nt.debug(`intersection calc abc89:
|
|
616
|
-
outsidePoint: ${JSON.stringify(e)}
|
|
617
|
-
insidePoint : ${JSON.stringify(r)}
|
|
618
|
-
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),nt.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 nt.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"),mx=v((t,e)=>{nt.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(nt.info("abc88 checking point",s,e),!l6(e,s)&&!i){const o=c6(e,n,s);nt.debug("abc88 inside",s,n,o),nt.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)?nt.warn("abc88 no intersect",o,r):r.push(o),i=!0}else nt.warn("abc88 outside",s,n),n=s,i||r.push(s)}),nt.debug("returning points",r),r},"cutPathAtIntersect");function Aw(t){const e=[],r=[];for(let n=1;n<t.length-1;n++){const i=t[n-1],s=t[n],o=t[n+1];(i.x===s.x&&s.y===o.y&&Math.abs(s.x-o.x)>5&&Math.abs(s.y-i.y)>5||i.y===s.y&&s.x===o.x&&Math.abs(s.x-i.x)>5&&Math.abs(s.y-o.y)>5)&&(e.push(s),r.push(n))}return{cornerPoints:e,cornerPointPositions:r}}v(Aw,"extractCornerPoints");var gx=v(function(t,e,r){const n=e.x-t.x,i=e.y-t.y,s=Math.sqrt(n*n+i*i),o=r/s;return{x:e.x-o*n,y:e.y-o*i}},"findAdjacentPoint"),h6=v(function(t){const{cornerPointPositions:e}=Aw(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=gx(i,o,5),l=gx(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){nt.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 nt.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"),u6=v((t,e,r)=>{const n=t-e-r,i=2,s=2,o=i+s,a=Math.floor(n/o),l=Array(a).fill(`${i} ${s}`).join(" ");return`0 ${e} ${l} ${r}`},"generateDashArray"),d6=v(function(t,e,r,n,i,s,o,a=!1){var O;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:l}=Qt();let h=e.points,u=!1;const d=i;var f=s;const p=[];for(const $ in e.cssCompiledStyles)Bk($)||p.push(e.cssCompiledStyles[$]);nt.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])),nt.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&&(nt.info("to cluster abc88",r.get(e.toCluster)),h=mx(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(nt.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(h,null,2)),h=mx(h.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=h.filter($=>!Number.isNaN($.y));const g=s6(e.curve);g!=="rounded"&&(x=h6(x));let y=Ro;switch(g){case"linear":y=Ro;break;case"basis":y=Uu;break;case"cardinal":y=y1;break;case"bumpX":y=p1;break;case"bumpY":y=f1;break;case"catmullRom":y=C1;break;case"monotoneX":y=_1;break;case"monotoneY":y=j1;break;case"natural":y=E1;break;case"step":y=B1;break;case"stepAfter":y=A1;break;case"stepBefore":y=L1;break;case"rounded":y=Ro;break;default:y=Uu}const{x:C,y:b}=sO(e),w=WP().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 S,N=g==="rounded"?Mw(Iw(x,e),5):w(x);const L=Array.isArray(e.style)?e.style:[e.style];let A=L.find($=>$==null?void 0:$.startsWith("stroke:")),j="";e.animate&&(j="edge-animation-fast"),e.animation&&(j="edge-animation-"+e.animation);let I=!1;if(e.look==="handDrawn"){const $=yt.svg(t);Object.assign([],x);const B=$.path(N,{roughness:.3,seed:l});_+=" transition",S=zt(B).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(j?" "+j:"")).attr("style",L?L.reduce((V,rt)=>V+";"+rt,""):"");let T=S.attr("d");S.attr("d",T),t.node().appendChild(S.node())}else{const $=p.join(";"),B=L?L.reduce((ut,xt)=>ut+xt+";",""):"",T=($?$+";"+B+";":B)+";"+(L?L.reduce((ut,xt)=>ut+";"+xt,""):"");S=t.append("path").attr("d",N).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(j?" "+j:"")).attr("style",T),A=(O=T.match(/stroke:([^;]+)/))==null?void 0:O[1],I=e.animate===!0||!!e.animation||$.includes("animation");const V=S.node(),rt=typeof V.getTotalLength=="function"?V.getTotalLength():0,P=Bg[e.arrowTypeStart]||0,X=Bg[e.arrowTypeEnd]||0;if(e.look==="neo"&&!I){const xt=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?u6(rt,P,X):`0 ${P} ${rt-P-X} ${X}`}; stroke-dashoffset: 0;`;S.attr("style",xt+S.attr("style"))}}S.attr("data-edge",!0),S.attr("data-et","edge"),S.attr("data-id",e.id),S.attr("data-points",m),S.attr("data-look",Me(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="";(Qt().flowchart.arrowMarkerAbsolute||Qt().state.arrowMarkerAbsolute)&&(z=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,z=z.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),nt.info("arrowTypeStart",e.arrowTypeStart),nt.info("arrowTypeEnd",e.arrowTypeEnd);const W=!I&&(e==null?void 0:e.look)==="neo";r6(S,e,z,o,n,W,A);const D=Math.floor(h.length/2),M=h[D];Pr.isLabelCoordinateInPath(M,S.attr("d"))||(u=!0);let F={};return u&&(F.updatedPath=h),F.originalPath=e.points,F},"insertEdge");function Mw(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,w=Math.max(-1,Math.min(1,b)),_=Math.acos(w);if(_<i||Math.abs(Math.PI-_)<i){r+=`L${o.x},${o.y}`;continue}const S=Math.min(e/Math.sin(_/2),p/2,m/2),N=o.x-x*S,L=o.y-g*S,A=o.x+y*S,j=o.y+C*S;r+=`L${N},${L}`,r+=`Q${o.x},${o.y} ${A},${j}`}}return r}v(Mw,"generateRoundedPath");function kd(t,e){if(!t||!e)return{angle:0,deltaX:0,deltaY:0};const r=e.x-t.x,n=e.y-t.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}v(kd,"calculateDeltaAndAngle");function Iw(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&Ye[e.arrowTypeStart]){const i=Ye[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=kd(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&&Ye[e.arrowTypeEnd]){const i=Ye[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=kd(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}v(Iw,"applyMarkerOffsetsToPoints");var p6=v((t,e,r,n)=>{e.forEach(i=>{P6[i](t,r,n)})},"insertMarkers"),f6=v((t,e,r)=>{nt.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"),m6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart-margin").attr("class","marker composition "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("viewBox","0 0 15 15").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd-margin").attr("class","marker composition "+e).attr("refX",3.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),g6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart-margin").attr("class","marker aggregation "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd-margin").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),x6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart-margin").attr("class","marker dependency "+e).attr("refX",4).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd-margin").attr("class","marker dependency "+e).attr("refX",16).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),y6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart-margin").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd-margin").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2)},"lollipop"),b6=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",11.5).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",10.5).attr("markerHeight",14).attr("orient","auto").append("path").attr("d","M 0 0 L 11.5 7 L 0 14 z").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",1).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11.5).attr("markerHeight",14).attr("orient","auto").append("polygon").attr("points","0,7 11.5,14 11.5,0").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"point"),C6=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refY",5).attr("refX",12.25).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-2).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"circle"),k6=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossEnd-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",17.7).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5),t.append("marker").attr("id",r+"_"+e+"-crossStart-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",-3.5).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5).style("stroke-dasharray","1,0")},"cross"),v6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),w6=v((t,e,r)=>{const n=ye(),{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"),S6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),T6=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),_6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),j6=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),N6=v((t,e,r)=>{const n=ye(),{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"),E6=v((t,e,r)=>{const n=ye(),{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"),B6=v((t,e,r)=>{const n=ye(),{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"),L6=v((t,e,r)=>{const n=ye(),{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"),A6=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
619
|
-
L20,10
|
|
620
|
-
M20,10
|
|
621
|
-
L0,20`)},"requirement_arrow"),M6=v((t,e,r)=>{const n=ye(),{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
|
|
622
|
-
L20,10
|
|
623
|
-
M20,10
|
|
624
|
-
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),I6=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),F6=v((t,e,r)=>{const n=ye(),{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"),P6={extension:f6,composition:m6,aggregation:g6,dependency:x6,lollipop:y6,point:b6,circle:C6,cross:k6,barb:v6,barbNeo:w6,only_one:S6,zero_or_one:T6,one_or_more:_6,zero_or_more:j6,only_one_neo:N6,zero_or_one_neo:E6,one_or_more_neo:B6,zero_or_more_neo:L6,requirement_arrow:A6,requirement_contains:I6,requirement_arrow_neo:M6,requirement_contains_neo:F6},D6=p6,O6={common:ma,getConfig:ye,insertCluster:FR,insertEdge:d6,insertEdgeLabel:o6,insertMarkers:D6,insertNode:Lw,interpolateToCurve:Jp,labelHelper:Bt,log:nt,positionEdgeLabel:a6},sa={},Fw=v(t=>{for(const e of t)sa[e.name]=e},"registerLayoutLoaders"),$6=v(()=>{Fw([{name:"dagre",loader:v(async()=>await Ht(()=>import("./dagre-BM42HDAG-DJlm4fEk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Ht(()=>import("./cose-bilkent-S5V4N54A-C3M0mZqk.js"),__vite__mapDeps([8,7,3,4,5,6])),"loader")}])},"registerDefaultLayoutLoaders");$6();var BV=v(async(t,e)=>{if(!(t.layoutAlgorithm in sa))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=sa[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,O6,{algorithm:r.algorithm})},"render"),LV=v((t="",{fallback:e="dagre"}={})=>{if(t in sa)return t;if(e in sa)return nt.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"),kf="comm",Pw="rule",Dw="decl",R6="@media",z6="@import",W6="@supports",q6="@namespace",vd="@keyframes",Ow="@layer",H6="@scope",U6=Math.abs,Wo=String.fromCharCode;function $w(t){return t.trim()}function wd(t,e,r){return t.replace(e,r)}function is(t,e){return t.charCodeAt(e)|0}function Es(t,e,r){return t.slice(e,r)}function Kr(t){return t.length}function Rw(t){return t.length}function Qa(t,e){return e.push(t),t}var Gc=1,Bs=1,zw=0,Er=0,_e=0,Rs="";function vf(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:Gc,column:Bs,length:o,return:"",siblings:a}}function Y6(){return _e}function V6(){return _e=Er>0?is(Rs,--Er):0,Bs--,_e===10&&(Bs=1,Gc--),_e}function Rr(){return _e=Er<zw?is(Rs,Er++):0,Bs++,_e===10&&(Bs=1,Gc++),_e}function $n(){return is(Rs,Er)}function kl(){return Er}function Xc(t,e){return Es(Rs,t,e)}function oa(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 G6(t){return Gc=Bs=1,zw=Kr(Rs=t),Er=0,[]}function X6(t){return Rs="",t}function Jh(t){return $w(Xc(Er-1,Sd(t===91?t+2:t===40?t+1:t)))}function K6(t){for(;(_e=$n())&&_e<33;)Rr();return oa(t)>2||oa(_e)>3?"":" "}function Q6(t,e){for(;--e&&Rr()&&!(_e<48||_e>102||_e>57&&_e<65||_e>70&&_e<97););return Xc(t,kl()+(e<6&&$n()==32&&Rr()==32))}function Sd(t){for(;Rr();)switch(_e){case t:return Er;case 34:case 39:t!==34&&t!==39&&Sd(_e);break;case 40:t===41&&Sd(t);break;case 92:Rr();break}return Er}function Z6(t,e){for(;Rr()&&t+_e!==57;)if(t+_e===84&&$n()===47)break;return"/*"+Xc(e,Er-1)+"*"+Wo(t===47?t:Rr())}function J6(t){for(;!oa($n());)Rr();return Xc(t,Er)}function t8(t){return X6(vl("",null,null,null,[""],t=G6(t),0,[0],t))}function vl(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,w="",_=i,S=s,N=n,L=w;g;)switch(m=b,b=Rr()){case 40:m!=108&&is(L,d-1)==58?(C++,L+="("):L+=Jh(b);break;case 41:C--,L+=")";break;case 34:case 39:case 91:L+=Jh(b);break;case 9:case 10:case 13:case 32:if(C>0){L+=Wo(b);break}L+=K6(m);break;case 92:L+=Q6(kl()-1,7);continue;case 47:switch($n()){case 42:case 47:Qa(e8(Z6(Rr(),kl()),e,r,l),l),(oa(m||1)==5||oa($n()||1)==5)&&Kr(L)&&Es(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*x:a[h++]=Kr(L)*y;case 125*x:case 59:case 0:if(C>0&&b){L+=Wo(b);break}switch(b){case 0:case 125:g=0;case 59+u:y==-1&&(L=wd(L,/\f/g,"")),p>0&&(Kr(L)-d||x===0)&&Qa(p>32?yx(L+";",n,r,d-1,l):yx(wd(L," ","")+";",n,r,d-2,l),l);break;case 59:L+=";";default:if(Qa(N=xx(L,e,r,h,u,i,a,w,_=[],S=[],d,s),s),b===123)if(u===0)vl(L,e,N,N,_,s,d,a,S);else{switch(f){case 99:if(is(L,3)===110)break;case 108:if(is(L,2)===97)break;default:u=0;case 100:case 109:case 115:}u?vl(t,N,N,n&&Qa(xx(t,N,N,0,0,i,a,w,i,_=[],d,S),S),i,S,d,a,n?_:S):vl(L,N,N,N,[""],S,0,a,S)}}h=u=p=0,x=y=1,w=L="",d=o;break;case 58:d=1+Kr(L),p=m;default:if(x<1){if(b==123)--x;else if(b==125&&x++==0&&V6()==125)continue}switch(L+=Wo(b),b*x){case 38:y=u>0?1:(L+="\f",-1);break;case 44:if(C>0)break;a[h++]=(Kr(L)-1)*y,y=1;break;case 64:$n()===45&&(L+=Jh(Rr())),f=$n(),u=d=Kr(w=L+=J6(kl())),b++;break;case 45:m===45&&Kr(L)==2&&(x=0)}}return s}function xx(t,e,r,n,i,s,o,a,l,h,u,d){for(var f=i-1,p=i===0?s:[""],m=Rw(p),x=0,g=0,y=0;x<n;++x)for(var C=0,b=Es(t,f+1,f=U6(g=o[x])),w=t;C<m;++C)(w=$w(g>0?p[C]+" "+b:wd(b,/&\f/g,p[C])))&&(l[y++]=w);return vf(t,e,r,i===0?Pw:a,l,h,u,d)}function e8(t,e,r,n){return vf(t,e,r,kf,Wo(Y6()),Es(t,2,-2),0,n)}function yx(t,e,r,n,i){return vf(t,e,r,Dw,Es(t,0,n),Es(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 r8(t,e,r,n){switch(t.type){case Ow:if(t.children.length)break;case z6:case q6:case Dw:return t.return=t.return||t.value;case kf:return"";case vd:return t.return=t.value+"{"+Td(t.children,n)+"}";case Pw:if(!Kr(t.value=t.props.join(",")))return""}return Kr(r=Td(t.children,n))?t.return=t.value+"{"+r+"}":""}function n8(t){var e=Rw(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 Ww="c4",i8=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),s8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./c4Diagram-AAUBKEIU-BsFJmPuS.js");return{diagram:e}},__vite__mapDeps([9,10,3,4,5,6,7]));return{id:Ww,diagram:t}},"loader"),o8={id:Ww,detector:i8,loader:s8},a8=o8,qw="flowchart",l8=v((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),c8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-C0t2ZGQv.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:qw,diagram:t}},"loader"),h8={id:qw,detector:l8,loader:c8},u8=h8,Hw="flowchart-v2",d8=v((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),p8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-C0t2ZGQv.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:Hw,diagram:t}},"loader"),f8={id:Hw,detector:d8,loader:p8},m8=f8,Uw="er",g8=v(t=>/^\s*erDiagram/.test(t),"detector"),x8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./erDiagram-TEJ5UH35-AMDitV0b.js");return{diagram:e}},__vite__mapDeps([16,13,14,15,3,4,5,6,7]));return{id:Uw,diagram:t}},"loader"),y8={id:Uw,detector:g8,loader:x8},b8=y8,Yw="gitGraph",C8=v(t=>/^\s*gitGraph/.test(t),"detector"),k8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./gitGraphDiagram-PVQCEYII-Lv_YTxnb.js");return{diagram:e}},__vite__mapDeps([17,18,19,20,5,3,4,6,7]));return{id:Yw,diagram:t}},"loader"),v8={id:Yw,detector:C8,loader:k8},w8=v8,Vw="gantt",S8=v(t=>/^\s*gantt/.test(t),"detector"),T8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./ganttDiagram-6RSMTGT7-BPlM-BEN.js");return{diagram:e}},__vite__mapDeps([21,3,4,22,23,24,5,6,7]));return{id:Vw,diagram:t}},"loader"),_8={id:Vw,detector:S8,loader:T8},j8=_8,Gw="info",N8=v(t=>/^\s*info/.test(t),"detector"),E8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./infoDiagram-5YYISTIA-Dul1vdUm.js");return{diagram:e}},__vite__mapDeps([25,20,5,3,4,6,7]));return{id:Gw,diagram:t}},"loader"),B8={id:Gw,detector:N8,loader:E8},Xw="pie",L8=v(t=>/^\s*pie/.test(t),"detector"),A8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./pieDiagram-4H26LBE5-oxNfr2TX.js");return{diagram:e}},__vite__mapDeps([26,18,20,5,3,4,6,27,28,23,7]));return{id:Xw,diagram:t}},"loader"),M8={id:Xw,detector:L8,loader:A8},Kw="quadrantChart",I8=v(t=>/^\s*quadrantChart/.test(t),"detector"),F8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./quadrantDiagram-W4KKPZXB-BmZCvD-z.js");return{diagram:e}},__vite__mapDeps([29,22,23,24,3,4,5,6,7]));return{id:Kw,diagram:t}},"loader"),P8={id:Kw,detector:I8,loader:F8},D8=P8,Qw="xychart",O8=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),$8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./xychartDiagram-2RQKCTM6-BCShes6B.js");return{diagram:e}},__vite__mapDeps([30,23,28,22,24,3,4,5,6,7]));return{id:Qw,diagram:t}},"loader"),R8={id:Qw,detector:O8,loader:$8},z8=R8,Zw="requirement",W8=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),q8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./requirementDiagram-4Y6WPE33-DsXZ05jo.js");return{diagram:e}},__vite__mapDeps([31,13,14,3,4,5,6,7]));return{id:Zw,diagram:t}},"loader"),H8={id:Zw,detector:W8,loader:q8},U8=H8,Jw="sequence",Y8=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),V8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./sequenceDiagram-3UESZ5HK-Dt5mu3g8.js");return{diagram:e}},__vite__mapDeps([32,10,19,3,4,5,6,7]));return{id:Jw,diagram:t}},"loader"),G8={id:Jw,detector:Y8,loader:V8},X8=G8,t2="class",K8=v((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),Q8=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./classDiagram-4FO5ZUOK-KXxOorUx.js");return{diagram:e}},__vite__mapDeps([33,34,12,10,13,14,3,4,5,6,7]));return{id:t2,diagram:t}},"loader"),Z8={id:t2,detector:K8,loader:Q8},J8=Z8,e2="classDiagram",tz=v((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),ez=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./classDiagram-v2-Q7XG4LA2-KXxOorUx.js");return{diagram:e}},__vite__mapDeps([35,34,12,10,13,14,3,4,5,6,7]));return{id:e2,diagram:t}},"loader"),rz={id:e2,detector:tz,loader:ez},nz=rz,r2="state",iz=v((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),sz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./stateDiagram-AJRCARHV-BFR5ZINQ.js");return{diagram:e}},__vite__mapDeps([36,37,13,14,1,2,3,4,5,6,7]));return{id:r2,diagram:t}},"loader"),oz={id:r2,detector:iz,loader:sz},az=oz,n2="stateDiagram",lz=v((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),cz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./stateDiagram-v2-BHNVJYJU-BDrQD8fR.js");return{diagram:e}},__vite__mapDeps([38,37,13,14,3,4,5,6,7]));return{id:n2,diagram:t}},"loader"),hz={id:n2,detector:lz,loader:cz},uz=hz,i2="journey",dz=v(t=>/^\s*journey/.test(t),"detector"),pz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./journeyDiagram-JHISSGLW-zUJN38EU.js");return{diagram:e}},__vite__mapDeps([39,12,10,27,3,4,5,6,7]));return{id:i2,diagram:t}},"loader"),fz={id:i2,detector:dz,loader:pz},mz=fz,gz=v((t,e,r)=>{nt.debug(`rendering svg for syntax error
|
|
625
|
-
`);const n=QP(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),Pb(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"),s2={draw:gz},xz=s2,yz={db:{},renderer:s2,parser:{parse:v(()=>{},"parse")}},bz=yz,o2="flowchart-elk",Cz=v((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),kz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-C0t2ZGQv.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:o2,diagram:t}},"loader"),vz={id:o2,detector:Cz,loader:kz},wz=vz,a2="timeline",Sz=v(t=>/^\s*timeline/.test(t),"detector"),Tz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./timeline-definition-PNZ67QCA-Bvnhw58e.js");return{diagram:e}},__vite__mapDeps([40,27,3,4,5,6,7]));return{id:a2,diagram:t}},"loader"),_z={id:a2,detector:Sz,loader:Tz},jz=_z,l2="mindmap",Nz=v(t=>/^\s*mindmap/.test(t),"detector"),Ez=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./mindmap-definition-RKZ34NQL-DolYwq7Y.js");return{diagram:e}},__vite__mapDeps([41,13,14,3,4,5,6,7]));return{id:l2,diagram:t}},"loader"),Bz={id:l2,detector:Nz,loader:Ez},Lz=Bz,c2="kanban",Az=v(t=>/^\s*kanban/.test(t),"detector"),Mz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./kanban-definition-UN3LZRKU-BNxWi-8J.js");return{diagram:e}},__vite__mapDeps([42,12,3,4,5,6,7]));return{id:c2,diagram:t}},"loader"),Iz={id:c2,detector:Az,loader:Mz},Fz=Iz,h2="sankey",Pz=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),Dz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./sankeyDiagram-5OEKKPKP-DsnYaawP.js");return{diagram:e}},__vite__mapDeps([43,28,23,3,4,5,6,7]));return{id:h2,diagram:t}},"loader"),Oz={id:h2,detector:Pz,loader:Dz},$z=Oz,u2="packet",Rz=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),zz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-LMA3HP47-Bmh7tvmI.js");return{diagram:e}},__vite__mapDeps([44,18,20,5,3,4,6,7]));return{id:u2,diagram:t}},"loader"),Wz={id:u2,detector:Rz,loader:zz},d2="radar",qz=v(t=>/^\s*radar-beta/.test(t),"detector"),Hz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-2AECGRRQ-BmcONQG5.js");return{diagram:e}},__vite__mapDeps([45,18,20,5,3,4,6,7]));return{id:d2,diagram:t}},"loader"),Uz={id:d2,detector:qz,loader:Hz},p2="block",Yz=v(t=>/^\s*block(-beta)?/.test(t),"detector"),Vz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./blockDiagram-GPEHLZMM-BilnUBG2.js");return{diagram:e}},__vite__mapDeps([46,12,1,15,3,4,5,6,7]));return{id:p2,diagram:t}},"loader"),Gz={id:p2,detector:Yz,loader:Vz},Xz=Gz,f2="treeView",Kz=v(t=>/^\s*treeView-beta/.test(t),"detector"),Qz=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-5GNKFQAL-5JbWGIwd.js");return{diagram:e}},__vite__mapDeps([47,18,19,20,5,3,4,6,7]));return{id:f2,diagram:t}},"loader"),Zz={id:f2,detector:Kz,loader:Qz},Jz=Zz,m2="architecture",t9=v(t=>/^\s*architecture/.test(t),"detector"),e9=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./architectureDiagram-3BPJPVTR-C5Nkyl9y.js");return{diagram:e}},__vite__mapDeps([48,18,20,5,3,4,6,7]));return{id:m2,diagram:t}},"loader"),r9={id:m2,detector:t9,loader:e9},n9=r9,g2="eventmodeling",i9=v(t=>/^\s*eventmodeling/.test(t),"detector"),s9=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-KO2AKTUF-DAnIvyI0.js");return{diagram:e}},__vite__mapDeps([49,18,20,5,3,4,6,7]));return{id:g2,diagram:t}},"loader"),o9={id:g2,detector:i9,loader:s9},a9=o9,x2="ishikawa",l9=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),c9=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./ishikawaDiagram-YF4QCWOH-CCBwgjFs.js");return{diagram:e}},__vite__mapDeps([50,3,4,5,6,7]));return{id:x2,diagram:t}},"loader"),h9={id:x2,detector:l9,loader:c9},y2="venn",u9=v(t=>/^\s*venn-beta/.test(t),"detector"),d9=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./vennDiagram-CIIHVFJN-5WnyjZqf.js");return{diagram:e}},__vite__mapDeps([51,3,4,5,6,7]));return{id:y2,diagram:t}},"loader"),p9={id:y2,detector:u9,loader:d9},f9=p9,b2="treemap",m9=v(t=>/^\s*treemap/.test(t),"detector"),g9=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-OG6HWLK6-hnHVMNnk.js");return{diagram:e}},__vite__mapDeps([52,14,18,20,5,3,4,6,24,28,23,7]));return{id:b2,diagram:t}},"loader"),x9={id:b2,detector:m9,loader:g9},C2="wardley-beta",y9=v(t=>/^\s*wardley-beta/i.test(t),"detector"),b9=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./wardleyDiagram-YWT4CUSO-K8Y1EOvb.js");return{diagram:e}},__vite__mapDeps([53,18,20,5,3,4,6,7]));return{id:C2,diagram:t}},"loader"),C9={id:C2,detector:y9,loader:b9},k9=C9,bx=!1,Kc=v(()=>{bx||(bx=!0,Wl("error",bz,t=>t.toLowerCase().trim()==="error"),Wl("---",{db:{clear:v(()=>{},"clear")},styles:{},renderer:{draw:v(()=>{},"draw")},parser:{parse:v(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:v(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),Bu(wz,Lz,n9),Bu(a8,Fz,nz,J8,b8,j8,B8,M8,U8,X8,m8,u8,jz,w8,uz,az,mz,D8,$z,Wz,z8,Xz,a9,Jz,Uz,h9,x9,f9,k9))},"addDiagrams"),v9=v(async()=>{nt.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(Ci).map(async([r,{detector:n,loader:i}])=>{if(i)try{Fu(r)}catch{try{const{diagram:s,id:o}=await i();Wl(o,s,n)}catch(s){throw nt.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Ci[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){nt.error(`Failed to load ${e.length} external diagrams`);for(const r of e)nt.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),w9="graphics-document document";function k2(t,e){t.attr("role",w9),e!==""&&t.attr("aria-roledescription",e)}v(k2,"setA11yDiagramInfo");function v2(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}v(v2,"addSVGa11yTitleDescription");var gi,_d=(gi=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=ye(),i=wp(e,n);e=e$(e)+`
|
|
626
|
-
`;try{Fu(i)}catch{const d=xM(i);if(!d)throw new kb(`Diagram ${i} not found.`);const{id:f,diagram:p}=await d();Wl(f,p)}const{db:s,parser:o,renderer:a,init:l}=Fu(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 gi(i,e,s,o,a)}async render(e,r){await this.renderer.draw(this.text,e,r,this)}getParser(){return this.parser}getType(){return this.type}},v(gi,"Diagram"),gi),Cx=[],S9=v(()=>{Cx.forEach(t=>{t()}),Cx=[]},"attachFunctions"),T9=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function w2(t){const e=t.match(Cb);if(!e)return{text:t,metadata:{}};let r=iO(e[1],{schema:nO})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:t.slice(e[0].length),metadata:n}}v(w2,"extractFrontMatter");var _9=v(t=>t.replace(/\r\n?/g,`
|
|
627
|
-
`).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),j9=v(t=>{const{text:e,metadata:r}=w2(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"),N9=v(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:WO(t),directive:e}},"processDirectives");function wf(t){const e=_9(t),r=j9(e),n=N9(r.text),i=sf(r.config,n.directive);return t=T9(n.text),{code:t,title:r.title,config:i}}v(wf,"preprocessDiagram");function S2(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(S2,"toBase64");var E9=5e4,B9="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",L9="sandbox",A9="loose",M9="http://www.w3.org/2000/svg",I9="http://www.w3.org/1999/xlink",F9="http://www.w3.org/1999/xhtml",P9="100%",D9="100%",O9="border:0;margin:0;",$9="margin:0",R9="allow-top-navigation-by-user-activation allow-popups",z9='The "iframe" tag is not supported by your browser.',W9=["foreignobject"],q9=["dominant-baseline"];function Sf(t){const e=wf(t);return Rl(),HM(e.config??{}),e}v(Sf,"processAndSetConfigs");async function T2(t,e){Kc();try{const{code:r,config:n}=Sf(t);return{diagramType:(await j2(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(T2,"parse");var kx=v((t,e,r=[])=>{const n=_b(`{ ${r.join(" !important; ")} !important; }`);return`.${t} ${e} ${n}`},"cssImportantStyles"),H9=v((t,e=new Map)=>{const r=new CSSStyleSheet;if(t.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${t.fontFamily}}`,r.cssRules.length),t.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${t.altFontFamily}}`,r.cssRules.length),e instanceof Map){const a=sr(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(l=>{Fg(l.styles)||a.forEach(h=>{r.insertRule(kx(l.id,h,l.styles),r.cssRules.length)}),Fg(l.textStyles)||r.insertRule(kx(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=Iu(i)+`
|
|
628
|
-
`}else n+=`${t.themeCSS}
|
|
629
|
-
`;return n+Iu(r)},"createCssStyles"),U9=v((t,e)=>Td(t8(`${t}{${e}}`),n8([v(function(n,i,s,o){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===vd)return;n.props=n.props.map(a=>a.startsWith(t)?a:`${t} ${a}`)}else n.type.startsWith("@")&&([...[R6,W6,Ow,H6,"@container","@starting-style"],vd].includes(n.type)||(nt.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=kf))},"addNamespace"),r8])),"compileCSS"),Y9=v((t,e,r,n)=>{const i=H9(t,r),s=cI(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return U9(n,s)},"createUserStyles"),V9=v((t="",e,r)=>{let n=t;return!r&&!e&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=Si(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),G9=v((t="",e)=>{var i,s;const r=(s=(i=e==null?void 0:e.viewBox)==null?void 0:i.baseVal)!=null&&s.height?e.viewBox.baseVal.height+"px":D9,n=S2(`<body style="${$9}">${t}</body>`);return`<iframe style="width:${P9};height:${r};${O9}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${R9}">
|
|
630
|
-
${z9}
|
|
631
|
-
</iframe>`},"putIntoIFrame"),vx=v((t,e,r,n,i)=>{const s=t.append("div");s.attr("id",r),n&&s.attr("style",n);const o=s.append("svg").attr("id",e).attr("width","100%").attr("xmlns",M9);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function jd(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(jd,"sandboxedIframe");var X9=v((t,e,r,n)=>{var i,s,o;(i=t.getElementById(e))==null||i.remove(),(s=t.getElementById(r))==null||s.remove(),(o=t.getElementById(n))==null||o.remove()},"removeExistingElements"),K9=v(async function(t,e,r){var z,W,D,M,F,O;Kc();const n=Sf(e);e=n.code;const i=ye();nt.debug(i),e.length>((i==null?void 0:i.maxTextSize)??E9)&&(e=B9);const s=`#${t}`,o="i"+t,a="#"+o,l="d"+t,h="#"+l,u=v(()=>{const B=zt(f?a:h).node();B&&"remove"in B&&B.remove()},"removeTempElements");let d=zt(document.body);const f=i.securityLevel===L9,p=i.securityLevel===A9,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const $=jd(zt(r),o);d=zt($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=zt(r);vx(d,t,l,`font-family: ${m}`,I9)}else{if(X9(document,t,l,o),f){const $=jd(zt(document.body),o);d=zt($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=zt("body");vx(d,t,l)}let x,g;try{x=await _d.fromText(e,{title:n.title})}catch($){if(i.suppressErrorRendering)throw u(),$;x=await _d.fromText("error"),g=$}const y=d.select(h).node(),C=x.type,b=y.firstChild,w=b.firstChild,_=(W=(z=x.renderer).getClasses)==null?void 0:W.call(z,e,x),S=Y9(i,C,_,s),N=document.createElement("style");N.innerHTML=S,b.insertBefore(N,w);try{await x.renderer.draw(e,t,"11.15.0",x)}catch($){throw i.suppressErrorRendering?u():xz.draw(e,t,"11.15.0"),$}const L=d.select(`${h} svg`),A=(M=(D=x.db).getAccTitle)==null?void 0:M.call(D),j=(O=(F=x.db).getAccDescription)==null?void 0:O.call(F);N2(C,L,A,j),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",F9);let I=d.select(h).node().innerHTML;if(nt.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),I=V9(I,f,kn(i.arrowMarkerAbsolute)),f){const $=d.select(h+" svg").node();I=G9(I,$)}else p||(I=ws.sanitize(I,{ADD_TAGS:W9,ADD_ATTR:q9,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(S9(),g)throw g;return u(),{diagramType:C,svg:I,bindFunctions:x.db.bindFunctions}},"render");function _2(t={}){var n;const e=Be({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),WM(e),e!=null&&e.theme&&e.theme in fn?e.themeVariables=fn[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=fn.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?zM(e):jb();vp(r.logLevel),Kc()}v(_2,"initialize");var j2=v((t,e={})=>{const{code:r}=wf(t);return _d.fromText(r,e)},"getDiagramFromText");function N2(t,e,r,n){k2(e,t),v2(e,r,n,e.attr("id"))}v(N2,"addA11yInfo");var _i=Object.freeze({render:K9,parse:T2,getDiagramFromText:j2,initialize:_2,getConfig:ye,setConfig:Nb,getSiteConfig:jb,updateSiteConfig:qM,reset:v(()=>{Rl()},"reset"),globalReset:v(()=>{Rl(Ss)},"globalReset"),defaultConfig:Ss});vp(ye().logLevel);Rl(ye());var Q9=v((t,e,r)=>{nt.warn(t),nf(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"),E2=v(async function(t={querySelector:".mermaid"}){try{await Z9(t)}catch(e){if(nf(e)&&nt.error(e.str),wr.parseError&&wr.parseError(e),!t.suppressErrors)throw nt.error("Use the suppressErrors option to suppress these errors"),e}},"run"),Z9=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=_i.getConfig();nt.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");nt.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(nt.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),_i.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(nt.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const h=`mermaid-${s.next()}`;o=l.innerHTML,o=qk(Pr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Pr.detectInit(o);u&&nt.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:f}=await M2(h,o,l);l.innerHTML=d,t&&await t(h),f&&f(l)}catch(d){Q9(d,a,wr.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),B2=v(function(t){_i.initialize(t)},"initialize"),J9=v(async function(t,e,r){nt.warn("mermaid.init is deprecated. Please use run instead."),t&&B2(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await E2(n)},"init"),t7=v(async(t,{lazyLoad:e=!0}={})=>{Kc(),Bu(...t),e===!1&&await v9()},"registerExternalDiagrams"),L2=v(function(){if(wr.startOnLoad){const{startOnLoad:t}=_i.getConfig();t&&wr.run().catch(e=>nt.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",L2,!1);var e7=v(function(t){wr.parseError=t},"setParseErrorHandler"),fc=[],tu=!1,A2=v(async()=>{if(!tu){for(tu=!0;fc.length>0;){const t=fc.shift();if(t)try{await t()}catch(e){nt.error("Error executing queue",e)}}tu=!1}},"executeQueue"),r7=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{_i.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;nt.error("Error parsing",a),(l=wr.parseError)==null||l.call(wr,a),o(a),n(a)})}),"performCall");fc.push(i),A2().catch(n)}),"parse"),M2=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{_i.render(t,e,r).then(l=>{o(l),n(l)},l=>{var h;nt.error("Error parsing",l),(h=wr.parseError)==null||h.call(wr,l),a(l),i(l)})}),"performCall");fc.push(s),A2().catch(i)}),"render"),n7=v(()=>Object.keys(Ci).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),wr={startOnLoad:!0,mermaidAPI:_i,parse:r7,render:M2,init:J9,run:E2,registerExternalDiagrams:t7,registerLayoutLoaders:Fw,initialize:B2,parseError:void 0,contentLoaded:L2,setParseErrorHandler:e7,detectType:wp,registerIconPacks:lR,getRegisteredDiagramsMetadata:n7},I2=wr;/*! Check if previously processed *//*!
|
|
632
|
-
* Wait for document loaded before starting the execution
|
|
633
|
-
*/I2.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function i7({code:t}){const e=k.useRef(null),r=k.useId(),[n,i]=k.useState(null),[s,o]=k.useState(null);return k.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}
|
|
634
|
-
|
|
635
|
-
${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 s7({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?c.jsx(i7,{code:String(e).trim()}):c.jsx("code",{className:t,...r,children:e})}const o7=`prose prose-sm prose-invert max-w-none
|
|
636
|
-
prose-headings:text-foreground prose-p:text-muted-foreground
|
|
637
|
-
prose-a:text-accent prose-strong:text-foreground
|
|
638
|
-
prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
|
|
639
|
-
prose-pre:bg-muted prose-pre:border prose-pre:border-border
|
|
640
|
-
prose-li:text-muted-foreground prose-table:text-xs
|
|
641
|
-
prose-th:text-foreground prose-td:text-muted-foreground
|
|
642
|
-
prose-hr:border-border`;function Qc({content:t,className:e}){return c.jsx("article",{className:st(o7,e),children:c.jsx(up,{remarkPlugins:[mp],components:{code:s7},children:t||""})})}function a7(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 F2(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=F2(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function P2(t){let e=t.files.length;for(const r of t.children.values())e+=P2(r);return e}function D2({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=l7(t,e),h=r.has(l)||!!a,u=P2(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(pT,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):c.jsx(Yd,{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(D2,{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(O2,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function O2({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(ji,{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 l7(t,e){return`dir-${e}-${t.name}`}function $2({items:t,selectedFile:e,onSelectedFileChange:r,previousView:n,onBack:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,h]=k.useState([]),[u,d]=k.useState(!0),[f,p]=k.useState(null),m=e||f,x=K=>{p(K),r&&r(K)},[g,y]=k.useState(null),[C,b]=k.useState(!1),[w,_]=k.useState(!1),[S,N]=k.useState(""),[L,A]=k.useState(null),[j,I]=k.useState(!1),z=k.useRef(null),[W,D]=k.useState(""),[M,F]=k.useState(()=>new Set(["dir-0-docs"])),[O,$]=k.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),B=k.useRef(!1),T=k.useRef(null),V=k.useCallback(K=>{K.preventDefault(),B.current=!0;const it=gt=>{if(!B.current||!T.current)return;const Jt=T.current.getBoundingClientRect(),It=Math.min(Math.max(gt.clientX-Jt.left,160),500);$(It)},wt=()=>{B.current=!1,document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",wt),$(gt=>(localStorage.setItem("compose:docsTreeWidth",gt),gt))};document.addEventListener("mousemove",it),document.addEventListener("mouseup",wt)},[]),rt=w&&S!==L,P=k.useCallback(async()=>{if(!(!m||j)){I(!0);try{const K=await jt("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:S})});K.ok?(A(S),y(S),se("Saved","info")):se(`Save failed (${K.status})`,"error")}catch(K){se(`Save failed: ${K.message}`,"error")}I(!1)}},[m,S,j]),X=k.useCallback(()=>{_(K=>(!K&&g!==null&&(N(g),A(g)),!K))},[g]);k.useEffect(()=>{if(!w)return;const K=it=>{(it.metaKey||it.ctrlKey)&&it.key==="s"&&(it.preventDefault(),P())};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[w,P]),k.useEffect(()=>{_(!1),N(""),A(null)},[m]),k.useEffect(()=>{jt("/api/files").then(K=>K.json()).then(K=>{h(K.files||[]),d(!1);const it=new Set(["dir-0-docs"]);for(const wt of K.files||[]){const gt=wt.split("/");gt.length>1&&it.add(`dir-1-${gt[1]}`)}F(it)}).catch(()=>d(!1))},[]),k.useEffect(()=>{if(!m){y(null);return}b(!0),jt(`/api/file?path=${encodeURIComponent(m)}`).then(K=>K.json()).then(K=>{y(K.content??null),b(!1)}).catch(()=>{y(null),b(!1)})},[m]);const ut=k.useMemo(()=>!o||!s?l:l.filter(K=>K.includes(`features/${s}/`)),[l,o,s]),xt=k.useMemo(()=>{const K=new Set,it=wt=>wt.split("/").pop();for(const wt of t){const gt=`${wt.title||""} ${wt.description||""} ${wt.planLink||""}`.toLowerCase();for(const Jt of ut)(gt.includes(Jt.toLowerCase())||gt.includes(it(Jt).replace(".md","").toLowerCase()))&&K.add(Jt)}return K},[t,ut]),Dt=k.useMemo(()=>a7(ut),[ut]),Wt=k.useMemo(()=>F2(Dt,W),[Dt,W]),lt=k.useCallback(K=>{F(it=>{const wt=new Set(it);return wt.has(K)?wt.delete(K):wt.add(K),wt})},[]);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:`${O}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(pa,{featureCode:s,active:o,onToggle:a})}),c.jsxs("div",{className:"relative",children:[c.jsx(bn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(Od,{placeholder:"Search files...",value:W,onChange:K=>D(K.target.value),className:"h-7 pl-7 pr-7 text-xs"}),W&&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(tn,{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-xt.size," untracked"]})]})]}),c.jsx(Hn,{className:"flex-1",children:c.jsxs("div",{className:"py-1",children:[[...Wt.children.values()].sort((K,it)=>K.name.localeCompare(it.name)).map(K=>c.jsx(D2,{node:K,depth:0,expandedDirs:M,onToggleDir:lt,selectedFile:m,onSelectFile:x,trackedPaths:xt,searchQuery:W},K.name)),Wt.files.sort((K,it)=>K.name.localeCompare(it.name)).map(K=>c.jsx(O2,{file:K,depth:0,isSelected:m===K.path,isTracked:xt.has(K.path),onSelect:()=>x(K.path)},K.path))]})})]}),c.jsx("div",{onMouseDown:V,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(WS,{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}),rt&&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"}),xt.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"}),w&&c.jsxs("button",{onClick:P,disabled:j||!rt,className:st("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",rt?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[c.jsx(HT,{className:"h-3 w-3"}),j?"Saving...":"Save"]}),c.jsx("button",{onClick:X,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:w?"Preview":"Edit",disabled:g===null,children:w?c.jsx(_0,{className:"h-3.5 w-3.5"}):c.jsx(N0,{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&&w?c.jsx("textarea",{ref:z,value:S,onChange:K=>N(K.target.value),className:"flex-1 w-full resize-none border-0 outline-none px-4 py-3 text-sm",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',background:"hsl(var(--background))",color:"hsl(var(--foreground))",tabSize:2},spellCheck:!1}):g!==null?c.jsx(Hn,{className:"flex-1",children:c.jsx("div",{className:"px-6 py-4 max-w-3xl",children:c.jsx(Qc,{content: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(ji,{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 c7{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 w=p[C-1],_=p[C+1];w&&(p[C-1]=void 0);let S=!1;if(_){const L=_.oldPos-C;S=_&&0<=L&&L<a}const N=w&&w.oldPos+1<l;if(!S&&!N){p[C]=void 0;continue}if(!N||S&&w.oldPos<_.oldPos?b=this.addToPath(_,!0,!1,0,n):b=this.addToPath(w,!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 h7 extends c7{constructor(){super(...arguments),this.tokenize=p7}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
643
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
|
|
644
|
-
`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
645
|
-
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
|
646
|
-
`)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const u7=new h7;function d7(t,e,r){return u7.diff(t,e,r)}function p7(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
|
647
|
-
`));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 Tf({oldText:t,newText:e}){const[r,n]=k.useState(!1),{parts:i,addCount:s,removeCount:o}=k.useMemo(()=>{if(!t||!e)return{parts:[],addCount:0,removeCount:0};const a=d7(t,e);let l=0,h=0;for(const u of a){const d=u.value.split(`
|
|
648
|
-
`).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(`
|
|
649
|
-
`);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 R2(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 f7({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=A0[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 m7(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 g7({gate:t}){const e=m7(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 wx({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 x7({gate:t,item:e,priorRevision:r,isExpanded:n,expandedAction:i,onExpand:s,onResolve:o,onSelect:a}){const[l,h]=k.useState(""),[u,d]=k.useState(!1),f=()=>{o(t.id,"revised",l||void 0),s(null,null),h("")},p=()=>{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:gn[t.stepId]??`${ke[t.fromPhase]??t.fromPhase} → ${ke[t.toPhase]??t.toPhase}`}),c.jsx(f7,{gate:t}),t.artifactSnapshot?c.jsxs("div",{className:"space-y-1",children:[c.jsxs("button",{onClick:()=>d(m=>!m),className:"flex items-center gap-1 text-[10px] text-accent hover:underline","data-testid":"gate-artifact-toggle",children:[u?c.jsx(Ms,{className:"h-3 w-3"}):c.jsx(xi,{className:"h-3 w-3"}),u?"Hide artifact":"View artifact"]}),u&&c.jsx("div",{className:"px-2 py-2 rounded bg-muted/40 border border-border max-h-96 overflow-auto","data-testid":"gate-artifact-body",children:c.jsx(Qc,{content:t.artifactSnapshot})})]}):null,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(Tf,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:R2(t.createdAt)})]}),c.jsx("div",{className:"mt-1.5",children:c.jsx(g7,{gate:t})}),c.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[c.jsx(Pt,{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(Pt,{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(Pt,{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:m=>h(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(i==="revise"?f():i==="kill"&&p()),m.key==="Escape"&&s(null,null)},autoFocus:!0}),c.jsx(Pt,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:i==="kill"&&!l.trim(),onClick:i==="revise"?f:p,children:i==="revise"?"Submit":"Confirm Kill"})]})]})}function y7(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function b7({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=y7(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(mr,{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:R2(t.resolvedAt)})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:gn[t.stepId]??`${ke[t.fromPhase]??t.fromPhase} → ${ke[t.toPhase]??t.toPhase}`}),t.comment&&c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function z2({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o,focusedGateId:a,onFocusHandled:l}){const[h,u]=k.useState(null),[d,f]=k.useState(null),p=k.useRef(new Map),[m,x]=k.useState(null),g=k.useMemo(()=>{if(!s||!i)return t;const L=new Set(e.filter(A=>{var j;return A.featureCode===i||((j=A.lifecycle)==null?void 0:j.featureCode)===i}).map(A=>A.id));return t.filter(A=>L.has(A.itemId))},[t,e,s,i]),y=(L,A)=>{u(L),f(A)},{pending:C,resolved:b,priorRevisions:w}=k.useMemo(()=>{const L=[],A=[];for(const I of g)I.status==="pending"?L.push(I):I.resolvedAt&&A.push(I);L.sort((I,z)=>new Date(I.createdAt)-new Date(z.createdAt)),A.sort((I,z)=>new Date(z.resolvedAt)-new Date(I.resolvedAt));const j=new Map;for(const I of L){const z=A.find(W=>W.stepId===I.stepId&&W.itemId===I.itemId&&(W.outcome==="revised"||W.outcome==="revise")&&W.comment);z&&j.set(I.id,{comment:z.comment,priorSnapshot:z.artifactSnapshot||null,currentSnapshot:I.artifactSnapshot||null})}return{pending:L,resolved:A,priorRevisions:j}},[g]),[_,S]=k.useState(!1),N=k.useMemo(()=>new Map(e.map(L=>[L.id,L])),[e]);return k.useEffect(()=>{var j;if(!a)return;const L=p.current.get(a);if(!L)return;(j=L.scrollIntoView)==null||j.call(L,{behavior:"smooth",block:"center"}),x(a),l==null||l();const A=setTimeout(()=>x(null),1600);return()=>clearTimeout(A)},[a,C,b,l]),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(pa,{featureCode:i,active:s,onToggle:o}),c.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),C.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:[C.length," pending"]}):c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),b.length>0&&c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",b.length," resolved"]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[C.length>0&&c.jsx(wx,{title:"Pending",count:C.length,color:"#f59e0b",children:C.map(L=>c.jsx("div",{ref:A=>{A?p.current.set(L.id,A):p.current.delete(L.id)},className:st("transition-colors duration-500",m===L.id&&"bg-amber-400/15 ring-1 ring-amber-400/40 rounded"),children:c.jsx(x7,{gate:L,item:N.get(L.itemId),priorRevision:w.get(L.id),isExpanded:h===L.id,expandedAction:h===L.id?d:null,onExpand:y,onResolve:r,onSelect:n})},L.id))}),b.length>0&&c.jsxs(wx,{title:"History",count:b.length,color:"#22c55e",children:[(_?b.slice(0,50):b.slice(0,10)).map(L=>c.jsx("div",{ref:A=>{A?p.current.set(L.id,A):p.current.delete(L.id)},className:st("transition-colors duration-500",m===L.id&&"bg-amber-400/15 ring-1 ring-amber-400/40 rounded"),children:c.jsx(b7,{gate:L,item:N.get(L.itemId)})},L.id)),b.length>10&&!_&&c.jsxs("button",{className:"w-full px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>S(!0),children:["Show all ",b.length," resolved gates"]})]}),C.length===0&&b.length===0&&c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function W2({event:t,items:e,onNavigate:r}){const[n,i]=k.useState(!1),[s,o]=k.useState(null);if(k.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: ${Yo(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 C7({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=k.useContext(Nc),i=r.has(t.id)?"vision-entering":n.has(t.id)?"vision-updated":"",[s,o]=k.useState(!1),[a,l]=k.useState(""),h=t.status==="complete"||t.status==="killed",{baseDesc:u,resolution:d}=k.useMemo(()=>{if(!t.description)return{baseDesc:"",resolution:""};const x=`
|
|
650
|
-
|
|
651
|
-
---
|
|
652
|
-
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=k.useCallback(async()=>{const g=`Be brief. Summarize, give your recommendation, refine the decision wording based on the resolution if needed: ${t.description||t.title}
|
|
653
|
-
`;try{const y=await jt(jS("/api/terminal/inject"),{method:"POST",headers:Dr({"Content-Type":"application/json"}),body:JSON.stringify({text:g})});if(!y.ok){se(`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),se(`Could not send to terminal: ${y.message}`,"error")}},[t]),p=k.useCallback(()=>{const x=a.trim()?`${t.description||""}
|
|
654
|
-
|
|
655
|
-
---
|
|
656
|
-
Resolution: ${a.trim()}`:t.description;e(t.id,{status:"complete",description:x}),o(!1),l("")},[t.id,t.description,a,e]),m=k.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))":gr.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(Pt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:p,children:c.jsx(Vd,{className:"h-3 w-3"})}),c.jsx(Pt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:c.jsx(tn,{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(kc,{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(ca,{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(sT,{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 q2({item:t,items:e,connections:r,onUpdate:n,onClose:i}){const[s,o]=k.useState(null),[a,l]=k.useState(null),[h,u]=k.useState(""),d=k.useRef(null),f=k.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;k.useEffect(()=>{if(!(!s||a!=="running"))return d.current=setInterval(async()=>{try{const x=await jt(`/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=k.useCallback(async()=>{if(a==="running")return;const x=t.description?`
|
|
657
|
-
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(`
|
|
658
|
-
`);l("running");try{const y=await jt("/api/agent/spawn",{method:"POST",headers:Dr({"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"),se(`Could not start challenge agent (${y.status})`,"error");return}const C=await y.json();o(C.agentId)}catch(y){l("failed"),u(y.message),se(`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(jl,{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(Pt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:c.jsx(tn,{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(Sl,{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(C7,{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(Pt,{size:"sm",className:st("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[c.jsx(jl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const k7=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],v7=["gate","flag","skip"],w7=["light","dark","system"],Sx=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function yo({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 qi({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 S7({value:t,className:e,onCommit:r}){const[n,i]=k.useState(t||"");return k.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 H2({settings:t,onSettingsChange:e,onReset:r}){var p,m,x,g,y,C;const n=x0();if(!t)return c.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."});const i=k.useCallback((b,w)=>{const _=w==="null"?null:w;e({policies:{[b]:_}})},[e]),s=k.useCallback((b,w)=>{const _=parseInt(w,10);_>=1&&_<=100&&e({iterations:{[b]:{maxIterations:_}}})},[e]),o=k.useCallback((b,w)=>{w.trim()&&e({models:{[b]:w.trim()}})},[e]),a=k.useCallback(b=>{if(e({ui:{theme:b}}),b==="system"){const w=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",w),localStorage.removeItem("compose:theme")}else document.documentElement.classList.toggle("dark",b==="dark"),localStorage.setItem("compose:theme",b)},[e]),l=k.useCallback(b=>{e({ui:{defaultView:b}})},[e]),h=k.useCallback(b=>{e({capabilities:{enforcement:b}})},[e]),u=k.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(yo,{title:"Phase Policies",children:k7.map(b=>c.jsx(qi,{label:ke[b]||b,children:c.jsxs("select",{className:d,value:t.policies[b]===null?"null":t.policies[b]||"skip",onChange:w=>i(b,w.target.value),children:[b==="explore_design"&&c.jsx("option",{value:"null",children:"—"}),v7.map(w=>c.jsx("option",{value:w,children:w},w))]})},b))}),c.jsxs(yo,{title:"Iteration Limits",children:[c.jsx(qi,{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(qi,{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(yo,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var w;return c.jsx(qi,{label:b,children:c.jsx(S7,{className:f+" w-48",value:((w=t.models)==null?void 0:w[b])||"",onCommit:_=>o(b,_)},b)},b)})}),c.jsxs(yo,{title:"Appearance",children:[c.jsx(qi,{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:w7.map(b=>c.jsx("option",{value:b,children:b},b))})}),c.jsx(qi,{label:"Default view",children:c.jsx("select",{className:d,value:Sx.includes((C=t.ui)==null?void 0:C.defaultView)?t.ui.defaultView:"graph",onChange:b=>l(b.target.value),children:Sx.map(b=>c.jsx("option",{value:b,children:b},b))})})]}),c.jsx(yo,{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:w})=>{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:w})]},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 T7(){const[t,e]=k.useState([]),[r,n]=k.useState(!0),[i,s]=k.useState(null);k.useEffect(()=>{jt("/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 jt("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})});l.ok||se(`Could not create draft (${l.status})`,"error")}catch(l){console.error("[TemplateSelector] Failed to create draft:",l),se(`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(Sl,{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",m_[a.category]||"border-border bg-card"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ji,{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(vT,{className:"w-3 h-3"})," ",a.steps," steps"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(T0,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),c.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function U2({activeBuild:t,pipelineDraft:e,onSelectStep:r,onRefresh:n}){const[i,s]=k.useState(null),[o,a]=k.useState(!1),[l,h]=k.useState(!1),u=C=>{const b=i===C?null:C;s(b),r&&r(b)},d=()=>{n&&n()},f=async()=>{if(e!=null&&e.draftId){a(!0);try{const C=await jt("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});C.ok?se("Draft approved","info"):se(`Approve failed (${C.status})`,"error")}catch(C){console.error("[PipelineView] Approve failed:",C),se(`Approve failed: ${C.message}`,"error")}a(!1)}},p=async()=>{if(e!=null&&e.draftId){h(!0);try{const C=await jt("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});C.ok||se(`Reject failed (${C.status})`,"error")}catch(C){console.error("[PipelineView] Reject failed:",C),se(`Reject failed: ${C.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(Uo,{className:"w-3 h-3"})," Refresh"]})})]}),c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(T7,{})})]});if(e){const C=e.steps||[],b=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(tn,{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(ca,{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: ",b.label||b.id||"Pipeline"]}),c.jsx("span",{className:"text-muted-foreground ml-2",children:b.description||""}),b.category&&c.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",b.category]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3",children:c.jsx("div",{className:"space-y-1",children:C.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:_+1}),c.jsx("span",{className:"text-xs text-foreground",children:w.id}),w.agent&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:w.agent}),w.function&&c.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",w.function]})]},w.id||_))})})]})}const m=(t==null?void 0:t.currentStepId)??null,x=NS(jf,(t==null?void 0:t.steps)??[],m),g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(C=>[C.id,C.status])):{},y=Object.keys(Bf).map(C=>({phase:C,config:Bf[C],steps:x.filter(b=>b.phase===C)}));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(Za,{icon:es,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),c.jsx(Za,{icon:Ud,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),c.jsx(Za,{icon:Gd,color:"text-slate-300 bg-slate-500/10",label:"Human"}),c.jsx(Za,{icon:Is,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(Uo,{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??jf.length]}),m&&c.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",c.jsx("span",{className:"font-medium",children:m})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:y.map(({phase:C,config:b,steps:w})=>c.jsxs("div",{className:st("rounded-lg border p-3",b.color),children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:b.label}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((_,S)=>{const N=g[_.id]??null,L=_.id===m,A=_.id===i;return c.jsxs(Rt.Fragment,{children:[c.jsx(_7,{step:_,liveStatus:N,isCurrent:L,isSelected:A,onClick:()=>u(_.id)}),S<w.length-1&&c.jsx(k0,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},_.id)})})]},C))})]})}function _7({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?Is:t.agent==="claude"?es:t.agent==="codex"?Ud:Gd,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 Za({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 j7(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 N7={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:es},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:Ud},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:es},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:Gd},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:es}},E7={bg:"bg-slate-800",text:"text-slate-600",Icon:es},Tx={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 B7({agent:t,size:e="md",className:r}){const n=N7[t]||E7,i=Tx[e]||Tx.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 Xn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const Y2=6048e5,L7=864e5,Ja=43200,_x=1440;let A7={};function wa(){return A7}function aa(t,e){var a,l,h,u;const r=wa(),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 mc(t){return aa(t,{weekStartsOn:1})}function V2(t){const e=ae(t),r=e.getFullYear(),n=Xn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=mc(n),s=Xn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=mc(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function jx(t){const e=ae(t);return e.setHours(0,0,0,0),e}function gc(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 M7(t,e){const r=jx(t),n=jx(e),i=+r-gc(r),s=+n-gc(n);return Math.round((i-s)/L7)}function I7(t){const e=V2(t),r=Xn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),mc(r)}function wl(t,e){const r=ae(t),n=ae(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function F7(t){return Xn(t,Date.now())}function P7(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function D7(t){if(!P7(t)&&typeof t!="number")return!1;const e=ae(t);return!isNaN(Number(e))}function O7(t,e){const r=ae(t),n=ae(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function $7(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function R7(t,e){return+ae(t)-+ae(e)}function z7(t){const e=ae(t);return e.setHours(23,59,59,999),e}function W7(t){const e=ae(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function q7(t){const e=ae(t);return+z7(e)==+W7(e)}function H7(t,e){const r=ae(t),n=ae(e),i=wl(r,n),s=Math.abs(O7(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=wl(r,n)===-i;q7(ae(t))&&s===1&&wl(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function U7(t,e,r){const n=R7(t,e)/1e3;return $7(r==null?void 0:r.roundingMethod)(n)}function Y7(t){const e=ae(t),r=Xn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const V7={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"}},G7=(t,e,r)=>{let n;const i=V7[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 eu(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const X7={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},K7={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Q7={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Z7={date:eu({formats:X7,defaultWidth:"full"}),time:eu({formats:K7,defaultWidth:"full"}),dateTime:eu({formats:Q7,defaultWidth:"full"})},J7={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},tW=(t,e,r,n)=>J7[t];function bo(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 eW={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},rW={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},nW={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"]},iW={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"]},sW={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"}},oW={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"}},aW=(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"},lW={ordinalNumber:aW,era:bo({values:eW,defaultWidth:"wide"}),quarter:bo({values:rW,defaultWidth:"wide",argumentCallback:t=>t-1}),month:bo({values:nW,defaultWidth:"wide"}),day:bo({values:iW,defaultWidth:"wide"}),dayPeriod:bo({values:sW,defaultWidth:"wide",formattingValues:oW,defaultFormattingWidth:"wide"})};function Co(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)?hW(a,d=>d.test(o)):cW(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 cW(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function hW(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function uW(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 dW=/^(\d+)(th|st|nd|rd)?/i,pW=/\d+/i,fW={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},mW={any:[/^b/i,/^(a|c)/i]},gW={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xW={any:[/1/i,/2/i,/3/i,/4/i]},yW={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},bW={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]},CW={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},kW={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]},vW={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},wW={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}},SW={ordinalNumber:uW({matchPattern:dW,parsePattern:pW,valueCallback:t=>parseInt(t,10)}),era:Co({matchPatterns:fW,defaultMatchWidth:"wide",parsePatterns:mW,defaultParseWidth:"any"}),quarter:Co({matchPatterns:gW,defaultMatchWidth:"wide",parsePatterns:xW,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Co({matchPatterns:yW,defaultMatchWidth:"wide",parsePatterns:bW,defaultParseWidth:"any"}),day:Co({matchPatterns:CW,defaultMatchWidth:"wide",parsePatterns:kW,defaultParseWidth:"any"}),dayPeriod:Co({matchPatterns:vW,defaultMatchWidth:"any",parsePatterns:wW,defaultParseWidth:"any"})},G2={code:"en-US",formatDistance:G7,formatLong:Z7,formatRelative:tW,localize:lW,match:SW,options:{weekStartsOn:0,firstWeekContainsDate:1}};function TW(t){const e=ae(t);return M7(e,Y7(e))+1}function _W(t){const e=ae(t),r=+mc(e)-+I7(e);return Math.round(r/Y2)+1}function X2(t,e){var u,d,f,p;const r=ae(t),n=r.getFullYear(),i=wa(),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=Xn(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=aa(o,e),l=Xn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const h=aa(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=h.getTime()?n:n-1}function jW(t,e){var a,l,h,u;const r=wa(),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=X2(t,e),s=Xn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),aa(s,e)}function NW(t,e){const r=ae(t),n=+aa(r,e)-+jW(r,e);return Math.round(n/Y2)+1}function ie(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const Mn={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)}},Hi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Nx={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 Mn.y(t,e)},Y:function(t,e,r,n){const i=X2(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=V2(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 Mn.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=NW(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):ie(i,e.length)},I:function(t,e,r){const n=_W(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"}):Mn.d(t,e)},D:function(t,e,r){const n=TW(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=Hi.noon:n===0?i=Hi.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=Hi.evening:n>=12?i=Hi.afternoon:n>=4?i=Hi.morning:i=Hi.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 Mn.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Mn.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"}):Mn.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Mn.s(t,e)},S:function(t,e){return Mn.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return Bx(n);case"XXXX":case"XX":return ai(n);case"XXXXX":case"XXX":default:return ai(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return Bx(n);case"xxxx":case"xx":return ai(n);case"xxxxx":case"xxx":default:return ai(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ex(n,":");case"OOOO":default:return"GMT"+ai(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ex(n,":");case"zzzz":default:return"GMT"+ai(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 Ex(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 Bx(t,e){return t%60===0?(t>0?"-":"+")+ie(Math.abs(t)/60,2):ai(t,e)}function ai(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 Lx=(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"})}},EW=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return Lx(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}}",Lx(n,e)).replace("{{time}}",K2(i,e))},BW={p:K2,P:EW},LW=/^D+$/,AW=/^Y+$/,MW=["D","DD","YY","YYYY"];function IW(t){return LW.test(t)}function FW(t){return AW.test(t)}function PW(t,e,r){const n=DW(t,e,r);if(console.warn(n),MW.includes(t))throw new RangeError(n)}function DW(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 OW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$W=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,RW=/^'([^]*?)'?$/,zW=/''/g,WW=/[a-zA-Z]/;function qW(t,e,r){var u,d,f,p;const n=wa(),i=n.locale??G2,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(!D7(a))throw new RangeError("Invalid time value");let l=e.match($W).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=BW[x];return g(m,i.formatLong)}return m}).join("").match(OW).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:HW(m)};if(Nx[x])return{isToken:!0,value:m};if(x.match(WW))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;(FW(x)||IW(x))&&PW(x,e,String(t));const g=Nx[x[0]];return g(a,x,i.localize,h)}).join("")}function HW(t){const e=t.match(RW);return e?e[1].replace(zW,"'"):t}function UW(t,e,r){const n=wa(),i=(r==null?void 0:r.locale)??n.locale??G2,s=2520,o=wl(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=U7(h,l),d=(gc(h)-gc(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<_x){const m=Math.round(f/60);return i.formatDistance("aboutXHours",m,a)}else{if(f<s)return i.formatDistance("xDays",1,a);if(f<Ja){const m=Math.round(f/_x);return i.formatDistance("xDays",m,a)}else if(f<Ja*2)return p=Math.round(f/Ja),i.formatDistance("aboutXMonths",p,a)}if(p=H7(h,l),p<12){const m=Math.round(f/Ja);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 YW(t,e){return UW(t,F7(t),e)}function Q2({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=YW(r,{addSuffix:!0}),i=qW(r,"PPpp");return c.jsx("time",{dateTime:r.toISOString(),title:i,className:st("text-muted-foreground tabular-nums",e),children:n})}function Z2({sessions:t=[],items:e=[],onSelectItem:r,featureCode:n,focusActive:i,onToggleFocus:s}){const[o,a]=k.useState(""),[l,h]=k.useState("all"),[u,d]=k.useState("all"),f=k.useMemo(()=>t.filter(m=>m.status==="active").length,[t]),p=k.useMemo(()=>{let m=j7(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(pa,{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(bn,{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"}),M0.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(Lc,{icon:qd,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),p.map(m=>c.jsx(VW,{session:m,items:e,onSelectItem:r},m.id))]})]})}function VW({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=Ef[n]||Ef.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(B7,{agent:t.agent,size:"sm",className:"shrink-0"}),c.jsx(kp,{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(Q2,{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 Ax=t=>Symbol.iterator in t,Mx=t=>"entries"in t,Ix=(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},GW=(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 XW(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:Ax(t)&&Ax(e)?Mx(t)&&Mx(e)?Ix(t,e):GW(t,e):Ix({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Bi(t){const e=Rt.useRef(void 0);return r=>{const n=t(r);return XW(e.current,n)?e.current:e.current=n}}function J2({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=fr(Bi(g=>({items:g.items,gates:g.gates,sessions:g.sessions}))),[a,l]=k.useState(""),[h,u]=k.useState(0),d=k.useRef(null);k.useEffect(()=>{t&&(l(""),u(0),setTimeout(()=>{var g;return(g=d.current)==null?void 0:g.focus()},0))},[t]);const f=k.useMemo(()=>{if(!t)return[];if(!a.trim()){const w=s.filter(S=>S.status==="pending").slice(0,3).map(S=>({type:"gate",id:S.id,label:Yo(S,i.find(N=>N.id===S.itemId)),sub:gn[S.stepId]?`${ke[S.fromPhase]??S.fromPhase} → ${ke[S.toPhase]??S.toPhase}`:null,status:"pending",gate:S})),_=i.filter(S=>S.status==="blocked").slice(0,3).map(S=>({type:"item",id:S.id,label:S.title,sub:S.type,status:S.status,item:S}));return[...w.length?[{type:"section",label:"Pending Gates"}]:[],...w,..._.length?[{type:"section",label:"Blocked Items"}]:[],..._]}const g=a.toLowerCase(),y=i.filter(w=>{var _,S;return((_=w.title)==null?void 0:_.toLowerCase().includes(g))||((S=w.featureCode)==null?void 0:S.toLowerCase().includes(g))||(w.description||"").toLowerCase().includes(g)}).slice(0,5).map(w=>({type:"item",id:w.id,label:w.title,sub:`${w.type} · ${w.phase??""}`,status:w.status,item:w})),C=s.filter(w=>{var _;return(w.fromPhase||"").toLowerCase().includes(g)||(w.toPhase||"").toLowerCase().includes(g)||(((_=i.find(S=>S.id===w.itemId))==null?void 0:_.title)??"").toLowerCase().includes(g)}).slice(0,3).map(w=>({type:"gate",id:w.id,label:Yo(w,i.find(_=>_.id===w.itemId)),sub:w.status,status:w.status,gate:w})),b=(o||[]).filter(w=>(w.featureCode||"").toLowerCase().includes(g)||(w.summary||"").toLowerCase().includes(g)).slice(0,2).map(w=>({type:"session",id:w.id,label:w.featureCode||w.id,sub:w.summary||w.agent||"",status:w.status,session:w}));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=k.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(bn,{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(Is,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&c.jsx(vc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&c.jsx(qd,{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(kp,{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 tl=[{id:"feature",label:"Feature",defaults:{type:"feature",phase:"vision",priority:2,governance:"gate"}},{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"}}],KW=["gate","flag","skip"];function Fx(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function tS({open:t,onClose:e,parentItem:r,initialType:n="task"}){const i=fr(b=>b.createItem),[s,o]=k.useState(()=>Fx(r)),[a,l]=k.useState("task"),[h,u]=k.useState(!1),[d,f]=k.useState(!1),[p,m]=k.useState(""),x=k.useRef(null);k.useEffect(()=>{if(t){const b=tl.find(_=>_.id===n)||tl.find(_=>_.id==="task"),w=Fx(r);o({...w,type:b.defaults.type,phase:(r==null?void 0:r.phase)??b.defaults.phase,priority:b.defaults.priority,governance:b.defaults.governance}),l(b.id),u(!1),m(""),setTimeout(()=>{var _;return(_=x.current)==null?void 0:_.focus()},50)}},[t,r,n]);const g=b=>{const w=tl.find(_=>_.id===b);w&&(l(b),o(_=>({..._,type:w.defaults.type,phase:(r==null?void 0:r.phase)??w.defaults.phase,priority:w.defaults.priority,governance:w.defaults.governance})))},y=async()=>{if(!s.title.trim()){m("Title is required");return}f(!0),m("");try{const b={type:s.type,title:s.title.trim(),description:s.description.trim()||void 0,phase:s.phase||void 0,status:"planned",confidence:0,priority:s.priority,assignedTo:s.assignedTo!=="unassigned"?s.assignedTo:void 0,governance:s.governance!=="flag"?s.governance:void 0,featureCode:s.featureCode.trim()||void 0};await i(b),e()}catch{m("Failed to create item")}finally{f(!1)}},C=b=>{b.key==="Enter"&&!b.shiftKey&&b.target.tagName!=="TEXTAREA"&&(b.preventDefault(),y())};return c.jsx($d,{open:t,onOpenChange:b=>!b&&e(),children:c.jsxs(Rd,{className:"max-w-md",onKeyDown:C,children:[c.jsx(zd,{children:c.jsx(Wd,{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:tl.map(b=>c.jsx("button",{type:"button",onClick:()=>g(b.id),className:st("rounded-md px-2 py-1.5 text-[11px] font-medium border transition-colors",a===b.id?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:b.label},b.id))}),c.jsx("input",{ref:x,type:"text",placeholder:"Item title…",value:s.title,onChange:b=>o(w=>({...w,title:b.target.value})),className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring"}),c.jsx("textarea",{placeholder:"Description (optional)…",value:s.description,onChange:b=>o(w=>({...w,description:b.target.value})),rows:2,className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring resize-none"}),c.jsxs("button",{type:"button",onClick:()=>u(b=>!b),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h?c.jsx(S0,{className:"h-3 w-3"}):c.jsx(Ms,{className:"h-3 w-3"}),"Advanced"]}),h&&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:s.featureCode,onChange:b=>o(w=>({...w,featureCode:b.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:s.phase,onChange:b=>o(w=>({...w,phase:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:L0.map(b=>c.jsx("option",{value:b,children:Nl[b]??b},b))})]}),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:s.priority,onChange:b=>o(w=>({...w,priority:Number(b.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:s.assignedTo,onChange:b=>o(w=>({...w,assignedTo:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:M0.map(b=>c.jsx("option",{value:b,children:b},b))})]}),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:KW.map(b=>c.jsx("button",{type:"button",onClick:()=>o(w=>({...w,governance:b})),className:st("flex-1 text-[11px] px-2 py-1 rounded border transition-colors",s.governance===b?b==="gate"?"bg-amber-500/20 text-amber-300 border-amber-500/40":b==="flag"?"bg-blue-500/20 text-blue-300 border-blue-500/40":"bg-slate-700 text-slate-400 border-slate-600":"border-border/40 text-muted-foreground hover:border-border"),children:b},b))})]})]}),p&&c.jsx("p",{className:"text-xs text-destructive",children:p})]}),c.jsxs(y0,{children:[c.jsx(Pt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),c.jsx(Pt,{size:"sm",onClick:y,disabled:d||!s.title.trim(),children:d?"Creating…":"Create"})]})]})})}const QW=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],ZW=[{id:"gate",Icon:Is,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:_0,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:E0,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function JW(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 eS({open:t,onClose:e,settings:r,onSettingsChange:n}){const[i,s]=k.useState(!1),o=k.useRef(null),a=k.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($d,{open:t,onOpenChange:l=>!l&&e(),children:c.jsxs(Rd,{className:"max-w-sm",children:[c.jsx(zd,{children:c.jsxs("div",{className:"flex items-center justify-between pr-6",children:[c.jsx(Wd,{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:QW.map(l=>{const h=l==="explore_design",u=JW(r,l),d=ke[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:ZW.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 rS({onOpenGate:t}){const{gates:e,items:r}=fr(Bi(g=>({gates:g.gates,items:g.items}))),[n,i]=k.useState(new Set),[s,o]=k.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=Yo(h,u),f=g_[h.fromPhase]??x_,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(Is,{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(w0,{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(xi,{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(tn,{className:"h-3 w-3"})})]})}const tq="●",eq="text-zinc-400";function rq(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 nq(t){var e;return((e=I0[t])==null?void 0:e.icon)??tq}function iq(t){var e;return((e=I0[t])==null?void 0:e.color)??eq}const sq={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 oq(t){return sq[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function aq(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function lq(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function cq({event:t,now:e}){const r=nq(t.kind),n=iq(t.kind),i=rq(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||lq(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",oq(s.name)),children:s.name},o))})]})}function nS({events:t=[],currentFeatureCode:e,now:r}){const n=aq(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(cq,{event:i,now:r},i.id))})})}function hq(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 uq="Select a feature to see status.";function iS({featureCode:t,snapshot:e}){const[r,n]=k.useState(!1),i=k.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??uq,o=hq(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 dq({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:w,settings:_,updateSettings:S,resetSettings:N,activeBuild:L,setActiveBuild:A,pipelineDraft:j,sessions:I,selectedPhase:z,setSelectedPhase:W,decisionEvents:D,statusSnapshots:M,setStatusSnapshot:F}=fr(),[O,$]=k.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),B=k.useRef(!!sessionStorage.getItem("vision-activeView")),[T,V]=k.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[rt,P]=k.useState(""),[X,ut]=k.useState(null),[xt,Dt]=k.useState(!1),[Wt,lt]=k.useState(!1),[K,it]=k.useState(!1);k.useEffect(()=>{sessionStorage.setItem("vision-activeView",T)},[T]),k.useEffect(()=>{O?sessionStorage.setItem("vision-selectedItemId",O):sessionStorage.removeItem("vision-selectedItemId")},[O]);const wt=k.useRef(!1);k.useEffect(()=>{var q;(q=_==null?void 0:_.ui)!=null&&q.defaultView&&!wt.current&&!B.current&&(V(_.ui.defaultView),wt.current=!0)},[_]),k.useEffect(()=>{o&&(o.view&&V(o.view),o.phase!==void 0&&W(o.phase),o.select!==void 0&&$(o.select),a())},[o,a]),k.useEffect(()=>{const q=()=>{var H;return["INPUT","TEXTAREA","SELECT"].includes((H=document.activeElement)==null?void 0:H.tagName)},J=H=>{(H.metaKey||H.ctrlKey)&&H.key==="k"&&(H.preventDefault(),Dt(et=>!et)),(H.metaKey||H.ctrlKey)&&H.key==="n"&&(H.preventDefault(),lt(!0)),H.key===","&&!H.metaKey&&!H.ctrlKey&&!q()&&it(!0)};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[]);const gt=k.useMemo(()=>{let q=n;if(z&&(q=q.filter(J=>J.phase===z)),rt){const J=rt.toLowerCase();q=q.filter(H=>H.title.toLowerCase().includes(J)||(H.description||"").toLowerCase().includes(J))}return q},[n,z,rt]),Jt=k.useMemo(()=>z?n.filter(q=>q.phase===z):n,[n,z]),It=k.useMemo(()=>new Set(Jt.map(q=>q.id)),[Jt]),Xt=k.useMemo(()=>z?C.filter(q=>It.has(q.itemId)):C,[C,It,z]),Ae=k.useMemo(()=>{if(!z&&!rt)return i;const q=new Set(gt.map(J=>J.id));return i.filter(J=>q.has(J.fromId)&&q.has(J.toId))},[i,gt,z,rt]);k.useEffect(()=>{y(()=>({activeView:T,selectedPhase:z,searchQuery:rt,selectedItemId:O,totalItems:n.length,filteredCount:gt.length,connected:s}))},[y,T,z,rt,O,n.length,gt.length,s]);const Kt=k.useCallback(q=>{$(q),t&&t({type:"item",id:q})},[t]),yr=k.useCallback((q,J)=>{u(q,J)},[u]);k.useCallback(async()=>{const J=await h({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:z||"vision"});J&&J.id&&$(J.id)},[h,z]),k.useCallback(async q=>{await d(q),O===q&&($(null),t&&t(null))},[d,O,t]);const he=k.useCallback(q=>{const J=C.find(H=>H.id===q);J&&($(J.itemId),t&&t({type:"item",id:J.itemId}))},[C,t]);k.useCallback(async q=>f(q),[f]),k.useCallback(async q=>p(q),[p]);const Ie=k.useCallback(()=>{jt("/api/build/state").then(q=>q.json()).then(q=>A(q.state??null)).catch(()=>{})},[A]),We=k.useCallback(q=>{t&&t({type:"step",id:q})},[t]),ue=k.useMemo(()=>{var J;if(!O)return null;const q=n.find(H=>H.id===O);return((J=q==null?void 0:q.lifecycle)==null?void 0:J.featureCode)||null},[O,n]);return k.useEffect(()=>{ue&&(M&&M[ue]||jt(`/api/lifecycle/status?featureCode=${encodeURIComponent(ue)}`).then(q=>q.json()).then(q=>{q.snapshot&&F&&F(ue,q.snapshot)}).catch(()=>{}))},[ue]),c.jsx(Nc.Provider,{value:l,children:c.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[c.jsx(iS,{featureCode:ue,snapshot:ue?(M==null?void 0:M[ue])??null:null}),ue&&c.jsx(nS,{events:D,currentFeatureCode:ue}),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(cb,{items:n,gates:C,activeBuild:L,activeView:T,onViewChange:V,selectedPhase:z,onPhaseSelect:W,searchQuery:rt,onSearchChange:P,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Kt,onThemeChange:S,onNewItem:()=>lt(!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(ub,{items:gt,connections:Ae,selectedItemId:O,onSelect:Kt}),T==="graph"&&c.jsx(pb,{items:gt,connections:Ae,selectedItemId:O,onSelect:Kt}),T==="pipeline"&&c.jsx(U2,{activeBuild:L,pipelineDraft:j,onSelectStep:We,onRefresh:Ie}),T==="sessions"&&c.jsx(Z2,{sessions:I,items:n,onSelectItem:Kt}),T==="docs"&&c.jsx($2,{items:Jt}),T==="gates"&&c.jsx(z2,{gates:Xt,items:Jt,onResolve:w,onSelect:Kt}),T==="settings"&&c.jsx(H2,{settings:_,onSettingsChange:S,onReset:N})]}),c.jsx(rS,{onOpenGate:he}),X&&(()=>{const q=n.find(J=>J.id===X);return q?c.jsx(q2,{item:q,items:n,connections:i,onUpdate:yr,onClose:()=>ut(null)}):null})(),c.jsx(W2,{event:b,items:n,onNavigate:()=>V("gates")}),c.jsx(J2,{open:xt,onClose:()=>Dt(!1),onSelectItem:q=>{Kt(q),Dt(!1)},onSelectGate:q=>{he(q),Dt(!1)}}),c.jsx(tS,{open:Wt,onClose:()=>lt(!1)}),c.jsx(eS,{open:K,onClose:()=>it(!1),settings:_,onSettingsChange:S})]})]})})}la.use(C0);const pq={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},fq={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function mq(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 gq(){const[t,e]=k.useState(()=>document.documentElement.classList.contains("dark"));return k.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const xq={"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}},yq={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function bq(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 xc="compose:graph:";function Cq(t){try{const e=localStorage.getItem(xc+t);return e?JSON.parse(e):null}catch{return null}}function kq(t,e){try{localStorage.setItem(xc+t,JSON.stringify(e))}catch{}}const vq=[{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 ts({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 el({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 ru(){return c.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function Px({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 wq({nodes:t,edges:e,graphKey:r}){const[n,i]=k.useState(()=>{try{const l=localStorage.getItem(xc+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});k.useEffect(()=>{try{localStorage.setItem(xc+r+":tree-collapsed",JSON.stringify([...n]))}catch{}},[n,r]);const s=k.useMemo(()=>{const l={};for(const h of t)l[h.id]=h;return l},[t]),o=k.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(ts,{onClick:()=>i(new Set),children:"Expand all"}),c.jsx(ts,{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(Px,{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(Px,{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 Sq({elements:t,nodes:e,edges:r,layout:n,style:i,title:s,subtitle:o,graphKey:a="default",onNodeClick:l}){const h=k.useRef(null),u=k.useRef(null),[d,f]=k.useState(null),p=gq(),m=p?pq:fq,x=k.useMemo(()=>Cq(a),[a]),[g,y]=k.useState((x==null?void 0:x.layoutKey)||"dagre-tb"),[C,b]=k.useState((x==null?void 0:x.showEdgeLabels)??!0),[w,_]=k.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[S,N]=k.useState((x==null?void 0:x.showLegend)??!0),[L,A]=k.useState((x==null?void 0:x.viewMode)||"graph");k.useEffect(()=>{kq(a,{layoutKey:g,showEdgeLabels:C,hiddenNodes:[...w],showLegend:S,viewMode:L})},[a,g,C,w,S,L]);const j=t||(e&&r?bq(e,r):[]),I=k.useMemo(()=>i||mq(m),[i,p]),z=n||xq[g],W=k.useMemo(()=>j.filter(T=>!T.data.source).map(T=>({id:T.data.id,label:T.data.label,color:T.data.color})),[JSON.stringify(j)]),D=k.useMemo(()=>w.size===0?j:j.filter(T=>T.data.source?!w.has(T.data.source)&&!w.has(T.data.target):!w.has(T.data.id)),[j,w]);k.useEffect(()=>{if(!h.current)return;const T=la({container:h.current,elements:D,style:I,layout:z,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=T,T.on("mouseover","node",V=>{const rt=V.target;rt.style("border-width",2),rt.style("border-opacity",1);const P=rt.renderedPosition();f({x:P.x,y:P.y-rt.renderedHeight()/2-12,label:rt.data("label"),sublabel:rt.data("sublabel"),id:rt.id(),color:rt.data("color")})}),T.on("mouseout","node",V=>{V.target.style("border-width",1),V.target.style("border-opacity",.5),f(null)}),l&&T.on("tap","node",V=>l(V.target.id())),T.on("layoutstop",()=>T.fit(void 0,40)),()=>{T.destroy(),u.current=null}},[JSON.stringify(D),JSON.stringify(z),p,L]),k.useEffect(()=>{const T=u.current;T&&T.edges().forEach(V=>{V.data("label")&&V.style("label",C?V.data("label"):"")})},[C]);const M=k.useCallback(()=>{var T;return(T=u.current)==null?void 0:T.fit(void 0,40)},[]),F=k.useCallback(()=>{const T=u.current;T&&T.zoom({level:T.zoom()*1.3,renderedPosition:{x:T.width()/2,y:T.height()/2}})},[]),O=k.useCallback(()=>{const T=u.current;T&&T.zoom({level:T.zoom()/1.3,renderedPosition:{x:T.width()/2,y:T.height()/2}})},[]),$=k.useCallback(T=>{_(V=>{const rt=new Set(V);return rt.has(T)?rt.delete(T):rt.add(T),rt})},[]),B=k.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(el,{mode:"graph",active:L==="graph",onClick:()=>A("graph")}),c.jsx(el,{mode:"tree",active:L==="tree",onClick:()=>A("tree")})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(wq,{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(yq).map(([T,V])=>c.jsx("option",{value:T,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:V},T))}),c.jsx(ru,{}),c.jsx(ts,{onClick:O,title:"Zoom out",children:"−"}),c.jsx(ts,{onClick:M,title:"Fit to view",children:"Fit"}),c.jsx(ts,{onClick:F,title:"Zoom in",children:"+"}),c.jsx(ru,{}),c.jsx(ts,{onClick:()=>N(!S),active:S,title:S?"Hide legend":"Show legend",children:"Legend"}),c.jsx(ru,{}),c.jsx(el,{mode:"graph",active:L==="graph",onClick:()=>A("graph")}),c.jsx(el,{mode:"tree",active:L==="tree",onClick:()=>A("tree")})]}),S&&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"}),w.size>0&&c.jsx("button",{onClick:B,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 V=w.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:V?.35:1},title:V?`Show ${T.label}`:`Hide ${T.label}`,children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:V?"transparent":T.color,border:`1.5px solid ${T.color}`}}),c.jsx("span",{className:"text-xs",style:{color:V?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:V?"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:vq.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 Ot={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"},Tq=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:Ot.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:Ot.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:Ot.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:Ot.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:Ot.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:Ot.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:Ot.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:Ot.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:Ot.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:Ot.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:Ot.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:Ot.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:Ot.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:Ot.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:Ot.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:Ot.decision},{id:"question",label:"Question",sublabel:"may block progress",color:Ot.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:Ot.artifact}],_q=[{from:"p-vision",to:"p-specification",color:Ot.pipeline},{from:"p-specification",to:"p-planning",color:Ot.pipeline},{from:"p-planning",to:"p-implementation",color:Ot.pipeline},{from:"p-implementation",to:"p-verification",color:Ot.pipeline},{from:"p-verification",to:"p-release",color:Ot.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:Ot.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:Ot.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:Ot.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:Ot.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:Ot.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:Ot.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:Ot.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:Ot.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:Ot.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:Ot.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:Ot.track},{from:"task",to:"feature",label:"implements",color:Ot.task},{from:"spec",to:"feature",label:"implements",color:Ot.spec},{from:"feature",to:"feature",label:"blocks",color:Ot.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:Ot.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:Ot.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:Ot.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:Ot.artifact},{from:"question",to:"decision",label:"contradicts",color:Ot.question},{from:"feature",to:"p-vision",label:"enters",color:Ot.feature,style:"dashed"}];function jq(){return c.jsx(Sq,{graphKey:"product",nodes:Tq,edges:_q,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const Nq="compose-popout";function sS(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 rl({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:sS(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(RS,{style:{width:11,height:11}}),"pop in"]})]})}function Eq({path:t}){const[e,r]=k.useState(null),[n,i]=k.useState(!0),s=k.useRef(null),o=k.useRef(null),a=t.startsWith("vision://")?"vision":t.startsWith("graph://")?"graph":t.endsWith(".html")||t.endsWith(".htm")?"html":"markdown";k.useEffect(()=>{document.title=sS(t)+" — Compose"},[t]),k.useEffect(()=>{const h=new BroadcastChannel(Nq);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=k.useCallback(()=>{var h;(h=s.current)==null||h.postMessage({type:"popout-dock",path:t}),window.close()},[t]);return k.useEffect(()=>{if(a==="vision"||a==="graph"){i(!1);return}jt(`/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]),k.useEffect(()=>{if(a==="vision"||a==="graph")return;const h=new WebSocket(ES());return o.current=h,h.onmessage=u=>{try{const d=JSON.parse(u.data);d.type==="fileChanged"&&d.path===t&&r(d.content)}catch{}},()=>h.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(rl,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(dq,{})})]}):a==="graph"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(rl,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(jq,{})})]}):a==="html"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(rl,{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(rl,{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(up,{remarkPlugins:[mp],children:e||""})})})]})}const Bq="/api/stratum";async function Zc(t,e={}){return(await jt(`${Bq}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function Lq(t,e){return Zc(t,{method:"POST",body:JSON.stringify(e)})}function oS({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 _f(){return c.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function Aq({onAction:t}){const[e,r]=k.useState(null),[n,i]=k.useState(null),[s,o]=k.useState({}),[a,l]=k.useState({}),h=k.useCallback(()=>{Zc("/gates").then(d=>{r(Array.isArray(d)?d:[]),i(null)}).catch(d=>i(d.message))},[]);k.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 Lq(`/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(_f,{}):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 Mq({flowId:t,onClose:e}){const[r,n]=k.useState(null),[i,s]=k.useState(null);return k.useEffect(()=>{Zc(`/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(_f,{}),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(oS,{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 Iq({activeBuild:t}){const[e,r]=k.useState(null),[n,i]=k.useState(null),[s,o]=k.useState(null),a=k.useCallback(()=>{Zc("/flows").then(l=>{r(Array.isArray(l)?l:[]),i(null)}).catch(l=>i(l.message))},[]);return k.useEffect(()=>{a();const l=setInterval(a,15e3);return()=>clearInterval(l)},[a]),k.useEffect(()=>{t&&a()},[t,a]),e===null&&!n?c.jsx(_f,{}):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(oS,{status:l.status})]})]})},l.flow_id)),s&&c.jsx("div",{style:{marginTop:8},children:c.jsx(Mq,{flowId:s,onClose:()=>o(null)})})]})}const Fq={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 Pq({build:t,onDismiss:e}){const r=t.status==="running",n=["complete","failed","aborted"].includes(t.status);k.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:Fq}),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 Dq(){const t=fr(s=>s.activeBuild),[e,r]=k.useState(null),n=k.useCallback(()=>{t&&r(`${t.flowId}:${t.completedAt}`)},[t]);k.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(Pq,{build:t,onDismiss:n}),c.jsx(Aq,{}),c.jsx("div",{style:{marginTop:20},children:c.jsx(Iq,{activeBuild:t})})]})}function Oq({projectName:t,projectRoot:e,onSwitch:r}){const[n,i]=k.useState(!1),[s,o]=k.useState(e||""),a=k.useRef(null);return k.useEffect(()=>{o(e||"")},[e]),k.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]),k.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 $q={dashboard:{label:"Dashboard",icon:ST,tip:"Overview of project status and activity"},tree:{label:"Items",icon:j0,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:FT,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:u_,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:qd,tip:"Active and past agent sessions"},"build-history":{label:"Builds",icon:fu,tip:"History of past build runs and outcomes"},gates:{label:"Gates",icon:Is,tip:"Quality gates and approval checkpoints"},docs:{label:"Docs",icon:ji,tip:"Project documentation and specs"},journal:{label:"Journal",icon:v0,tip:"Project journal and changelog"},design:{label:"Design",icon:kc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:yi,tip:"Captured ideas and suggestions"}};function Rq({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=$q[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(bn,{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 zq(){const[t,e]=k.useState(P0);function r(){const n=!t;$_(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 Ve={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},Wq={[Ve.COLLAPSED]:Ve.EXPANDED,[Ve.EXPANDED]:Ve.MAXIMIZED,[Ve.MAXIMIZED]:Ve.COLLAPSED};function qq(t){return Wq[t]??Ve.COLLAPSED}function Hq(t){return Ve.COLLAPSED}function Uq(t){return Ve.MAXIMIZED}const Yq=new Set(Object.values(Ve));function Vq(t){return Yq.has(t)}function Gq(t){switch(t){case Ve.COLLAPSED:return"h-7";case Ve.EXPANDED:return"h-[40vh]";case Ve.MAXIMIZED:return"flex-1";default:return"h-7"}}const aS="compose:agentBarState";function Xq(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(aS);return Vq(e)?e:Ve.COLLAPSED}catch{return Ve.COLLAPSED}}function Kq(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(aS,t)}catch{}}const Dx="▾",Qq="▴",Zq="⤢";function Jq({barState:t="collapsed",onStateChange:e}){const[r,n]=k.useState("ready"),[i,s]=k.useState(null);k.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=k.useCallback(()=>{e==null||e(qq(t))},[t,e]),a=k.useCallback(()=>{e==null||e(Hq())},[t,e]);k.useCallback(()=>{e==null||e(Uq())},[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?Qq:h?Zq: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(zq,{}),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($0,{})})]})}const lS=k.createContext(null);function tH(){return k.useContext(lS)}const eH={item:"openItem",feature:"openFeature",gate:"openGate",view:"openView"};function zs({kind:t,id:e,label:r,className:n}){const i=tH(),s=r??e,o=i==null?void 0:i[eH[t]],a=typeof(i==null?void 0:i.canNavigate)=="function"?i.canNavigate(t,e):!0;return typeof o!="function"||!a?c.jsx("span",{className:st("text-[11px] font-mono text-muted-foreground",n),children:s}):c.jsx("button",{type:"button",onClick:l=>{l.stopPropagation();try{o(e)}catch{}},className:st("text-[11px] font-mono text-blue-400 hover:underline cursor-pointer",n),children:s})}const rH=280,nH=.6;function iH({isOpen:t=!1,onToggle:e,widthPx:r=380,onResizePx:n,children:i,activeBuild:s,gates:o=[],agentErrors:a=[],items:l=[]}){const h=k.useRef(!1),u=k.useCallback(f=>{f.preventDefault(),h.current=!0;const p=x=>{if(!h.current)return;const g=window.innerWidth-x.clientX,y=window.innerWidth*nH,C=Math.max(rH,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:Rt.Children.toArray(i).length>0?c.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):c.jsx(oH,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const sH={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function Ox(t){return sH[t]||"#6b7280"}function oH({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] truncate",children:c.jsx(zs,{kind:"gate",id:a.id,label:Yo(a,n.find(h=>h.id===a.itemId)),className:"text-[10px]"})},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:Ox(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:Ox(a)}}),a,": ",l]},a))})]})]})]})}const In=60,Lr=24,nl=80,nu=28,iu=48,$x=8,ss=5,yc=9;function aH(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function lH(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 su(t,e,r,n,i){const s=Math.min(t,ss),o=s*n+(s-1)*$x,a=(r-o)/2,l=[];for(let h=0;h<s;h++)l.push({x:a+h*(n+$x),y:e,w:n,h:i});return{positions:l,overflow:t>ss?t-ss+1:0}}function il({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:h}){const u=gr[t.type]||gr.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?yc+1:yc,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:aH(t.title,s?10:8)})]})}function cH({item:t,pos:e}){if(!t||!e)return null;const r=gr[t.type]||gr.task,n=qn[t.status]||qn.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:Xd[t.confidence||0]})]})]})}function hH({item:t,items:e,connections:r,onSelect:n}){const[i,s]=k.useState(null),[o,a]=k.useState(null),{parents:l,children:h,grandchildren:u}=k.useMemo(()=>lH(t,e,r),[t,e,r]),d=k.useCallback((M,F)=>{const O=F.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),$=F.currentTarget.getBoundingClientRect();s(M),a({x:$.x+$.width/2-O.x,y:$.y-O.y-4})},[]),f=k.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=su(l.length,g,m,In,Lr);y=M.positions,C=M.overflow,g+=Lr+iu}const b=(m-nl)/2,w=g;g+=nu+iu;let _=[],S=0;if(h.length>0){const M=su(h.length,g,m,In,Lr);_=M.positions,S=M.overflow,g+=Lr}let N=new Map,L=new Map;const A=[...u.entries()];let j=[];if(A.length>0){g+=iu;for(const[O,$]of A)for(const B of $)j.push({...B,_parentChildId:O});const M=su(j.length,g,m,In,Lr);let F=0;for(const[O,$]of A){const B=[];for(let T=0;T<$.length&&F<M.positions.length;T++,F++)B.push(M.positions[F]);N.set(O,B)}M.overflow>0&&L.set("all",M.overflow),g+=Lr}const I=g+12;for(let M=0;M<y.length;M++){const F=y[M];x.push({x1:F.x+F.w/2,y1:F.y+F.h,x2:b+nl/2,y2:w})}for(let M=0;M<_.length;M++){const F=_[M];x.push({x1:b+nl/2,y1:w+nu,x2:F.x+F.w/2,y2:F.y})}for(const[M,F]of N){const O=h.findIndex($=>$.id===M);if(O>=0&&O<_.length){const $=_[O];for(const B of F)x.push({x1:$.x+$.w/2,y1:$.y+$.h,x2:B.x+B.w/2,y2:B.y})}}const z=l.slice(0,ss-(C>0?1:0)),W=h.slice(0,ss-(S>0?1:0)),D=j.slice(0,ss-(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:I,className:"w-full",viewBox:`0 0 ${m} ${I}`,children:[x.map((M,F)=>c.jsx("line",{x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},F)),z.map((M,F)=>c.jsx(il,{item:M,x:y[F].x,y:y[F].y,w:In,h:Lr,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:f},M.id)),C>0&&c.jsxs("text",{x:y[y.length-1].x+In/2,y:y[0].y+Lr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:yc,fill:"hsl(var(--muted-foreground))",children:["+",C," more"]}),c.jsx(il,{item:t,x:b,y:w,w:nl,h:nu,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:f}),W.map((M,F)=>c.jsx(il,{item:M,x:_[F].x,y:_[F].y,w:In,h:Lr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},M.id)),S>0&&c.jsxs("text",{x:_[_.length-1].x+In/2,y:_[0].y+Lr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:yc,fill:"hsl(var(--muted-foreground))",children:["+",S," more"]}),D.map((M,F)=>{const $=[...N.values()].flat()[F];return $?c.jsx(il,{item:M,x:$.x,y:$.y,w:In,h:Lr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},M.id):null})]}),c.jsx(cH,{item:i,pos:o})]})]})}const uH=["Untested","Low","Moderate","High","Crystallized"];function dH({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=uH[r]??"Untested",i=r===0?Af[0]:Af[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 pH(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 Rx(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function fH(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function mH(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 gH(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:pH(new Date(n).toISOString(),e)}function xH(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=gH(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 yH(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 zx({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:`${Rx(i.tokens_in)} / ${Rx(i.tokens_out)}`},{label:"USD",value:fH(i.usd)},{label:"Wall clock",value:mH(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 bH({lineage:t,selectedPair:e=[],onSelectPair:r=()=>{},extraMetricsForBranch:n=()=>[],now:i=Date.now()}){var g,y;const[s,o]=k.useState(!1),{summary:a,canCompare:l,completeBranches:h}=xH(t,i),[u,d]=yH(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(zx,{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(zx,{branch:d,extraRows:n(d)})]})]}),c.jsx("div",{className:"col-span-2",children:x?c.jsx(Tf,{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 CH={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function kH(t){return CH[t]??t}function Wx(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function vH(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 wH({item:t}){const[e,r]=k.useState(!1),n=vH(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(vc,{size:13}),c.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?c.jsx(S0,{size:13,style:{marginLeft:"auto"}}):c.jsx(Ms,{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:kH(s.axis_id)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:Wx(s.ratio)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:Wx(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))})]})]})}async function cS({featureCode:t,mode:e="feature",description:r=""}){const n=await jt("/api/build/start",{method:"POST",headers:Dr({"Content-Type":"application/json"}),body:JSON.stringify({featureCode:t,mode:e,description:r})});if(!n.ok){let i=null;try{i=await n.json()}catch{}const s=new Error(i&&i.error||`Failed to start build (HTTP ${n.status})`);throw s.status=n.status,s}return n}function SH({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]=k.useState(r),[s,o]=k.useState((t==null?void 0:t.type)==="bug"?"bug":"feature"),[a,l]=k.useState(""),[h,u]=k.useState(!1),[d,f]=k.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{await cS({featureCode:g,mode:s,description:a.trim()}),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 TH({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:Xd[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 _H({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:qn[h.status]||qn.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:gr[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(tn,{className:"h-3 w-3"})})]},u))})]},`${l.type}-${l.direction}`))]})}function sl(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 jH({featureCode:t,lineage:e}){const r=fr(i=>i.selectedBranches),n=fr(i=>i.setSelectedBranches);return c.jsx(bH,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function NH({featureCode:t}){const[e,r]=k.useState([]),[n,i]=k.useState(!0);return k.useEffect(()=>{const s=new AbortController;return i(!0),jt(`/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 EH=["informs","supports","blocks","contradicts"];function BH({item:t,items:e,onCreateConnection:r,onDismiss:n}){const[i,s]=k.useState(""),[o,a]=k.useState("informs"),l=e.filter(u=>u.id===t.id?!1:i?u.title.toLowerCase().includes(i.toLowerCase()):!0).slice(0,8),h=k.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:EH.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(bn,{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:qn[u.status]||qn.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:gr[u.type]},children:u.type})]},u.id))})]})})}function LH({gate:t,onResolveGate:e}){const[r,n]=k.useState(null),[i,s]=k.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(Pt,{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(Pt,{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(Pt,{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(Pt,{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 AH({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 $,B,T,V,rt,P;const f=x0(),[p,m]=k.useState(!1),[x,g]=k.useState(""),[y,C]=k.useState(!1),[b,w]=k.useState(""),[_,S]=k.useState(!1),[N,L]=k.useState(!1),[A,j]=k.useState("");k.useEffect(()=>{j((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const I=k.useCallback(()=>{const X=A.trim(),ut=(t==null?void 0:t.group)||"";X!==ut&&i(t.id,{group:X||null})},[A,t==null?void 0:t.id,t==null?void 0:t.group,i]),z=k.useCallback(()=>{g(t.title),m(!0)},[t==null?void 0:t.title]),W=k.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]),D=k.useCallback(()=>{w(t.description||""),C(!0)},[t==null?void 0:t.description]),M=k.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]),F=k.useMemo(()=>{if(!t)return 0;let X=0;for(const ut of r)ut.type==="contradicts"&&(ut.fromId===t.id||ut.toId===t.id)&&X++;return X},[t==null?void 0:t.id,r]);if(!t)return null;const O=gr[t.type]||gr.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(mr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:O,borderColor:O},children:t.type}),t.phase&&c.jsx(mr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:Nl[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:X=>g(X.target.value),onBlur:W,onKeyDown:X=>{X.key==="Enter"&&W(),X.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(Pt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:h,children:c.jsx(tn,{className:"h-3.5 w-3.5"})})]}),c.jsx(Pl,{}),c.jsx(Hn,{className:"flex-1",children:c.jsxs("div",{className:"p-3 space-y-4",children:[c.jsx(wH,{item:t}),(($=t.lifecycle)==null?void 0:$.featureCode)&&c.jsx(jH,{featureCode:t.lifecycle.featureCode,lineage:(B=t.lifecycle.lifecycle_ext)==null?void 0:B.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:X=>i(t.id,{status:X.target.value}),children:p_.map(X=>c.jsx("option",{value:X,children:X.replace("_"," ")},X))}),c.jsx(TH,{level:t.confidence||0,onChange:X=>i(t.id,{confidence:X})})]}),c.jsx(dH,{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:X=>i(t.id,{phase:X.target.value||null}),children:[c.jsx("option",{value:"",children:"No phase"}),L0.map(X=>c.jsx("option",{value:X,children:Nl[X]},X))]})]}),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:A,placeholder:"(none)",onChange:X=>j(X.target.value),onBlur:I,onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),X.currentTarget.blur()),X.key==="Escape"&&(j(t.group||""),X.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:X=>w(X.target.value),onBlur:M,onKeyDown:X=>{X.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:D,children:t.description||"Click to add description..."})]}),c.jsx(_H,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),c.jsx(hH,{item:t,items:e,connections:r,onSelect:l}),((T=t.lifecycle)==null?void 0:T.featureCode)&&c.jsx(NH,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(X=>X.itemId===t.id))&&(()=>{var Wt;const X=t.lifecycle,ut=n?n.filter(lt=>lt.itemId===t.id):[],xt=ut.filter(lt=>lt.status==="pending"),Dt=ut.filter(lt=>lt.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:[X&&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:ke[X.currentPhase]??X.currentPhase}),X.featureCode&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:X.featureCode})]}),((Wt=X==null?void 0:X.phaseHistory)==null?void 0:Wt.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:X.phaseHistory.map((lt,K)=>c.jsxs("span",{className:st("text-[10px]",lt.phase===X.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[ke[lt.phase]??lt.phase,lt.outcome&<.outcome!=="approved"&&c.jsxs("span",{className:"text-amber-400",children:[" (",lt.outcome,")"]}),K<X.phaseHistory.length-1&&" → "]},K))})]}),xt.map(lt=>{var wt,gt;const K=lt.artifactAssessment,it=A0[lt.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:"," ",c.jsx(zs,{kind:"gate",id:lt.id,label:gn[lt.stepId]??`${ke[lt.fromPhase]??lt.fromPhase} → ${ke[lt.toPhase]??lt.toPhase}`,className:"text-[10px]"})]}),K&&K.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[it&&c.jsx("span",{className:"font-mono",children:it}),it&&": ",Math.round(K.completeness*100),"% complete"," · ",K.wordCount," words",((gt=(wt=K.sections)==null?void 0:wt.missing)==null?void 0:gt.length)>0&&c.jsxs("span",{className:"text-amber-400",children:[" (missing: ",K.sections.missing.join(", "),")"]}),!K.meetsMinWordCount&&c.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),K&&!K.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[it??"Artifact"," not found"]}),d&&c.jsx(LH,{gate:lt,onResolveGate:d})]},lt.id)}),Dt.map(lt=>{const K={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:gn[lt.stepId]??`${ke[lt.fromPhase]??lt.fromPhase} → ${ke[lt.toPhase]??lt.toPhase}`}),c.jsx(mr,{variant:"outline",className:st("text-[10px] px-1.5 py-0 h-4 ml-auto",K[lt.outcome]||""),children:lt.outcome})]},lt.id)})]})]})})(),((rt=(V=t.evidence)==null?void 0:V.stratumViolations)==null?void 0:rt.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:sl(t.evidence.violatedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((X,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:X})]},ut))})]}),((P=t.evidence)==null?void 0:P.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:sl(t.evidence.tracedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(X=>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:X.step_id}),X.attempts>1&&c.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[X.attempts,"x"]}),X.duration_ms!=null&&c.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:X.duration_ms<1e3?`${X.duration_ms}ms`:`${(X.duration_ms/1e3).toFixed(1)}s`})]},X.step_id))})]}),c.jsxs("div",{className:"space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",sl(t.createdAt)]}),c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",sl(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(Pt,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",N&&"bg-accent/10 border-accent"),onClick:()=>L(!N),"data-testid":"item-start-build",title:"Start the build/bug-fix lifecycle for this item",children:[c.jsx(OT,{className:"h-3 w-3"})," Start"]}),N&&c.jsx(SH,{item:t,onClose:()=>L(!1)})]}),c.jsxs("div",{className:"relative",children:[c.jsxs(Pt,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",_&&"bg-accent/10 border-accent"),onClick:()=>S(!_),children:[c.jsx(jT,{className:"h-3 w-3"})," Connect"]}),_&&c.jsx(BH,{item:t,items:e,onCreateConnection:o,onDismiss:()=>S(!1)})]}),c.jsxs(Pt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:z,children:[c.jsx(N0,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&c.jsxs(Pt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[c.jsx(jl,{className:"h-3 w-3"})," Pressure Test",F>0&&c.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:F})]}),t.status!=="killed"&&c.jsxs(Pt,{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 X=await jt(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!X.ok){const ut=await X.json().catch(()=>({}));console.error("[vision] Lifecycle kill failed:",ut.error),se(`Kill failed: ${ut.error||X.status}`,"error")}}catch(X){console.error("[vision] Lifecycle kill failed:",X.message),se(`Kill failed: ${X.message}`,"error")}else i(t.id,{status:"killed"})},children:[c.jsx(_l,{className:"h-3 w-3"})," Kill"]}),s&&c.jsxs(Pt,{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(_l,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const hS=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];hS.map(t=>t.id);const MH={overview:ji,pipeline:j0,sessions:T0,errors:vc,files:Yd};function IH({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:hS.map(({id:n,label:i})=>{const s=MH[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 qx=[{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 FH({item:t,activeBuild:e}){const[r,n]=k.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:qx.map((o,a)=>{const l=Nd(o.id,i,e,s),h=Lf[l],u=r===o.id;return c.jsxs(Rt.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:qx.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)":Lf[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(PH,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function PH({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 DH(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 OH(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function $H({featureCode:t,sessions:e=[],items:r=[]}){const[n,i]=k.useState(null),s=k.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=k.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:OH(a.durationMs)}),c.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:DH(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 RH(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 ou=10;function zH({featureCode:t,errors:e=[],items:r=[]}){const[n,i]=k.useState(null),[s,o]=k.useState(!1),a=k.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=k.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(rT,{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,ou);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:RH(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>ou&&c.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-ou," more"]})]})}function WH(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function qH(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 HH({featureCode:t,onOpenFile:e}){const[r,n]=k.useState([]),[i,s]=k.useState(!0);k.useEffect(()=>{const l=new AbortController;return s(!0),jt("/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=k.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(Yd,{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(ji,{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:WH(f)}),p&&c.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:qH(p)})]},h)})]})}function UH({itemId:t,onSelect:e,onClose:r,onOpenFile:n,onViewInGraph:i,onViewInTree:s}){var S;const{items:o,connections:a,gates:l,updateItem:h,deleteItem:u,createConnection:d,deleteConnection:f,resolveGate:p,activeBuild:m,sessions:x,agentErrors:g}=fr(Bi(N=>({items:N.items,connections:N.connections,gates:N.gates,updateItem:N.updateItem,deleteItem:N.deleteItem,createConnection:N.createConnection,deleteConnection:N.deleteConnection,resolveGate:N.resolveGate,activeBuild:N.activeBuild,sessions:N.sessions,agentErrors:N.agentErrors}))),y=o.find(N=>N.id===t)||null,[C,b]=k.useState("overview"),w=((S=y==null?void 0:y.lifecycle)==null?void 0:S.featureCode)||(y==null?void 0:y.featureCode)||(y==null?void 0:y.feature_code)||"",_=k.useMemo(()=>w?g.filter(N=>N.featureCode===w||w&&N.message&&N.message.includes(w)):[],[g,w]);return y?c.jsxs("div",{className:"h-full flex flex-col",children:[c.jsx(IH,{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(AH,{item:y,items:o,connections:a,gates:l,onUpdate:(N,L)=>h(N,L),onDelete:N=>{u(N),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(FH,{item:y,activeBuild:m}),C==="sessions"&&c.jsx($H,{featureCode:w,sessions:x,items:o}),C==="errors"&&c.jsx(zH,{featureCode:w,errors:g,items:o}),C==="files"&&c.jsx(HH,{featureCode:w,onOpenFile:n})]})]}):c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function YH(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 VH(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function GH(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function XH(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 KH(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 Hx(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const Ux=[{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 QH({tierMap:t,tierSummary:e}){const[r,n]=k.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:[Ux.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(Rt.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=Ux.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 au(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function ZH(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const Yx={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 JH({loopState:t,budget:e}){const[r,n]=k.useState(()=>Date.now());k.useEffect(()=>{if(!t||t.status!=="running")return;const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[t]);const i=XH(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 tU({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=fr(Bi(A=>({activeBuild:A.activeBuild,iterationStates:A.iterationStates}))),[o,a]=k.useState(!1),[l,h]=k.useState(null),u=(i==null?void 0:i.featureCode)??null,d=k.useRef(null);k.useEffect(()=>{if(!u){h(null);return}u!==d.current&&(d.current=u,jt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(A=>A.json()).then(A=>h(A)).catch(()=>{}))},[u]);const{step:f,allSteps:p}=k.useMemo(()=>i!=null&&i.steps?{step:i.steps.find(j=>j.id===t||j.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=k.useMemo(()=>{if(!r||r.length===0)return null;for(let A=r.length-1;A>=0;A--){const j=r[A];if(j.subtype==="health_score"&&typeof j.score=="number")return j}return null},[r]),{tierMap:x,tierSummary:g}=k.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const A={};let j=null;for(const I of e)I.subtype==="gate_tier_result"?A[I.tierId]=I.passed:I.subtype==="gate_tier_summary"&&(j=I);return{tierMap:A,tierSummary:j}},[e]),y=Object.keys(x).length>0||g!==null,C=k.useMemo(()=>{const A=p.filter(j=>j.cost_usd!=null);return A.length===0?[]:[...A].sort((j,I)=>o?(j.cost_usd??0)-(I.cost_usd??0):(I.cost_usd??0)-(j.cost_usd??0))},[p,o]),b=C.length>0?C[0].id:null,w=k.useMemo(()=>YH(f),[f]),_=k.useMemo(()=>VH(f),[f]),S=k.useMemo(()=>GH(s,t),[s,t]),N=k.useMemo(()=>{if(!n||n.length===0)return null;const A=n.filter(z=>z.stepId===t);if(A.length===0)return null;const j=A.filter(z=>z.severity==="violation").length,I=A.filter(z=>z.severity==="warning").length;return{total:A.length,hardViolations:j,warnings:I}},[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"})]}),w&&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 ",w.count," ",w.count===1?"time":"times"]}),w.isArray&&w.items.length>0&&c.jsx("div",{className:"mt-1 space-y-0.5",children:w.items.map((A,j)=>c.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",j+1,A.reason?`: ${A.reason}`:""]},j))})]}),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((A,j)=>c.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:A},j))})]}),(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:Hx(f.cost_usd)})]})]}),y&&c.jsx("div",{children:c.jsx(QH,{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((A,j)=>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 A=="string"?A:A.message||JSON.stringify(A)})]},j))})]}),N&&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:[N.total," ",N.total===1?"finding":"findings"," ","(",N.hardViolations," ",N.hardViolations===1?"violation":"violations",","," ",N.warnings," ",N.warnings===1?"warning":"warnings",")"]})]}),(S==null?void 0:S.status)==="running"&&c.jsx(JH,{loopState:S,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 ${au(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 ${au(m.score)}`,children:[ZH(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(([A,j])=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:Yx[A]??A}),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 ${j>=80?"bg-success":j>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${j}%`}})}),c.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${au(j)}`,children:j})]},A)),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(A=>Yx[A]??A).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(A=>!A),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(A=>{const j=A.id===b,I=A.id===t,z=A.durationMs!=null?A.durationMs<1e3?`${A.durationMs}ms`:A.durationMs<6e4?`${(A.durationMs/1e3).toFixed(1)}s`:`${(A.durationMs/6e4).toFixed(1)}m`:"—";return c.jsxs("tr",{className:`${j?"text-amber-400":"text-foreground"} ${I?"font-semibold":""}`,children:[c.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:A.id}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((A.input_tokens??0)/1e3).toFixed(1),"k"]}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((A.output_tokens??0)/1e3).toFixed(1),"k"]}),c.jsx("td",{className:"text-right py-0.5 font-mono",children:Hx(A.cost_usd)}),c.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:z})]},A.id)})})]})})]})]})}function uS(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 Gx(t,e){var l;const r=(e||[]).filter(h=>!h.superseded);if(r.length===0)return"";let n=`# Design Document
|
|
659
|
-
|
|
660
|
-
`;const i=(t||[]).filter(h=>h.role==="human"&&h.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
|
|
661
|
-
|
|
662
|
-
`,n+=i.map(h=>h.content).join(`
|
|
663
|
-
|
|
664
|
-
`),n+=`
|
|
665
|
-
|
|
666
|
-
`);for(const h of r){const u=h.selectedOption||{};n+=`## ${h.question}
|
|
667
|
-
|
|
668
|
-
`,n+=`**Decision:** ${u.title||u.id||"Selected option"}
|
|
669
|
-
|
|
670
|
-
`,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
|
|
671
|
-
`),n+=`
|
|
672
|
-
|
|
673
|
-
`),h.comment&&(n+=`*Note: ${h.comment}*
|
|
674
|
-
|
|
675
|
-
`)}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(`
|
|
676
|
-
`);for(const d of u){const f=d.trim();f.endsWith("?")&&f.length>10&&f.length<200&&a.push(f)}}return n+=`## Open Threads
|
|
677
|
-
|
|
678
|
-
`,a.length>0?(n+=a.map(h=>`- ${h}`).join(`
|
|
679
|
-
`),n+=`
|
|
680
|
-
`):n+=`_No open threads._
|
|
681
|
-
`,n}function eU(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const ko={es:null},Wn=gp((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 jt(`/api/design/session${a}`),{session:h}=await l.json();if(h){const u=h.messages||[],d=h.decisions||[],f=Gx(u,d),p=eU(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 jt("/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 jt("/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 jt("/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 jt("/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 jt("/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(ko.es)return;const{scope:r,featureCode:n}=e(),i=new URLSearchParams({scope:r||"product"});n&&i.set("featureCode",n);const s=m0("/api/design/stream"),o=s.includes("?")?"&":"?",a=new EventSource(`${s}${o}${i}`);ko.es=a,a.addEventListener("ack",()=>{t(l=>l.status!=="streaming"?{status:"streaming"}:{})}),a.addEventListener("text",l=>{const h=JSON.parse(l.data);t(u=>u.streamingMessage?{streamingMessage:{...u.streamingMessage,content:u.streamingMessage.content+h.content}}:{status:"streaming",streamingMessage:{role:"assistant",type:"text",content:h.content,timestamp:new Date().toISOString()}})}),a.addEventListener("decision",l=>{const h=JSON.parse(l.data);t(u=>({status:"streaming",streamingMessage:u.streamingMessage?{...u.streamingMessage,type:"decision",decisionData:h}:{role:"assistant",type:"decision",content:"",decisionData:h,timestamp:new Date().toISOString()}}))}),a.addEventListener("done",()=>{t(l=>({messages:l.streamingMessage?[...l.messages,l.streamingMessage]:l.messages,streamingMessage:null,status:"active"})),e().hydrate()}),a.addEventListener("research",l=>{const h=JSON.parse(l.data);t(u=>({researchItems:[...u.researchItems,{id:h.id,tool:h.tool,input:h.input,timestamp:h.timestamp,summary:null}]}))}),a.addEventListener("research_result",l=>{const h=JSON.parse(l.data);t(u=>{const d=[...u.researchItems],f=h.id?d.findIndex(p=>p.id===h.id):-1;return f!==-1&&(d[f]={...d[f],summary:h.summary}),{researchItems:d}})}),a.addEventListener("error",l=>{try{const h=JSON.parse(l.data);t(u=>({status:"active",streamingMessage:null,error:h.message||"Agent error",messages:u.messages}))}catch{t({status:"active",streamingMessage:null})}}),a.onerror=()=>{t({status:"active"})}},disconnectSSE:()=>{ko.es&&(ko.es.close(),ko.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=Gx(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function rU(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=Wn(Bi(h=>({draftDoc:h.draftDoc,docManuallyEdited:h.docManuallyEdited,updateDraftDoc:h.updateDraftDoc,resetDocEdited:h.resetDocEdited}))),[i,s]=k.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(up,{remarkPlugins:[mp],children:t})})})]})}function Xx(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 nU(t){if(!t)return"";const e=Math.max(0,Math.floor((new Date(t).getTime()-Date.now())/1e3));if(e<=0)return"expired";const r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function iU({device:t,idx:e,onRevoke:r}){const[n,i]=k.useState(!1),s=k.useRef(null),o=k.useCallback(()=>{if(!n){i(!0),s.current=setTimeout(()=>i(!1),3e3);return}clearTimeout(s.current),i(!1),r(t.id)},[n,t.id,r]);return k.useEffect(()=>()=>clearTimeout(s.current),[]),c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg bg-muted/30 border border-border",style:{opacity:t.revoked?.5:1},children:[c.jsx(B0,{className:"h-4 w-4 text-muted-foreground shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name||"Unknown device"}),t.revoked&&c.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-destructive/10 text-destructive shrink-0",children:"revoked"})]}),c.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Paired ",Xx(t.paired_at),t.last_seen&&!t.revoked&&` · seen ${Xx(t.last_seen)}`]})]}),!t.revoked&&c.jsx("button",{"data-testid":`pair-device-revoke-${e}`,onClick:o,className:`shrink-0 text-[10px] px-2 py-1 rounded transition-colors ${n?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"text-muted-foreground hover:text-destructive hover:bg-destructive/10"}`,title:n?"Click again to confirm revoke":"Revoke device",children:n?c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(_l,{className:"h-3 w-3"})," Confirm"]}):c.jsx(_l,{className:"h-3 w-3"})})]})}function sU({open:t,onClose:e,publicHost:r}){const[n,i]=k.useState("idle"),[s,o]=k.useState(null),[a,l]=k.useState(""),[h,u]=k.useState(null),[d,f]=k.useState(""),[p,m]=k.useState(null),[x,g]=k.useState(""),[y,C]=k.useState(null),[b,w]=k.useState([]),[_,S]=k.useState(!1),N=k.useRef(null),L=k.useRef(null),A=k.useCallback(async()=>{S(!0);try{const W=await jt("/api/auth/devices",{headers:Dr()});if(W.ok){const D=await W.json();w(D.devices||[])}}catch{}finally{S(!1)}},[]),j=k.useCallback(async W=>{try{(await jt(`/api/auth/devices/${W}`,{method:"DELETE",headers:Dr()})).ok&&await A()}catch{}},[A]),I=k.useCallback(async()=>{i("loading"),g(""),C(null),o(null),l(""),u(null),f("");try{const W=await jt("/api/auth/pair/init",{method:"POST",headers:Dr({"Content-Type":"application/json"})});if(W.status===503){i("error"),g("COMPOSE_API_TOKEN is not set — the server cannot authenticate this request. Start compose via `compose start` so the supervisor generates the token, or set COMPOSE_API_TOKEN manually.");return}if(!W.ok){const O=await W.json().catch(()=>({}));i("error"),g(O.error||`Server returned ${W.status}`);return}const D=await W.json(),M=D.public_host||r||(typeof window<"u"?window.location.origin:""),F=D.pair_url||`${M}/m/pair?code=${D.code}`;m(D.public_host||r||null),o(D.code),l(F),u(D.expires_at),i("ready")}catch(W){i("error"),g(W.message||"Network error")}},[r]);if(k.useEffect(()=>{if(!t){i("idle"),o(null),l(""),u(null),f(""),g(""),C(null),clearInterval(L.current);return}I(),A()},[t]),k.useEffect(()=>{if(n!=="ready"||!a||!N.current)return;let W=!1;return(async()=>{try{const D=(await Ht(async()=>{const{default:M}=await import("./browser-DW2JlJCC.js").then(F=>F.b);return{default:M}},__vite__mapDeps([54,3,4]))).default;!W&&N.current&&await D.toCanvas(N.current,a,{width:200,margin:2,color:{dark:"#000000",light:"#ffffff"}})}catch{}})(),()=>{W=!0}},[n,a]),k.useEffect(()=>{if(!h){clearInterval(L.current);return}clearInterval(L.current);const W=()=>f(nU(h));return W(),L.current=setInterval(W,1e3),()=>clearInterval(L.current)},[h]),k.useEffect(()=>{if(!t)return;function W(D){const{name:M,device_id:F}=D.detail??{};C({name:M||"New device",id:F}),clearInterval(L.current),f(""),A()}return window.addEventListener("compose:devicePaired",W),()=>window.removeEventListener("compose:devicePaired",W)},[t,A]),!t)return null;const z=!p;return c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",role:"dialog","aria-modal":"true","aria-label":"Pair mobile device","data-testid":"pair-device-modal",children:[c.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:e}),c.jsxs("div",{className:"relative w-full max-w-md max-h-[85vh] flex flex-col rounded-xl border border-border bg-card shadow-2xl mx-4",children:[c.jsxs("div",{className:"flex items-center gap-3 p-4 pb-3 border-b border-border shrink-0",children:[c.jsx(B0,{className:"h-5 w-5 text-accent shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pair mobile device"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Scan the QR code on your phone to connect remotely"})]}),c.jsx("button",{className:"shrink-0 opacity-60 hover:opacity-100 transition-opacity",onClick:e,"aria-label":"Close",children:c.jsx(tn,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[y&&c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-success/10 border border-success/20",children:[c.jsx(Hd,{className:"h-4 w-4 text-success shrink-0"}),c.jsxs("span",{className:"text-xs text-success font-medium",children:["Paired: ",y.name]})]}),n==="loading"&&c.jsxs("div",{className:"flex items-center justify-center py-10 gap-2 text-muted-foreground",children:[c.jsx(Sl,{className:"h-5 w-5 animate-spin"}),c.jsx("span",{className:"text-xs",children:"Generating pairing code…"})]}),n==="error"&&c.jsxs("div",{"data-testid":"pair-device-error",className:"px-3 py-3 rounded-lg bg-destructive/10 border border-destructive/20 space-y-2",children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(c_,{className:"h-4 w-4 text-destructive shrink-0 mt-0.5"}),c.jsx("p",{className:"text-xs text-destructive leading-relaxed",children:x})]}),c.jsx("button",{className:"text-[10px] text-accent hover:underline",onClick:I,children:"Retry"})]}),n==="ready"&&c.jsxs("div",{className:"space-y-3",children:[z&&c.jsxs("div",{className:"text-[10px] text-amber-500 bg-amber-500/10 border border-amber-500/20 rounded px-2 py-1.5",children:["No public host configured — the URL below uses your local origin. For remote pairing, configure a public host (e.g. via"," ",c.jsx("code",{className:"font-mono",children:"compose remote pair --public-host=<URL>"}),")."]}),c.jsx("div",{className:"flex justify-center",children:c.jsx("canvas",{ref:N,"data-testid":"pair-device-qr",className:"rounded border border-border bg-white",width:200,height:200,"aria-label":"QR code for pairing"})}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Pairing URL"}),c.jsx("input",{"data-testid":"pair-device-url",readOnly:!0,value:a,className:"w-full text-[10px] font-mono bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none select-all cursor-text",onFocus:W=>W.target.select(),"aria-label":"Pairing URL"})]}),d&&c.jsxs("p",{className:"text-[10px] text-center text-muted-foreground",children:["Expires in"," ",c.jsx("span",{className:d==="expired"?"text-destructive font-semibold":"text-foreground font-mono",children:d}),d!=="expired"&&c.jsx("button",{className:"ml-2 text-accent hover:underline",onClick:I,children:"Refresh"}),d==="expired"&&c.jsx("button",{className:"ml-2 text-accent hover:underline",onClick:I,children:"Generate new code"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Paired devices"}),_&&c.jsx(Sl,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),c.jsxs("div",{"data-testid":"pair-device-list",className:"space-y-1.5",children:[!_&&b.length===0&&c.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:"No paired devices yet"}),b.map((W,D)=>c.jsx(iU,{device:W,idx:D,onRevoke:j},W.id))]})]})]})]})]})}const lu={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%)"}},Kx={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 oU({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?lu.done:lu[t])||lu.build,l=Kx[o]||Kx.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 aU(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function lU(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function cU(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function hU({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=aU(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=gn[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=`, ${lU(f)}/${cU(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 uU({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=fr(Bi(D=>({activeBuild:D.activeBuild,gates:D.gates,items:D.items,recentErrors:D.recentErrors,resolveGate:D.resolveGate,iterationStates:D.iterationStates}))),[l,h]=k.useState(new Map),u=k.useRef([]),d=k.useRef(new Set),f=k.useRef(new Set),[p,m]=k.useState(null),x=k.useRef(null),g=(r==null?void 0:r.featureCode)??null;k.useEffect(()=>{if(!g){m(null),x.current=null;return}g!==x.current&&(x.current=g,jt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(D=>D.json()).then(D=>m(D)).catch(()=>{}))},[g]);const y=k.useRef(0);k.useEffect(()=>{if(!g)return;const D=a?[...a.values()].reduce((M,F)=>M+(F.count??0),0):0;D!==y.current&&(y.current=D,jt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(M=>M.json()).then(M=>m(M)).catch(()=>{}))},[a,g]);const C=k.useRef(r),[b,w]=k.useState(null);k.useEffect(()=>{const D=C.current;if(D&&D.featureCode&&!r){w({...D,status:"complete"});const M=setTimeout(()=>w(null),3e3);return C.current=r,()=>clearTimeout(M)}C.current=r},[r]);const _=r||b,[S,N]=k.useState(()=>Date.now()),L=a&&[...a.values()].some(D=>D.status==="running");k.useEffect(()=>{if(!L)return;const D=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(D)},[L]);const A=k.useMemo(()=>hU({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:S}),[_,n,i,s,a,S]),j=k.useMemo(()=>A.filter(D=>!d.current.has(D.key)),[A]);k.useEffect(()=>{const D=new Set(u.current.map(F=>F.key)),M=j.filter(F=>!D.has(F.key)).map(F=>F.key);M.length>0&&(h(F=>{const O=new Map(F);for(const $ of M)O.set($,"enter");return O}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{h(F=>{const O=new Map(F);for(const $ of M)O.get($)==="enter"&&O.set($,"steady");return O})})}));for(const F of j)F.type==="done"&&!f.current.has(F.key)&&(f.current.add(F.key),h(O=>{const $=new Map(O);return $.set(F.key,"flash"),$}),setTimeout(()=>{h(O=>{const $=new Map(O);return $.set(F.key,"exit"),$}),setTimeout(()=>{d.current.add(F.key),h(O=>{const $=new Map(O);return $.delete(F.key),$})},500)},2e3));u.current=j},[j]);const I=k.useCallback(D=>{h(M=>{const F=new Map(M);return F.set(D,"exit"),F}),setTimeout(()=>{d.current.add(D),h(M=>{const F=new Map(M);return F.delete(D),F})},200)},[]),z=k.useCallback(D=>{o&&o(D,"approve","Approved from ops strip")},[o]);if(t==="docs"||j.length===0)return null;const W=KH(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:[j.map(D=>c.jsx(oU,{type:D.type,label:D.label,retries:D.retries,animationState:l.get(D.key)||"steady",onClick:e?()=>e(D.featureCode):void 0,onApprove:D.type==="gate"&&D.gateId?()=>z(D.gateId):void 0,onDismiss:D.type==="error"?()=>I(D.key):void 0},D.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 cu=["dashboard","graph","tree","docs","journal","design","gates","pipeline","sessions","build-history","ideabox"];function dU(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function pU(t){return(t==null?void 0:t[0])??null}const fU="compose:mainTabs",dS="compose:activeTab";function mU(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(fU);if(!e)return[...cu];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of cu)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[...cu]}function gU(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(dS);if(r&&dU(t,r))return r}catch{}return pU(t)}function Qx(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(dS,t)}catch{}}function pS(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 fS(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const mS="compose:sidebarOpen",gS="compose:contextPanelOpen";function xU(){return pS(mS,!0)}function yU(t){return fS(mS,t)}function bU(){return pS(gS,!1)}function Zx(t){return fS(gS,t)}const Jx={complete:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",failed:"bg-red-500/15 text-red-400 border border-red-500/30",aborted:"bg-amber-500/15 text-amber-400 border border-amber-500/30",killed:"bg-slate-500/15 text-slate-400 border border-slate-500/30"};function CU(t){if(typeof t!="number"||t<0)return"—";const e=Math.round(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60),n=e%60;return r<60?`${r}m ${n}s`:`${Math.floor(r/60)}h ${r%60}m`}function kU(t){return typeof t!="number"||t<=0?null:`$${t.toFixed(t<1?4:2)}`}function vU({builds:t=[],items:e=[],onSelectItem:r}){const[n,i]=k.useState(""),[s,o]=k.useState("all"),a=k.useMemo(()=>{let l=t;if(s!=="all"&&(l=l.filter(h=>h.status===s)),n.trim()){const h=n.toLowerCase();l=l.filter(u=>(u.featureCode||"").toLowerCase().includes(h))}return l},[t,n,s]);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.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[c.jsx(fu,{className:"h-3 w-3"}),c.jsx("span",{children:"Past builds"})]}),c.jsx("div",{className:"h-4 w-px bg-border"}),c.jsxs("div",{className:"relative",children:[c.jsx(bn,{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 feature…",value:n,onChange:l=>i(l.target.value),className:"text-xs pl-5 pr-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-36"})]}),c.jsxs("select",{value:s,onChange:l=>o(l.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"}),["complete","failed","aborted","killed"].map(l=>c.jsx("option",{value:l,children:l},l))]}),c.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length,"/",t.length]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[a.length===0&&c.jsx(Lc,{icon:fu,title:"No past builds yet",description:"Builds are recorded here after each run completes",className:"py-8"}),a.map((l,h)=>c.jsx(wU,{build:l,items:e,onSelectItem:r},`${l.featureCode}-${l.completedAt}-${h}`))]})]})}function wU({build:t,items:e,onSelectItem:r}){const n=t.featureCode?e.find(u=>{var d;return u.featureCode===t.featureCode||u.feature_code===t.featureCode||((d=u.lifecycle)==null?void 0:d.featureCode)===t.featureCode}):null,i=Jx[t.status]||Jx.killed,s=kU(t.cost_usd),o=t.status==="failed"||t.status==="aborted",[a,l]=k.useState(!1);async function h(){const u=t.featureCode;l(!0);try{await cS({featureCode:u,mode:t.mode}),se(`Build restarted for ${u}`,"info")}catch(d){d.status===409?se(`A build for ${u} is already active`,"warn"):se(d.message||"Failed to restart build","error")}finally{l(!1)}}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("span",{className:st("text-[10px] px-1.5 py-0.5 rounded capitalize",i),children:t.status}),t.featureCode&&c.jsx("button",{onClick:()=>n&&(r==null?void 0:r(n.id)),className:st("text-[11px] font-mono",n?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:t.featureCode}),t.mode==="bug"&&c.jsx("span",{className:"text-[10px] px-1 py-0.5 rounded bg-rose-500/15 text-rose-400",children:"bug"}),c.jsx(Q2,{date:t.completedAt,className:"ml-auto text-[10px] shrink-0"})]}),c.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[c.jsxs("span",{children:["⏱ ",CU(t.durationMs)]}),s&&c.jsxs("span",{children:["💵 ",s]}),typeof t.stepCount=="number"&&c.jsxs("span",{children:["◆ ",t.stepCount," steps"]})]}),(t.failureReason||o)&&c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.failureReason&&c.jsx("p",{className:"text-[11px] text-red-400/90 truncate flex-1 min-w-0",children:t.failureReason}),o&&c.jsxs("button",{onClick:h,disabled:a,className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted/50 disabled:opacity-50 shrink-0 ml-auto cursor-pointer",title:`Restart build for ${t.featureCode}`,"data-testid":"past-build-retry",children:[c.jsx(WT,{className:"h-2.5 w-2.5"}),a?"Retrying…":"Retry"]})]})]})}const Ed=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ed.displayName="Card";const Bd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex flex-col space-y-1.5 p-6",t),...e}));Bd.displayName="CardHeader";const Ld=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("font-semibold leading-none tracking-tight",t),...e}));Ld.displayName="CardTitle";const SU=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("text-sm text-muted-foreground",t),...e}));SU.displayName="CardDescription";const Ad=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("p-6 pt-0",t),...e}));Ad.displayName="CardContent";const TU=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex items-center p-6 pt-0",t),...e}));TU.displayName="CardFooter";function _U(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 t0({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]=k.useState(()=>{const m=t.startedAt?new Date(t.startedAt).getTime():Date.now();return(t.completedAt?new Date(t.completedAt).getTime():Date.now())-m});k.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:_U(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 jU(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 Ui(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 e0(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const NU=(t,e)=>Math.abs(t-e)<1.01,EU=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}};let vo;const hu=()=>{if(vo!==void 0)return vo;if(typeof navigator>"u")return vo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return vo=!0;const t=navigator.maxTouchPoints;return vo=navigator.platform==="MacIntel"&&t!==void 0&&t>0},r0=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},BU=t=>t,LU=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},AU=(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(r0(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(r0(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},bc={passive:!0},MU=typeof window>"u"?!0:"onscrollend"in window,IU=(t,e,r)=>{const n=t.scrollElement;if(!n)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&MU;let o=0;const a=s?null:EU(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,bc),s&&n.addEventListener("scrollend",u,bc),()=>{n.removeEventListener("scroll",h),s&&n.removeEventListener("scrollend",u)}},FU=(t,e)=>IU(t,e,r=>{const{horizontal:n,isRtl:i}=t.options;return n?r.scrollLeft*(i&&-1||1):r.scrollTop}),PU=(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"]},DU=(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})},OU=DU;class $U{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:BU,rangeExtractor:LU,onChange:()=>{},measureElement:PU,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 w=s.followOnAppend===!0?"auto":s.followOnAppend||null;w&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||s.getItemKey(p-1)!==g)&&(l=w)}}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=Ui(()=>(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,!(!hu()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,bc),s.addEventListener("touchend",a,bc),this.unsubs.push(()=>{s.removeEventListener("touchstart",o),s.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,o,a,l]=i;s!==null&&!a&&(hu()&&(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=Ui(()=>[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=Ui(()=>[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 w=s(b),_=u.get(w),S=typeof _=="number"?_:this.options.estimateSize(b);g[b*2]=y,g[b*2+1]=S,y+=S+m}const C=jU(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 N=p[y],L=N!==void 0?f[N]:void 0;C=L?L.end+this.options.gap:n+i}else{const N=this.options.lanes===1?f[m-1]:this.getFurthestMeasurement(f,m);C=N?N.end+this.options.gap:n+i,y=N?N.lane:m%this.options.lanes,this.options.lanes>1&&b&&this.laneAssignments.set(m,y)}const w=u.get(x),_=typeof w=="number"?w:this.options.estimateSize(m),S=C+_;f[m]={index:m,start:C,size:_,end:S,key:x,lane:y},p[y]=m}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ui(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?RU({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=Ui(()=>{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.itemSizeCache.has(l)||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=Ui(()=>[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=xS(0,n.length-1,s?a=>i[a*2]:a=>e0(n[a]).start,r);return e0(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&&(hu()&&(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&&NU(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 xS=(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 RU({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=xS(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 uu=typeof document<"u"?k.useLayoutEffect:k.useEffect;function zU({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:r="transform",...n}){const i=k.useReducer(h=>h+1,0)[1],s=k.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||!u.container)return;const d=h.getTotalSize();if(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?IS.flushSync(i):i()),(d=n.onChange)==null||d.call(n,h,u)}},[l]=k.useState(()=>{const h=new $U(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),uu(()=>l._didMount(),[]),uu(()=>l._willUpdate()),uu(()=>{o(l)}),l}function WU(t){return zU({observeElementRect:AU,observeElementOffset:FU,scrollToFn:OU,...t})}function qU(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=gn[u.stepId]??(u.fromPhase&&u.toPhase?`${ke[u.fromPhase]??u.fromPhase} → ${ke[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 HU={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function UU(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 YU({event:t,onSelectItem:e,style:r}){const n=HU[t.category]||"●",i=b_[t.category]||"text-zinc-400",s=y_[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:UU(t.timestamp)})]})}const VU=["all","phase","gate","session","iteration","error"],n0={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function GU({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=k.useState("all"),[s,o]=k.useState([]),a=k.useRef(null),l=fr(m=>m.gates),h=fr(m=>m.featureTimeline),u=fr(m=>m.setFeatureTimeline);k.useEffect(()=>{if(!t)return;let m=!1;return jt(`/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=qU(x.sessions||[],g,{id:e});o(y)}).catch(()=>{m||o([])}),()=>{m=!0}},[t,e]);const d=k.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,w=(y=C.meta)==null?void 0:y.featureCode;(!b&&!w||b===e||w===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=k.useMemo(()=>n==="all"?d:d.filter(m=>m.category===n),[d,n]),p=WU({count:f.length,getScrollElement:()=>a.current,estimateSize:()=>48,overscan:5});return k.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:VU.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:[n0[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 "${n0[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(YU,{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 qo=["explore_design","prd","architecture","blueprint","plan","execute","report"];function XU(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 KU({currentPhase:t}){const e=qo.indexOf(t);return c.jsx("div",{className:"space-y-1.5",children:qo.map((r,n)=>{const i=e>n,s=e===n,o=ke[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(Hd,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?c.jsx(k0,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):c.jsx(aT,{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 QU({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=k.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(t0,{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(t0,{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(ji,{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 ZU({gates:t,allGates:e,items:r,onResolveGate:n}){const i=FS(),s=k.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:[gn[o.stepId]??ke[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(Tf,{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(Pt,{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(Pt,{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(Pt,{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 JU({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(i_,{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(zs,{kind:"feature",id:s,label:s,className:"text-[9px]"}),c.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:XU(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 tY({items:t=[],gates:e=[],sessions:r=[],activeBuild:n,spawnedAgents:i=[],featureCode:s,sessionState:o,agentActivity:a,iterationStates:l,onSelect:h,onResolveGate:u,onOpenGate:d,onCreateFeature:f,isEmptyProject:p}){var S;const m=k.useMemo(()=>t.find(N=>{var L;return N.featureCode===s||((L=N.lifecycle)==null?void 0:L.featureCode)===s}),[t,s]),[x,g]=k.useState(()=>{try{return localStorage.getItem("compose:timeline-open")==="true"}catch{return!1}}),y=k.useCallback(()=>{g(N=>{const L=!N;try{localStorage.setItem("compose:timeline-open",String(L))}catch{}return L})},[]),C=((S=m==null?void 0:m.lifecycle)==null?void 0:S.currentPhase)||(m==null?void 0:m.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,b=qo.indexOf(C),w=C?Math.max(0,(b+1)/qo.length):0,_=k.useMemo(()=>{let N=e.filter(L=>L.status==="pending"||!L.resolvedAt);if(s){const L=new Set(t.filter(A=>{var j;return A.featureCode===s||((j=A.lifecycle)==null?void 0:j.featureCode)===s}).map(A=>A.id));N=N.filter(A=>L.has(A.itemId))}return N},[e,t,s]);if(!s){const N=t.filter(L=>L.type==="feature"&&(L.status==="complete"||L.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:p?"No items yet.":"No feature in progress."}),p&&f&&c.jsx(Pt,{variant:"outline",size:"sm",onClick:f,children:"Create your first feature"}),c.jsx("p",{className:"text-[11px] text-muted-foreground/70 font-mono",children:"Run /compose <feature-code> in the terminal to start."}),N.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:N.map(L=>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(L.id),children:[c.jsx(Hd,{className:"w-3 h-3 text-emerald-400 shrink-0"}),c.jsx("span",{className:"text-[11px] text-foreground truncate",children:L.title}),L.featureCode&&c.jsx(mr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:L.featureCode})]},L.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:(m==null?void 0:m.title)??s}),c.jsx(mr,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),C&&c.jsx(mr,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:ke[C]??C}),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",x?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:y,children:[c.jsx(ET,{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(w*100)}%`,transition:"width 800ms cubic-bezier(0.4, 0, 0.2, 1)"}})}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:b>=0?`${b+1} of ${qo.length} phases`:"Phase unknown"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs(Ed,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[c.jsx(Bd,{className:"p-3 pb-2",children:c.jsx(Ld,{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(KU,{currentPhase:C})})]}),c.jsxs(Ed,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[c.jsx(Bd,{className:"p-3 pb-2",children:c.jsx(Ld,{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(QU,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),l&&l.size>0&&c.jsx("div",{className:"space-y-2",children:[...l.values()].map(N=>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:[N.status==="running"?"↻":N.outcome==="clean"?"✓":"✗"," ",N.loopType==="review"?"Review Loop":"Coverage Sweep"]}),c.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[N.count," of ",N.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(N.count/N.maxIterations*100)}%`,transition:"width 600ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:N.outcome==="clean"?"#22c55e":N.outcome==="max_reached"?"#ef4444":"#3b82f6"}})}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:N.status==="running"?N.loopType==="review"?"Waiting for clean review...":"Waiting for tests passing...":N.outcome==="clean"?"Clean!":N.outcome==="max_reached"?"Max iterations reached":"Aborted"})]},N.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"}),_.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:_.length})]}),c.jsx(ZU,{gates:_,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(JU,{sessions:r,items:t,onSelect:h})})]})]}),x&&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(GU,{featureCode:s,itemId:m==null?void 0:m.id,onSelectItem:h})]})]})}function eY(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 rY(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:eY(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function nY({results:t,onClose:e}){const r=k.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(yi,{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(Pt,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function iY({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=vs(),[o,a]=k.useState(()=>[...t]),[l,h]=k.useState(0),[u,d]=k.useState([]),[f,p]=k.useState(!1),[m,x]=k.useState(""),[g,y]=k.useState(!1),[C,b]=k.useState(!1),w=o[l]??null;o.length-l;const _=k.useMemo(()=>w?rY(w,s.filter(I=>I.id!==w.id)):[],[w,s]),S=k.useCallback(()=>{const I=l+1;I>=o.length?p(!0):(h(I),y(!1),x(""))},[l,o.length]),N=k.useCallback(async I=>{if(!(!w||C)){b(!0);try{await r(w.id,I),d(z=>[...z,{id:w.id,action:"priority",priority:I}]),S()}finally{b(!1)}}},[w,C,r,S]),L=k.useCallback(async()=>{if(!(!w||C)){b(!0);try{await n(w.id,m),d(I=>[...I,{id:w.id,action:"kill"}]),y(!1),x(""),S()}finally{b(!1)}}},[w,C,n,m,S]),A=k.useCallback(()=>{w&&(d(I=>[...I,{id:w.id,action:"skip"}]),S())},[w,S]),j=k.useCallback(async()=>{if(!(!w||C)){b(!0);try{await i(w.id),d(I=>[...I,{id:w.id,action:"promote"}]),S()}finally{b(!1)}}},[w,C,i,S]);return k.useEffect(()=>{const I=z=>{if(z.key==="Escape"){e();return}g||(z.key==="0"&&N("P0"),z.key==="1"&&N("P1"),z.key==="2"&&N("P2"),(z.key==="s"||z.key==="ArrowRight")&&A(),z.key==="k"&&y(!0))};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[g,N,A,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(yi,{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(tn,{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(nY,{results:u,onClose:e}):w?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(mr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:w.id}),w.cluster&&c.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:w.cluster})]}),c.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:w.title}),w.description&&c.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:w.description}),c.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(w.tags||[]).map(I=>c.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:I},I))}),w.source&&c.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",w.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(I=>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(mr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:I.id}),c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:I.title})]},I.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:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&L(),I.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(Pt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),c.jsx(Pt,{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&&w&&!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(Pt,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>N("P0"),disabled:C,title:"Press 0",children:["P0 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),c.jsxs(Pt,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>N("P1"),disabled:C,title:"Press 1",children:["P1 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),c.jsxs(Pt,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>N("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(Pt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:j,disabled:C,children:"Promote"}),c.jsxs(Pt,{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(Pt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:A,title:"Press s or →",children:[c.jsx(E0,{className:"w-3 h-3"}),"Skip ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function i0(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 sY(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
|
|
682
|
-
|
|
683
|
-
**Date:** ${r}
|
|
684
|
-
**Promoted from:** ${t.id}
|
|
685
|
-
**Priority:** ${t.priority||"TBD"}
|
|
686
|
-
**Tags:** ${n}
|
|
687
|
-
|
|
688
|
-
## Context
|
|
689
|
-
|
|
690
|
-
${t.description||t.title}
|
|
691
|
-
|
|
692
|
-
## Source
|
|
693
|
-
|
|
694
|
-
${t.source||"Internal idea"}
|
|
695
|
-
|
|
696
|
-
## Goals
|
|
697
|
-
|
|
698
|
-
- [ ] Define acceptance criteria
|
|
699
|
-
- [ ] Identify affected components
|
|
700
|
-
- [ ] Estimate effort
|
|
701
|
-
|
|
702
|
-
## Related
|
|
703
|
-
|
|
704
|
-
${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
|
|
705
|
-
`.trimStart()}function oY({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(ca,{className:"w-3 h-3"}):t})})}function aY({idea:t,onClose:e}){var _;const{promoteIdea:r}=vs(),[n,i]=k.useState(1),[s,o]=k.useState(()=>i0(t)),[a,l]=k.useState(""),[h,u]=k.useState(""),[d,f]=k.useState(!1),[p,m]=k.useState(null),x=k.useRef(null);k.useEffect(()=>{u(sY(t,s||"FEAT-?"))},[t,s]),k.useEffect(()=>{n===1&&setTimeout(()=>{var S;return(S=x.current)==null?void 0:S.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(S=>S+1)},C=()=>i(S=>S-1),b=async()=>{if(!d){f(!0);try{await r(t.id,s.trim().toUpperCase()),m({featureCode:s.trim().toUpperCase()}),i(4)}catch(S){l(S.message||"Failed to promote"),i(1)}finally{f(!1)}}},w=["Feature ID","Preview","Confirm"];return c.jsx($d,{open:!0,onOpenChange:S=>!S&&e(),children:c.jsxs(Rd,{className:"max-w-lg",children:[c.jsx(zd,{children:c.jsxs(Wd,{className:"flex items-center gap-2",children:[c.jsx(yi,{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((S,N)=>c.jsxs(Rt.Fragment,{children:[c.jsx(oY,{step:S,current:n}),c.jsx("span",{className:st("text-[10px] transition-colors",n===S?"text-foreground font-medium":"text-muted-foreground/60"),children:w[N]}),N<2&&c.jsx(xi,{className:"w-3 h-3 text-muted-foreground/30 mx-0.5"})]},S))})}),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(mr,{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:S=>{o(S.target.value.toUpperCase()),l("")},onKeyDown:S=>{S.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:[i0(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((S,N,L)=>L.indexOf(S)===N).map(S=>c.jsx("button",{onClick:()=>{o(S),l("")},className:st("text-[10px] px-2 py-1 rounded border font-mono transition-colors",s===S?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:S},S))})]})]}),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(ca,{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(Pt,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&c.jsxs(y0,{children:[n>1&&c.jsxs(Pt,{variant:"ghost",size:"sm",onClick:C,disabled:d,children:[c.jsx(w0,{className:"w-3 h-3 mr-1"}),"Back"]}),c.jsx(Pt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?c.jsxs(Pt,{size:"sm",onClick:y,children:["Next",c.jsx(xi,{className:"w-3 h-3 ml-1"})]}):c.jsx(Pt,{size:"sm",onClick:b,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const Md=["S","M","L"],lY=["high","medium","low"],cY={"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"},s0={"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"},o0=["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 hY({idea:t,onSubmit:e,onCancel:r}){const[n,i]=k.useState(t.effort||""),[s,o]=k.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:Md.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 uY({ideas:t,selectedIdeaId:e,onSelectIdea:r,onUpdateIdea:n}){const[i,s]=k.useState(null),o=k.useMemo(()=>{const u=[...new Set(t.map(f=>f.cluster||"__none__"))],d={};return u.forEach((f,p)=>{d[f]=o0[p%o0.length]}),d},[t]),a=k.useMemo(()=>t.filter(u=>u.effort&&u.impact),[t]),l=k.useMemo(()=>t.filter(u=>!u.effort||!u.impact),[t]),h=k.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:Md.map(u=>c.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),lY.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})}),Md.map(d=>{const f=`${u}-${d}`,p=cY[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",s0[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(s0).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(hY,{idea:u,onSubmit:h,onCancel:()=>s(null)})})]},u.id))})]})]})}function du({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 dY({ideas:t,killed:e}){const[r,n]=k.useState(!1),i=k.useMemo(()=>{var C,b,w,_;const s=[...t,...e||[]],o={};for(const S of s){const N=((C=S.source)==null?void 0:C.trim())||"(no source)",L=N.length>30?N.slice(0,30)+"…":N;o[L]=(o[L]||0)+1}const a=Object.entries(o).sort((S,N)=>N[1]-S[1]).slice(0,6),l=((b=a[0])==null?void 0:b[1])||1,h=s.filter(S=>S.status==="NEW").length,u=s.filter(S=>S.status==="DISCUSSING").length,d=s.filter(S=>{var N;return(N=S.status)==null?void 0:N.startsWith("PROMOTED")}).length,f=(e||[]).length,p=t.length,m=s.length>0?Math.round(f/s.length*100):0,x={};for(const S of s){const N=S.cluster||"(unclustered)";x[N]||(x[N]={total:0,promoted:0}),x[N].total+=1,(w=S.status)!=null&&w.startsWith("PROMOTED")&&(x[N].promoted+=1)}const g=Object.entries(x).sort((S,N)=>N[1].total-S[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(Ms,{className:"w-3 h-3"}):c.jsx(xi,{className:"w-3 h-3"}),c.jsx(XS,{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(du,{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(du,{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(du,{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 pY=[{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 a0(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function yS({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 fY({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 mY({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(mr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),c.jsx(yS,{status:t.status}),c.jsx("div",{className:"flex-1"}),c.jsx(fY,{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 gY({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,C,b,w;const[o,a]=k.useState(""),[l,h]=k.useState(!1),[u,d]=k.useState(!1),[f,p]=k.useState(""),[m,x]=k.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(mr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),c.jsx(yS,{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(kc,{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((_,S)=>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})]},S))}),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(Vd,{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":_},_))})]})]}),!((w=t.status)!=null&&w.startsWith("PROMOTED"))&&t.status!=="KILLED"&&c.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[c.jsx(Pt,{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(Pt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{h(!1),a("")},children:"Cancel"}),c.jsx(Pt,{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(Pt,{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 xY({killed:t,onResurrect:e}){const[r,n]=k.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(Ms,{className:"w-3 h-3 text-muted-foreground"}):c.jsx(xi,{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(mr,{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 yY(){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}=vs(),[m,x]=k.useState(!1),[g,y]=k.useState(null),[C,b]=k.useState(null),[w,_]=k.useState(null),[S,N]=k.useState("cards"),L=k.useMemo(()=>{var rt;const O=t.filter(P=>P.status==="NEW").length,$=t.filter(P=>!P.priority||P.priority==="—").length,B=t.filter(P=>P.priority==="P0").length,T={};t.filter(P=>P.priority==="P0"&&P.cluster).forEach(P=>{T[P.cluster]=(T[P.cluster]||0)+1});const V=((rt=Object.entries(T).sort((P,X)=>X[1]-P[1])[0])==null?void 0:rt[0])??null;return{newCount:O,untriaged:$,p0Count:B,topCluster:V}},[t]),A=k.useMemo(()=>{const O=new Set;return t.forEach($=>($.tags||[]).forEach(B=>O.add(B))),[...O].sort()},[t]),j=k.useMemo(()=>t.filter(O=>{var $;if(s.tag&&!(($=O.tags)!=null&&$.includes(s.tag))||s.status&&(O.status||"").split(/\s+/)[0]!==s.status||s.priority&&O.priority!==s.priority)return!1;if(s.search){const B=s.search.toLowerCase();if(!`${O.title} ${O.description} ${O.id} ${(O.tags||[]).join(" ")}`.toLowerCase().includes(B))return!1}return!0}),[t,s]),I=k.useMemo(()=>{const O=new Map,$=[];j.forEach(V=>{V.cluster?(O.has(V.cluster)||O.set(V.cluster,[]),O.get(V.cluster).push(V)):$.push(V)});const B=V=>[...V].sort((rt,P)=>a0(rt.priority)-a0(P.priority)),T=[];for(const[V,rt]of O)T.push({cluster:V,ideas:B(rt)});return $.length>0&&T.push({cluster:null,ideas:B($)}),T},[j]),z=k.useMemo(()=>t.find(O=>O.id===i)||e.find(O=>O.id===i)||null,[t,e,i]),W=k.useCallback((O,$)=>{b($),O.dataTransfer.effectAllowed="move"},[]),D=k.useCallback(()=>{b(null),_(null)},[]),M=k.useCallback((O,$)=>{O.preventDefault(),O.dataTransfer.dropEffect="move",_($)},[]),F=k.useCallback(async(O,$)=>{O.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(yi,{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(Uo,{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:()=>N("cards"),className:st("text-[10px] px-2 py-0.5 rounded transition-colors",S==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Cards"}),c.jsx("button",{onClick:()=>N("matrix"),className:st("text-[10px] px-2 py-0.5 rounded transition-colors",S==="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(Uo,{className:"w-3 h-3"})}),c.jsxs(Pt,{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(dY,{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(gT,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),c.jsxs("select",{value:s.tag,onChange:O=>d({tag:O.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"}),A.map(O=>c.jsx("option",{value:O,children:O},O))]}),c.jsxs("select",{value:s.status,onChange:O=>d({status:O.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:O=>d({priority:O.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(bn,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),c.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:O=>d({search:O.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:()=>vs.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})}),S==="matrix"&&c.jsx(uY,{ideas:j,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:p}),S==="cards"&&j.length===0&&!r&&c.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-2",children:[c.jsx(yi,{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"'})]})]}),S==="cards"&&I.map(({cluster:O,ideas:$})=>c.jsxs("div",{className:"mb-6",children:[O&&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:O}),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:pY.map(B=>{const T=$.filter(rt=>rt.priority===B.key),V=w===B.key&&C;return c.jsxs("div",{className:st("rounded-lg border p-2 min-h-[80px] transition-colors",B.bg,B.border,V&&"ring-1 ring-accent"),onDragOver:rt=>M(rt,B.key),onDrop:rt=>F(rt,B.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",B.color),children:B.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(rt=>c.jsx(mY,{idea:rt,selected:i===rt.id,onClick:u,onDragStart:W,onDragEnd:D},rt.id)),T.length===0&&c.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},B.key)})})]},O||"__unclustered__")),S==="cards"&&c.jsx(xY,{killed:e,onResurrect:h})]})]}),z&&c.jsx(gY,{idea:z,onClose:()=>u(null),onPromote:O=>y(O),onKill:l,onSetPriority:a,onAddDiscussion:f}),m&&c.jsx(iY,{ideas:t.filter(O=>!O.priority||O.priority==="—"),onClose:()=>x(!1)}),g&&c.jsx(aY,{idea:g,onClose:()=>y(null)})]})}const bS=[["what_happened","What happened"],["what_we_built","What we built"],["what_we_learned","What we learned"],["open_threads","Open threads"]],l0={summary:"",feature_code:"",what_happened:"",what_we_built:"",what_we_learned:"",open_threads:""};function bY(){const[t,e]=k.useState("journal"),[r,n]=k.useState(""),[i,s]=k.useState([]),[o,a]=k.useState(!0),[l,h]=k.useState(null),[u,d]=k.useState(!1),[f,p]=k.useState(l0),[m,x]=k.useState(!1),g=k.useRef(0),y=k.useCallback(async()=>{const w=++g.current;a(!0),h(null);try{const _=new URLSearchParams;r.trim()&&_.set("feature",r.trim());const S=_.toString(),N=await jt(`/api/${t}${S?`?${S}`:""}`);if(!N.ok)throw new Error(`fetch failed (${N.status})`);const L=await N.json();if(w!==g.current)return;s(L.entries||[])}catch(_){if(w!==g.current)return;h(_.message||String(_)),s([])}finally{w===g.current&&a(!1)}},[t,r]);k.useEffect(()=>{y()},[y]);const C=k.useRef(y);k.useEffect(()=>{C.current=y},[y]);const b=async()=>{x(!0);try{const w=await jt("/api/journal",{method:"POST",headers:Dr({"Content-Type":"application/json"}),body:JSON.stringify({summary:f.summary,...f.feature_code.trim()?{feature_code:f.feature_code.trim()}:{},sections:{what_happened:f.what_happened,what_we_built:f.what_we_built,what_we_learned:f.what_we_learned,open_threads:f.open_threads}})});if(!w.ok){let _=`journal write failed (${w.status})`;try{const S=await w.json();S!=null&&S.error&&(_=S.error)}catch{}throw new Error(_)}se("Journal entry written","info"),p(l0),d(!1),C.current()}catch(w){se(w.message||String(w),"error")}finally{x(!1)}};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("div",{className:"flex rounded overflow-hidden border border-border",role:"group","aria-label":"Source",children:["journal","changelog"].map(w=>c.jsx("button",{type:"button",onClick:()=>e(w),className:st("text-xs px-2 py-0.5 h-6 capitalize cursor-pointer",t===w?"bg-muted text-foreground":"bg-transparent text-muted-foreground hover:text-foreground"),children:w},w))}),c.jsx("input",{type:"text",placeholder:"Filter by feature code…","aria-label":"Feature filter",value:r,onChange:w=>n(w.target.value),className:"text-xs px-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-44 font-mono"}),c.jsx("button",{type:"button",onClick:y,title:"Refresh",className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-muted-foreground border border-border hover:text-foreground cursor-pointer",children:c.jsx(Uo,{className:"h-3 w-3"})}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i.length," entries"]}),t==="journal"&&c.jsxs("button",{type:"button",onClick:()=>d(w=>(w||p(_=>({..._,feature_code:_.feature_code||r.trim()})),!w)),className:"ml-auto flex items-center gap-1 text-xs px-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border hover:bg-accent cursor-pointer",children:[c.jsx(Tl,{className:"h-3 w-3"}),"New entry"]})]}),u&&t==="journal"&&c.jsxs("div",{className:"px-3 py-2 border-b border-border shrink-0 space-y-1.5","data-testid":"journal-write-form",children:[c.jsx("input",{type:"text",placeholder:"Summary (one line)","aria-label":"Summary",value:f.summary,onChange:w=>p(_=>({..._,summary:w.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full"}),c.jsx("input",{type:"text",placeholder:"Feature code (optional)","aria-label":"Feature code",value:f.feature_code,onChange:w=>p(_=>({..._,feature_code:w.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full font-mono"}),bS.map(([w,_])=>c.jsx("textarea",{placeholder:_,"aria-label":_,rows:2,value:f[w],onChange:S=>p(N=>({...N,[w]:S.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full resize-y"},w)),c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx("button",{type:"button",disabled:m,onClick:b,className:"text-xs px-2 py-0.5 rounded bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50 cursor-pointer",children:m?"Writing…":"Write entry"}),c.jsx("button",{type:"button",onClick:()=>d(!1),className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground border border-border cursor-pointer",children:"Cancel"})]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[o&&c.jsx("div",{className:"py-8 text-center text-[11px] text-muted-foreground",children:"Loading…"}),!o&&l&&c.jsx("div",{className:"py-8 text-center text-[11px] text-red-400",children:l}),!o&&!l&&i.length===0&&c.jsx(Lc,{icon:v0,title:t==="journal"?"No journal entries":"No changelog entries",description:t==="journal"?"Journal entries appear as sessions are written up":"Changelog entries appear as features ship",className:"py-8"}),!o&&!l&&t==="journal"&&i.map(w=>c.jsx(kY,{entry:w},w.path||`${w.date}-${w.slug}`)),!o&&!l&&t==="changelog"&&i.map((w,_)=>c.jsx(vY,{entry:w},`${w.line_number??_}`))]})]})}function kY({entry:t}){return c.jsxs("div",{className:"px-3 py-2.5 border-b border-border/50",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:t.date}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Session ",t.session_number]}),t.feature_code&&c.jsx(zs,{kind:"feature",id:t.feature_code})]}),t.summary&&c.jsx("div",{className:"text-xs text-foreground mt-0.5 font-medium",children:t.summary}),c.jsx("div",{className:"mt-1.5 space-y-1.5",children:bS.map(([e,r])=>{var n;return(n=t.sections)!=null&&n[e]?c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:r}),c.jsx(Qc,{content:t.sections[e],className:"prose prose-invert prose-sm max-w-none text-xs"})]},e):null})}),t.closing_line&&c.jsx("div",{className:"mt-1.5 text-[11px] italic text-muted-foreground",children:t.closing_line})]})}function vY({entry:t}){return c.jsxs("div",{className:"px-3 py-2.5 border-b border-border/50",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:t.date_or_version}),t.code&&c.jsx(zs,{kind:"feature",id:t.code})]}),t.summary&&c.jsx("div",{className:"text-xs text-foreground mt-0.5 font-medium",children:t.summary}),t.body&&c.jsx("div",{className:"mt-1",children:c.jsx(Qc,{content:t.body,className:"prose prose-invert prose-sm max-w-none text-xs"})})]})}const wY=["A","B","C","D","E","F","G","H"];function SY({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)?wY[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(ca,{style:{width:14,height:14}}):c.jsx(t_,{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 TY(){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}=Wn(),[x,g]=k.useState(""),[y,C]=k.useState(null),[b,w]=k.useState(""),_=k.useRef(null),S=b0();k.useEffect(()=>(Wn.setState({scope:null,featureCode:null}),a(),()=>p()),[]),k.useEffect(()=>{var W;(W=_.current)==null||W.scrollIntoView({behavior:"smooth"})},[e,s]);const N=k.useCallback(()=>{x.trim()&&(h(x.trim()),g(""))},[x,h]),L=k.useCallback((W,D)=>{C({messageIndex:D,cardId:W})},[]),A=k.useCallback(()=>{y&&(u(y.cardId,b||null,y.messageIndex),C(null),w(""))},[y,b,u]),j=n==="streaming"||n==="summarizing",I=e.reduce((W,D,M)=>D.role==="assistant"&&D.content&&uS(D.content).parts.some(F=>F.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(Nf,{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,D)=>c.jsx(c0,{messageIndex:D,message:W,onCardSelect:L,selectedCard:y,isStreaming:j,cardsDisabled:j||D!==I},D)),s&&c.jsx(c0,{message:s,onCardSelect:L,selectedCard:y,isStreaming:j}),!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=>w(W.target.value),onKeyDown:W=>W.key==="Enter"&&A(),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:A,disabled:j,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),w("")},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&&N(),placeholder:j?"Waiting for response...":"Type a response...",disabled:j,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:N,disabled:j||!x.trim(),className:"px-3 py-1.5 rounded bg-accent text-accent-foreground disabled:opacity-50 transition-opacity",children:c.jsx(Vd,{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(Nf,{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(kc,{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 S({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 c0({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,h;const o=t.role==="human",a=!o&&t.content?uS(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(SY,{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 _Y=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),jY=new Set(["WebSearch","web_search"]);function NY({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 EY(){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 BY(){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 pu({title:t,count:e,defaultExpanded:r,children:n}){const[i,s]=k.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(NY,{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 ol(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function h0(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function LY({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>_Y.has(o.tool)),n=t.filter(o=>jY.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return c.jsx(Hn,{className:"flex-1",children:c.jsxs("div",{children:[c.jsx(pu,{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(EY,{}):c.jsx(BY,{})}),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(pu,{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:ol(h0(o.tool,o.input),50)})]}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:ol(o.summary,100)})]},a))})}),c.jsx(pu,{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:ol(h0(o.tool,o.input),80)}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:ol(o.summary,100)})]},a))})})]})})}function AY({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=k.useState("decisions"),o=t.filter(h=>!h.superseded).length,a=Wn(h=>h.researchItems)||[],l=Wn(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(Hn,{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(LY,{researchItems:a,topicOutline:l})]})}function MY(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function IY(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 FY(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 PY=320,DY=40,OY={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function CS(t){return t?`compose:${t}:openLoopsCollapsed`:null}function u0(t){const e=CS(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function $Y(t,e){const r=CS(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function RY({onConfirm:t,onCancel:e}){const[r,n]=k.useState("deferred"),[i,s]=k.useState(""),[o,a]=k.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 zY({loop:t,onResolve:e,nowMs:r}){const n=FY(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:OY[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.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:6},children:[t.parent_feature&&c.jsx(zs,{kind:"feature",id:t.parent_feature,label:t.parent_feature,className:"text-[10px]"}),c.jsx("span",{style:{fontSize:10,color:"#6c7086"},children:IY(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 WY({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var y,C;const i=b0(),[s,o]=k.useState(()=>u0(t)),[a,l]=k.useState(!1),[h,u]=k.useState(()=>Date.now());k.useEffect(()=>{const b=setInterval(()=>u(Date.now()),6e4);return()=>clearInterval(b)},[]),k.useEffect(()=>{o(u0(t))},[t]);const d=k.useCallback(()=>{o(b=>{const w=!b;return $Y(t,w),w})},[t]),f=k.useMemo(()=>!t||!e?null:e.find(b=>{var w;return((w=b.lifecycle)==null?void 0:w.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=k.useMemo(()=>MY(p.filter(b=>b.resolution==null)),[p]),x=k.useCallback(async b=>{if(l(!1),r)try{await r(t,b)}catch(w){console.error("[OpenLoopsPanel] addLoop failed:",w.message),se(`Could not add loop: ${w.message}`,"error")}},[t,r]),g=k.useCallback(async b=>{if(n){const w=await i({title:"Resolve note",label:"(optional)"});if(w===null)return;try{await n(t,b,{note:w})}catch(_){console.error("[OpenLoopsPanel] resolveLoop failed:",_.message),se(`Could not resolve loop: ${_.message}`,"error")}}},[t,n,i]);return t?s?c.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:DY,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:PY,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(zY,{loop:b,onResolve:g,nowMs:h},b.id))})]}),a&&c.jsx(RY,{onConfirm:x,onCancel:()=>l(!1)})]}):null}const Yi={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},qY=new Set(["blocks","informs"]);function d0(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 HY(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function UY(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=Yi.error;else if(o==="running"){const h=a&&a.endsWith("_gate"),u=d0(e,s);h&&u&&n.some(f=>f.itemId===u.id&&!f.resolvedAt)?i[s]=Yi.gate_pending:i[s]=Yi.building}const l=d0(e,s);if(l&&(i[s]===Yi.building||i[s]===Yi.gate_pending)){const h=new Set([l.id]),u=YY(h,r),d=new Map(e.map(f=>[f.id,HY(f)]));for(const f of u){const p=d.get(f);p&&!i[p]&&(i[p]=Yi.blocked_downstream)}}return i}function YY(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)qY.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 VY(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=C_[h]||"#3b82f6";r.push({data:{id:`agent-${l.agentId}`,label:`${h}
|
|
706
|
-
${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 Cr extends Rt.Component{constructor(){super(...arguments);re(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 GY extends Rt.Component{constructor(){super(...arguments);re(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($0,{})})]}):this.props.children}}const Id="compose:fontSize",XY="compose:theme",Ho=13,Fd=10,Pd=20;function KY(){try{const t=parseInt(localStorage.getItem(Id),10);return t>=Fd&&t<=Pd?t:Ho}catch{return Ho}}const p0=new URLSearchParams(window.location.search).get("popout");function QY(){return p0?c.jsx(Eq,{path:p0}):c.jsx(GY,{children:c.jsx(JY,{})})}function ZY({activeView:t,items:e,filteredItems:r,phaseFilteredItems:n,phaseFilteredGates:i,connections:s,filteredConnections:o,sessions:a,activeBuild:l,pipelineDraft:h,buildHistory:u,gates:d,settings:f,selectedPhase:p,selectedItemId:m,buildStateMap:x,agentOverlay:g,spawnedAgents:y,agentRelays:C,docsSelectedFile:b,onDocsSelectedFileChange:w,docsPreviousView:_,onDocsBack:S,visibleTracks:N,hiddenGroups:L,onSelect:A,onUpdate:j,onCreate:I,onCreateFeature:z,isEmptyProject:W,onDelete:D,onOpenGate:M,onCreateConnection:F,onDeleteConnection:O,onRefreshBuild:$,onSelectStep:B,onResolveGate:T,onUpdateSettings:V,onResetSettings:rt,projectRoot:P,featureCode:X,focusActive:ut,onToggleFocus:xt,sessionState:Dt,agentActivity:Wt,iterationStates:lt,focusedGateId:K,onFocusHandled:it}){switch(t){case"dashboard":return c.jsx(tY,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:y,featureCode:X,sessionState:Dt,agentActivity:Wt,iterationStates:lt,onSelect:A,onResolveGate:T,onOpenGate:M,onCreateFeature:z,isEmptyProject:W});case"tree":return c.jsx(ub,{items:r,connections:o,selectedItemId:m,onSelect:A,onCreate:I,onCreateFeature:z,isEmptyProject:W,featureCode:X,focusActive:ut,onToggleFocus:xt});case"graph":return c.jsx(pb,{items:e,connections:s,selectedItemId:m,onSelect:A,onCreateFeature:z,isEmptyProject:W,visibleTracks:N,hiddenGroups:L,buildStateMap:x,resolveGate:T,gates:d,spawnedAgents:y,agentRelays:C,agentOverlay:g,featureCode:X,focusActive:ut,onToggleFocus:xt});case"pipeline":return c.jsx(U2,{activeBuild:l,pipelineDraft:h,onSelectStep:B,onRefresh:$});case"sessions":return c.jsx(Z2,{sessions:a,items:e,onSelectItem:A,featureCode:X,focusActive:ut,onToggleFocus:xt});case"build-history":return c.jsx(vU,{builds:u,items:e,onSelectItem:A});case"gates":return c.jsx(z2,{gates:i,items:n,onResolve:T,onSelect:A,featureCode:X,focusActive:ut,onToggleFocus:xt,focusedGateId:K,onFocusHandled:it});case"docs":return c.jsx($2,{items:n,selectedFile:b,onSelectedFileChange:w,previousView:_,onBack:S,featureCode:X,focusActive:ut,onToggleFocus:xt});case"design":return c.jsx(TY,{},P);case"ideabox":return c.jsx(yY,{});case"journal":return c.jsx(bY,{});case"settings":return c.jsx(H2,{settings:f,onSettingsChange:V,onReset:rt});case"stratum":return c.jsx(Dq,{});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 JY(){const{refresh:t}=PS(),e=Wn(U=>U.decisions),r=Wn(U=>U.status),[n,i]=k.useState(KY),[s,o]=k.useState(()=>document.documentElement.classList.contains("dark")),[a]=k.useState(mU),[l,h]=k.useState(()=>gU(a)),[u,d]=k.useState(Xq),[f,p]=k.useState(xU),[m,x]=k.useState(bU),[g,y]=k.useState(null),[C,b]=k.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[w,_]=k.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:S,connections:N,connected:L,uiCommand:A,clearUICommand:j,recentChanges:I,createItem:z,updateItem:W,deleteItem:D,createConnection:M,deleteConnection:F,agentActivity:O,agentErrors:$,spawnedAgents:B,agentRelays:T,sessionState:V,registerSnapshotProvider:rt,gates:P,gateEvent:X,resolveGate:ut,settings:xt,updateSettings:Dt,resetSettings:Wt,activeBuild:lt,setActiveBuild:K,pipelineDraft:it,sessions:wt,iterationStates:gt,buildHistory:Jt,fetchBuildHistory:It,selectedPhase:Xt,setSelectedPhase:Ae,statusSnapshots:Kt,setStatusSnapshot:yr}=fr(Bi(U=>({items:U.items,connections:U.connections,connected:U.connected,uiCommand:U.uiCommand,clearUICommand:U.clearUICommand,recentChanges:U.recentChanges,createItem:U.createItem,updateItem:U.updateItem,deleteItem:U.deleteItem,createConnection:U.createConnection,deleteConnection:U.deleteConnection,agentActivity:U.agentActivity,agentErrors:U.agentErrors,spawnedAgents:U.spawnedAgents,agentRelays:U.agentRelays,sessionState:U.sessionState,registerSnapshotProvider:U.registerSnapshotProvider,gates:U.gates,gateEvent:U.gateEvent,resolveGate:U.resolveGate,settings:U.settings,updateSettings:U.updateSettings,resetSettings:U.resetSettings,activeBuild:U.activeBuild,setActiveBuild:U.setActiveBuild,pipelineDraft:U.pipelineDraft,sessions:U.sessions,iterationStates:U.iterationStates,buildHistory:U.buildHistory,fetchBuildHistory:U.fetchBuildHistory,selectedPhase:U.selectedPhase,setSelectedPhase:U.setSelectedPhase,statusSnapshots:U.statusSnapshots,setStatusSnapshot:U.setStatusSnapshot}))),he=(V==null?void 0:V.featureCode)||null;k.useEffect(()=>{he&&(Kt&&Kt[he]||jt(`/api/lifecycle/status?featureCode=${encodeURIComponent(he)}`).then(U=>U.json()).then(U=>{U!=null&&U.snapshot&&yr&&yr(he,U.snapshot)}).catch(()=>{}))},[he,Kt,yr]);const[Ie,We]=k.useState(null),ue=k.useRef(!!localStorage.getItem("compose:activeView")),[q,J]=k.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[H,et]=k.useState(""),at=k.useCallback(U=>{b(U),localStorage.setItem("compose:contextWidthPx",String(Math.round(U)))},[]),ft=k.useRef(!1),_t=k.useCallback(U=>{U.preventDefault(),ft.current=!0;const dt=ee=>{if(!ft.current)return;const lr=ee.clientX-16,Zs=Math.max(160,Math.min(window.innerWidth*.4,lr));_(Zs),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(Zs)))},pt=()=>{ft.current=!1,document.removeEventListener("mousemove",dt),document.removeEventListener("mouseup",pt)};document.addEventListener("mousemove",dt),document.addEventListener("mouseup",pt)},[]),[te,fe]=k.useState(null),[we,qe]=k.useState(null),[me,ge]=k.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[ce,Fe]=k.useState(()=>{try{const U=localStorage.getItem("compose:visibleTracks");if(U){const dt=JSON.parse(U);return new Set(dt)}}catch{}return null}),[Ws,Sa]=k.useState(new Set),[qs,Li]=k.useState(!1),Ai=k.useCallback(U=>{Sa(dt=>{const pt=new Set(dt);return pt.has(U)?pt.delete(U):pt.add(U),pt})},[]),[Zn,Tr]=k.useState(null),[Sn,an]=k.useState(!1),[Hs,Mi]=k.useState(!1),[Ta,Ii]=k.useState("task"),[_a,Fi]=k.useState(!1),[Jc,Tn]=k.useState(!1),[th,ja]=k.useState(""),[de,ln]=k.useState("");k.useEffect(()=>{jt("/api/project").then(U=>U.json()).then(U=>{ja(U.name||""),ln(U.targetRoot||"")}).catch(()=>{})},[]);const eh=k.useCallback(async U=>{try{const pt=await(await jt("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:U})})).json();return pt.ok?(await t(),ja(pt.name),ln(pt.targetRoot),!0):!1}catch{return!1}},[t]),Us=u===Ve.MAXIMIZED,Ys=k.useCallback(U=>{h(U),Qx(U),J(U)},[]),Ne=k.useCallback(U=>{J(U),h(U),Qx(U)},[]);k.useEffect(()=>{localStorage.setItem("compose:activeView",q),q!=="docs"&&(qe(null),fe(null))},[q]),k.useEffect(()=>{me?localStorage.setItem("compose:selectedTrack",me):localStorage.removeItem("compose:selectedTrack")},[me]),k.useEffect(()=>{Ie?sessionStorage.setItem("vision-selectedItemId",Ie):sessionStorage.removeItem("vision-selectedItemId")},[Ie]),k.useEffect(()=>{try{ce?localStorage.setItem("compose:visibleTracks",JSON.stringify([...ce])):localStorage.removeItem("compose:visibleTracks")}catch{}},[ce]);const Vs=k.useRef(!1);k.useEffect(()=>{var U;Vs.current||ue.current||(U=xt==null?void 0:xt.ui)!=null&&U.defaultView&&(Ne(xt.ui.defaultView),Vs.current=!0)},[xt]),k.useEffect(()=>{A&&(A.view&&Ne(A.view),A.phase!==void 0&&Ae(A.phase),A.select!==void 0&&or(A.select),j())},[A,j]),k.useEffect(()=>{const U=()=>{var pt;return["INPUT","TEXTAREA","SELECT"].includes((pt=document.activeElement)==null?void 0:pt.tagName)},dt=pt=>{(pt.metaKey||pt.ctrlKey)&&pt.key==="k"&&(pt.preventDefault(),an(ee=>!ee)),(pt.metaKey||pt.ctrlKey)&&pt.key==="n"&&(pt.preventDefault(),Mi(!0)),pt.key===","&&!pt.metaKey&&!pt.ctrlKey&&!U()&&Fi(!0)};return window.addEventListener("keydown",dt),()=>window.removeEventListener("keydown",dt)},[]);const Jn=k.useMemo(()=>{let U=S;if(Xt&&(U=U.filter(dt=>dt.phase===Xt)),me&&(U=U.filter(dt=>{const pt=(dt.description||"").match(/Track:\s*(\w+)/i);return pt&&pt[1].toLowerCase()===me})),H){const dt=H.toLowerCase();U=U.filter(pt=>pt.title.toLowerCase().includes(dt)||(pt.description||"").toLowerCase().includes(dt))}return U},[S,Xt,me,H]),Gs=k.useMemo(()=>Xt?S.filter(U=>U.phase===Xt):S,[S,Xt]),Na=k.useMemo(()=>new Set(Gs.map(U=>U.id)),[Gs]),rh=k.useMemo(()=>Xt?P.filter(U=>Na.has(U.itemId)):P,[P,Na,Xt]),Hr=k.useMemo(()=>{if(!Xt&&!me&&!H)return N;const U=new Set(Jn.map(dt=>dt.id));return N.filter(dt=>U.has(dt.fromId)&&U.has(dt.toId))},[N,Jn,Xt,me,H]),Ea=k.useMemo(()=>UY(lt,S,N,P),[lt,S,N,P]),cn=k.useMemo(()=>VY(B,T),[B,T]),Ze=k.useCallback(U=>{y(U)},[]),or=k.useCallback(U=>{We(dt=>dt===U?(Ze(null),null):(Ze({type:"item",id:U}),U))},[Ze]),Ba=k.useCallback(async U=>{try{const dt=await jt(`/api/agent/${U}/stop`,{method:"POST",headers:Dr({"Content-Type":"application/json"})});dt.ok||se(`Could not stop agent (${dt.status})`,"error")}catch(dt){console.error(`[App] Failed to stop agent ${U}:`,dt.message),se(`Could not stop agent: ${dt.message}`,"error")}},[]),Xs=k.useRef(lt);k.useEffect(()=>{!Xs.current&<&<.featureItemId&&or(lt.featureItemId),Xs.current=lt},[lt]);const _n=k.useCallback(U=>{if(!U)return;const dt=S.find(pt=>{var ee,lr;return((ee=pt.lifecycle)==null?void 0:ee.featureCode)===U||pt.featureCode===U||pt.feature_code===U||((lr=pt.title)==null?void 0:lr.includes(U))});dt&&or(dt.id)},[S,or]);k.useEffect(()=>{const U=dt=>{const{featureCode:pt}=dt.detail||{};pt&&_n(pt)};return window.addEventListener("compose:select-feature",U),()=>window.removeEventListener("compose:select-feature",U)},[_n]);const jn=k.useCallback(U=>S.find(dt=>{var pt;return((pt=dt.lifecycle)==null?void 0:pt.featureCode)===U})||null,[S]),Pi=k.useCallback(async(U,dt)=>{const pt=jn(U);if(!pt)throw new Error(`No item found for feature ${U}`);const ee=await jt(`/api/vision/items/${pt.id}/loops`,{method:"POST",headers:Dr({"Content-Type":"application/json"}),body:JSON.stringify(dt)});if(!ee.ok)throw new Error(`Add loop failed: ${ee.status}`)},[jn]),Nn=k.useCallback(async(U,dt,{note:pt})=>{const ee=jn(U);if(!ee)throw new Error(`No item found for feature ${U}`);const lr=await jt(`/api/vision/items/${ee.id}/loops/${dt}/resolve`,{method:"POST",headers:Dr({"Content-Type":"application/json"}),body:JSON.stringify({note:pt})});if(!lr.ok)throw new Error(`Resolve loop failed: ${lr.status}`)},[jn]);k.useEffect(()=>{rt(()=>({activeView:q,selectedPhase:Xt,searchQuery:H,selectedItemId:Ie,totalItems:S.length,filteredCount:Jn.length,connected:L}))},[rt,q,Xt,H,Ie,S.length,Jn.length,L]),k.useEffect(()=>{const U=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return U.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>U.disconnect()},[]),k.useEffect(()=>{g&&!m&&(x(!0),Zx(!0))},[g]),k.useEffect(()=>{q==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[q]),k.useEffect(()=>{q==="build-history"&&It()},[q,It]);const ti=k.useCallback(()=>{const U=s?"light":"dark";document.documentElement.classList.toggle("dark",U==="dark"),localStorage.setItem(XY,U),jt("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:U}})}).catch(()=>{})},[s]),_r=k.useCallback(U=>{i(dt=>{const pt=Math.min(Math.max(dt+U,Fd),Pd);return localStorage.setItem(Id,pt),pt})},[]),nh=k.useCallback(()=>{i(Ho),localStorage.setItem(Id,Ho)},[]),ih=k.useCallback(U=>{d(U),Kq(U)},[]),La=k.useCallback(()=>{p(U=>(yU(!U),!U))},[]),Aa=k.useCallback(()=>{x(U=>(Zx(!U),!U))},[]),Ma=k.useCallback((U,dt)=>{W(U,dt)},[W]),Ia=k.useCallback(async()=>{const dt=await z({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Xt||"vision"});dt&&dt.id&&or(dt.id)},[z,Xt]),sh=k.useCallback(()=>{Ii("feature"),Mi(!0)},[]),oh=S.length===0,Fa=k.useCallback(async U=>{await D(U),Ie===U&&(We(null),Ze(null))},[D,Ie,Ze]),En=k.useCallback(U=>{const dt=P.find(pt=>pt.id===U);dt&&(We(dt.itemId),Ze({type:"item",id:dt.itemId}))},[P,Ze]),[Ks,ht]=k.useState(null),R=k.useCallback(U=>{P.find(pt=>pt.id===U)&&(Ae(null),Li(!1),ht(U),Ne("gates"))},[P,Ae,Li,Ne]),G=k.useCallback(()=>ht(null),[]),ct=k.useCallback(U=>{if(!U)return;const dt=S.find(pt=>{var ee;return pt.featureCode===U||pt.feature_code===U||((ee=pt.lifecycle)==null?void 0:ee.featureCode)===U});dt&&or(dt.id)},[S,or]),bt=k.useCallback((U,dt)=>{if(!dt)return!1;switch(U){case"gate":return P.some(pt=>pt.id===dt);case"item":return S.some(pt=>pt.id===dt);case"feature":return S.some(pt=>{var ee;return pt.featureCode===dt||pt.feature_code===dt||((ee=pt.lifecycle)==null?void 0:ee.featureCode)===dt});case"view":return!0;default:return!1}},[P,S]),$t=k.useMemo(()=>({openItem:or,openGate:R,openView:Ne,openFeature:ct,canNavigate:bt}),[or,R,Ne,ct,bt]),Ut=k.useCallback(async U=>M(U),[M]),Se=k.useCallback(async U=>F(U),[F]),be=k.useCallback(()=>{jt("/api/build/state").then(U=>U.json()).then(U=>K(U.state??null)).catch(()=>{})},[K]),ar=k.useCallback(U=>{Ze({type:"step",id:U})},[Ze]),He=k.useCallback(U=>{const dt=S.find(lr=>lr.id===U);if(!dt)return;const pt=(dt.description||"").match(/Track:\s*(\w+)/i),ee=pt?pt[1].toLowerCase():null;me&&ee&&me!==ee&&ge(null),ee&&ce&&!ce.has(ee)&&Fe(lr=>{const Zs=new Set(lr);return Zs.add(ee),Zs})},[S,me,ce]),Qs=k.useCallback(U=>{He(U),We(U),Ze({type:"item",id:U}),Ne("graph")},[Ne,Ze,He]),Pe=k.useCallback(U=>{He(U),We(U),Ze({type:"item",id:U}),Ne("tree")},[Ne,Ze,He]),kS=k.useCallback(U=>{qe(q),fe(U),Ne("docs")},[q,Ne]),vS=k.useCallback(()=>{we&&(Ne(we),qe(null),fe(null))},[we,Ne]);return c.jsx(lS.Provider,{value:$t,children:c.jsx(Nc.Provider,{value:I,children:c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[c.jsx(Cr,{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(Oq,{projectName:th,projectRoot:de,onSwitch:eh}),c.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:c.jsx(Rq,{tabs:a,activeTab:l,onTabChange:Ys,onOpenPalette:()=>an(U=>!U),badges:{gates:P.filter(U=>!U.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:()=>Tn(!0),title:"Pair mobile device","aria-label":"Pair mobile device",children:"📱"}),c.jsx("button",{className:"compose-btn-icon",onClick:ti,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:()=>_r(-1),disabled:n<=Fd,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:()=>_r(1),disabled:n>=Pd,title:"Increase font size",children:"A+"})]}),c.jsx("button",{className:"compose-btn-icon",onClick:nh,disabled:n===Ho,title:"Reset to default size",children:"100%"})]})]})}),c.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!Us&&c.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[c.jsx(Cr,{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:La,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:_t}),f&&(q==="design"?c.jsx(AY,{decisions:e,sessionComplete:r==="complete",onReviseDecision:U=>Wn.getState().reviseDecision(U),widthPx:w}):c.jsx(cb,{items:S,gates:P,activeBuild:lt,onViewChange:Ne,selectedPhase:Xt,onPhaseSelect:Ae,selectedTrack:me,onTrackSelect:ge,visibleTracks:ce,onToggleVisibleTrack:(U,dt)=>Fe(pt=>{if(!pt){const lr=new Set(dt);return lr.delete(U),lr}const ee=new Set(pt);return ee.has(U)?ee.delete(U):ee.add(U),dt&&ee.size>=dt.length?null:ee}),onShowAllTracks:()=>Fe(null),hiddenGroups:Ws,onToggleGroup:Ai,searchQuery:H,onSearchChange:et,connected:L,agentActivity:O,agentErrors:$,spawnedAgents:B,agentRelays:T,sessionState:V,onSelectItem:or,onStopAgent:Ba,onThemeChange:Dt,onNewItem:()=>Mi(!0),widthPx:w}))]})}),c.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[c.jsx(iS,{featureCode:he,snapshot:he?(Kt==null?void 0:Kt[he])??null:null}),he&&c.jsx(nS,{currentFeatureCode:he}),c.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:c.jsx(Cr,{children:c.jsx(ZY,{activeView:q,items:S,filteredItems:Jn,phaseFilteredItems:Gs,phaseFilteredGates:rh,connections:N,filteredConnections:Hr,sessions:wt,buildHistory:Jt,activeBuild:lt,pipelineDraft:it,gates:P,settings:xt,selectedPhase:Xt,selectedItemId:Ie,onSelect:or,onUpdate:Ma,onCreate:Ia,onCreateFeature:sh,isEmptyProject:oh,onDelete:Fa,onOpenGate:En,onCreateConnection:Ut,onDeleteConnection:Se,onRefreshBuild:be,onSelectStep:ar,onResolveGate:ut,onUpdateSettings:Dt,onResetSettings:Wt,visibleTracks:ce,hiddenGroups:Ws,buildStateMap:Ea,agentOverlay:cn,spawnedAgents:B,agentRelays:T,docsSelectedFile:te,onDocsSelectedFileChange:fe,docsPreviousView:we,onDocsBack:vS,projectRoot:de,featureCode:he,focusActive:qs,onToggleFocus:()=>Li(U=>!U),sessionState:V,agentActivity:O,iterationStates:gt,focusedGateId:Ks,onFocusHandled:G})})})]}),q!=="docs"&&c.jsx(Cr,{children:c.jsxs(iH,{isOpen:m,onToggle:Aa,widthPx:C,onResizePx:at,activeBuild:lt,gates:P,agentErrors:$,items:S,children:[(g==null?void 0:g.type)==="item"&&c.jsx(UH,{itemId:g.id,onSelect:U=>{y({type:"item",id:U}),We(U)},onClose:()=>{y(null),We(null)},onOpenFile:kS,onViewInGraph:Qs,onViewInTree:Pe}),(g==null?void 0:g.type)==="step"&&c.jsx(tU,{stepId:g.id,tierEvents:lt==null?void 0:lt.tierEvents,healthEvents:(lt==null?void 0:lt.health_score)!=null?[{score:lt.health_score,breakdown:lt.health_breakdown,missing:lt.health_missing}]:void 0,capabilityEvents:lt==null?void 0:lt.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&c.jsx(rU,{})]})}),he&&q!=="docs"&&c.jsx(Cr,{zone:"open loops panel",children:c.jsx(WY,{featureCode:he,items:S,onAddLoop:Pi,onResolveLoop:Nn})})]}),c.jsx(Cr,{zone:"ops strip",children:c.jsx(uU,{activeView:q,onSelectFeature:_n})}),c.jsx(Cr,{zone:"agent bar",children:c.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",Us?"flex-1 min-h-0":Gq(u)].join(" "),children:c.jsx(Jq,{barState:u,onStateChange:ih})})})]}),c.jsx(Cr,{zone:"notifications",children:c.jsx(BS,{})}),c.jsx(Cr,{zone:"gate notifications",children:c.jsx(rS,{onOpenGate:En})}),c.jsx(Cr,{zone:"challenge modal",children:Zn&&(()=>{const U=S.find(dt=>dt.id===Zn);return U?c.jsx(q2,{item:U,items:S,connections:N,onUpdate:Ma,onClose:()=>Tr(null)}):null})()}),c.jsx(W2,{event:X,items:S,onNavigate:()=>Ne("gates")}),c.jsx(Cr,{zone:"command palette",children:c.jsx(J2,{open:Sn,onClose:()=>an(!1),onSelectItem:U=>{or(U),an(!1)},onSelectGate:U=>{En(U),an(!1)}})}),c.jsx(Cr,{zone:"item form",children:c.jsx(tS,{open:Hs,initialType:Ta,onClose:()=>{Mi(!1),Ii("task")}})}),c.jsx(Cr,{zone:"settings",children:c.jsx(eS,{open:_a,onClose:()=>Fi(!1),settings:xt,onSettingsChange:Dt})}),c.jsx(sU,{open:Jc,onClose:()=>Tn(!1)})]})})})}const AV=Object.freeze(Object.defineProperty({__proto__:null,default:QY},Symbol.toStringTag,{value:"Module"}));export{Db as $,aV as A,Rn as B,E3 as C,ye as D,yI as E,sf as F,Tb as G,VO as H,QP as I,nO as J,wM as K,Xo as L,sV as M,zc as N,ZM as O,Fb as P,ng as Q,WP as R,Uu as S,YO as T,fa as U,Wr as V,Q as W,Z as X,oI as Y,OO as Z,v as _,dI as a,TV as a$,OP as a0,Pp as a1,uV as a2,fV as a3,Ri as a4,wg as a5,vg as a6,gV as a7,mV as a8,pV as a9,fO as aA,hO as aB,xO as aC,gk as aD,pO as aE,TO as aF,SO as aG,wO as aH,jO as aI,_O as aJ,dO as aK,xk as aL,yO as aM,gO as aN,mO as aO,yk as aP,sO as aQ,sr as aR,uo as aS,of as aT,Tk as aU,Si as aV,Ek as aW,gb as aX,D6 as aY,jV as aZ,EV as a_,cV as aa,hV as ab,dV as ac,yV as ad,xV as ae,FR as af,Lw as ag,NV as ah,Mt as ai,Zr as aj,vn as ak,ka as al,lR as am,aR as an,rf as ao,yt as ap,hR as aq,Qp as ar,Xp as as,xl as at,vO as au,kO as av,CO as aw,bO as ax,uO as ay,mk as az,uI as b,vt as b0,_V as b1,d6 as b2,a6 as b3,o6 as b4,$P as b5,iV as b6,Ap as b7,Pn as b8,Zo as b9,gg as ba,y4 as bb,kt as bc,Bk as bd,pr as be,u4 as bf,Lp as bg,Qb as bh,xa as bi,t1 as bj,lV as bk,N3 as bl,AV as bm,Qt as c,zt as d,Pb as e,Be as f,fI as g,yn as h,zr as i,lO as j,ma as k,nt as l,jk as m,oV as n,LV as o,mI as p,gI as q,BV as r,pI as s,iO as t,Pr as u,e6 as v,KO as w,bV as x,ws as y,hI as z};
|