@saluzi/saluzi-edu 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/cli.js +105 -95
  2. package/dist/rcs-web/assets/{AdminPanel-Bsimdm5Q.js → AdminPanel-B8BuW6U3.js} +1 -1
  3. package/{packages/remote-control-server/web/dist/assets/Claim-D-6HcIPy.js → dist/rcs-web/assets/Claim-Bc5MvUyK.js} +1 -1
  4. package/dist/rcs-web/assets/Dashboard-D8JkTUyb.js +1 -0
  5. package/{packages/remote-control-server/web/dist/assets/Join-HoIZ1jyc.js → dist/rcs-web/assets/Join-DZwoyeOG.js} +1 -1
  6. package/dist/rcs-web/assets/{Login-bLM4Zn4h.js → Login-BLCeIURz.js} +1 -1
  7. package/dist/rcs-web/assets/{Register-ByAIpM2v.js → Register-DlnIJyvt.js} +1 -1
  8. package/dist/rcs-web/assets/SessionDetail-Ok36DGag.js +55 -0
  9. package/dist/rcs-web/assets/{SessionVisibilityBadge-p6speHFz.js → SessionVisibilityBadge-BTFvePCl.js} +1 -1
  10. package/{packages/remote-control-server/web/dist/assets/Setup-BfTiM2jB.js → dist/rcs-web/assets/Setup-BmaS0cmR.js} +1 -1
  11. package/dist/rcs-web/assets/{ShareLanding-DGo_cLNv.js → ShareLanding-hSlUOwmY.js} +1 -1
  12. package/dist/rcs-web/assets/{TeamCreate-DuC03Q55.js → TeamCreate-DSvsAFm1.js} +1 -1
  13. package/dist/rcs-web/assets/TeamDetail-BCpILjkt.js +6 -0
  14. package/dist/rcs-web/assets/{TeamList-gTscY5gq.js → TeamList-ad3mm3hY.js} +1 -1
  15. package/dist/rcs-web/assets/{TeamSettings-Dvvn1zTh.js → TeamSettings-BWzNEVzI.js} +1 -1
  16. package/dist/rcs-web/assets/UserSearchInput-BMPx_a06.js +1 -0
  17. package/dist/rcs-web/assets/{UserSettings-TpFvBUH2.js → UserSettings-crJkXh-k.js} +1 -1
  18. package/dist/rcs-web/assets/{arc-cNQXzZJk.js → arc-D3D49Xtu.js} +1 -1
  19. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-C97K07oU.js → architectureDiagram-3BPJPVTR-B2FZDdv-.js} +1 -1
  20. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CCawpz6v.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-BSCtI5ja.js} +1 -1
  21. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-BT2wuHdt.js → c4Diagram-AAUBKEIU-9Jwp9YE4.js} +1 -1
  22. package/dist/rcs-web/assets/channel-Ks7us70E.js +1 -0
  23. package/dist/rcs-web/assets/{chunk-2J33WTMH-D7mXynqp.js → chunk-2J33WTMH-B7FEDH7A.js} +1 -1
  24. package/dist/rcs-web/assets/{chunk-4BX2VUAB-Cr6Ax9dk.js → chunk-4BX2VUAB-Ckz1_Kja.js} +1 -1
  25. package/dist/rcs-web/assets/{chunk-55IACEB6-D67JVqPZ.js → chunk-55IACEB6-QY67to6a.js} +1 -1
  26. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CVttzQWT.js → dist/rcs-web/assets/chunk-727SXJPM-CScpVqb2.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-AQP2D5EJ-fH3XrepF.js → chunk-AQP2D5EJ-Evavw2Qw.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-FMBD7UC4-CJQNdt2v.js → chunk-FMBD7UC4-CVuIoB79.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-ND2GUHAM-CcxkLR8x.js → chunk-ND2GUHAM-Bedyq8-J.js} +1 -1
  30. package/dist/rcs-web/assets/{chunk-QZHKN3VN--e3-i6Ei.js → chunk-QZHKN3VN-CslOfkQg.js} +1 -1
  31. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-D5Sj-C_X.js +1 -0
  32. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-D5Sj-C_X.js +1 -0
  33. package/dist/rcs-web/assets/{code-block-IT6T5CEO-D9lXU6hr.js → code-block-IT6T5CEO-bsC936tN.js} +1 -1
  34. package/dist/rcs-web/assets/{copy-DGJ36Idc.js → copy-DCC7RzR2.js} +1 -1
  35. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-hOIwi1aZ.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-Bk5jqkQe.js} +1 -1
  36. package/dist/rcs-web/assets/{dagre-BM42HDAG-BPQQ96TG.js → dagre-BM42HDAG-B-x8fR4m.js} +1 -1
  37. package/dist/rcs-web/assets/{diagram-2AECGRRQ-CLR_Phbu.js → diagram-2AECGRRQ-CsZv2Psb.js} +1 -1
  38. package/dist/rcs-web/assets/{diagram-5GNKFQAL-CLWnRjBK.js → diagram-5GNKFQAL-BcYXy7MO.js} +1 -1
  39. package/dist/rcs-web/assets/{diagram-KO2AKTUF-BL3D8pmI.js → diagram-KO2AKTUF-BjJST7Q-.js} +1 -1
  40. package/dist/rcs-web/assets/{diagram-LMA3HP47-OXbFOADC.js → diagram-LMA3HP47-BhzIJ5vj.js} +1 -1
  41. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-2k9pa530.js → dist/rcs-web/assets/diagram-OG6HWLK6-BKN4TotX.js} +1 -1
  42. package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-DMx7MReU.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-CEEcJ3no.js} +1 -1
  43. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-seK4rTjU.js → flowDiagram-I6XJVG4X-CGqPQbGE.js} +1 -1
  44. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-B89rGHgc.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-Byt7vWZu.js} +1 -1
  45. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-CZc1v0no.js → gitGraphDiagram-PVQCEYII-DL5rfdDX.js} +1 -1
  46. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-CeGh4MXv.js → infoDiagram-5YYISTIA-_uDdZSq3.js} +1 -1
  47. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-C0LJyHyd.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-oASsmQUS.js} +1 -1
  48. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-Dleh_HZM.js → journeyDiagram-JHISSGLW-BXJWUGGs.js} +1 -1
  49. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-Br8f2hg8.js → kanban-definition-UN3LZRKU-fvKiMkSD.js} +1 -1
  50. package/dist/rcs-web/assets/{linear-D7AT_2cB.js → linear-TM5xxJnF.js} +1 -1
  51. package/dist/rcs-web/assets/{main-DU4tqNTD.js → main-DrB3sbfk.js} +12 -12
  52. package/dist/rcs-web/assets/{mermaid-VLURNSYL-C1rDhYTC.js → mermaid-VLURNSYL-Dscj4u4i.js} +4 -4
  53. package/dist/rcs-web/assets/{mermaid.core-B6lZnoad.js → mermaid.core-Bcqfc2ey.js} +5 -5
  54. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-CLc9hYkr.js → mindmap-definition-RKZ34NQL-eXSVovf0.js} +1 -1
  55. package/{packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-BDZzTeXG.js → dist/rcs-web/assets/pieDiagram-4H26LBE5-C50JrIh-.js} +1 -1
  56. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-Crv3up_A.js → quadrantDiagram-W4KKPZXB-wXEhdATW.js} +1 -1
  57. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-BXnQO4WS.js → requirementDiagram-4Y6WPE33-DWBtLk9F.js} +1 -1
  58. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CjszWFSR.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CPsYFxLH.js} +1 -1
  59. package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-B1IqrmXj.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-C20Y3wg0.js} +1 -1
  60. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-DpnuIetC.js → stateDiagram-AJRCARHV-CZe6o8l_.js} +1 -1
  61. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-Doalz6kF.js → stateDiagram-v2-BHNVJYJU-Ztmndbls.js} +1 -1
  62. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-B6fL9WVp.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-BA9OhQiY.js} +1 -1
  63. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-NpYOQ9yd.js → vennDiagram-CIIHVFJN-CbkmNoMF.js} +1 -1
  64. package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-shB3lzpB.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-CaObqUdc.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-vdG6_jKc.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-CoYZ5isQ.js} +1 -1
  66. package/dist/rcs-web/index.html +1 -1
  67. package/package.json +1 -1
  68. package/packages/remote-control-server/src/__tests__/session-visibility.test.ts +74 -0
  69. package/packages/remote-control-server/src/__tests__/shares.test.ts +73 -3
  70. package/packages/remote-control-server/src/db/rcs-schema.sql +121 -0
  71. package/packages/remote-control-server/src/db/sqlite.ts +39 -10
  72. package/packages/remote-control-server/src/routes/web/control.ts +1 -1
  73. package/packages/remote-control-server/src/routes/web/sessions.ts +21 -1
  74. package/packages/remote-control-server/src/routes/web/shares.ts +4 -2
  75. package/packages/remote-control-server/src/services/session.ts +60 -0
  76. package/packages/remote-control-server/src/types/api.ts +2 -0
  77. package/packages/remote-control-server/web/dist/assets/{AdminPanel-Bsimdm5Q.js → AdminPanel-B8BuW6U3.js} +1 -1
  78. package/{dist/rcs-web/assets/Claim-D-6HcIPy.js → packages/remote-control-server/web/dist/assets/Claim-Bc5MvUyK.js} +1 -1
  79. package/packages/remote-control-server/web/dist/assets/Dashboard-D8JkTUyb.js +1 -0
  80. package/{dist/rcs-web/assets/Join-HoIZ1jyc.js → packages/remote-control-server/web/dist/assets/Join-DZwoyeOG.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Login-bLM4Zn4h.js → Login-BLCeIURz.js} +1 -1
  82. package/packages/remote-control-server/web/dist/assets/{Register-ByAIpM2v.js → Register-DlnIJyvt.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/SessionDetail-Ok36DGag.js +55 -0
  84. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-p6speHFz.js → SessionVisibilityBadge-BTFvePCl.js} +1 -1
  85. package/{dist/rcs-web/assets/Setup-BfTiM2jB.js → packages/remote-control-server/web/dist/assets/Setup-BmaS0cmR.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/{ShareLanding-DGo_cLNv.js → ShareLanding-hSlUOwmY.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/{TeamCreate-DuC03Q55.js → TeamCreate-DSvsAFm1.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/TeamDetail-BCpILjkt.js +6 -0
  89. package/packages/remote-control-server/web/dist/assets/{TeamList-gTscY5gq.js → TeamList-ad3mm3hY.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/{TeamSettings-Dvvn1zTh.js → TeamSettings-BWzNEVzI.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/UserSearchInput-BMPx_a06.js +1 -0
  92. package/packages/remote-control-server/web/dist/assets/{UserSettings-TpFvBUH2.js → UserSettings-crJkXh-k.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{arc-cNQXzZJk.js → arc-D3D49Xtu.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-C97K07oU.js → architectureDiagram-3BPJPVTR-B2FZDdv-.js} +1 -1
  95. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-CCawpz6v.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BSCtI5ja.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-BT2wuHdt.js → c4Diagram-AAUBKEIU-9Jwp9YE4.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/channel-Ks7us70E.js +1 -0
  98. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-D7mXynqp.js → chunk-2J33WTMH-B7FEDH7A.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-Cr6Ax9dk.js → chunk-4BX2VUAB-Ckz1_Kja.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-D67JVqPZ.js → chunk-55IACEB6-QY67to6a.js} +1 -1
  101. package/{dist/rcs-web/assets/chunk-727SXJPM-CVttzQWT.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CScpVqb2.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-fH3XrepF.js → chunk-AQP2D5EJ-Evavw2Qw.js} +1 -1
  103. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-CJQNdt2v.js → chunk-FMBD7UC4-CVuIoB79.js} +1 -1
  104. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CcxkLR8x.js → chunk-ND2GUHAM-Bedyq8-J.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN--e3-i6Ei.js → chunk-QZHKN3VN-CslOfkQg.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-D5Sj-C_X.js +1 -0
  107. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-D5Sj-C_X.js +1 -0
  108. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-D9lXU6hr.js → code-block-IT6T5CEO-bsC936tN.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{copy-DGJ36Idc.js → copy-DCC7RzR2.js} +1 -1
  110. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-hOIwi1aZ.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-Bk5jqkQe.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-BPQQ96TG.js → dagre-BM42HDAG-B-x8fR4m.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-CLR_Phbu.js → diagram-2AECGRRQ-CsZv2Psb.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-CLWnRjBK.js → diagram-5GNKFQAL-BcYXy7MO.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-BL3D8pmI.js → diagram-KO2AKTUF-BjJST7Q-.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-OXbFOADC.js → diagram-LMA3HP47-BhzIJ5vj.js} +1 -1
  116. package/{dist/rcs-web/assets/diagram-OG6HWLK6-2k9pa530.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-BKN4TotX.js} +1 -1
  117. package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-DMx7MReU.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-CEEcJ3no.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-seK4rTjU.js → flowDiagram-I6XJVG4X-CGqPQbGE.js} +1 -1
  119. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-B89rGHgc.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-Byt7vWZu.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-CZc1v0no.js → gitGraphDiagram-PVQCEYII-DL5rfdDX.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-CeGh4MXv.js → infoDiagram-5YYISTIA-_uDdZSq3.js} +1 -1
  122. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-C0LJyHyd.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-oASsmQUS.js} +1 -1
  123. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-Dleh_HZM.js → journeyDiagram-JHISSGLW-BXJWUGGs.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-Br8f2hg8.js → kanban-definition-UN3LZRKU-fvKiMkSD.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{linear-D7AT_2cB.js → linear-TM5xxJnF.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{main-DU4tqNTD.js → main-DrB3sbfk.js} +12 -12
  127. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-C1rDhYTC.js → mermaid-VLURNSYL-Dscj4u4i.js} +4 -4
  128. package/packages/remote-control-server/web/dist/assets/{mermaid.core-B6lZnoad.js → mermaid.core-Bcqfc2ey.js} +5 -5
  129. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-CLc9hYkr.js → mindmap-definition-RKZ34NQL-eXSVovf0.js} +1 -1
  130. package/{dist/rcs-web/assets/pieDiagram-4H26LBE5-BDZzTeXG.js → packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-C50JrIh-.js} +1 -1
  131. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-Crv3up_A.js → quadrantDiagram-W4KKPZXB-wXEhdATW.js} +1 -1
  132. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-BXnQO4WS.js → requirementDiagram-4Y6WPE33-DWBtLk9F.js} +1 -1
  133. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CjszWFSR.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CPsYFxLH.js} +1 -1
  134. package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-B1IqrmXj.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-C20Y3wg0.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-DpnuIetC.js → stateDiagram-AJRCARHV-CZe6o8l_.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-Doalz6kF.js → stateDiagram-v2-BHNVJYJU-Ztmndbls.js} +1 -1
  137. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-B6fL9WVp.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-BA9OhQiY.js} +1 -1
  138. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-NpYOQ9yd.js → vennDiagram-CIIHVFJN-CbkmNoMF.js} +1 -1
  139. package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-shB3lzpB.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-CaObqUdc.js} +1 -1
  140. package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-vdG6_jKc.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-CoYZ5isQ.js} +1 -1
  141. package/packages/remote-control-server/web/dist/index.html +1 -1
  142. package/dist/rcs-web/assets/Dashboard-C6G49-2O.js +0 -1
  143. package/dist/rcs-web/assets/SessionDetail-DbLnDhLO.js +0 -55
  144. package/dist/rcs-web/assets/TeamDetail-DQeJ56yT.js +0 -6
  145. package/dist/rcs-web/assets/channel-CElwc65q.js +0 -1
  146. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BYQJbP8Y.js +0 -1
  147. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BYQJbP8Y.js +0 -1
  148. package/packages/remote-control-server/web/dist/assets/Dashboard-C6G49-2O.js +0 -1
  149. package/packages/remote-control-server/web/dist/assets/SessionDetail-DbLnDhLO.js +0 -55
  150. package/packages/remote-control-server/web/dist/assets/TeamDetail-DQeJ56yT.js +0 -6
  151. package/packages/remote-control-server/web/dist/assets/channel-CElwc65q.js +0 -1
  152. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BYQJbP8Y.js +0 -1
  153. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BYQJbP8Y.js +0 -1
  154. /package/{packages/remote-control-server/src/db/schema.sql → dist/rcs-schema.sql} +0 -0
@@ -1,4 +1,4 @@
1
- import{e as Gt,b0 as Wt,a1 as Kt,a5 as Ht,b3 as Yt,a2 as Xt,b1 as Zt,b as S,a3 as St,a$ as Jt,a_ as rt,l as Qt,au as $t,az as te,L as ee,E as ne,t as se,s as ie,S as re}from"./mermaid.core-B6lZnoad.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-C1rDhYTC.js";import"./main-DU4tqNTD.js";import"./motion-BILbV7YQ.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=ae(t),e=s.filter(c=>oe(c,t));let i=0,r=0;const o=[];if(e.length>1){const c=Tt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-c.x,a.y-c.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(f.parentIndex.includes(a.parentIndex[m])){const x=t[a.parentIndex[m]],M=Math.atan2(a.x-x.x,a.y-x.y),T=Math.atan2(f.x-x.x,f.y-x.y);let _=T-M;_<0&&(_+=2*Math.PI);const w=T-_/2;let g=W(y,{x:x.x+x.radius*Math.sin(w),y:x.y+x.radius*Math.cos(w)});g>x.radius*2&&(g=x.radius*2),(d==null||d.width>g)&&(d={circle:x,width:g,p1:a,p2:f,large:g>x.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),f=a)}}else{let c=t[0];for(let u=1;u<t.length;++u)t[u].radius<c.radius&&(c=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(W(t[u],c)>Math.abs(c.radius-t[u].radius)){f=!0;break}f?i=r=0:(i=c.radius*c.radius*Math.PI,o.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-_t,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function oe(t,n){return n.every(s=>W(t,s)<s.radius+_t)}function ae(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Et(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function W(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Et(t,n){const s=W(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),c=t.x+r*(n.x-t.x)/s,f=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:c+u,y:f-a},{x:c-u,y:f+a}]}function Tt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function le(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),c=t(s);let f=s-n;if(o*c>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(c===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*o>=0&&(n=a),Math.abs(f)<r||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,c=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,x=new Array(m+1);x[0]=n,x[0].fx=t(n),x[0].id=0;for(let v=0;v<m;++v){const l=n.slice();l[v]=l[v]?l[v]*i:r,x[v+1]=l,x[v+1].fx=t(l),x[v+1].id=v+1}function M(v){for(let l=0;l<v.length;l++)x[m][l]=v[l];x[m].fx=v.fx}const T=(v,l)=>v.fx-l.fx,_=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(x.sort(T),s.history){const p=x.map(h=>{const j=h.slice();return j.fx=h.fx,j.id=h.id,j});p.sort((h,j)=>h.id-j.id),s.history.push({x:x[0].slice(),fx:x[0].fx,simplex:p})}d=0;for(let p=0;p<m;++p)d=Math.max(d,Math.abs(x[0][p]-x[1][p]));if(Math.abs(x[0].fx-x[m].fx)<o&&d<c)break;for(let p=0;p<m;++p){_[p]=0;for(let h=0;h<m;++h)_[p]+=x[h][p];_[p]/=m}const l=x[m];if(Q(w,1+f,_,-f,l),w.fx=t(w),w.fx<x[0].fx)Q(b,1+u,_,-u,l),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=x[m-1].fx){let p=!1;if(w.fx>l.fx?(Q(g,1+a,_,-a,l),g.fx=t(g),g.fx<l.fx?M(g):p=!0):(Q(g,1-a*f,_,a*f,l),g.fx=t(g),g.fx<w.fx?M(g):p=!0),p){if(y>=1)break;for(let h=1;h<x.length;++h)Q(x[h],1-y,x[0],y,x[h]),x[h].fx=t(x[h])}}else M(w)}return x.sort(T),{fx:x[0].fx,x:x[0]}}function ce(t,n,s,e,i,r,o){const c=s.fx,f=tt(s.fxprime,n);let u=c,a=c,y=f,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(x,M,T){for(let _=0;_<16;++_)if(i=(x+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||u>=T)M=i;else{if(Math.abs(y)<=-o*f)return i;y*(M-x)>=0&&(M=x),x=i,T=u}return 0}for(let x=0;x<10;++x){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||x&&u>=a)return m(d,i,a);if(Math.abs(y)<=-o*f)return i;if(y>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function ue(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,c,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ce(t,o,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const y=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/y);Q(o,d,o,-1,i.fxprime),c=e,e=i,i=c}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||ge,e=n.lossFunction||et,i=he(t,n),r=s(i,n),o=Object.keys(r),c=[];for(const a of o)c.push(r[a].x),c.push(r[a].y);const u=zt(a=>{const y={};for(let d=0;d<o.length;++d){const m=o[d];y[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(y,i)},c,n).x;for(let a=0;a<o.length;++a){const y=o[a];r[y].x=u[2*a],r[y].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):le(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(c=>Object.assign({},c));function i(c){return c.join(";")}if(s){const c=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);c.set(a,f.size+(c.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const d=String(f.sets[y]),m=`${a};${d}`,x=`${d};${a}`;c.set(m,f.size+(c.get(m)||0)),c.set(x,f.size+(c.get(x)||0))}}for(const f of e)f.sets.length<3&&(f.size=c.get(i(f.sets)))}const r=[],o=new Set;for(const c of e)if(c.sets.length===1)r.push(c.sets[0]);else if(c.sets.length===2){const f=c.sets[0],u=c.sets[1];o.add(i(c.sets)),o.add(i([u,f]))}r.sort((c,f)=>c===f?0:c<f?-1:1);for(let c=0;c<r.length;++c){const f=r[c];for(let u=c+1;u<r.length;++u){const a=r[u];o.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function fe(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],c=s[r.sets[1]],f=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[c].size/Math.PI),a=ft(f,u,r.size);e[o][c]=e[c][o]=a;let y=0;r.size+1e-10>=Math.min(n[o].size,n[c].size)?y=1:r.size<=1e-10&&(y=-1),i[o][c]=i[c][o]=y}),{distances:e,constraints:i}}function de(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],c=t[2*r+1];for(let f=r+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[r][f],d=e[r][f],m=(u-o)*(u-o)+(a-c)*(a-c),x=Math.sqrt(m),M=m-y*y;d>0&&x<=y||d<0&&x>=y||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(c-a),n[2*f]+=4*M*(u-o),n[2*f+1]+=4*M*(a-c))}}return i}function ge(t,n={}){let s=ye(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=xe(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function xe(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=fe(t,e,i);const c=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/c));const f=(d,m)=>de(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),x=ue(f,m,n);(!u||x.fx<u.fx)&&(u=x)}const a=u.x,y={};for(let d=0;d<e.length;++d){const m=e[d];y[m.sets[0]]={x:a[2*d]*c,y:a[2*d+1]*c,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,c);return y}function ye(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const y of t)if(y.sets.length===1){const d=y.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[d]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let d=y.weight!=null?y.weight:1;const m=y.sets[0],x=y.sets[1];y.size+Rt>=Math.min(e[m].size,e[x].size)&&(d=0),i[m].push({set:x,size:y.size,weight:d}),i[x].push({set:m,size:y.size,weight:d})}const r=[];Object.keys(i).forEach(y=>{let d=0;for(let m=0;m<i[y].length;++m)d+=i[y][m].size*i[y][m].weight;r.push({set:y,size:d})});function o(y,d){return d.size-y.size}r.sort(o);const c={};function f(y){return y.set in c}function u(y,d){e[d].x=y.x,e[d].y=y.y,c[d]=!0}u({x:0,y:0},r[0].set);for(let y=1;y<r.length;++y){const d=r[y].set,m=i[d].filter(f),x=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(x.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],l=ft(x.radius,v.radius,m[b].size),p=Et({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:l});M.push(...p)}}let T=1e50,_=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<T&&(T=g,_=w)}u(_,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],c=t[e.sets[1]];i=xt(o.radius,c.radius,W(o,c))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const c=t[e.sets[0]],f=t[e.sets[1]];i=xt(c.radius,f.radius,W(c,f))}else i=st(e.sets.map(c=>t[c]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function pe(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&W(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const c of t){const f=c.x,u=c.y;c.x=r*f-o*u,c.y=o*f+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function me(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),c=n(r);o.parent=c}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;W(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=me(e);for(const u of i){pe(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function c(u,a,y){if(!u)return;const d=u.bounds;let m,x;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(y)x=r.yRange.max-d.yRange.min+o;else{x=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(x+=M)}for(const M of u)M.x+=m,M.y+=x,e.push(M)}let f=1;for(;f<i.length;)c(i[f],!0,!1),c(i[f+1],!1,!0),c(i[f+2],!0,!0),f+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:c}=dt(r);if(o.max===o.min||c.max===c.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const m=Math.sqrt(i/Math.PI)*2;f=n/m,u=s/m}else f=n/(o.max-o.min),u=s/(c.max-c.min);const a=Math.min(u,f),y=(n-(o.max-o.min)*a)/2,d=(s-(c.max-c.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+y+(m.x-o.min)*a,y:e+d+(m.y-c.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function be(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,c=!0,f=null,u=!0,a=!0,y=null,d=null,m=!1,x=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,T={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(p){if(p in T)return T[p];var h=T[p]=_[w];return w+=1,w>=_.length&&(w=0),h},b=At,v=et;function l(p){let h=p.datum();const j=new Set;h.forEach(I=>{I.size==0&&I.sets.length==1&&j.add(I.sets[0])}),h=h.filter(I=>!I.sets.some(L=>j.has(L)));let k={},N={};if(h.length>0){let I=b(h,{lossFunction:v,distinct:m});c&&(I=Dt(I,o,d)),k=Nt(I,s,e,i,f),N=jt(k,h,M)}const Y={};h.forEach(I=>{I.label&&(Y[I.sets]=I.label)});function B(I){if(I.sets in Y)return Y[I.sets];if(I.sets.length==1)return""+I.sets[0]}p.selectAll("svg").data([k]).enter().append("svg");const U=p.select("svg");n?U.attr("viewBox",`0 0 ${s} ${e}`):U.attr("width",s).attr("height",e);const q={};let z=!1;U.selectAll(".venn-area path").each(function(I){const L=this.getAttribute("d");I.sets.length==1&&L&&!m&&(z=!0,q[I.sets[0]]=ke(L))});function A(I){return L=>{const G=I.sets.map(Z=>{let H=q[Z],J=k[Z];return H||(H={x:s/2,y:e/2,radius:1}),J||(J={x:s/2,y:e/2,radius:1}),{x:H.x*(1-L)+J.x*L,y:H.y*(1-L)+J.y*L,radius:H.radius*(1-L)+J.radius*L}});return wt(G,x)}}const C=U.selectAll(".venn-area").data(h,I=>I.sets),O=C.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),P=O.append("path"),V=O.append("text").attr("class","label").text(I=>B(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(P.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),V.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function R(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let E=p;z&&typeof E.transition=="function"?(E=R(p),E.selectAll("path").attrTween("d",A)):E.selectAll("path").attr("d",I=>wt(I.sets.map(L=>k[L])),x);const F=E.selectAll("text").filter(I=>I.sets in N).text(I=>B(I)).attr("x",I=>Math.floor(N[I.sets].x)).attr("y",I=>Math.floor(N[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,B)):F.each("end",ot(k,B)):F.each(ot(k,B)));const D=R(C.exit()).remove();typeof C.transition=="function"&&D.selectAll("path").attrTween("d",A);const X=D.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(V.style("font-size","0px"),F.style("font-size",y),X.style("font-size","0px")),{circles:k,textCentres:N,nodes:C,enter:O,update:E,exit:D}}return l.wrap=function(p){return arguments.length?(u=p,l):u},l.useViewBox=function(){return n=!0,l},l.width=function(p){return arguments.length?(s=p,l):s},l.height=function(p){return arguments.length?(e=p,l):e},l.padding=function(p){return arguments.length?(i=p,l):i},l.distinct=function(p){return arguments.length?(m=p,l):m},l.colours=function(p){return arguments.length?(g=p,l):g},l.colors=function(p){return arguments.length?(g=p,l):g},l.fontSize=function(p){return arguments.length?(y=p,l):y},l.round=function(p){return arguments.length?(x=p,l):x},l.duration=function(p){return arguments.length?(r=p,l):r},l.layoutFunction=function(p){return arguments.length?(b=p,l):b},l.normalize=function(p){return arguments.length?(c=p,l):c},l.scaleToFit=function(p){return arguments.length?(f=p,l):f},l.styled=function(p){return arguments.length?(a=p,l):a},l.orientation=function(p){return arguments.length?(o=p,l):o},l.orientationOrder=function(p){return arguments.length?(d=p,l):d},l.lossFunction=function(p){return arguments.length?(v=p==="default"?et:p==="logRatio"?Ct:p,l):v},l}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),f=(r.length+o.length)/3;let u=o.pop(),a=[u],y=0;const d=1.1;e.textContent=null;const m=[];function x(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=x(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=x(u),y++)}const T=.35-y*d/2,_=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",_),g.setAttribute("y",w),g.setAttribute("dy",`${T+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-W(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-W(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=W(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function Lt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=r&&(i=e[a],r=y)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,c={x:s?0:o[0],y:o[1]};let f=!0;for(const a of t)if(W(c,a)>a.radius){f=!1;break}for(const a of n)if(W(c,a)<a.radius){f=!1;break}if(f)return c;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Lt(t,[]):Tt(u.arcs.map(a=>a.p1))}function ve(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const c=s[o],f=t[c],u=W(r,f);u+f.radius<=r.radius+1e-10?n[c].push(i):u+r.radius<=f.radius+1e-10&&n[i].push(c)}}return n}function jt(t,n,s){const e={},i=ve(t);for(let r=0;r<n.length;++r){const o=n[r].sets,c={},f={};for(let d=0;d<o.length;++d){c[o[d]]=!0;const m=i[o[d]];for(let x=0;x<m.length;++x)f[m[x]]=!0}const u=[],a=[];for(let d in t)d in c?u.push(t[d]):d in f||a.push(t[d]);const y=Lt(u,a,s);e[o]=y,y.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
1
+ import{e as Gt,b0 as Wt,a1 as Kt,a5 as Ht,b3 as Yt,a2 as Xt,b1 as Zt,b as S,a3 as St,a$ as Jt,a_ as rt,l as Qt,au as $t,az as te,L as ee,E as ne,t as se,s as ie,S as re}from"./mermaid.core-Bcqfc2ey.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-Dscj4u4i.js";import"./main-DrB3sbfk.js";import"./motion-BILbV7YQ.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=ae(t),e=s.filter(c=>oe(c,t));let i=0,r=0;const o=[];if(e.length>1){const c=Tt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-c.x,a.y-c.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(f.parentIndex.includes(a.parentIndex[m])){const x=t[a.parentIndex[m]],M=Math.atan2(a.x-x.x,a.y-x.y),T=Math.atan2(f.x-x.x,f.y-x.y);let _=T-M;_<0&&(_+=2*Math.PI);const w=T-_/2;let g=W(y,{x:x.x+x.radius*Math.sin(w),y:x.y+x.radius*Math.cos(w)});g>x.radius*2&&(g=x.radius*2),(d==null||d.width>g)&&(d={circle:x,width:g,p1:a,p2:f,large:g>x.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),f=a)}}else{let c=t[0];for(let u=1;u<t.length;++u)t[u].radius<c.radius&&(c=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(W(t[u],c)>Math.abs(c.radius-t[u].radius)){f=!0;break}f?i=r=0:(i=c.radius*c.radius*Math.PI,o.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-_t,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function oe(t,n){return n.every(s=>W(t,s)<s.radius+_t)}function ae(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Et(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function W(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Et(t,n){const s=W(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),c=t.x+r*(n.x-t.x)/s,f=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:c+u,y:f-a},{x:c-u,y:f+a}]}function Tt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function le(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),c=t(s);let f=s-n;if(o*c>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(c===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*o>=0&&(n=a),Math.abs(f)<r||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,c=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,x=new Array(m+1);x[0]=n,x[0].fx=t(n),x[0].id=0;for(let v=0;v<m;++v){const l=n.slice();l[v]=l[v]?l[v]*i:r,x[v+1]=l,x[v+1].fx=t(l),x[v+1].id=v+1}function M(v){for(let l=0;l<v.length;l++)x[m][l]=v[l];x[m].fx=v.fx}const T=(v,l)=>v.fx-l.fx,_=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(x.sort(T),s.history){const p=x.map(h=>{const j=h.slice();return j.fx=h.fx,j.id=h.id,j});p.sort((h,j)=>h.id-j.id),s.history.push({x:x[0].slice(),fx:x[0].fx,simplex:p})}d=0;for(let p=0;p<m;++p)d=Math.max(d,Math.abs(x[0][p]-x[1][p]));if(Math.abs(x[0].fx-x[m].fx)<o&&d<c)break;for(let p=0;p<m;++p){_[p]=0;for(let h=0;h<m;++h)_[p]+=x[h][p];_[p]/=m}const l=x[m];if(Q(w,1+f,_,-f,l),w.fx=t(w),w.fx<x[0].fx)Q(b,1+u,_,-u,l),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=x[m-1].fx){let p=!1;if(w.fx>l.fx?(Q(g,1+a,_,-a,l),g.fx=t(g),g.fx<l.fx?M(g):p=!0):(Q(g,1-a*f,_,a*f,l),g.fx=t(g),g.fx<w.fx?M(g):p=!0),p){if(y>=1)break;for(let h=1;h<x.length;++h)Q(x[h],1-y,x[0],y,x[h]),x[h].fx=t(x[h])}}else M(w)}return x.sort(T),{fx:x[0].fx,x:x[0]}}function ce(t,n,s,e,i,r,o){const c=s.fx,f=tt(s.fxprime,n);let u=c,a=c,y=f,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(x,M,T){for(let _=0;_<16;++_)if(i=(x+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||u>=T)M=i;else{if(Math.abs(y)<=-o*f)return i;y*(M-x)>=0&&(M=x),x=i,T=u}return 0}for(let x=0;x<10;++x){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||x&&u>=a)return m(d,i,a);if(Math.abs(y)<=-o*f)return i;if(y>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function ue(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,c,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ce(t,o,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const y=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/y);Q(o,d,o,-1,i.fxprime),c=e,e=i,i=c}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||ge,e=n.lossFunction||et,i=he(t,n),r=s(i,n),o=Object.keys(r),c=[];for(const a of o)c.push(r[a].x),c.push(r[a].y);const u=zt(a=>{const y={};for(let d=0;d<o.length;++d){const m=o[d];y[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(y,i)},c,n).x;for(let a=0;a<o.length;++a){const y=o[a];r[y].x=u[2*a],r[y].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):le(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(c=>Object.assign({},c));function i(c){return c.join(";")}if(s){const c=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);c.set(a,f.size+(c.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const d=String(f.sets[y]),m=`${a};${d}`,x=`${d};${a}`;c.set(m,f.size+(c.get(m)||0)),c.set(x,f.size+(c.get(x)||0))}}for(const f of e)f.sets.length<3&&(f.size=c.get(i(f.sets)))}const r=[],o=new Set;for(const c of e)if(c.sets.length===1)r.push(c.sets[0]);else if(c.sets.length===2){const f=c.sets[0],u=c.sets[1];o.add(i(c.sets)),o.add(i([u,f]))}r.sort((c,f)=>c===f?0:c<f?-1:1);for(let c=0;c<r.length;++c){const f=r[c];for(let u=c+1;u<r.length;++u){const a=r[u];o.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function fe(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],c=s[r.sets[1]],f=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[c].size/Math.PI),a=ft(f,u,r.size);e[o][c]=e[c][o]=a;let y=0;r.size+1e-10>=Math.min(n[o].size,n[c].size)?y=1:r.size<=1e-10&&(y=-1),i[o][c]=i[c][o]=y}),{distances:e,constraints:i}}function de(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],c=t[2*r+1];for(let f=r+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[r][f],d=e[r][f],m=(u-o)*(u-o)+(a-c)*(a-c),x=Math.sqrt(m),M=m-y*y;d>0&&x<=y||d<0&&x>=y||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(c-a),n[2*f]+=4*M*(u-o),n[2*f+1]+=4*M*(a-c))}}return i}function ge(t,n={}){let s=ye(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=xe(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function xe(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=fe(t,e,i);const c=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/c));const f=(d,m)=>de(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),x=ue(f,m,n);(!u||x.fx<u.fx)&&(u=x)}const a=u.x,y={};for(let d=0;d<e.length;++d){const m=e[d];y[m.sets[0]]={x:a[2*d]*c,y:a[2*d+1]*c,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,c);return y}function ye(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const y of t)if(y.sets.length===1){const d=y.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[d]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let d=y.weight!=null?y.weight:1;const m=y.sets[0],x=y.sets[1];y.size+Rt>=Math.min(e[m].size,e[x].size)&&(d=0),i[m].push({set:x,size:y.size,weight:d}),i[x].push({set:m,size:y.size,weight:d})}const r=[];Object.keys(i).forEach(y=>{let d=0;for(let m=0;m<i[y].length;++m)d+=i[y][m].size*i[y][m].weight;r.push({set:y,size:d})});function o(y,d){return d.size-y.size}r.sort(o);const c={};function f(y){return y.set in c}function u(y,d){e[d].x=y.x,e[d].y=y.y,c[d]=!0}u({x:0,y:0},r[0].set);for(let y=1;y<r.length;++y){const d=r[y].set,m=i[d].filter(f),x=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(x.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],l=ft(x.radius,v.radius,m[b].size),p=Et({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:l});M.push(...p)}}let T=1e50,_=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<T&&(T=g,_=w)}u(_,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],c=t[e.sets[1]];i=xt(o.radius,c.radius,W(o,c))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const c=t[e.sets[0]],f=t[e.sets[1]];i=xt(c.radius,f.radius,W(c,f))}else i=st(e.sets.map(c=>t[c]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function pe(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&W(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const c of t){const f=c.x,u=c.y;c.x=r*f-o*u,c.y=o*f+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function me(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),c=n(r);o.parent=c}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;W(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=me(e);for(const u of i){pe(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function c(u,a,y){if(!u)return;const d=u.bounds;let m,x;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(y)x=r.yRange.max-d.yRange.min+o;else{x=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(x+=M)}for(const M of u)M.x+=m,M.y+=x,e.push(M)}let f=1;for(;f<i.length;)c(i[f],!0,!1),c(i[f+1],!1,!0),c(i[f+2],!0,!0),f+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:c}=dt(r);if(o.max===o.min||c.max===c.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const m=Math.sqrt(i/Math.PI)*2;f=n/m,u=s/m}else f=n/(o.max-o.min),u=s/(c.max-c.min);const a=Math.min(u,f),y=(n-(o.max-o.min)*a)/2,d=(s-(c.max-c.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+y+(m.x-o.min)*a,y:e+d+(m.y-c.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function be(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,c=!0,f=null,u=!0,a=!0,y=null,d=null,m=!1,x=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,T={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(p){if(p in T)return T[p];var h=T[p]=_[w];return w+=1,w>=_.length&&(w=0),h},b=At,v=et;function l(p){let h=p.datum();const j=new Set;h.forEach(I=>{I.size==0&&I.sets.length==1&&j.add(I.sets[0])}),h=h.filter(I=>!I.sets.some(L=>j.has(L)));let k={},N={};if(h.length>0){let I=b(h,{lossFunction:v,distinct:m});c&&(I=Dt(I,o,d)),k=Nt(I,s,e,i,f),N=jt(k,h,M)}const Y={};h.forEach(I=>{I.label&&(Y[I.sets]=I.label)});function B(I){if(I.sets in Y)return Y[I.sets];if(I.sets.length==1)return""+I.sets[0]}p.selectAll("svg").data([k]).enter().append("svg");const U=p.select("svg");n?U.attr("viewBox",`0 0 ${s} ${e}`):U.attr("width",s).attr("height",e);const q={};let z=!1;U.selectAll(".venn-area path").each(function(I){const L=this.getAttribute("d");I.sets.length==1&&L&&!m&&(z=!0,q[I.sets[0]]=ke(L))});function A(I){return L=>{const G=I.sets.map(Z=>{let H=q[Z],J=k[Z];return H||(H={x:s/2,y:e/2,radius:1}),J||(J={x:s/2,y:e/2,radius:1}),{x:H.x*(1-L)+J.x*L,y:H.y*(1-L)+J.y*L,radius:H.radius*(1-L)+J.radius*L}});return wt(G,x)}}const C=U.selectAll(".venn-area").data(h,I=>I.sets),O=C.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),P=O.append("path"),V=O.append("text").attr("class","label").text(I=>B(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(P.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),V.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function R(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let E=p;z&&typeof E.transition=="function"?(E=R(p),E.selectAll("path").attrTween("d",A)):E.selectAll("path").attr("d",I=>wt(I.sets.map(L=>k[L])),x);const F=E.selectAll("text").filter(I=>I.sets in N).text(I=>B(I)).attr("x",I=>Math.floor(N[I.sets].x)).attr("y",I=>Math.floor(N[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,B)):F.each("end",ot(k,B)):F.each(ot(k,B)));const D=R(C.exit()).remove();typeof C.transition=="function"&&D.selectAll("path").attrTween("d",A);const X=D.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(V.style("font-size","0px"),F.style("font-size",y),X.style("font-size","0px")),{circles:k,textCentres:N,nodes:C,enter:O,update:E,exit:D}}return l.wrap=function(p){return arguments.length?(u=p,l):u},l.useViewBox=function(){return n=!0,l},l.width=function(p){return arguments.length?(s=p,l):s},l.height=function(p){return arguments.length?(e=p,l):e},l.padding=function(p){return arguments.length?(i=p,l):i},l.distinct=function(p){return arguments.length?(m=p,l):m},l.colours=function(p){return arguments.length?(g=p,l):g},l.colors=function(p){return arguments.length?(g=p,l):g},l.fontSize=function(p){return arguments.length?(y=p,l):y},l.round=function(p){return arguments.length?(x=p,l):x},l.duration=function(p){return arguments.length?(r=p,l):r},l.layoutFunction=function(p){return arguments.length?(b=p,l):b},l.normalize=function(p){return arguments.length?(c=p,l):c},l.scaleToFit=function(p){return arguments.length?(f=p,l):f},l.styled=function(p){return arguments.length?(a=p,l):a},l.orientation=function(p){return arguments.length?(o=p,l):o},l.orientationOrder=function(p){return arguments.length?(d=p,l):d},l.lossFunction=function(p){return arguments.length?(v=p==="default"?et:p==="logRatio"?Ct:p,l):v},l}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),f=(r.length+o.length)/3;let u=o.pop(),a=[u],y=0;const d=1.1;e.textContent=null;const m=[];function x(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=x(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=x(u),y++)}const T=.35-y*d/2,_=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",_),g.setAttribute("y",w),g.setAttribute("dy",`${T+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-W(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-W(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=W(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function Lt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=r&&(i=e[a],r=y)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,c={x:s?0:o[0],y:o[1]};let f=!0;for(const a of t)if(W(c,a)>a.radius){f=!1;break}for(const a of n)if(W(c,a)<a.radius){f=!1;break}if(f)return c;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Lt(t,[]):Tt(u.arcs.map(a=>a.p1))}function ve(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const c=s[o],f=t[c],u=W(r,f);u+f.radius<=r.radius+1e-10?n[c].push(i):u+r.radius<=f.radius+1e-10&&n[i].push(c)}}return n}function jt(t,n,s){const e={},i=ve(t);for(let r=0;r<n.length;++r){const o=n[r].sets,c={},f={};for(let d=0;d<o.length;++d){c[o[d]]=!0;const m=i[o[d]];for(let x=0;x<m.length;++x)f[m[x]]=!0}const u=[],a=[];for(let d in t)d in c?u.push(t[d]):d in f||a.push(t[d]);const y=Lt(u,a,s);e[o]=y,y.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
2
2
  M`,t,n),e.push(`
3
3
  m`,-s,0),e.push(`
4
4
  a`,s,s,0,1,0,s*2,0),e.push(`
@@ -1,4 +1,4 @@
1
- import{b0 as zt,a1 as Lt,a5 as Tt,b3 as At,a2 as Xt,b1 as Et,b as y,ae as Yt,a3 as It,s as Q,aD as et,a$ as Bt,E as Ft,t as Rt,a4 as V}from"./mermaid.core-B6lZnoad.js";import{p as Ot}from"./chunk-4BX2VUAB-Cr6Ax9dk.js";import{p as Wt}from"./wardley-L42UT6IY-CMlb6SDs.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-C1rDhYTC.js";import"./main-DU4tqNTD.js";import"./motion-BILbV7YQ.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(Ot(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Rt()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Et,getAccTitle:Xt,setDiagramTitle:At,getDiagramTitle:Tt,getAccDescription:Lt,setAccDescription:zt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map
1
+ import{b0 as zt,a1 as Lt,a5 as Tt,b3 as At,a2 as Xt,b1 as Et,b as y,ae as Yt,a3 as It,s as Q,aD as et,a$ as Bt,E as Ft,t as Rt,a4 as V}from"./mermaid.core-Bcqfc2ey.js";import{p as Ot}from"./chunk-4BX2VUAB-Ckz1_Kja.js";import{p as Wt}from"./wardley-L42UT6IY-CMlb6SDs.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-Dscj4u4i.js";import"./main-DrB3sbfk.js";import"./motion-BILbV7YQ.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(Ot(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Rt()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Et,getAccTitle:Xt,setDiagramTitle:At,getDiagramTitle:Tt,getAccDescription:Lt,setAccDescription:zt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map
2
2
  `+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),L=v.getDiagramTitle(),M=((J=g.size)==null?void 0:J.width)??r.width,k=((K=g.size)==null?void 0:K.height)??r.height,N=Bt(o);N.selectAll("*").remove(),Ft(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const B=M-r.padding*2,F=k-r.padding*2;L&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(L);const T=y(t=>r.padding+t/100*B,"projectX"),A=y(t=>k-r.padding-t/100*F,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+B/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+F/2})`).text(bt);const R=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(R.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===R.length){let i=0;n.forEach(h=>{s.push({start:i,end:h}),i=h})}else{const i=1/R.length;R.forEach((h,l)=>{s.push({start:l*i,end:(l+1)*i})})}R.forEach((i,h)=>{const l=s[h],x=r.padding+l.start*B,f=r.padding+l.end*B,u=(x+f)/2;h>0&&t.append("line").attr("x1",x).attr("x2",x).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+B*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-F*s).attr("y2",k-r.padding-F*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:T(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f<i.length-1;f++){const u=i[f],w=i[f+1];n.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",u.pos.x).attr("y1",u.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let h=1/0,l=-1/0,x=0;if(s.componentIds.forEach(f=>{const u=c.get(f);u&&(h=Math.min(h,u.x),l=Math.max(l,u.x),x=u.y)}),h!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=x-u/2,S=c.get(s.nodeId);if(S){const z=(h+l)/2;S.x=z,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",w).attr("width",l-h+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.x+l/f*h}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.y+x/f*h}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.x+l/f*h}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.y+x/f*h}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=s.y-n.y,l=s.x-n.x,x=Math.sqrt(l*l+h*h),f=8,u=h/x;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,h=s.x-n.x,l=s.y-n.y,x=Math.sqrt(h*h+l*l),f=8,u=-h/x;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=(n.y+s.y)/2,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x),u=8,w=x/f,S=-l/f,z=i+w*u,W=h+S*u;let Y=Math.atan2(x,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${z} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=T(t.targetX),i=A(t.targetY),h=s-n.x,l=i-n.y,x=Math.sqrt(h*h+l*l),f=r.nodeRadius+2,u=x>f?s-h/x*f:s,w=x>f?i-l/x*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:T(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i<s.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",s[i].x).attr("y1",s[i].y).attr("x2",s[i+1].x).attr("y2",s[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach(i=>{const h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=T(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,h=16,l=11,x=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const z=x.append("text").attr("x",n+i).attr("y",s+i+(S+1)*h).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(z)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const z=w+i*2+105,W=f.length*h+i*2+S/2,Y=r.padding,Pt=M-r.padding-z,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*h)}),x.insert("rect","text").attr("x",n).attr("y",s).attr("width",z).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=T(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=T(n.x),i=A(n.y),h=60,l=30,x=20,f=`
3
3
  M ${s} ${i-l/2}
4
4
  L ${s+h-x} ${i-l/2}
@@ -1,4 +1,4 @@
1
- import{b0 as gi,a1 as xi,a5 as Xt,b3 as di,a2 as fi,b1 as pi,b as a,aD as Yt,a$ as mi,E as yi,t as bi,a3 as _t,aZ as Ai,s as Nt,S as wi,ae as Ci,A as Si,aA as Wt}from"./mermaid.core-B6lZnoad.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-Cboi1Yqb.js";import{l as zt}from"./linear-D7AT_2cB.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-C1rDhYTC.js";import"./main-DU4tqNTD.js";import"./motion-BILbV7YQ.js";import"./defaultLocale-CrowFXzY.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var M=Ri(y).map(function(m){return v+o*m});return i(E?M.reverse():M)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=(function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],M=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,Mt=0,hi=2,It=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||It,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var I,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((I===null||typeof I>"u")&&(I=Vt()),z=rt[q]&&rt[q][I]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
1
+ import{b0 as gi,a1 as xi,a5 as Xt,b3 as di,a2 as fi,b1 as pi,b as a,aD as Yt,a$ as mi,E as yi,t as bi,a3 as _t,aZ as Ai,s as Nt,S as wi,ae as Ci,A as Si,aA as Wt}from"./mermaid.core-Bcqfc2ey.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-Cboi1Yqb.js";import{l as zt}from"./linear-TM5xxJnF.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-Dscj4u4i.js";import"./main-DrB3sbfk.js";import"./motion-BILbV7YQ.js";import"./defaultLocale-CrowFXzY.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var M=Ri(y).map(function(m){return v+o*m});return i(E?M.reverse():M)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=(function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],M=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:M,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,Mt=0,hi=2,It=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||It,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var I,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((I===null||typeof I>"u")&&(I=Vt()),z=rt[q]&&rt[q][I]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
2
2
  `+D.showPosition()+`
3
3
  Expecting `+gt.join(", ")+", got '"+(this.terminals_[I]||I)+"'":yt="Parse error on line "+(ct+1)+": Unexpected "+(I==It?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(yt,{text:D.match,token:this.terminals_[I]||I,line:D.yylineno,loc:pt,expected:gt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+I);switch(z[0]){case 1:g.push(I),C.push(D.yytext),r.push(D.yylloc),g.push(z[1]),I=null,Mt=D.yyleng,d=D.yytext,ct=D.yylineno,pt=D.yylloc;break;case 2:if(N=this.productions_[z[1]][1],G.$=C[C.length-N],G._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ci&&(G._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(G,[d,Mt,ct,$.yy,z[1],C,r].concat(li)),typeof mt<"u")return mt;N&&(g=g.slice(0,-1*N*2),C=C.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[z[1]][0]),C.push(G.$),r.push(G._$),Bt=rt[g[g.length-2]][g[g.length-1]],g.push(Bt);break;case 3:return!0}}return!0},"parse")},k=(function(){var F={EOF:1,parseError:a(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:a(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var c=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
@@ -6,7 +6,7 @@
6
6
  <title>Remote Control — Saluzi</title>
7
7
  <link rel="preconnect" href="https://fonts.googleapis.com" />
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
- <script type="module" crossorigin src="/code/assets/main-DU4tqNTD.js"></script>
9
+ <script type="module" crossorigin src="/code/assets/main-DrB3sbfk.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/code/assets/vendor-DE_-CLIE.js">
11
11
  <link rel="modulepreload" crossorigin href="/code/assets/shiki-mEP5vQQu.js">
12
12
  <link rel="modulepreload" crossorigin href="/code/assets/motion-BILbV7YQ.js">
@@ -1 +0,0 @@
1
- import{j as e,e as i}from"./vendor-DE_-CLIE.js";import{G as T,a2 as y,a0 as v,i as _,K as E,a1 as k,Y as o,Q as L,n as M,q as B,r as I,p as F}from"./main-DU4tqNTD.js";import{g as N}from"./workerType-Bd-zteMi.js";import{S as A,D as O,a as P,c as $,d as W,b as q}from"./SessionVisibilityBadge-p6speHFz.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function G({teamName:n,className:d}){return n?e.jsx("span",{className:T("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",d),children:n}):null}function H({environments:n,onSelectEnvironment:d}){const{activeTeam:u}=y(),{user:c}=v(),m=i.useMemo(()=>(c==null?void 0:c.role)==="admin"?n:u?n.filter(a=>a.team_id===u.id):n.filter(a=>!a.team_id),[n,u,c]);return!m||m.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No active environments"}):e.jsx("div",{className:"space-y-2",children:m.map(a=>{const l=a.worker_type==="acp",p=N(a.worker_type),h=p.fullLabel,b=p.colorClass;return e.jsxs("button",{type:"button",onClick:()=>d==null?void 0:d(a),disabled:l,className:`flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors ${l?"cursor-default opacity-80":"hover:border-border-light cursor-pointer"}`,children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:a.machine_name||a.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${b}`,children:h}),e.jsx(G,{teamName:a.team_name??null})]}),e.jsx("div",{className:"text-sm text-text-muted",children:a.directory||""})]})}),e.jsxs("div",{className:"text-right",children:[e.jsx(_,{status:a.status}),e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:a.branch||""})]})]},a.id)})})}function K({sessions:n,environments:d,onSelect:u,onDelete:c}){const{activeTeam:m,myTeams:a}=y(),{user:l}=v(),p=i.useMemo(()=>{const t=new Map;for(const r of a)t.set(r.id,r.name);return t},[a]),h=i.useMemo(()=>(l==null?void 0:l.role)==="admin"?n:m?n.filter(t=>t.owner_type==="team"&&t.owner_id===m.id):n.filter(t=>t.owner_type==="user"||!t.owner_type),[n,m,l]);if(!h||h.length===0)return e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No sessions"});const b=new Map;for(const t of d??[])t!=null&&t.id&&t.worker_type&&b.set(t.id,t.worker_type);const g=[...h].sort((t,r)=>(r.updated_at||0)-(t.updated_at||0));return e.jsx("div",{className:"space-y-2",children:g.map(t=>e.jsxs("div",{className:"group flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("button",{type:"button",onClick:()=>u(t.id),className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),t.visibility&&e.jsx(A,{visibility:t.visibility||"private"}),(()=>{var f;let r=t.source==="acp"?"acp":(f=t.environment)==null?void 0:f.worker_type;!r&&t.environment_id&&(r=b.get(t.environment_id));const x=N(r);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${x.colorClass}`,children:x.fullLabel})})()]}),e.jsxs("div",{className:"flex items-center gap-2 truncate text-xs text-text-muted",children:[e.jsx("span",{className:"truncate font-mono",children:t.id}),t.owner_type==="team"&&t.owner_id&&e.jsxs("span",{className:"inline-flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-text-muted/40",children:"|"}),e.jsx("span",{className:"truncate",children:p.get(t.owner_id)||t.owner_id})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:E(t.created_at||t.updated_at)}),c&&e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),c(t.id)},className:"rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100",title:"Delete session",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id))})}function Q({open:n,environments:d,onClose:u,onCreated:c}){k();const{activeTeam:m}=y(),{user:a}=v(),[l,p]=i.useState(""),[h,b]=i.useState(""),[g,t]=i.useState("same-dir"),[r,x]=i.useState(""),[f,w]=i.useState(!1),C=i.useMemo(()=>(a==null?void 0:a.role)==="admin"?d:m?d.filter(s=>s.team_id===m.id):d.filter(s=>!s.team_id),[d,m,a]);i.useEffect(()=>{n&&(p(""),b(""),t("same-dir"),x(""))},[n]);const S=async()=>{w(!0),x("");try{const s={};l.trim()&&(s.title=l.trim()),h&&(s.environment_id=h),s.spawn_mode=g;const j=L();j&&(s.team_id=j);const D=await M(s);c(D)}catch(s){x(s instanceof Error?s.message:o("dialog.createFailed"))}finally{w(!1)}};return e.jsx(O,{open:n,onOpenChange:s=>{s||u()},children:e.jsxs(P,{className:"max-w-md rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx($,{children:e.jsx(W,{className:"font-display text-lg font-semibold text-text-primary",children:o("dialog.newSession")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:o("dialog.titleOptional")}),e.jsx("input",{type:"text",value:l,onChange:s=>p(s.target.value),placeholder:o("dialog.titlePlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:o("dialog.environment")}),e.jsxs("select",{value:h,onChange:s=>b(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"",children:o("dialog.none")}),C.map(s=>{const j=N(s.worker_type).shortLabel;return e.jsxs("option",{value:s.id,children:[s.machine_name||s.id," (",s.branch||o("dialog.noBranch"),") · ",j]},s.id)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:o("dialog.workspaceMode")}),e.jsxs("select",{value:g,onChange:s=>t(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"same-dir",children:o("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:o("dialog.worktree")})]})]}),r&&e.jsx("div",{className:"text-sm text-status-error",children:r})]}),e.jsxs(q,{children:[e.jsx("button",{onClick:u,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:o("common.cancel")}),e.jsx("button",{onClick:S,disabled:f,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:f?o("common.creating"):o("common.create")})]})]})})}function X({onNavigateSession:n}){k();const[d,u]=i.useState([]),[c,m]=i.useState([]),[a,l]=i.useState(!1),p=i.useCallback(async()=>{try{const[r,x]=await Promise.all([B(),I()]);u(r||[]),m(x||[])}catch(r){console.error("Dashboard render error:",r)}},[]);i.useEffect(()=>{p();const r=setInterval(p,1e4);return()=>clearInterval(r)},[p]);const h=r=>{l(!1),n(r.id)},b=i.useCallback(r=>{},[]),g=i.useCallback(r=>{n(r)},[n]),t=i.useCallback(async r=>{if(window.confirm(o("dashboard.confirmDelete").replace("{id}",r)))try{await F(r),u(x=>x.filter(f=>f.id!==r))}catch(x){alert(x instanceof Error?x.message:o("dashboard.deleteFailed"))}},[]);return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:o("dashboard.title")}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:o("dashboard.environments")}),e.jsx(H,{environments:c,onSelectEnvironment:b})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:o("dashboard.sessions")}),e.jsx("button",{onClick:()=>l(!0),className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:o("dashboard.newSession")})]}),e.jsx(K,{sessions:d,environments:c,onSelect:g,onDelete:t})]}),e.jsx(Q,{open:a,environments:c,onClose:()=>l(!1),onCreated:h})]})})}export{X as Dashboard};
@@ -1,55 +0,0 @@
1
- var xe=Object.defineProperty;var pe=(s,t,n)=>t in s?xe(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var T=(s,t,n)=>pe(s,typeof t!="symbol"?t+"":t,n);import{e as p,j as e}from"./vendor-DE_-CLIE.js";import{H as D,t as he,z as fe,M as ye,y as O,u as be,i as ee,K as te,L as se,k as ge,h as je,J as P,G as H,d as we,Z as Ne,v as ke,o as ve,x as _e,a1 as ne,Y as g,A as Se,N as Ce,_ as Me,I as Ee,p as Te,j as re,c as $e,C as Ae,s as Ie,V as Pe,D as De,a as Re}from"./main-DU4tqNTD.js";import{g as qe}from"./workerType-Bd-zteMi.js";import{D as ae,a as oe,c as ie,d as le,b as Ue,S as Fe}from"./SessionVisibilityBadge-p6speHFz.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
2
- * @license lucide-react v0.555.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Oe=[["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"}]],He=D("activity",Oe);/**
7
- * @license lucide-react v0.555.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Le=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ze=D("chevron-right",Le);/**
12
- * @license lucide-react v0.555.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Be=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Y=D("clock",Be);/**
17
- * @license lucide-react v0.555.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const Ve=[["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"}]],Qe=D("cpu",Ve);/**
22
- * @license lucide-react v0.555.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const We=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Ke=D("hash",We);/**
27
- * @license lucide-react v0.555.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const Ye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Je=D("info",Ye);/**
32
- * @license lucide-react v0.555.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const Ge=[["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"}]],Ze=D("play",Ge);/**
37
- * @license lucide-react v0.555.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const Xe=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],et=D("server-cog",Xe);/**
42
- * @license lucide-react v0.555.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const tt=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],st=D("share-2",tt);/**
47
- * @license lucide-react v0.555.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const nt=[["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"}]],rt=D("triangle-alert",nt);function ce(){return{tasks:{}}}const J=3e4;function V(s){const t=s.trim();if(!t)return"agent";const n=t.split(/\s+/).slice(0,2).join(" ");return n.length>40?n.slice(0,40)+"…":n}function at(s,t){var x,d,u,l,o,a,h,b,f,y,j,N;const n=t.subtype;if(n!=="task_started"&&n!=="task_progress"&&n!=="task_notification")return s;const r=t.task_id;if(!r)return s;const c=Date.now(),i=s.tasks[r];if(n==="task_started"){if(i)return{tasks:{...s.tasks,[r]:{...i,description:t.description??i.description,name:V(t.description??i.description),taskType:t.task_type??i.taskType,workflowName:t.workflow_name??i.workflowName,prompt:t.prompt??i.prompt,toolUseId:t.tool_use_id??i.toolUseId,status:"running",startTime:c,evictAfter:void 0}}};const k=t.description??"";return{tasks:{...s.tasks,[r]:{taskId:r,name:V(k),description:k,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:c}}}}if(n==="task_progress"){if(!i){const k=t.description??"";return{tasks:{...s.tasks,[r]:{taskId:r,name:V(k),description:k,toolUseId:t.tool_use_id,status:"running",startTime:c,tokenCount:(x=t.usage)==null?void 0:x.total_tokens,toolUseCount:(d=t.usage)==null?void 0:d.tool_uses,durationMs:(u=t.usage)==null?void 0:u.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...s.tasks,[r]:{...i,description:t.description??i.description,tokenCount:((l=t.usage)==null?void 0:l.total_tokens)??i.tokenCount,toolUseCount:((o=t.usage)==null?void 0:o.tool_uses)??i.toolUseCount,durationMs:((a=t.usage)==null?void 0:a.duration_ms)??i.durationMs,lastToolName:t.last_tool_name??i.lastToolName,summary:t.summary??i.summary}}}}return i?{tasks:{...s.tasks,[r]:{...i,status:t.status??"completed",endTime:c,finalSummary:t.summary??i.finalSummary,outputFile:t.output_file??i.outputFile,tokenCount:((y=t.usage)==null?void 0:y.total_tokens)??i.tokenCount,toolUseCount:((j=t.usage)==null?void 0:j.tool_uses)??i.toolUseCount,durationMs:((N=t.usage)==null?void 0:N.duration_ms)??i.durationMs,evictAfter:c+J}}}:{tasks:{...s.tasks,[r]:{taskId:r,name:V(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:c,endTime:c,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(h=t.usage)==null?void 0:h.total_tokens,toolUseCount:(b=t.usage)==null?void 0:b.tool_uses,durationMs:(f=t.usage)==null?void 0:f.duration_ms,evictAfter:c+J}}}}function ot(s,t=Date.now()){return Object.values(s.tasks).filter(n=>n.evictAfter===void 0||n.evictAfter>t).sort((n,r)=>n.startTime-r.startTime)}class it{constructor(){T(this,"listeners",new Set);T(this,"eventSource",null);T(this,"_lastSeqNum",0)}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}connect(t){this.disconnect();const n=`/web/sessions/${t}/events`,r=new EventSource(n,{withCredentials:!0});this.eventSource=r,r.addEventListener("message",c=>{try{const i=JSON.parse(c.data);if(i.seqNum!==void 0&&i.seqNum<=this._lastSeqNum)return;i.seqNum!==void 0&&(this._lastSeqNum=i.seqNum);for(const x of this.listeners)x(i)}catch{}})}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._lastSeqNum=0}}const K=new it;function G(s){if(typeof s.content=="string")return s.content;if(s.message&&typeof s.message=="object"){const t=s.message;if(typeof t.content=="string")return t.content;if(Array.isArray(t.content))return t.content.filter(n=>n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("")}return""}function Z(s,t){for(let n=s.length-1;n>=0;n--){const r=s[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}class lt{constructor(t,n,r){T(this,"sessionId");T(this,"setEntries");T(this,"unsub",null);T(this,"onStatusChange");T(this,"onError");T(this,"onPermissionRequest");T(this,"onModelsStateChange");T(this,"onSubagentUpdate");T(this,"subagentState",ce());this.sessionId=t,this.setEntries=n,this.onStatusChange=r==null?void 0:r.onStatusChange,this.onError=r==null?void 0:r.onError,this.onPermissionRequest=r==null?void 0:r.onPermissionRequest,this.onModelsStateChange=r==null?void 0:r.onModelsStateChange,this.onSubagentUpdate=r==null?void 0:r.onSubagentUpdate}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var x;const{events:t}=await he(this.sessionId);if(!t||t.length===0)return;const n=[];let r=null;const c=()=>{r&&(n.push(r),r=null)};for(const d of t){const u=d.payload||{};if(d.type==="user"){if(d.direction==="inbound")continue;c();const l=G(u);l&&n.push({type:"user_message",id:d.id||`hist-user-${n.length}`,content:l})}else if(d.type==="assistant"){c();const l=G(u),o=[],a=u.message;if(a&&typeof a=="object"&&Array.isArray(a.content))for(const h of a.content)h.type==="tool_use"&&o.push({type:"tool_call",toolCall:{id:h.id||`hist-tool-${n.length}`,title:h.name||"tool",status:"complete",rawInput:h.input||{}}});if(l||o.length>0){r={type:"assistant_message",id:d.id||`hist-asst-${n.length}`,chunks:l?[{type:"message",text:l}]:[]},n.push(r);for(const h of o)n.push(h);r=null}}else if(d.type==="tool_use"){const l=u,o={type:"tool_call",toolCall:{id:l.tool_call_id||`hist-tool-${n.length}`,title:l.tool_name||"tool",status:"complete",rawInput:l.tool_input||{}}};n.push(o)}else if(d.type==="tool_result"){const l=u,o=Z(n,l.tool_call_id||"");if(o>=0){const a=n[o];n[o]={type:"tool_call",toolCall:{...a.toolCall,rawOutput:{output:l.content||l.output||""}}}}}}c(),this.setEntries(n);let i=null;for(const d of t){if(d.type!=="models_state")continue;const u=d.payload||{},l=u.raw,o=l&&typeof l=="object"?l.models_state:u.models_state;o&&Array.isArray(o.availableModels)&&typeof o.currentModelId=="string"&&(i=o)}i&&((x=this.onModelsStateChange)==null||x.call(this,i))}connectSSE(){K.connect(this.sessionId),this.unsub=K.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),K.disconnect()}handleEvent(t){var i,x,d,u,l;const n=t.type,r=t.payload||{},c=JSON.stringify(t);if(!/Remote Control connecting/i.test(c))switch(n){case"assistant":{const o=typeof r.content=="string"?r.content:"";this.setEntries(h=>{const b=h[h.length-1];if((b==null?void 0:b.type)==="assistant_message"){const f=b.chunks[b.chunks.length-1];return(f==null?void 0:f.type)==="message"?[...h.slice(0,-1),{...b,chunks:[...b.chunks.slice(0,-1),{type:"message",text:f.text+o}]}]:[...h.slice(0,-1),{...b,chunks:[...b.chunks,{type:"message",text:o}]}]}if(o&&o.trim()){const f={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:o}]};return[...h,f]}return h});const a=r.message;if(a&&typeof a=="object"&&Array.isArray(a.content)){const h=a.content.filter(b=>b.type==="tool_use");for(const b of h){const y={id:b.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`,title:b.name||"tool",status:"running",rawInput:b.input||{}};this.setEntries(j=>[...j,{type:"tool_call",toolCall:y}])}}break}case"tool_use":{const o=r,h={id:o.tool_call_id||`call-${Date.now()}`,title:o.tool_name||"tool",status:"running",rawInput:o.tool_input||{}};this.setEntries(b=>[...b,{type:"tool_call",toolCall:h}]);break}case"tool_result":{const o=r,a=o.tool_call_id||"";this.setEntries(h=>{const b=Z(h,a);if(b<0)return h;const f=h[b];return h.map((y,j)=>j===b?{type:"tool_call",toolCall:{...f.toolCall,status:"complete",rawOutput:{output:o.content||o.output||""}}}:y)});break}case"control_request":case"permission_request":{const o=r.request;if(o&&o.subtype==="can_use_tool"){const a=r.request_id||"",h=o.tool_name||"unknown",b=o.input||o.tool_input||{},f=o.description||"";this.setEntries(y=>{const j=[...y].reverse().findIndex(N=>N.type==="tool_call");if(j>=0){const N=y.length-1-j,k=y[N];if(k.toolCall.status==="running")return y.map((M,E)=>E===N?{type:"tool_call",toolCall:{...k.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:a,options:[]}}}:M)}return y}),(i=this.onPermissionRequest)==null||i.call(this,{requestId:a,toolName:h,toolInput:b,description:f})}break}case"session_status":{typeof r.status=="string"&&((x=this.onStatusChange)==null||x.call(this,r.status));break}case"error":{const o=String(r.message||r.content||"Unknown error");(d=this.onError)==null||d.call(this,o);break}case"models_state":{const o=r.raw,a=typeof o=="object"&&o!==null?o.models_state:r.models_state;a&&Array.isArray(a.availableModels)&&typeof a.currentModelId=="string"&&((u=this.onModelsStateChange)==null||u.call(this,a));break}case"system":{const o=r.raw,a=o&&typeof o=="object"?o:r,h=typeof a.subtype=="string"?a.subtype:void 0;if(h==="task_started"||h==="task_progress"||h==="task_notification"){const b={subtype:h,task_id:typeof a.task_id=="string"?a.task_id:void 0,tool_use_id:typeof a.tool_use_id=="string"?a.tool_use_id:void 0,description:typeof a.description=="string"?a.description:void 0,task_type:typeof a.task_type=="string"?a.task_type:void 0,workflow_name:typeof a.workflow_name=="string"?a.workflow_name:void 0,prompt:typeof a.prompt=="string"?a.prompt:void 0,usage:a.usage&&typeof a.usage=="object"?a.usage:void 0,last_tool_name:typeof a.last_tool_name=="string"?a.last_tool_name:void 0,summary:typeof a.summary=="string"?a.summary:void 0,status:a.status==="completed"||a.status==="failed"||a.status==="stopped"?a.status:void 0,output_file:typeof a.output_file=="string"?a.output_file:void 0};this.subagentState=at(this.subagentState,b),(l=this.onSubagentUpdate)==null||l.call(this,this.subagentState)}break}}}async sendMessage(t,n,r){const c=n&&n.length>0,i=r&&r.length>0;if(!t.trim()&&!c&&!i)return;const x={type:"user_message",id:`user-${Date.now()}`,content:t,images:c?n:void 0,attachments:i?r:void 0};this.setEntries(l=>[...l,x]);const d=[];if(t&&d.push({type:"text",text:t}),c)for(const l of n)d.push({type:"image",source:{type:"base64",media_type:l.mimeType,data:l.data}});if(i){for(const l of r)if(l.kind==="text"||l.kind==="table"){const o=`📎 ${l.name}${l.size!=null?` (${ct(l.size)})`:""}`,a=l.textContent||"(空文件)";d.push({type:"text",text:`${o}
52
- \`\`\`
53
- ${a}
54
- \`\`\``})}else if(l.kind==="directory"){const o=`📁 目录: ${l.name}${l.files!=null?` (${l.files.length} 个文件)`:""}`,a=l.textContent||"(空目录)";d.push({type:"text",text:`${o}
55
- ${a}`})}}const u=d.length===1&&d[0].type==="text"?d[0].text||t:d.length>0?d:t;await fe(this.sessionId,{type:"user",uuid:ye(),content:t,message:{content:u}})}async respondPermission(t,n,r){await O(this.sessionId,{type:"permission_response",approved:n,request_id:t,...r}),this.setEntries(c=>c.map(i=>{var x;return i.type!=="tool_call"||((x=i.toolCall.permissionRequest)==null?void 0:x.requestId)!==t?i:{type:"tool_call",toolCall:{...i.toolCall,status:n?"running":"rejected",permissionRequest:void 0}}}))}async interrupt(){this.setEntries(t=>t.map(n=>n.type!=="tool_call"||n.toolCall.status!=="running"&&n.toolCall.status!=="waiting_for_confirmation"?n:{type:"tool_call",toolCall:{...n.toolCall,status:"canceled",permissionRequest:void 0}})),await be(this.sessionId)}}function ct(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function dt(s){if(!s)return"never";const t=Math.max(0,Date.now()-s);return t<5e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function ut(s){return s?Date.now()-s<6e4:!1}function mt({onClose:s,session:t,liveStatus:n,pendingPermissions:r,onInterrupt:c,onDelete:i}){const[x,d]=p.useState(!1),u=async()=>{await navigator.clipboard.writeText(t.id),d(!0),setTimeout(()=>d(!1),1500)},l=r.length,o=t.worker,a=t.work_item,h=t.environment;return e.jsx(ae,{open:!0,onOpenChange:b=>{b||s()},children:e.jsxs(oe,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-96 h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md overflow-y-auto",children:[e.jsx(ie,{children:e.jsx(le,{className:"font-display font-semibold text-text-primary",children:"Session Ops"})}),e.jsxs("div",{className:"mt-3 space-y-5 text-sm",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(He,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{status:n||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:o&&(ut(o.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[o&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:dt(o.last_heartbeat_at)})]}),h&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Qe,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:h.machine_name||h.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:te(t.created_at)})]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),l>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[l," permission request",l>1?"s":""," awaiting your approval"]}):e.jsx("p",{className:"text-xs text-text-muted",children:"No pending actions"})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(et,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:c,className:"flex-1 rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-2 transition-colors",children:"Interrupt"}),e.jsxs("button",{onClick:i,className:"flex-1 rounded-md border border-status-error/30 px-3 py-1.5 text-xs text-status-error hover:bg-status-error/10 transition-colors",children:[e.jsx(ge,{className:"mr-1 inline h-3 w-3"}),"Delete"]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(Ke,{className:"h-3.5 w-3.5"}),"Session Info"]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("dt",{children:"Session ID"}),e.jsxs("dd",{className:"flex items-center gap-1 min-w-0",children:[e.jsx("code",{className:"break-all font-mono text-text-secondary text-right",children:t.id}),e.jsx("button",{onClick:u,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:x?"✓":"⧉"})]})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Spawn mode"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:a.spawn_mode??"default"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Work state"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:a.state})]})]}),t.source&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Source"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:t.source})]}),h&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:h.worker_type})]})]})]})]})]})})}const X="rcs:subagent-panel:collapsed";function xt(s){if(s<1e3)return"0s";const t=Math.floor(s/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;if(n<60)return r?`${n}m${r}s`:`${n}m`;const c=Math.floor(n/60),i=n%60;return i?`${c}h${i}m`:`${c}h`}function pt(s){return s===void 0||s<=0?"":s<1e3?`${s}`:s<1e6?`${(s/1e3).toFixed(s<1e4?1:0)}k`:`${(s/1e6).toFixed(1)}M`}function ht({status:s}){return s==="running"?e.jsx(se,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(Ze,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(je,{className:"h-3 w-3 text-status-error"}):null}function ft({task:s}){const t=s.status==="running",n=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,r=pt(s.tokenCount),c=s.toolUseCount!==void 0&&s.toolUseCount>0?`${s.toolUseCount} tool${s.toolUseCount>1?"s":""}`:"",i=s.summary||s.description||"(no description)";return e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-xs",children:[e.jsx("div",{className:"mt-0.5 flex-shrink-0",children:e.jsx(ht,{status:s.status})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:s.name}),e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:xt(n)})]}),e.jsx("div",{className:"mt-0.5 truncate text-text-secondary",children:i}),(r||c||s.lastToolName)&&e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-text-muted",children:[r&&e.jsxs("span",{children:["↕ ",r," tok"]}),c&&e.jsxs("span",{children:["· ",c]}),s.lastToolName&&e.jsxs("span",{className:"truncate",children:["· last: ",s.lastToolName]})]}),!t&&s.finalSummary&&e.jsx("div",{className:"mt-1 rounded bg-status-success/10 px-1.5 py-0.5 text-[10px] text-status-success",children:s.finalSummary})]})]})}function yt({state:s}){const[t,n]=p.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(X)==="1"}catch{return!1}}),r=()=>{n(u=>{const l=!u;try{window.localStorage.setItem(X,l?"1":"0")}catch{}return l})},[,c]=p.useState(0);p.useEffect(()=>{const u=Object.values(s.tasks).some(a=>a.status==="running"),l=Object.values(s.tasks).some(a=>a.status!=="running"&&a.evictAfter!==void 0);if(!u&&!l)return;const o=setInterval(()=>{c(a=>a+1)},1e3);return()=>clearInterval(o)},[s]);const i=ot(s);if(i.length===0)return null;const x=i.filter(u=>u.status==="running").length,d=x>0?`${x} running`:`${i.length} recent`;return e.jsx("section",{"aria-label":"Subagents",className:"border-t border-border bg-surface-1 px-4 py-2",children:e.jsxs("div",{className:"mx-auto max-w-3xl space-y-1.5",children:[e.jsxs("button",{type:"button",onClick:r,"aria-expanded":!t,"aria-controls":"subagent-list",className:"flex w-full items-center justify-between text-[10px] font-medium uppercase tracking-wide text-text-muted hover:text-text-secondary transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ze,{className:`h-3 w-3 transition-transform ${t?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:d})]}),!t&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:i.map(u=>e.jsx(ft,{task:u},u.taskId))})]})})}function bt({requestId:s,toolName:t,toolInput:n,description:r,onApprove:c,onReject:i}){const x=typeof n=="string"?n:JSON.stringify(n,null,2);return e.jsxs("div",{className:"rounded-xl border border-warning-border/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-warning-border/15 text-warning-text",children:e.jsx(rt,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-semibold text-warning-text",children:"Permission Request"})]}),r&&e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:P(r)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:P(t)}),t!=="AskUserQuestion"&&e.jsx("pre",{className:"mb-3 max-h-40 overflow-auto rounded-lg bg-surface-1 p-2 text-xs text-text-secondary font-mono",children:Ne(x,500)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:c,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Approve"}),e.jsx("button",{onClick:i,className:"rounded-lg bg-status-error/20 px-4 py-2 text-sm font-medium text-status-error hover:bg-status-error/30 transition-colors",children:"Reject"})]})]})}function gt({questions:s,description:t,onSubmit:n,onSkip:r}){const[c,i]=p.useState({}),[x,d]=p.useState({}),[u,l]=p.useState(0),o=(f,y,j)=>{if(j){const N=c[f]||[],k=N.includes(y)?N.filter(M=>M!==y):[...N,y];i({...c,[f]:k})}else i({...c,[f]:y})},a=f=>{var j;const y=(j=x[f])==null?void 0:j.trim();y&&(i({...c,[f]:y}),d({...x,[f]:""}))},h=()=>{var y,j;const f={};for(const[N,k]of Object.entries(c)){const M=s[parseInt(N,10)];M&&(typeof k=="number"?f[N]=((j=(y=M.options)==null?void 0:y[k])==null?void 0:j.label)||String(k):Array.isArray(k)?f[N]=k.map(E=>{var $,R;return((R=($=M.options)==null?void 0:$[E])==null?void 0:R.label)||String(E)}):f[N]=k)}n(f)};if(s.length<=1){const f=s[0]||{question:t,options:[],multiSelect:!1},y=f.multiSelect||!1;return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:P(t||f.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(f.options||[]).map((j,N)=>{const k=y?(c[0]||[]).includes(N):c[0]===N;return e.jsxs("button",{onClick:()=>o(0,N,y),className:H("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",k?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:P(j.label)}),j.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:P(j.description)})]},N)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:x[0]||"",onChange:j=>d({...x,0:j.target.value}),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:j=>j.key==="Enter"&&a(0)}),e.jsx("button",{onClick:()=>a(0),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:h,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit"}),e.jsx("button",{onClick:r,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})}const b=s[u];return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:P(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((f,y)=>e.jsx("button",{onClick:()=>l(y),className:H("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",u===y?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:f.header||`Q${y+1}`},y))}),b&&e.jsx(jt,{question:b,qIdx:u,answers:c,otherTexts:x,onSelect:o,onOtherTextChange:(f,y)=>d({...x,[f]:y}),onOtherSubmit:a}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[u+1," / ",s.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:h,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit All"}),e.jsx("button",{onClick:r,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})]})}function jt({question:s,qIdx:t,answers:n,otherTexts:r,onSelect:c,onOtherTextChange:i,onOtherSubmit:x}){const d=s.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:P(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((u,l)=>{const o=d?(n[t]||[]).includes(l):n[t]===l;return e.jsxs("button",{onClick:()=>c(t,l,d),className:H("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",o?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:P(u.label)}),u.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:P(u.description)})]},l)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:r[t]||"",onChange:u=>i(t,u.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:u=>u.key==="Enter"&&x(t)}),e.jsx("button",{onClick:()=>x(t),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]})]})}function wt({planContent:s,description:t,onSubmit:n}){const[r,c]=p.useState(null),[i,x]=p.useState(""),d=!s||!s.trim(),u=()=>{r&&n(r,r==="no"?i:void 0)};return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand",children:e.jsx(we,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold text-text-primary",children:d?"Exit plan mode?":"Ready to code?"})]}),!d&&e.jsx("div",{className:"mb-4 max-h-64 overflow-auto rounded-lg bg-tool-card p-4 text-sm text-text-secondary",dangerouslySetInnerHTML:{__html:Nt(s)}}),e.jsx("div",{className:"space-y-2",children:d?e.jsxs(e.Fragment,{children:[e.jsx(F,{selected:r==="yes-default",onClick:()=>c("yes-default"),label:"Yes"}),e.jsx(F,{selected:r==="no",onClick:()=>c("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{selected:r==="yes-accept-edits",onClick:()=>c("yes-accept-edits"),label:"Yes, auto-accept edits",desc:"Approve plan and auto-accept file edits"}),e.jsx(F,{selected:r==="yes-default",onClick:()=>c("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(F,{selected:r==="no",onClick:()=>c("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),r==="no"&&e.jsx("textarea",{value:i,onChange:l=>x(l.target.value),placeholder:"Tell Saluzi what to change...",className:"mt-3 w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",rows:3}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:u,disabled:!r,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function F({selected:s,onClick:t,label:n,desc:r}){return e.jsxs("button",{onClick:t,className:H("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",s?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:H("flex h-4 w-4 items-center justify-center rounded-full border text-[10px] transition-colors",s?"border-brand bg-brand text-white":"border-border"),children:s&&"✓"}),e.jsx("span",{className:"font-medium",children:n})]}),r&&e.jsx("div",{className:"mt-0.5 pl-6 text-xs text-text-muted",children:r})]})}function Nt(s){let t=P(s);return t=t.replace(/```(\w*)\n?([\s\S]*?)```/g,(n,r,c)=>`<pre class="my-2 overflow-x-auto rounded-lg bg-tool-card p-3 font-mono text-xs">${c.trim()}</pre>`),t=t.replace(/`([^`]+)`/g,'<code class="rounded bg-tool-card px-1.5 py-0.5 font-mono text-xs">$1</code>'),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t}function kt(s){const[t,n]=p.useState([]),[r,c]=p.useState(!0),[i,x]=p.useState(null),d=p.useCallback(async()=>{c(!0),x(null);try{const o=await ke(s);n(o)}catch(o){x(o instanceof Error?o.message:"Failed to load shares")}finally{c(!1)}},[s]);p.useEffect(()=>{d()},[d]);const u=p.useCallback(async o=>{x(null);try{const a=await ve(s,o);return await d(),a}catch(a){throw x(a instanceof Error?a.message:"Failed to create share"),a}},[s,d]),l=p.useCallback(async o=>{x(null);try{await _e(s,o),await d()}catch(a){throw x(a instanceof Error?a.message:"Failed to revoke share"),a}},[s,d]);return{shares:t,isLoading:r,error:i,createShare:u,revokeShare:l,refresh:d}}function vt({open:s,onClose:t,sessionId:n,sessionTitle:r}){ne();const{shares:c,isLoading:i,error:x,createShare:d,revokeShare:u}=kt(n),[l,o]=p.useState("user"),[a,h]=p.useState(""),[b,f]=p.useState(""),[y,j]=p.useState("read"),[N,k]=p.useState(""),[M,E]=p.useState(!1),[$,R]=p.useState(null),[L,U]=p.useState(""),[z,S]=p.useState(!1);p.useEffect(()=>{s&&(o("user"),h(""),f(""),j("read"),k(""),E(!1),R(null),U(""),S(!1))},[s]);const q=async()=>{E(!0),U(""),R(null);try{const w={grantedTo:l==="user"?{userId:a.trim()}:{teamId:b.trim()},permission:y};N.trim()&&(w.expiresAt=N.trim());const A=await d(w);R(A.shareToken)}catch(w){U(w instanceof Error?w.message:"Failed to create share")}finally{E(!1)}},Q=async w=>{try{await u(w)}catch{}},B=async()=>{if(!$)return;const w=`${window.location.origin}/code/s/${$}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(w),S(!0),setTimeout(()=>S(!1),2e3);return}}catch{}const A=document.createElement("textarea");A.value=w,A.style.position="fixed",A.style.opacity="0",document.body.appendChild(A),A.select();try{document.execCommand("copy"),S(!0),setTimeout(()=>S(!1),2e3)}catch{}document.body.removeChild(A)};return e.jsx(ae,{open:s,onOpenChange:w=>{w||t()},children:e.jsxs(oe,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(ie,{children:e.jsxs(le,{className:"font-display text-lg font-semibold text-text-primary",children:[g("share.title"),r?`: ${r}`:""]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:g("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>o("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${l==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:g("share.user")}),e.jsx("button",{onClick:()=>o("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${l==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:g("share.team")})]}),l==="user"?e.jsx("input",{type:"text",value:a,onChange:w=>h(w.target.value),placeholder:g("share.userIdPlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"}):e.jsx("input",{type:"text",value:b,onChange:w=>f(w.target.value),placeholder:g("share.teamIdPlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:g("share.permission")}),e.jsxs("select",{value:y,onChange:w=>j(w.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"read",children:g("share.permissionRead")}),e.jsx("option",{value:"write",children:g("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:g("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:N,onChange:w=>k(w.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none"})]}),(L||x)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:L||x}),$&&e.jsxs("div",{className:"rounded-md bg-surface-2 px-3 py-2",children:[e.jsx("p",{className:"text-sm text-text-secondary mb-1",children:g("share.linkCreated")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"flex-1 truncate text-xs text-text-primary",children:["/code/s/",$]}),e.jsx("button",{onClick:B,className:"rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:z?g("share.copied"):g("share.copy")})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:g("share.existingShares")}),i?e.jsx("p",{className:"text-sm text-text-muted",children:g("share.loading")}):c.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:g("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:c.map(w=>e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-surface-2 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:w.granted_to_user||w.granted_to_team||"Unknown"}),e.jsxs("p",{className:"text-xs text-text-muted",children:[w.permission==="write"?g("share.permissionWrite"):g("share.permissionRead"),w.expires_at?` · expires ${w.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>Q(w.id),className:"ml-2 shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:g("share.revoke")})]},w.id))})]})]}),e.jsxs(Ue,{children:[e.jsx("button",{onClick:t,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:g("common.close")}),e.jsx("button",{onClick:q,disabled:M,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:M?g("common.creating"):g("share.createShare")})]})]})})}function _t(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function St(s){const t=_t(s),n=Ce(),r=n?{proxyUrl:t,token:n}:{proxyUrl:t};return new Se(r)}function Rt({sessionId:s,onSessionLoaded:t}){ne();const[n,r]=p.useState(null),[c,i]=p.useState(null),[x,d]=p.useState(""),[u,l]=p.useState(!1),[o,a]=p.useState(!1),[h,b]=p.useState(!1),[f,y]=p.useState([]),[j,N]=p.useState(!1),[k,M]=p.useState([]),[E,$]=p.useState(null),[R,L]=p.useState(()=>ce()),U=p.useRef(null),z=p.useRef(f);z.current=f;const S=p.useMemo(()=>new lt(s,y,{onStatusChange:m=>{i(m)},onError:m=>{console.error("[RCSChatAdapter] error:",m)},onPermissionRequest:m=>{M(v=>v.some(_=>_.requestId===m.requestId)?v:[...v,m])},onModelsStateChange:m=>{$(m)},onSubagentUpdate:m=>{L(m)}}),[s]);p.useEffect(()=>(U.current=S,()=>{S.disconnect()}),[S]),p.useEffect(()=>{let m=!1;async function v(){d("");try{const _=await Ie(s);if(m)return;r(_),i(_.status),t==null||t(_)}catch(_){if(m)return;d(_ instanceof Error?_.message:g("session.loadFailed"));return}try{await S.init()}catch(_){console.warn("Failed to init adapter:",_)}}return v(),()=>{m=!0}},[s,S,t]);const q=Pe(c),Q=p.useCallback(async m=>{const v=m.text.trim(),_=m.images&&m.images.length>0||m.attachments&&m.attachments.length>0;if(!v&&!_||q)return;const C=await Me(v,{sessionId:s,availableCommands:[],availableModels:(E==null?void 0:E.availableModels)??[],currentModel:E?{modelId:E.currentModelId,name:E.currentModelId}:null,supportsImages:!0,entries:z.current,setModel:async I=>{await O(s,{type:"control_request",request:{subtype:"set_model",model:I}}),$(W=>W&&{...W,currentModelId:I})},onNewSession:()=>{y([])}}).catch(()=>null);if(C){if(Ee("[SessionDetail] local command result",C),"clearEntries"in C&&C.clearEntries){y([]);return}if("newSession"in C&&C.newSession){y([]);return}if("userEntry"in C){y(I=>[...I,C.userEntry,C.cmdEntry]);return}}N(!0);try{await S.sendMessage(v,m.images,m.attachments)}catch(I){console.error("Send failed:",I)}},[S,q,s,E]),B=p.useCallback(async()=>{try{await S.interrupt()}catch(m){console.error("Interrupt failed:",m)}finally{N(!1)}},[S]),w=p.useCallback(async()=>{if(n&&window.confirm(g("dashboard.confirmDelete").replace("{id}",n.title||n.id)))try{await Te(n.id),window.location.href="/code/"}catch(m){alert(m instanceof Error?m.message:g("dashboard.deleteFailed"))}},[n]);p.useEffect(()=>{if(f.length===0)return;const m=f[f.length-1];if((m==null?void 0:m.type)==="assistant_message"||(m==null?void 0:m.type)==="tool_call"){if(m.type==="tool_call"&&m.toolCall.status==="running")return;N(!1)}},[f]);const A=p.useCallback(async m=>{try{await S.respondPermission(m,!0)}catch(v){console.error("Failed to approve:",v)}M(v=>v.filter(_=>_.requestId!==m))},[S]),de=p.useCallback(async m=>{try{await S.respondPermission(m,!1)}catch(v){console.error("Failed to reject:",v)}M(v=>v.filter(_=>_.requestId!==m))},[S]),ue=p.useCallback(async(m,v,_)=>{try{await O(s,{type:"permission_response",approved:!0,request_id:m,updated_input:{questions:_,answers:v}})}catch(C){console.error("Failed to submit answers:",C)}M(C=>C.filter(I=>I.requestId!==m))},[s]),me=p.useCallback(async(m,v,_)=>{try{v==="no"?await O(s,{type:"permission_response",approved:!1,request_id:m,..._?{message:_}:{}}):await O(s,{type:"permission_response",approved:!0,request_id:m,updated_permissions:[{type:"setMode",mode:{"yes-accept-edits":"acceptEdits","yes-default":"default"}[v]||"default",destination:"session"}]})}catch(C){console.error("Failed to submit plan response:",C)}M(C=>C.filter(I=>I.requestId!==m))},[s]);return x?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-status-error",children:x}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:g("session.backToDashboard")})]})}):n?n.source==="acp"&&n.environment_id?e.jsx(Mt,{sessionId:s,agentId:n.environment_id}):e.jsx(re,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:n.title||n.id}),e.jsx("div",{className:"border-b bg-surface-1 px-4 py-3",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:e.jsx("span",{className:"truncate",children:n.title||n.id})}),n.visibility&&e.jsx(Fe,{visibility:n.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var _;const m=n.source==="acp"?"acp":(_=n.environment)==null?void 0:_.worker_type,v=qe(m);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${v.colorClass}`,children:v.fullLabel})})(),c&&e.jsx(ee,{status:c}),e.jsx("span",{className:"text-xs text-text-muted",children:te(n.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>b(!0),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:g("session.share"),children:e.jsx(st,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>a(!o),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:g("session.info"),children:e.jsx(Je,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>l(!u),className:"flex items-center gap-1 rounded-md px-3 py-1.5 text-sm text-text-primary font-bold hover:bg-brand-light hover:text-white transition-colors",children:[g("session.tasks"),k.length>0&&e.jsx("span",{className:"ml-1 rounded-full bg-status-warning px-1.5 py-0.5 text-[10px] font-medium text-white",children:k.length})]})]})]}),o&&e.jsxs("div",{className:"mt-2 rounded-md bg-surface-2 px-3 py-2 text-xs text-text-muted space-y-1 font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:g("session.metaSession")})," ",n.id]}),n.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:g("session.metaEnvironment")})," ",n.environment_id]})]})]})}),e.jsx($e,{entries:f,isLoading:j,emptyTitle:g("session.emptyTitle"),emptyDescription:g("session.emptyDescription")}),e.jsx(yt,{state:R}),k.length>0&&e.jsx("div",{className:"border-t bg-surface-1 px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl space-y-3",children:k.map(m=>e.jsx(Ct,{request:m,onApprove:()=>A(m.requestId),onReject:()=>de(m.requestId),onSubmitAnswers:ue,onSubmitPlan:me},m.requestId))})}),e.jsx(Ae,{onSubmit:Q,isLoading:j,onInterrupt:B,disabled:q,placeholder:q?g("session.closed"):g("session.inputPlaceholder"),supportsAttachments:!0}),u&&n&&e.jsx(mt,{onClose:()=>l(!1),session:n,liveStatus:c,pendingPermissions:k,onInterrupt:B,onDelete:w}),e.jsx(vt,{open:h,onClose:()=>b(!1),sessionId:n.id,sessionTitle:n.title||void 0})]})}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("div",{className:"text-text-muted",children:g("session.loading")})})}function Ct({request:s,onApprove:t,onReject:n,onSubmitAnswers:r,onSubmitPlan:c}){const i=s.toolName,x=s.toolInput,d=s.description||"";if(i==="AskUserQuestion"){const u=x.questions||[];return e.jsx(gt,{requestId:s.requestId,questions:u,description:d,onSubmit:l=>r(s.requestId,l,u),onSkip:n})}if(i==="ExitPlanMode"){const u=x.plan||"";return e.jsx(wt,{requestId:s.requestId,planContent:u,description:d,onSubmit:(l,o)=>c(s.requestId,l,o)})}return e.jsx(bt,{requestId:s.requestId,toolName:i,toolInput:x,description:d,onApprove:t,onReject:n})}function Mt({sessionId:s,agentId:t}){const[n,r]=p.useState(null),[c,i]=p.useState("disconnected"),[x,d]=p.useState(null),u=p.useRef(null);return p.useEffect(()=>{const l=St(t);return l.setConnectionStateHandler((o,a)=>{i(o),d(a||null)}),u.current=l,r(l),l.connect().catch(o=>{o instanceof De||(d(o.message),i("error"))}),()=>{l.disconnect(),u.current=null,r(null),i("disconnected")}},[t]),e.jsx(re,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[x&&c==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:x}),c==="connecting"&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),e.jsx("p",{className:"text-text-muted text-sm",children:g("session.connectingAgent")})]})}),c==="error"&&!n&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium mb-1",children:g("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:x})]})}),n&&c==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Re,{client:n,agentId:t})})]})})}export{Rt as SessionDetail};
@@ -1,6 +0,0 @@
1
- import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{H as M,l as w,a1 as P,Y as y,X as B,i as G,r as z,E as I,B as O,a0 as Q,S as W}from"./main-DU4tqNTD.js";import{C as T}from"./copy-DGJ36Idc.js";import{g as X}from"./workerType-Bd-zteMi.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
2
- * @license lucide-react v0.555.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Y=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],q=M("user-plus",Y);function _(s){const[o,r]=a.useState([]),[j,v]=a.useState(!1),i=a.useCallback(async()=>{if(s){v(!0);try{const x=await w("GET",`/web/teams/${s}/members`);r(x)}catch{r([])}finally{v(!1)}}},[s]);a.useEffect(()=>{i()},[i]);const u=a.useCallback(async(x,l)=>{await w("POST",`/web/teams/${s}/members`,{userId:x,role:l}),await i()},[s,i]),d=a.useCallback(async x=>{await w("DELETE",`/web/teams/${s}/members/${x}`),await i()},[s,i]),m=a.useCallback(async(x,l)=>{await w("PATCH",`/web/teams/${s}/members/${x}`,{role:l}),await i()},[s,i]);return{members:o,isLoading:j,addMember:u,removeMember:d,updateRole:m,refetch:i}}function J(s){const[o,r]=a.useState([]),j=a.useCallback(async i=>{if(!s)return null;const u=await w("POST",`/web/teams/${s}/invitations`,i);return r(d=>[...d,u]),u},[s]),v=a.useCallback(async i=>{s&&(await w("DELETE",`/web/teams/${s}/invitations/${i}`),r(u=>u.filter(d=>d.token!==i)))},[s]);return{invitations:o,createInvitation:j,revokeInvitation:v}}function V({teamId:s,canManage:o}){P();const{invitations:r,createInvitation:j,revokeInvitation:v}=J(s),{addMember:i}=_(s),[u,d]=a.useState(!1),[m,x]=a.useState(null),[l,p]=a.useState("member"),[N,g]=a.useState(!1),[c,b]=a.useState(""),[C,k]=a.useState([]),[E,S]=a.useState(!1),[t,h]=a.useState("member"),[$,L]=a.useState(null),[A,U]=a.useState(!1),R=async()=>{d(!0);try{const n=await j({role:l,expiresIn:86400,maxUses:5});n&&x(n.token||n.inviteToken||null)}catch{}finally{d(!1)}},D=async()=>{if(!m)return;const n=`${window.location.origin}/join?invite=${m}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(n);return}}catch{}const f=document.createElement("textarea");f.value=n,f.style.position="fixed",f.style.opacity="0",document.body.appendChild(f),f.select();try{document.execCommand("copy")}catch{}document.body.removeChild(f)},F=async n=>{if(b(n),n.trim().length<2){k([]);return}S(!0);try{const f=await w("GET",`/web/users/search?q=${encodeURIComponent(n.trim())}`);k(f)}catch{k([])}finally{S(!1)}},H=async n=>{U(!0),L(null);try{await i(n,t),b(""),k([]),g(!1)}catch(f){L(f instanceof Error?f.message:"Failed to add user")}finally{U(!1)}};return e.jsxs("div",{className:"space-y-5",children:[o&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("select",{className:"rounded-md border border-border bg-surface-2 px-2.5 py-1.5 text-xs text-text-primary focus:border-accent focus:outline-none",value:l,onChange:n=>p(n.target.value),children:[e.jsx("option",{value:"member",children:y("invitation.member")}),e.jsx("option",{value:"admin",children:y("invitation.admin")})]}),e.jsx("button",{type:"button",onClick:R,disabled:u,className:"rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:opacity-50",children:u?y("invitation.creating"):y("invitation.create")}),e.jsxs("button",{type:"button",onClick:()=>g(!N),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2",title:y("invitation.addExistingHint"),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),y("invitation.addExisting")]})]}),N&&o&&e.jsxs("div",{className:"space-y-3 rounded border border-border bg-surface-2 p-3",children:[e.jsx("p",{className:"text-xs text-text-muted",children:y("invitation.addExistingHint")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:c,onChange:n=>F(n.target.value),placeholder:y("invitation.searchUser"),className:"flex-1 rounded border border-border bg-surface-1 px-3 py-1.5 text-sm text-text-primary focus:border-accent focus:outline-none",autoFocus:!0}),e.jsxs("select",{className:"rounded border border-border bg-surface-1 px-2 py-1.5 text-sm",value:t,onChange:n=>h(n.target.value),children:[e.jsx("option",{value:"member",children:y("invitation.member")}),e.jsx("option",{value:"admin",children:y("invitation.admin")})]})]}),E&&e.jsx("p",{className:"text-xs text-text-muted",children:"Searching..."}),$&&e.jsx("p",{className:"text-xs text-destructive",children:$}),C.length>0&&e.jsx("ul",{className:"divide-y divide-border rounded border border-border bg-surface-1",children:C.map(n=>e.jsxs("li",{className:"flex items-center justify-between px-3 py-2 text-sm",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-text-primary",children:n.username}),e.jsx("div",{className:"truncate font-mono text-xs text-text-muted",children:n.id})]}),e.jsx("button",{type:"button",onClick:()=>H(n.id),disabled:A,className:"rounded bg-accent px-2 py-1 text-xs text-white hover:bg-accent/90 disabled:opacity-50",children:y("invitation.add")})]},n.id))}),c.trim().length>=2&&C.length===0&&!E&&e.jsx("p",{className:"text-xs text-text-muted",children:"No users found."})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 rounded border border-accent/40 bg-accent/5 p-3",children:[e.jsx("code",{className:"flex-1 text-xs text-text-primary break-all",children:`${window.location.origin}/join?invite=${m}`}),e.jsx("button",{type:"button",onClick:D,className:"text-text-muted hover:text-text-primary",children:e.jsx(T,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>x(null),className:"text-text-muted hover:text-text-primary",children:e.jsx(B,{className:"h-4 w-4"})})]}),r.length>0&&e.jsx("ul",{className:"space-y-2",children:r.map(n=>e.jsxs("li",{className:"flex items-center justify-between rounded border border-border/60 bg-surface-2 p-2 text-sm",children:[e.jsxs("span",{className:"text-text-muted",children:[n.role," — expires ",new Date(n.expiresAt).toLocaleDateString()]}),o&&e.jsx("button",{type:"button",onClick:()=>v(n.token),className:"text-sm text-destructive hover:underline",children:y("invitation.revoke")})]},n.token))})]})}function Z({teamId:s,canManage:o}){const[r,j]=a.useState([]),[v,i]=a.useState(!0),[u,d]=a.useState(null),[m,x]=a.useState(""),[l,p]=a.useState(null),[N,g]=a.useState(!1),c=async()=>{try{const t=await z();j(t||[])}catch(t){d(t instanceof Error?t.message:"Failed to load environments")}finally{i(!1)}};a.useEffect(()=>{c()},[]);const b=a.useMemo(()=>r.filter(t=>t.team_id===s),[r,s]),C=a.useMemo(()=>r.filter(t=>!t.team_id),[r]),k=async()=>{if(m){p(null);try{await O(m,s),x(""),await c()}catch(t){p(t instanceof Error?t.message:"Failed to link environment")}}},E=async t=>{if(window.confirm("Unlink this environment from the team? It will revert to personal scope.")){p(null);try{await I(s,t),await c()}catch(h){p(h instanceof Error?h.message:"Failed to unlink environment")}}},S=async()=>{const t=`slz rc --team-id ${s}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(t),g(!0),setTimeout(()=>g(!1),2e3);return}}catch{}const h=document.createElement("textarea");h.value=t,h.style.position="fixed",h.style.opacity="0",document.body.appendChild(h),h.select();try{document.execCommand("copy"),g(!0),setTimeout(()=>g(!1),2e3)}catch{}document.body.removeChild(h)};return v?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading environments..."}):u?e.jsx("p",{className:"text-sm text-destructive",children:u}):e.jsxs("div",{className:"space-y-8",children:[e.jsx("ul",{className:"space-y-3",children:b.length===0?e.jsx("li",{className:"text-sm text-text-muted",children:"No environments linked to this team yet."}):b.map(t=>{const h=X(t.worker_type);return e.jsxs("li",{className:"text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.machine_name||t.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${h.colorClass}`,children:h.shortLabel}),e.jsx(G,{status:t.status}),o&&e.jsx("button",{type:"button",onClick:()=>E(t.id),className:"ml-2 text-xs text-text-muted underline-offset-2 transition-colors hover:text-destructive hover:underline",children:"Unlink"})]}),e.jsxs("div",{className:"mt-1 font-mono text-xs text-text-muted",children:[t.directory||""," ",t.branch?`· ${t.branch}`:""]})]},t.id)})}),o&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Register a new worker to this team:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"rounded-md border border-border bg-surface-2 px-3 py-1.5 font-mono text-xs text-text-primary",children:["slz rc --team-id ",s]}),e.jsx("button",{type:"button",onClick:S,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy command",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),N&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"})]})]}),C.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Link an existing personal environment:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:m,onChange:t=>x(t.target.value),className:"max-w-md rounded-md border border-border bg-surface-2 px-3 py-1.5 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:"Select environment..."}),C.map(t=>e.jsxs("option",{value:t.id,children:[t.machine_name||t.id," ",t.branch?`· ${t.branch}`:""]},t.id))]}),e.jsx("button",{type:"button",onClick:k,disabled:!m,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:"Link"})]})]}),l&&e.jsx("p",{className:"text-sm text-destructive",children:l})]})]})}async function K(s){try{const o=s.startsWith("team_")?`/web/teams/${s}`:`/web/teams/by-slug/${s}`;return await w("GET",o)}catch{return null}}function ie(){const s=window.location.pathname.split("/"),o=s[s.length-1]||"",[r,j]=a.useState(null),[v,i]=a.useState(!0),[u,d]=a.useState(!1),{members:m,isLoading:x}=_((r==null?void 0:r.id)||null),{user:l}=Q();if(a.useEffect(()=>{o&&(i(!0),K(o).then(c=>{j(c),i(!1)}))},[o]),v)return e.jsx("div",{className:"px-6 py-16 text-sm text-text-muted",children:"Loading..."});if(!r)return e.jsx("div",{className:"px-6 py-16 sm:px-10",children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})});const p=m.find(c=>c.user_id===(l==null?void 0:l.userId)),N=(l==null?void 0:l.role)==="admin"||(p==null?void 0:p.role)==="owner"||(p==null?void 0:p.role)==="admin",g=async()=>{const c=r.id;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(c),d(!0),setTimeout(()=>d(!1),2e3);return}}catch{}const b=document.createElement("textarea");b.value=c,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select();try{document.execCommand("copy"),d(!0),setTimeout(()=>d(!1),2e3)}catch{}document.body.removeChild(b)};return e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:r.name}),e.jsxs("p",{className:"mt-2 font-mono text-xs text-text-muted",children:["/",r.slug]}),r.description&&e.jsx("p",{className:"mt-5 max-w-2xl text-sm leading-relaxed text-text-muted",children:r.description}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:r.id}),e.jsx("button",{type:"button",onClick:g,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy team ID",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),u&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"}),N&&e.jsx("a",{href:`/teams/${r.slug}/settings`,className:"ml-1 text-text-muted transition-colors hover:text-text-primary","aria-label":"Team settings",title:"Team settings",children:e.jsx(W,{className:"h-4 w-4"})})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsxs("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:["Members (",m.length,")"]}),x?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading members..."}):e.jsx("ul",{className:"space-y-3",children:m.map(c=>e.jsxs("li",{className:"text-sm",children:[e.jsx("span",{className:"text-text-primary",children:c.username||c.user_id}),e.jsxs("span",{className:"text-text-muted",children:[" (",c.role,") "]}),e.jsx("span",{className:"font-mono text-xs text-text-muted",children:c.user_id})]},c.user_id))})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:"Environments"}),e.jsx(Z,{teamId:r.id,canManage:N})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:"Invitations"}),e.jsx(V,{teamId:r.id,canManage:N})]})]})}export{ie as TeamDetail};
@@ -1 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-B6lZnoad.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as a,a as s,c as t,C as e}from"./chunk-727SXJPM-CVttzQWT.js";import{b as i}from"./mermaid.core-B6lZnoad.js";import"./chunk-FMBD7UC4-CJQNdt2v.js";import"./chunk-ND2GUHAM-CcxkLR8x.js";import"./chunk-55IACEB6-D67JVqPZ.js";import"./chunk-2J33WTMH-D7mXynqp.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-C1rDhYTC.js";import"./main-DU4tqNTD.js";import"./motion-BILbV7YQ.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
@@ -1 +0,0 @@
1
- import{s as a,a as s,c as t,C as e}from"./chunk-727SXJPM-CVttzQWT.js";import{b as i}from"./mermaid.core-B6lZnoad.js";import"./chunk-FMBD7UC4-CJQNdt2v.js";import"./chunk-ND2GUHAM-CcxkLR8x.js";import"./chunk-55IACEB6-D67JVqPZ.js";import"./chunk-2J33WTMH-D7mXynqp.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-C1rDhYTC.js";import"./main-DU4tqNTD.js";import"./motion-BILbV7YQ.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
@@ -1 +0,0 @@
1
- import{j as e,e as i}from"./vendor-DE_-CLIE.js";import{G as T,a2 as y,a0 as v,i as _,K as E,a1 as k,Y as o,Q as L,n as M,q as B,r as I,p as F}from"./main-DU4tqNTD.js";import{g as N}from"./workerType-Bd-zteMi.js";import{S as A,D as O,a as P,c as $,d as W,b as q}from"./SessionVisibilityBadge-p6speHFz.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function G({teamName:n,className:d}){return n?e.jsx("span",{className:T("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",d),children:n}):null}function H({environments:n,onSelectEnvironment:d}){const{activeTeam:u}=y(),{user:c}=v(),m=i.useMemo(()=>(c==null?void 0:c.role)==="admin"?n:u?n.filter(a=>a.team_id===u.id):n.filter(a=>!a.team_id),[n,u,c]);return!m||m.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No active environments"}):e.jsx("div",{className:"space-y-2",children:m.map(a=>{const l=a.worker_type==="acp",p=N(a.worker_type),h=p.fullLabel,b=p.colorClass;return e.jsxs("button",{type:"button",onClick:()=>d==null?void 0:d(a),disabled:l,className:`flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors ${l?"cursor-default opacity-80":"hover:border-border-light cursor-pointer"}`,children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:a.machine_name||a.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${b}`,children:h}),e.jsx(G,{teamName:a.team_name??null})]}),e.jsx("div",{className:"text-sm text-text-muted",children:a.directory||""})]})}),e.jsxs("div",{className:"text-right",children:[e.jsx(_,{status:a.status}),e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:a.branch||""})]})]},a.id)})})}function K({sessions:n,environments:d,onSelect:u,onDelete:c}){const{activeTeam:m,myTeams:a}=y(),{user:l}=v(),p=i.useMemo(()=>{const t=new Map;for(const r of a)t.set(r.id,r.name);return t},[a]),h=i.useMemo(()=>(l==null?void 0:l.role)==="admin"?n:m?n.filter(t=>t.owner_type==="team"&&t.owner_id===m.id):n.filter(t=>t.owner_type==="user"||!t.owner_type),[n,m,l]);if(!h||h.length===0)return e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No sessions"});const b=new Map;for(const t of d??[])t!=null&&t.id&&t.worker_type&&b.set(t.id,t.worker_type);const g=[...h].sort((t,r)=>(r.updated_at||0)-(t.updated_at||0));return e.jsx("div",{className:"space-y-2",children:g.map(t=>e.jsxs("div",{className:"group flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("button",{type:"button",onClick:()=>u(t.id),className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),t.visibility&&e.jsx(A,{visibility:t.visibility||"private"}),(()=>{var f;let r=t.source==="acp"?"acp":(f=t.environment)==null?void 0:f.worker_type;!r&&t.environment_id&&(r=b.get(t.environment_id));const x=N(r);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${x.colorClass}`,children:x.fullLabel})})()]}),e.jsxs("div",{className:"flex items-center gap-2 truncate text-xs text-text-muted",children:[e.jsx("span",{className:"truncate font-mono",children:t.id}),t.owner_type==="team"&&t.owner_id&&e.jsxs("span",{className:"inline-flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-text-muted/40",children:"|"}),e.jsx("span",{className:"truncate",children:p.get(t.owner_id)||t.owner_id})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:E(t.created_at||t.updated_at)}),c&&e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),c(t.id)},className:"rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100",title:"Delete session",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id))})}function Q({open:n,environments:d,onClose:u,onCreated:c}){k();const{activeTeam:m}=y(),{user:a}=v(),[l,p]=i.useState(""),[h,b]=i.useState(""),[g,t]=i.useState("same-dir"),[r,x]=i.useState(""),[f,w]=i.useState(!1),C=i.useMemo(()=>(a==null?void 0:a.role)==="admin"?d:m?d.filter(s=>s.team_id===m.id):d.filter(s=>!s.team_id),[d,m,a]);i.useEffect(()=>{n&&(p(""),b(""),t("same-dir"),x(""))},[n]);const S=async()=>{w(!0),x("");try{const s={};l.trim()&&(s.title=l.trim()),h&&(s.environment_id=h),s.spawn_mode=g;const j=L();j&&(s.team_id=j);const D=await M(s);c(D)}catch(s){x(s instanceof Error?s.message:o("dialog.createFailed"))}finally{w(!1)}};return e.jsx(O,{open:n,onOpenChange:s=>{s||u()},children:e.jsxs(P,{className:"max-w-md rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx($,{children:e.jsx(W,{className:"font-display text-lg font-semibold text-text-primary",children:o("dialog.newSession")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:o("dialog.titleOptional")}),e.jsx("input",{type:"text",value:l,onChange:s=>p(s.target.value),placeholder:o("dialog.titlePlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:o("dialog.environment")}),e.jsxs("select",{value:h,onChange:s=>b(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"",children:o("dialog.none")}),C.map(s=>{const j=N(s.worker_type).shortLabel;return e.jsxs("option",{value:s.id,children:[s.machine_name||s.id," (",s.branch||o("dialog.noBranch"),") · ",j]},s.id)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:o("dialog.workspaceMode")}),e.jsxs("select",{value:g,onChange:s=>t(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"same-dir",children:o("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:o("dialog.worktree")})]})]}),r&&e.jsx("div",{className:"text-sm text-status-error",children:r})]}),e.jsxs(q,{children:[e.jsx("button",{onClick:u,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:o("common.cancel")}),e.jsx("button",{onClick:S,disabled:f,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:f?o("common.creating"):o("common.create")})]})]})})}function X({onNavigateSession:n}){k();const[d,u]=i.useState([]),[c,m]=i.useState([]),[a,l]=i.useState(!1),p=i.useCallback(async()=>{try{const[r,x]=await Promise.all([B(),I()]);u(r||[]),m(x||[])}catch(r){console.error("Dashboard render error:",r)}},[]);i.useEffect(()=>{p();const r=setInterval(p,1e4);return()=>clearInterval(r)},[p]);const h=r=>{l(!1),n(r.id)},b=i.useCallback(r=>{},[]),g=i.useCallback(r=>{n(r)},[n]),t=i.useCallback(async r=>{if(window.confirm(o("dashboard.confirmDelete").replace("{id}",r)))try{await F(r),u(x=>x.filter(f=>f.id!==r))}catch(x){alert(x instanceof Error?x.message:o("dashboard.deleteFailed"))}},[]);return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:o("dashboard.title")}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:o("dashboard.environments")}),e.jsx(H,{environments:c,onSelectEnvironment:b})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:o("dashboard.sessions")}),e.jsx("button",{onClick:()=>l(!0),className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:o("dashboard.newSession")})]}),e.jsx(K,{sessions:d,environments:c,onSelect:g,onDelete:t})]}),e.jsx(Q,{open:a,environments:c,onClose:()=>l(!1),onCreated:h})]})})}export{X as Dashboard};