@saluzi/saluzi-edu 0.6.2 → 0.6.4

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 (152) hide show
  1. package/dist/cli.js +42 -42
  2. package/dist/rcs-web/assets/{AdminPanel-YIhNS5Qr.js → AdminPanel-B9YWaqlO.js} +1 -1
  3. package/dist/rcs-web/assets/{ArtifactView-wAwsEOXp.js → ArtifactView-B8lAeS5B.js} +1 -1
  4. package/{packages/remote-control-server/web/dist/assets/ArtifactsGallery-DIp4aSOX.js → dist/rcs-web/assets/ArtifactsGallery-CNd9-Awp.js} +1 -1
  5. package/{packages/remote-control-server/web/dist/assets/Claim-DJ4tizsL.js → dist/rcs-web/assets/Claim-Dq08pl4W.js} +1 -1
  6. package/dist/rcs-web/assets/{Dashboard-BLV5zTyh.js → Dashboard-JZcrtByh.js} +1 -1
  7. package/dist/rcs-web/assets/{Join-B91AXtrD.js → Join-DgvRnpyb.js} +1 -1
  8. package/{packages/remote-control-server/web/dist/assets/Login-CWFOyYxU.js → dist/rcs-web/assets/Login-CZbz6Wms.js} +1 -1
  9. package/dist/rcs-web/assets/{Register-BaQgCZnM.js → Register-DD7uiwEj.js} +1 -1
  10. package/dist/rcs-web/assets/{RegisterEmpty-VAnkkhxE.js → RegisterEmpty-BrBfeQXp.js} +1 -1
  11. package/dist/rcs-web/assets/SessionDetail-BbnQBjP1.js +78 -0
  12. package/dist/rcs-web/assets/{SessionVisibilityBadge-SoKp2ads.js → SessionVisibilityBadge-kSo9esvT.js} +1 -1
  13. package/dist/rcs-web/assets/{Setup-CuKeura-.js → Setup-Ca30VUSF.js} +1 -1
  14. package/dist/rcs-web/assets/{ShareLanding-CcFoMs-8.js → ShareLanding-C_vlxFAM.js} +1 -1
  15. package/dist/rcs-web/assets/{TeamDetail-Cwer75cF.js → TeamDetail-8T_kKUcX.js} +1 -1
  16. package/dist/rcs-web/assets/{TeamList-zWC3UYCg.js → TeamList-DRXGQCJi.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamSettings-C8PMmj1J.js → TeamSettings-Byhon5C1.js} +1 -1
  18. package/dist/rcs-web/assets/{UserSearchInput-OP0ex0JY.js → UserSearchInput-wixyd_8w.js} +1 -1
  19. package/dist/rcs-web/assets/{UserSettings-Bk0df0IW.js → UserSettings-Ds2retFk.js} +1 -1
  20. package/dist/rcs-web/assets/{arc-LA1YluYC.js → arc-CThS8KNL.js} +1 -1
  21. package/{packages/remote-control-server/web/dist/assets/architectureDiagram-3BPJPVTR-BX0GtZq3.js → dist/rcs-web/assets/architectureDiagram-3BPJPVTR-Bko99SuX.js} +1 -1
  22. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DOEtgiur.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-CqCAgp0i.js} +1 -1
  23. package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-B4yXmB4r.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-C1pGDG-L.js} +1 -1
  24. package/dist/rcs-web/assets/channel-D6RbJTfV.js +1 -0
  25. package/dist/rcs-web/assets/{chunk-2J33WTMH-BTtQR0Cy.js → chunk-2J33WTMH-Bz0kJwEY.js} +1 -1
  26. package/dist/rcs-web/assets/{chunk-4BX2VUAB-1HwNFe2a.js → chunk-4BX2VUAB-DYnlidI7.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-55IACEB6-BZNQqhIb.js → chunk-55IACEB6-cMV4HRvm.js} +1 -1
  28. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CYhzt0io.js → dist/rcs-web/assets/chunk-727SXJPM-Bgz9JRYO.js} +1 -1
  29. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-DHrz4pCx.js → dist/rcs-web/assets/chunk-AQP2D5EJ-DIFGJlEF.js} +1 -1
  30. package/dist/rcs-web/assets/{chunk-FMBD7UC4-CaPwOz97.js → chunk-FMBD7UC4-BUC7O7T0.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-ND2GUHAM-DA0ZkEzn.js → chunk-ND2GUHAM-kGqgVnBZ.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-QZHKN3VN-DSfuz56H.js → chunk-QZHKN3VN-B01O0qXh.js} +1 -1
  33. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BlCPk6aR.js +1 -0
  34. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BlCPk6aR.js +1 -0
  35. package/dist/rcs-web/assets/{code-block-IT6T5CEO-BNvuvbAY.js → code-block-IT6T5CEO-CscK0pCh.js} +1 -1
  36. package/dist/rcs-web/assets/{copy-D89XvJAZ.js → copy-CvmA5P_Q.js} +1 -1
  37. package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-BBBWys5l.js → cose-bilkent-S5V4N54A-BsBsVccW.js} +1 -1
  38. package/dist/rcs-web/assets/{dagre-BM42HDAG-BQXT7HJf.js → dagre-BM42HDAG-Bn4B33S-.js} +1 -1
  39. package/{packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-BWcc0ls-.js → dist/rcs-web/assets/diagram-2AECGRRQ-DAuAIPR6.js} +1 -1
  40. package/dist/rcs-web/assets/{diagram-5GNKFQAL-CraFf5c1.js → diagram-5GNKFQAL-w3k2b4gC.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-KO2AKTUF-ibhCBjd8.js → diagram-KO2AKTUF-CMLav2KT.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-LMA3HP47-CbTdpjvm.js → diagram-LMA3HP47-D14sXWdh.js} +1 -1
  43. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-CNP77FZu.js → dist/rcs-web/assets/diagram-OG6HWLK6-BexFwBQa.js} +1 -1
  44. package/dist/rcs-web/assets/{dialog-CAsYgtpg.js → dialog-B4hKrd7w.js} +1 -1
  45. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-CrXP8g6S.js → erDiagram-TEJ5UH35-BA8ANmoV.js} +1 -1
  46. package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-CNjng8UY.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-dTQIvKsj.js} +1 -1
  47. package/dist/rcs-web/assets/{ganttDiagram-6RSMTGT7-CDNjDeCq.js → ganttDiagram-6RSMTGT7-8SDHYxXc.js} +1 -1
  48. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-CASecY9v.js → gitGraphDiagram-PVQCEYII-Bu7LyvTG.js} +1 -1
  49. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-Cs3XWzD-.js → infoDiagram-5YYISTIA-BuQuDvuX.js} +1 -1
  50. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-kAO88EzG.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-QjafGk8V.js} +1 -1
  51. package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-BCX4o3Cd.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-_FOXjXDF.js} +1 -1
  52. package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-CDC9KVRS.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-CbqJqyY6.js} +1 -1
  53. package/dist/rcs-web/assets/{linear-CUrURi3P.js → linear-H6F41eb2.js} +1 -1
  54. package/dist/rcs-web/assets/{main-7jP_dqcT.js → main-BopVSHhX.js} +24 -24
  55. package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-D7suvi1K.js → dist/rcs-web/assets/mermaid-VLURNSYL-5FH_DIq9.js} +4 -4
  56. package/dist/rcs-web/assets/{mermaid.core-BTm2FoGO.js → mermaid.core-C004NitB.js} +5 -5
  57. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-BptbcT1w.js → mindmap-definition-RKZ34NQL-utqEJ2a8.js} +1 -1
  58. package/dist/rcs-web/assets/{notifications-CJOZ8afS.js → notifications-DOBs9HVf.js} +1 -1
  59. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-DWptAgm8.js → pieDiagram-4H26LBE5-OlbTwDZQ.js} +1 -1
  60. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-BMXRPRcs.js → quadrantDiagram-W4KKPZXB-BOe2DhrU.js} +1 -1
  61. package/dist/rcs-web/assets/{refresh-cw-BdnkJGAc.js → refresh-cw-BSwpDl-7.js} +1 -1
  62. package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-T0k9vm-H.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-s6V1yWUG.js} +1 -1
  63. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CTMqVl1K.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CdJD78Mx.js} +1 -1
  64. package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-DOpiyGKl.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-DvGV6Dhl.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-CHE-ZSds.js → dist/rcs-web/assets/stateDiagram-AJRCARHV-Bj-_Ulcn.js} +1 -1
  66. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-Wtd7hWcf.js → stateDiagram-v2-BHNVJYJU-BLGWynk-.js} +1 -1
  67. package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-v6PYD_S4.js → timeline-definition-PNZ67QCA-B6VAH6Ka.js} +1 -1
  68. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-eZ0ybaJe.js → vennDiagram-CIIHVFJN-DUwaLI6R.js} +1 -1
  69. package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-C1Eujzxf.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-CBetJore.js} +1 -1
  70. package/dist/rcs-web/assets/{workerType-D9tOpHFH.js → workerType-BF4aY_R_.js} +1 -1
  71. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-DE480xjy.js → xychartDiagram-2RQKCTM6-BBnx6V66.js} +1 -1
  72. package/dist/rcs-web/index.html +1 -1
  73. package/package.json +1 -1
  74. package/packages/remote-control-server/web/dist/assets/{AdminPanel-YIhNS5Qr.js → AdminPanel-B9YWaqlO.js} +1 -1
  75. package/packages/remote-control-server/web/dist/assets/{ArtifactView-wAwsEOXp.js → ArtifactView-B8lAeS5B.js} +1 -1
  76. package/{dist/rcs-web/assets/ArtifactsGallery-DIp4aSOX.js → packages/remote-control-server/web/dist/assets/ArtifactsGallery-CNd9-Awp.js} +1 -1
  77. package/{dist/rcs-web/assets/Claim-DJ4tizsL.js → packages/remote-control-server/web/dist/assets/Claim-Dq08pl4W.js} +1 -1
  78. package/packages/remote-control-server/web/dist/assets/{Dashboard-BLV5zTyh.js → Dashboard-JZcrtByh.js} +1 -1
  79. package/packages/remote-control-server/web/dist/assets/{Join-B91AXtrD.js → Join-DgvRnpyb.js} +1 -1
  80. package/{dist/rcs-web/assets/Login-CWFOyYxU.js → packages/remote-control-server/web/dist/assets/Login-CZbz6Wms.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Register-BaQgCZnM.js → Register-DD7uiwEj.js} +1 -1
  82. package/packages/remote-control-server/web/dist/assets/{RegisterEmpty-VAnkkhxE.js → RegisterEmpty-BrBfeQXp.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/SessionDetail-BbnQBjP1.js +78 -0
  84. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-SoKp2ads.js → SessionVisibilityBadge-kSo9esvT.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/{Setup-CuKeura-.js → Setup-Ca30VUSF.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/{ShareLanding-CcFoMs-8.js → ShareLanding-C_vlxFAM.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/{TeamDetail-Cwer75cF.js → TeamDetail-8T_kKUcX.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{TeamList-zWC3UYCg.js → TeamList-DRXGQCJi.js} +1 -1
  89. package/packages/remote-control-server/web/dist/assets/{TeamSettings-C8PMmj1J.js → TeamSettings-Byhon5C1.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-OP0ex0JY.js → UserSearchInput-wixyd_8w.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/{UserSettings-Bk0df0IW.js → UserSettings-Ds2retFk.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{arc-LA1YluYC.js → arc-CThS8KNL.js} +1 -1
  93. package/{dist/rcs-web/assets/architectureDiagram-3BPJPVTR-BX0GtZq3.js → packages/remote-control-server/web/dist/assets/architectureDiagram-3BPJPVTR-Bko99SuX.js} +1 -1
  94. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-DOEtgiur.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CqCAgp0i.js} +1 -1
  95. package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-B4yXmB4r.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-C1pGDG-L.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/channel-D6RbJTfV.js +1 -0
  97. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-BTtQR0Cy.js → chunk-2J33WTMH-Bz0kJwEY.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-1HwNFe2a.js → chunk-4BX2VUAB-DYnlidI7.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-BZNQqhIb.js → chunk-55IACEB6-cMV4HRvm.js} +1 -1
  100. package/{dist/rcs-web/assets/chunk-727SXJPM-CYhzt0io.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-Bgz9JRYO.js} +1 -1
  101. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-DHrz4pCx.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-DIFGJlEF.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-CaPwOz97.js → chunk-FMBD7UC4-BUC7O7T0.js} +1 -1
  103. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-DA0ZkEzn.js → chunk-ND2GUHAM-kGqgVnBZ.js} +1 -1
  104. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-DSfuz56H.js → chunk-QZHKN3VN-B01O0qXh.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BlCPk6aR.js +1 -0
  106. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BlCPk6aR.js +1 -0
  107. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-BNvuvbAY.js → code-block-IT6T5CEO-CscK0pCh.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/{copy-D89XvJAZ.js → copy-CvmA5P_Q.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-BBBWys5l.js → cose-bilkent-S5V4N54A-BsBsVccW.js} +1 -1
  110. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-BQXT7HJf.js → dagre-BM42HDAG-Bn4B33S-.js} +1 -1
  111. package/{dist/rcs-web/assets/diagram-2AECGRRQ-BWcc0ls-.js → packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-DAuAIPR6.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-CraFf5c1.js → diagram-5GNKFQAL-w3k2b4gC.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-ibhCBjd8.js → diagram-KO2AKTUF-CMLav2KT.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-CbTdpjvm.js → diagram-LMA3HP47-D14sXWdh.js} +1 -1
  115. package/{dist/rcs-web/assets/diagram-OG6HWLK6-CNP77FZu.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-BexFwBQa.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/{dialog-CAsYgtpg.js → dialog-B4hKrd7w.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-CrXP8g6S.js → erDiagram-TEJ5UH35-BA8ANmoV.js} +1 -1
  118. package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-CNjng8UY.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-dTQIvKsj.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/{ganttDiagram-6RSMTGT7-CDNjDeCq.js → ganttDiagram-6RSMTGT7-8SDHYxXc.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-CASecY9v.js → gitGraphDiagram-PVQCEYII-Bu7LyvTG.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-Cs3XWzD-.js → infoDiagram-5YYISTIA-BuQuDvuX.js} +1 -1
  122. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-kAO88EzG.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-QjafGk8V.js} +1 -1
  123. package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-BCX4o3Cd.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-_FOXjXDF.js} +1 -1
  124. package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-CDC9KVRS.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-CbqJqyY6.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{linear-CUrURi3P.js → linear-H6F41eb2.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{main-7jP_dqcT.js → main-BopVSHhX.js} +24 -24
  127. package/{dist/rcs-web/assets/mermaid-VLURNSYL-D7suvi1K.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-5FH_DIq9.js} +4 -4
  128. package/packages/remote-control-server/web/dist/assets/{mermaid.core-BTm2FoGO.js → mermaid.core-C004NitB.js} +5 -5
  129. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-BptbcT1w.js → mindmap-definition-RKZ34NQL-utqEJ2a8.js} +1 -1
  130. package/packages/remote-control-server/web/dist/assets/{notifications-CJOZ8afS.js → notifications-DOBs9HVf.js} +1 -1
  131. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-DWptAgm8.js → pieDiagram-4H26LBE5-OlbTwDZQ.js} +1 -1
  132. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-BMXRPRcs.js → quadrantDiagram-W4KKPZXB-BOe2DhrU.js} +1 -1
  133. package/packages/remote-control-server/web/dist/assets/{refresh-cw-BdnkJGAc.js → refresh-cw-BSwpDl-7.js} +1 -1
  134. package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-T0k9vm-H.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-s6V1yWUG.js} +1 -1
  135. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CTMqVl1K.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CdJD78Mx.js} +1 -1
  136. package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-DOpiyGKl.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-DvGV6Dhl.js} +1 -1
  137. package/{dist/rcs-web/assets/stateDiagram-AJRCARHV-CHE-ZSds.js → packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-Bj-_Ulcn.js} +1 -1
  138. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-Wtd7hWcf.js → stateDiagram-v2-BHNVJYJU-BLGWynk-.js} +1 -1
  139. package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-v6PYD_S4.js → timeline-definition-PNZ67QCA-B6VAH6Ka.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-eZ0ybaJe.js → vennDiagram-CIIHVFJN-DUwaLI6R.js} +1 -1
  141. package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-C1Eujzxf.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-CBetJore.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{workerType-D9tOpHFH.js → workerType-BF4aY_R_.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-DE480xjy.js → xychartDiagram-2RQKCTM6-BBnx6V66.js} +1 -1
  144. package/packages/remote-control-server/web/dist/index.html +1 -1
  145. package/dist/rcs-web/assets/SessionDetail-CvkeGPev.js +0 -78
  146. package/dist/rcs-web/assets/channel-BSkZH-Bh.js +0 -1
  147. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DPk5suy5.js +0 -1
  148. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DPk5suy5.js +0 -1
  149. package/packages/remote-control-server/web/dist/assets/SessionDetail-CvkeGPev.js +0 -78
  150. package/packages/remote-control-server/web/dist/assets/channel-BSkZH-Bh.js +0 -1
  151. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DPk5suy5.js +0 -1
  152. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DPk5suy5.js +0 -1
@@ -1 +1 @@
1
- import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{aL as x,aM as o,a3 as m,aD as s,at as l,I as u}from"./main-7jP_dqcT.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function j(){x();const[a,i]=d.useState([]),{myTeams:r,isLoading:c}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),c?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",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}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{aL as x,aM as o,a3 as m,aD as s,at as l,I as u}from"./main-BopVSHhX.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function j(){x();const[a,i]=d.useState([]),{myTeams:r,isLoading:c}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),c?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",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}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
@@ -1 +1 @@
1
- import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{aL as A,a4 as j,aD as r,a1 as q,ao as R,P as U,N as F}from"./main-7jP_dqcT.js";import{S as O,E as G,C as K}from"./ArtifactsGallery-DIp4aSOX.js";import{R as P}from"./refresh-cw-BdnkJGAc.js";import{C as J}from"./copy-D89XvJAZ.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";import"./dialog-CAsYgtpg.js";let m=null;function M(n,c,e=0){b();const o=`/web/sessions/${n}/events`,l=new EventSource(o,{withCredentials:!0});m=l;let u=e;l.addEventListener("message",p=>{try{const x=JSON.parse(p.data);if(x.seqNum!==void 0&&x.seqNum<=u)return;x.seqNum!==void 0&&(u=x.seqNum),c(x)}catch{}}),l.addEventListener("error",()=>{console.warn("[SSE] error, readyState:",l.readyState),l.readyState===EventSource.CLOSED&&(l.close(),b())})}function b(){m&&(m.close(),m=null)}function V(n,c){const e=a.useRef(c);e.current=c;const o=a.useCallback(l=>{e.current(l)},[]);a.useEffect(()=>{if(n)return M(n,o),()=>{b()}},[n,o])}function I({artifactId:n,onBack:c}){A();const[e,o]=a.useState(null),[l,u]=a.useState(""),[p,x]=a.useState(!1),[S,f]=a.useState(0),[w,h]=a.useState(!1),[g,C]=a.useState(null),[E,k]=a.useState("template"),[d,y]=a.useState(!1);a.useEffect(()=>{let s=!1;return j(n).then(i=>{s||o(i)}).catch(i=>{s||u(i instanceof Error?i.message:r("artifacts.viewNotFound"))}),()=>{s=!0}},[n]);const v=a.useCallback(()=>{j(n).then(s=>o(s)).catch(()=>{})},[n]),_=a.useCallback(s=>{var i;s.type==="artifact_updated"&&((i=s.payload)!=null&&i.id&&s.payload.id!==n||(v(),f(D=>D+1),y(!0)))},[n,v]);V((e==null?void 0:e.session_id)??null,_),a.useEffect(()=>{if(!d)return;const s=setTimeout(()=>y(!1),2500);return()=>clearTimeout(s)},[d]);const N=a.useCallback(s=>{e&&(C(e),k(s),h(!0))},[e]),$=a.useCallback(s=>{h(!1),o(i=>i?{...i,...s}:s),f(i=>i+1)},[]),T=a.useCallback(async()=>{if(window.confirm(r("artifacts.delete")+" — "+n.slice(0,8)+"…?"))try{await q(n),c()}catch(s){alert(s instanceof Error?s.message:r("artifacts.deleteFailed"))}},[n,c]),L=a.useCallback(async()=>{if(!e)return;await R(`${window.location.origin}${e.url}`)&&(x(!0),setTimeout(()=>x(!1),1500))},[e]);return l?t.jsx("div",{className:"flex flex-1 items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-status-error",children:r("artifacts.viewNotFound")}),t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:l}),t.jsx("button",{type:"button",onClick:c,className:"mt-4 rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:r("artifacts.backToGallery")})]})}):e?t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-surface-1 px-4 py-2.5",children:[t.jsx("button",{type:"button",onClick:c,className:"text-sm text-text-muted hover:text-text-primary",children:r("artifacts.backToGallery")}),t.jsx("span",{className:"text-text-muted/40",children:"/"}),t.jsx("span",{className:"truncate font-medium text-text-primary",children:e.title||e.id.slice(0,12)}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] transition-colors ${d?"bg-status-active/15 text-status-active":"bg-surface-3 text-text-muted"}`,title:d?r("artifacts.view.liveUpdated"):void 0,children:d?`↻ v${e.version}`:`v${e.version}`}),e.session_id&&t.jsxs("a",{href:`/code/${e.session_id}`,className:"truncate font-mono text-[10px] text-text-muted hover:text-accent",title:e.session_id,children:[r("artifacts.session"),": ",e.session_id.slice(0,14),"…"]}),e.expires_at&&t.jsxs("span",{className:"text-[10px] text-text-muted",title:e.expires_at,children:[r("artifacts.expires"),": ",new Date(e.expires_at).toLocaleDateString()]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx("button",{type:"button",onClick:()=>f(s=>s+1),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("common.loading"),children:t.jsx(P,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:()=>N("ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.aiUpdate"),children:t.jsx(O,{className:"h-3.5 w-3.5"})}),e.can_manage&&t.jsx("button",{type:"button",onClick:()=>N("template"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.edit"),children:t.jsx(U,{className:"h-3.5 w-3.5"})}),t.jsxs("button",{type:"button",onClick:L,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${r("artifacts.copyLink")} · ${r("artifacts.linkNotice")}`,children:[t.jsx(J,{className:"h-3.5 w-3.5"}),p&&t.jsx("span",{className:"text-status-active",children:r("artifacts.copied")})]}),t.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.openInNewTab"),children:t.jsx(G,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:r("artifacts.delete"),children:t.jsx(F,{className:"h-3.5 w-3.5"})})]})]}),t.jsx("iframe",{src:`${e.url}${e.url.includes("?")?"&":"?"}_=${Date.now()}`,title:e.title||e.id,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"},S),t.jsx(K,{open:w,onClose:()=>h(!1),onCreated:$,editArtifact:g,initialMode:E})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:r("common.loading")})}export{I as ArtifactView};
1
+ import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{aL as A,a4 as j,aD as r,a1 as q,ao as R,P as U,N as F}from"./main-BopVSHhX.js";import{S as O,E as G,C as K}from"./ArtifactsGallery-CNd9-Awp.js";import{R as P}from"./refresh-cw-BSwpDl-7.js";import{C as J}from"./copy-CvmA5P_Q.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";import"./dialog-B4hKrd7w.js";let m=null;function M(n,c,e=0){b();const o=`/web/sessions/${n}/events`,l=new EventSource(o,{withCredentials:!0});m=l;let u=e;l.addEventListener("message",p=>{try{const x=JSON.parse(p.data);if(x.seqNum!==void 0&&x.seqNum<=u)return;x.seqNum!==void 0&&(u=x.seqNum),c(x)}catch{}}),l.addEventListener("error",()=>{console.warn("[SSE] error, readyState:",l.readyState),l.readyState===EventSource.CLOSED&&(l.close(),b())})}function b(){m&&(m.close(),m=null)}function V(n,c){const e=a.useRef(c);e.current=c;const o=a.useCallback(l=>{e.current(l)},[]);a.useEffect(()=>{if(n)return M(n,o),()=>{b()}},[n,o])}function I({artifactId:n,onBack:c}){A();const[e,o]=a.useState(null),[l,u]=a.useState(""),[p,x]=a.useState(!1),[S,f]=a.useState(0),[w,h]=a.useState(!1),[g,C]=a.useState(null),[E,k]=a.useState("template"),[d,y]=a.useState(!1);a.useEffect(()=>{let s=!1;return j(n).then(i=>{s||o(i)}).catch(i=>{s||u(i instanceof Error?i.message:r("artifacts.viewNotFound"))}),()=>{s=!0}},[n]);const v=a.useCallback(()=>{j(n).then(s=>o(s)).catch(()=>{})},[n]),_=a.useCallback(s=>{var i;s.type==="artifact_updated"&&((i=s.payload)!=null&&i.id&&s.payload.id!==n||(v(),f(D=>D+1),y(!0)))},[n,v]);V((e==null?void 0:e.session_id)??null,_),a.useEffect(()=>{if(!d)return;const s=setTimeout(()=>y(!1),2500);return()=>clearTimeout(s)},[d]);const N=a.useCallback(s=>{e&&(C(e),k(s),h(!0))},[e]),$=a.useCallback(s=>{h(!1),o(i=>i?{...i,...s}:s),f(i=>i+1)},[]),T=a.useCallback(async()=>{if(window.confirm(r("artifacts.delete")+" — "+n.slice(0,8)+"…?"))try{await q(n),c()}catch(s){alert(s instanceof Error?s.message:r("artifacts.deleteFailed"))}},[n,c]),L=a.useCallback(async()=>{if(!e)return;await R(`${window.location.origin}${e.url}`)&&(x(!0),setTimeout(()=>x(!1),1500))},[e]);return l?t.jsx("div",{className:"flex flex-1 items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-status-error",children:r("artifacts.viewNotFound")}),t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:l}),t.jsx("button",{type:"button",onClick:c,className:"mt-4 rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:r("artifacts.backToGallery")})]})}):e?t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-surface-1 px-4 py-2.5",children:[t.jsx("button",{type:"button",onClick:c,className:"text-sm text-text-muted hover:text-text-primary",children:r("artifacts.backToGallery")}),t.jsx("span",{className:"text-text-muted/40",children:"/"}),t.jsx("span",{className:"truncate font-medium text-text-primary",children:e.title||e.id.slice(0,12)}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] transition-colors ${d?"bg-status-active/15 text-status-active":"bg-surface-3 text-text-muted"}`,title:d?r("artifacts.view.liveUpdated"):void 0,children:d?`↻ v${e.version}`:`v${e.version}`}),e.session_id&&t.jsxs("a",{href:`/code/${e.session_id}`,className:"truncate font-mono text-[10px] text-text-muted hover:text-accent",title:e.session_id,children:[r("artifacts.session"),": ",e.session_id.slice(0,14),"…"]}),e.expires_at&&t.jsxs("span",{className:"text-[10px] text-text-muted",title:e.expires_at,children:[r("artifacts.expires"),": ",new Date(e.expires_at).toLocaleDateString()]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx("button",{type:"button",onClick:()=>f(s=>s+1),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("common.loading"),children:t.jsx(P,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:()=>N("ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.aiUpdate"),children:t.jsx(O,{className:"h-3.5 w-3.5"})}),e.can_manage&&t.jsx("button",{type:"button",onClick:()=>N("template"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.edit"),children:t.jsx(U,{className:"h-3.5 w-3.5"})}),t.jsxs("button",{type:"button",onClick:L,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${r("artifacts.copyLink")} · ${r("artifacts.linkNotice")}`,children:[t.jsx(J,{className:"h-3.5 w-3.5"}),p&&t.jsx("span",{className:"text-status-active",children:r("artifacts.copied")})]}),t.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.openInNewTab"),children:t.jsx(G,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:r("artifacts.delete"),children:t.jsx(F,{className:"h-3.5 w-3.5"})})]})]}),t.jsx("iframe",{src:`${e.url}${e.url.includes("?")?"&":"?"}_=${Date.now()}`,title:e.title||e.id,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"},S),t.jsx(K,{open:w,onClose:()=>h(!1),onCreated:$,editArtifact:g,initialMode:E})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:r("common.loading")})}export{I as ArtifactView};
@@ -1,4 +1,4 @@
1
- var pt=Object.defineProperty;var ht=(t,e,r)=>e in t?pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var S=(t,e,r)=>ht(t,typeof e!="symbol"?e+"":e,r);import{e as k,j as o}from"./vendor-DE_-CLIE.js";import{ap as Te,au as ut,aL as Qe,aM as ft,a5 as mt,aD as f,a1 as xt,ao as gt,F as bt,i as kt,P as yt,N as wt,t as vt,a4 as St,aa as Rt,ay as Tt,a9 as $t,ai as jt,aj as Et,_ as Nt,b as Ct}from"./main-7jP_dqcT.js";import{D as It,a as At,c as Lt,d as zt,b as _t}from"./dialog-CAsYgtpg.js";import{C as Dt}from"./copy-D89XvJAZ.js";/**
1
+ var pt=Object.defineProperty;var ht=(t,e,r)=>e in t?pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var S=(t,e,r)=>ht(t,typeof e!="symbol"?e+"":e,r);import{e as k,j as o}from"./vendor-DE_-CLIE.js";import{ap as Te,au as ut,aL as Qe,aM as ft,a5 as mt,aD as f,a1 as xt,ao as gt,F as bt,i as kt,P as yt,N as wt,t as vt,a4 as St,aa as Rt,ay as Tt,a9 as $t,ai as jt,aj as Et,_ as Nt,b as Ct}from"./main-BopVSHhX.js";import{D as It,a as At,c as Lt,d as zt,b as _t}from"./dialog-B4hKrd7w.js";import{C as Dt}from"./copy-CvmA5P_Q.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{Y as u,a3 as f}from"./main-7jP_dqcT.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{Y as u,a3 as f}from"./main-BopVSHhX.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
@@ -1,4 +1,4 @@
1
- import{j as e,e as r}from"./vendor-DE_-CLIE.js";import{ap as Q,an as E,aM as I,aK as O,aD as t,U as V,at as q,aL as B,I as X,f as P,e as $,$ as Z,ah as G,a3 as J,a6 as Y,a2 as ee,S as U,X as se,aE as ae}from"./main-7jP_dqcT.js";import{R as H,E as te}from"./RegisterEmpty-VAnkkhxE.js";import{g as L}from"./workerType-D9tOpHFH.js";import{S as ne}from"./SessionVisibilityBadge-SoKp2ads.js";import{D as re,a as le,d as ce}from"./dialog-CAsYgtpg.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";/**
1
+ import{j as e,e as r}from"./vendor-DE_-CLIE.js";import{ap as Q,an as E,aM as I,aK as O,aD as t,U as V,at as q,aL as B,I as X,f as P,e as $,$ as Z,ah as G,a3 as J,a6 as Y,a2 as ee,S as U,X as se,aE as ae}from"./main-BopVSHhX.js";import{R as H,E as te}from"./RegisterEmpty-BrBfeQXp.js";import{g as L}from"./workerType-BF4aY_R_.js";import{S as ne}from"./SessionVisibilityBadge-kSo9esvT.js";import{D as re,a as le,d as ce}from"./dialog-B4hKrd7w.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aK as v,c as N,aD as t}from"./main-7jP_dqcT.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function P({onSuccess:h,onInvalidInvite:i}){const{join:b}=v(),[l,f]=r.useState(""),[u,w]=r.useState(""),[o,j]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):i()},[i]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await b(l,u,o),h()}catch(a){const d=a instanceof Error?a.message:"Join failed";if(d.includes("Invalid invitation")||d.includes("expired")||d.includes("already used")){i();return}n(d)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(N,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:u,onChange:s=>w(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,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 font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>j(s.target.value),required:!0,autoComplete:"new-password",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 font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",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"})]}),m&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!l,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{P as Join};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aK as v,c as N,aD as t}from"./main-BopVSHhX.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function P({onSuccess:h,onInvalidInvite:i}){const{join:b}=v(),[l,f]=r.useState(""),[u,w]=r.useState(""),[o,j]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):i()},[i]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await b(l,u,o),h()}catch(a){const d=a instanceof Error?a.message:"Join failed";if(d.includes("Invalid invitation")||d.includes("expired")||d.includes("already used")){i();return}n(d)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(N,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:u,onChange:s=>w(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,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 font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>j(s.target.value),required:!0,autoComplete:"new-password",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 font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",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"})]}),m&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!l,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{P as Join};
@@ -1 +1 @@
1
- import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{aD as t,aE as y,aK as j,c as w}from"./main-7jP_dqcT.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function v(r){if(!(r instanceof Error))return t("auth.login.failed");if(r instanceof TypeError)return t("auth.login.unreachable");const s=r.message;return/failed to fetch|network|load failed/i.test(s)?t("auth.login.unreachable"):/csrf/i.test(s)?t("auth.login.csrfBlocked"):/too many/i.test(s)?t("auth.login.rateLimited"):/invalid credentials/i.test(s)?t("auth.login.failed"):!s||/^login failed$/i.test(s)?t("auth.login.failed"):y("auth.login.failedWithReason",{message:s})}function C({onSuccess:r,onNavigateRegister:s}){const{login:m,registrationAllowed:x,singleUserMode:h}=j(),[o,f]=n.useState(""),[i,b]=n.useState(""),[l,d]=n.useState(""),[u,c]=n.useState(!1),g=async a=>{a.preventDefault(),d(""),c(!0);try{await m(o,i),r()}catch(p){d(v(p))}finally{c(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(w,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[h&&e.jsxs("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2 text-xs text-text-secondary",children:[e.jsx("p",{children:t("auth.login.singleUserHint")}),e.jsx("p",{className:"mt-1 font-mono text-text-primary",children:"admin / admin123"}),e.jsx("p",{className:"mt-1 text-text-muted",children:t("auth.login.singleUserHintFooter")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:o,onChange:a=>f(a.target.value),required:!0,autoComplete:"username",autoFocus:!0,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 font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:i,onChange:a=>b(a.target.value),required:!0,autoComplete:"current-password",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"})]}),l&&e.jsx("p",{className:"text-sm text-status-error",children:l}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:u?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:s,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{C as Login};
1
+ import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{aD as t,aE as y,aK as j,c as w}from"./main-BopVSHhX.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function v(r){if(!(r instanceof Error))return t("auth.login.failed");if(r instanceof TypeError)return t("auth.login.unreachable");const s=r.message;return/failed to fetch|network|load failed/i.test(s)?t("auth.login.unreachable"):/csrf/i.test(s)?t("auth.login.csrfBlocked"):/too many/i.test(s)?t("auth.login.rateLimited"):/invalid credentials/i.test(s)?t("auth.login.failed"):!s||/^login failed$/i.test(s)?t("auth.login.failed"):y("auth.login.failedWithReason",{message:s})}function C({onSuccess:r,onNavigateRegister:s}){const{login:m,registrationAllowed:x,singleUserMode:h}=j(),[o,f]=n.useState(""),[i,b]=n.useState(""),[l,d]=n.useState(""),[u,c]=n.useState(!1),g=async a=>{a.preventDefault(),d(""),c(!0);try{await m(o,i),r()}catch(p){d(v(p))}finally{c(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(w,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[h&&e.jsxs("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2 text-xs text-text-secondary",children:[e.jsx("p",{children:t("auth.login.singleUserHint")}),e.jsx("p",{className:"mt-1 font-mono text-text-primary",children:"admin / admin123"}),e.jsx("p",{className:"mt-1 text-text-muted",children:t("auth.login.singleUserHintFooter")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:o,onChange:a=>f(a.target.value),required:!0,autoComplete:"username",autoFocus:!0,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 font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:i,onChange:a=>b(a.target.value),required:!0,autoComplete:"current-password",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"})]}),l&&e.jsx("p",{className:"text-sm text-status-error",children:l}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:u?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:s,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{C as Login};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aK as w,c as y,aD as t}from"./main-7jP_dqcT.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function C({onSuccess:m,onBack:x}){const{register:h}=w(),[n,p]=r.useState(""),[a,b]=r.useState(""),[l,f]=r.useState(""),[d,o]=r.useState(""),[i,u]=r.useState(!1),g=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==l){o(t("auth.setup.passwordMismatch"));return}u(!0);try{await h(n,a),m()}catch(c){o(c instanceof Error?c.message:t("auth.register.failed"))}finally{u(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.register.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.register.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:n,onChange:s=>p(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,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 font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>b(s.target.value),required:!0,autoComplete:"new-password",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 font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>f(s.target.value),required:!0,autoComplete:"new-password",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"})]}),d&&e.jsx("p",{className:"text-sm text-status-error",children:d}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:i?t("common.loading"):t("auth.register.submit")})]}),e.jsx("button",{type:"button",onClick:x,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.register.backToLogin")})]})})}export{C as Register};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aK as w,c as y,aD as t}from"./main-BopVSHhX.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function C({onSuccess:m,onBack:x}){const{register:h}=w(),[n,p]=r.useState(""),[a,b]=r.useState(""),[l,f]=r.useState(""),[d,o]=r.useState(""),[i,u]=r.useState(!1),g=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==l){o(t("auth.setup.passwordMismatch"));return}u(!0);try{await h(n,a),m()}catch(c){o(c instanceof Error?c.message:t("auth.register.failed"))}finally{u(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.register.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.register.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:n,onChange:s=>p(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,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 font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>b(s.target.value),required:!0,autoComplete:"new-password",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 font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>f(s.target.value),required:!0,autoComplete:"new-password",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"})]}),d&&e.jsx("p",{className:"text-sm text-status-error",children:d}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:i?t("common.loading"):t("auth.register.submit")})]}),e.jsx("button",{type:"button",onClick:x,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.register.backToLogin")})]})})}export{C as Register};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./vendor-DE_-CLIE.js";import{ap as a,i as d,h as l,an as p,aD as h}from"./main-7jP_dqcT.js";import{A as y}from"./workerType-D9tOpHFH.js";/**
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{ap as a,i as d,h as l,an as p,aD as h}from"./main-BopVSHhX.js";import{A as y}from"./workerType-BF4aY_R_.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,78 @@
1
+ var Js=Object.defineProperty;var Xs=(r,t,s)=>t in r?Js(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var A=(r,t,s)=>Xs(r,typeof t!="symbol"?t+"":t,s);import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{ap as Q,a8 as Zs,ax as It,aw as $t,aD as c,az as en,ay as Ue,aE as K,au as le,aj as tn,ai as G,ab as sn,ag as nn,aI as rn,aL as Z,T as an,Q as on,X as ln,L as Ce,H as cn,I as dn,i as Dt,at as ds,N as un,aq as Fe,e as Te,S as ct,M as mn,y as xn,ar as V,an as ne,as as fn,aF as pn,G as hn,D as gn,aG as qt,ac as yn,a0 as bn,af as jn,A as wn,av as kn,aA as vn,aB as Nn,Z as Pt,$ as _n,aH as Sn,b as Cn,a2 as Ot,ad as Tn,K as us,F as En,d as Mn,C as An,a7 as Ut,l as Rn,a as In,u as Le,w as Be,E as $n,g as He,f as We,v as Qe,s as Dn,B as qn}from"./main-BopVSHhX.js";import{A as Pn,g as Ft}from"./workerType-BF4aY_R_.js";import{D as me,a as xe,c as fe,d as pe,b as On}from"./dialog-B4hKrd7w.js";import{R as Un}from"./refresh-cw-BSwpDl-7.js";import{A as Fn,U as Kn}from"./UserSearchInput-wixyd_8w.js";import{C as Ln}from"./copy-CvmA5P_Q.js";import{E as Bn,A as Hn}from"./ArtifactsGallery-CNd9-Awp.js";import{S as Wn}from"./SessionVisibilityBadge-kSo9esvT.js";import{S as Qn,b as zn}from"./notifications-DOBs9HVf.js";import"./preload-helper-BiaRt2Oj.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 Vn=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ms=Q("chevron-right",Vn);/**
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 Gn=[["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"}]],xs=Q("cpu",Gn);/**
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 Yn=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Jn=Q("gauge",Yn);/**
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 Xn=[["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"}]],Zn=Q("hash",Xn);/**
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 er=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],tr=Q("info",er);/**
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 sr=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],nr=Q("layers",sr);/**
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 rr=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],fs=Q("message-circle-question-mark",rr);/**
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 ar=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],or=Q("message-square-text",ar);/**
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 ir=[["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"}]],lr=Q("play",ir);/**
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 cr=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],ps=Q("plug",cr);/**
52
+ * @license lucide-react v0.555.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const dr=[["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"}]],ur=Q("server-cog",dr);/**
57
+ * @license lucide-react v0.555.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const mr=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],hs=Q("settings-2",mr);/**
62
+ * @license lucide-react v0.555.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const xr=[["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"}]],fr=Q("share-2",xr);/**
67
+ * @license lucide-react v0.555.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const pr=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hr=Q("shield-check",pr);function dt(){return{tasks:{}}}const Kt=3e4;function Pe(r){const t=r.trim();if(!t)return"agent";const s=t.split(/\s+/).slice(0,2).join(" ");return s.length>40?s.slice(0,40)+"…":s}function Lt(r,t){var i,u,f,p,g,y,k,C,_,j,m,h;const s=t.subtype;if(s!=="task_started"&&s!=="task_progress"&&s!=="task_notification")return r;const n=t.task_id;if(!n)return r;const a=Date.now(),d=r.tasks[n];if(s==="task_started"){if(d)return{tasks:{...r.tasks,[n]:{...d,description:t.description??d.description,name:Pe(t.description??d.description),taskType:t.task_type??d.taskType,workflowName:t.workflow_name??d.workflowName,prompt:t.prompt??d.prompt,toolUseId:t.tool_use_id??d.toolUseId,status:"running",startTime:a,evictAfter:void 0}}};const w=t.description??"";return{tasks:{...r.tasks,[n]:{taskId:n,name:Pe(w),description:w,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:a}}}}if(s==="task_progress"){if(!d){const w=t.description??"";return{tasks:{...r.tasks,[n]:{taskId:n,name:Pe(w),description:w,toolUseId:t.tool_use_id,status:"running",startTime:a,tokenCount:(i=t.usage)==null?void 0:i.total_tokens,toolUseCount:(u=t.usage)==null?void 0:u.tool_uses,durationMs:(f=t.usage)==null?void 0:f.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...r.tasks,[n]:{...d,description:t.description??d.description,tokenCount:((p=t.usage)==null?void 0:p.total_tokens)??d.tokenCount,toolUseCount:((g=t.usage)==null?void 0:g.tool_uses)??d.toolUseCount,durationMs:((y=t.usage)==null?void 0:y.duration_ms)??d.durationMs,lastToolName:t.last_tool_name??d.lastToolName,summary:t.summary??d.summary}}}}return d?{tasks:{...r.tasks,[n]:{...d,status:t.status??"completed",endTime:a,finalSummary:t.summary??d.finalSummary,outputFile:t.output_file??d.outputFile,tokenCount:((j=t.usage)==null?void 0:j.total_tokens)??d.tokenCount,toolUseCount:((m=t.usage)==null?void 0:m.tool_uses)??d.toolUseCount,durationMs:((h=t.usage)==null?void 0:h.duration_ms)??d.durationMs,evictAfter:a+Kt}}}:{tasks:{...r.tasks,[n]:{taskId:n,name:Pe(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:a,endTime:a,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(k=t.usage)==null?void 0:k.total_tokens,toolUseCount:(C=t.usage)==null?void 0:C.tool_uses,durationMs:(_=t.usage)==null?void 0:_.duration_ms,evictAfter:a+Kt}}}}function gs(r,t=Date.now()){return Object.values(r.tasks).filter(s=>s.evictAfter===void 0||s.evictAfter>t).sort((s,n)=>s.startTime-n.startTime)}const Bt={in_process_teammate:0,local_bash:1,monitor_mcp:2,remote_agent:3,local_agent:4,dream:5},Ht=100;function gr(r){const t=new Map;for(const s of r){const n=s.taskType??"",a=t.get(n);a?a.push(s):t.set(n,[s])}return[...t.entries()].sort(([s],[n])=>{const a=Bt[s]??Ht,d=Bt[n]??Ht;return a===d?s.localeCompare(n):a-d}).map(([s,n])=>({taskType:s,tasks:[...n].sort((a,d)=>a.startTime-d.startTime)}))}function Wt(r){const t=r.raw,s=t&&typeof t=="object"?t:r,n=typeof s.subtype=="string"?s.subtype:void 0;return n!=="task_started"&&n!=="task_progress"&&n!=="task_notification"?null:{subtype:n,task_id:typeof s.task_id=="string"?s.task_id:void 0,tool_use_id:typeof s.tool_use_id=="string"?s.tool_use_id:void 0,description:typeof s.description=="string"?s.description:void 0,task_type:typeof s.task_type=="string"?s.task_type:void 0,workflow_name:typeof s.workflow_name=="string"?s.workflow_name:void 0,prompt:typeof s.prompt=="string"?s.prompt:void 0,usage:s.usage&&typeof s.usage=="object"?s.usage:void 0,last_tool_name:typeof s.last_tool_name=="string"?s.last_tool_name:void 0,summary:typeof s.summary=="string"?s.summary:void 0,status:s.status==="completed"||s.status==="failed"||s.status==="stopped"?s.status:void 0,output_file:typeof s.output_file=="string"?s.output_file:void 0}}function yr(r){if(!r||typeof r!="object"||Array.isArray(r))return null;const t=r,s={file_search:t.file_search===!0,clear:t.clear===!0,set_max_thinking_tokens:t.set_max_thinking_tokens===!0,get_context_usage:t.get_context_usage===!0,stop_task:t.stop_task===!0,set_model:t.set_model===!0,set_permission_mode:t.set_permission_mode===!0,interrupt:t.interrupt===!0,end_session:t.end_session===!0,mcp_management:t.mcp_management===!0,remote_settings:t.remote_settings===!0,rewind:t.rewind===!0,resume:t.resume===!0,set_effort:t.set_effort===!0,side_question:t.side_question===!0};return Object.values(s).some(Boolean)?s:null}function Qt(r,t){const s=[];if(Array.isArray(r)){for(const n of r){if(!n||typeof n!="object")continue;const a=n;if(typeof a.name!="string"||!a.name)continue;const d=a.type==="prompt"||a.type==="local"||a.type==="local-jsx"?a.type:void 0;s.push({name:a.name,...typeof a.description=="string"&&a.description?{description:a.description}:{},...typeof a.argumentHint=="string"&&a.argumentHint?{argumentHint:a.argumentHint}:{},...d?{type:d}:{}})}if(s.length>0)return s}if(Array.isArray(t))for(const n of t)typeof n=="string"&&n&&s.push({name:n});return s}function zt(r){const t=r.raw&&typeof r.raw=="object"&&!Array.isArray(r.raw)?r.raw:r,s=Qt(t.slash_command_details??r.slash_command_details,t.slash_commands??r.slash_commands),n=Qt(t.skill_details??r.skill_details,t.skills??r.skills),a=yr(t.remote_capabilities??r.remote_capabilities);return s.length===0&&n.length===0&&!a?null:{commands:s,skills:n,capabilities:a}}class br{constructor(t){A(this,"listeners",new Set);A(this,"stateListeners",new Set);A(this,"eventSource",null);A(this,"sessionId",null);A(this,"_lastSeqNum",0);A(this,"lastFrameAt",0);A(this,"firstEventAfterOpen",!1);A(this,"watchdogTimer",null);A(this,"visibilityHandler",null);A(this,"reconnectTimer",null);A(this,"reconnectAttempts",0);A(this,"_state","idle");A(this,"opts");this.opts={stallThresholdMs:45e3,watchdogTickMs:5e3,reconnectBaseDelayMs:1e3,reconnectMaxDelayMs:15e3,maxReconnectAttempts:6,...t}}get state(){return this._state}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onStateChange(t){return this.stateListeners.add(t),()=>this.stateListeners.delete(t)}connect(t){this.stopReconnectTimer(),this.reconnectAttempts=0,this.sessionId=t,this.openStream()}openStream(){if(this.closeStream(),!this.sessionId)return;this.setState("connecting");const t=this._lastSeqNum>0?`/web/sessions/${this.sessionId}/events?fromSeqNum=${this._lastSeqNum}`:`/web/sessions/${this.sessionId}/events`,s=new EventSource(t,{withCredentials:!0});this.eventSource=s,this.lastFrameAt=Date.now(),this.firstEventAfterOpen=!0,s.addEventListener("open",()=>{this.lastFrameAt=Date.now(),this.reconnectAttempts=0,this.firstEventAfterOpen=!0,this.setState("open")}),s.addEventListener("ping",()=>{this.lastFrameAt=Date.now()}),s.addEventListener("message",n=>{this.lastFrameAt=Date.now();try{const a=JSON.parse(n.data);if(this.firstEventAfterOpen&&(this.firstEventAfterOpen=!1,typeof a.seqNum=="number"&&a.seqNum<this._lastSeqNum&&(this._lastSeqNum=a.seqNum-1,this.notifyResync())),a.seqNum!==void 0&&a.seqNum<=this._lastSeqNum)return;a.seqNum!==void 0&&(this._lastSeqNum=a.seqNum);for(const d of this.listeners)d(a)}catch{}}),s.addEventListener("error",()=>{s.readyState===EventSource.CLOSED&&this.scheduleReconnect()}),this.startWatchdog()}disconnect(){this.sessionId=null,this.stopReconnectTimer(),this.closeStream(),this._lastSeqNum=0,this.reconnectAttempts=0,this.setState("idle")}closeStream(){this.stopWatchdog(),this.eventSource&&(this.eventSource.close(),this.eventSource=null)}startWatchdog(){this.stopWatchdog(),this.watchdogTimer=setInterval(()=>{this.probeStall()},this.opts.watchdogTickMs),typeof document<"u"&&(this.visibilityHandler=()=>{document.visibilityState==="visible"&&this.probeStall()},document.addEventListener("visibilitychange",this.visibilityHandler))}probeStall(){const t=this.eventSource;!t||t.readyState!==EventSource.OPEN||Date.now()-this.lastFrameAt<=this.opts.stallThresholdMs||this.scheduleReconnect()}stopWatchdog(){this.watchdogTimer&&(clearInterval(this.watchdogTimer),this.watchdogTimer=null),this.visibilityHandler&&(typeof document<"u"&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null)}stopReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}scheduleReconnect(){if(this.reconnectTimer||!this.sessionId)return;if(this.closeStream(),this.reconnectAttempts++,this.reconnectAttempts>this.opts.maxReconnectAttempts){this.setState("failed");return}this.setState("reconnecting");const t=Math.min(this.opts.reconnectBaseDelayMs*2**(this.reconnectAttempts-1),this.opts.reconnectMaxDelayMs),s=Math.max(0,t+t*.25*(2*Math.random()-1));this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.reconnect()},s)}async reconnect(){this.sessionId&&(await rn(),this.sessionId&&this.openStream())}setState(t){if(this._state!==t){this._state=t;for(const s of this.stateListeners)s(t,{})}}notifyResync(){for(const t of this.stateListeners)t(this._state,{resync:!0})}}const ce=new br;function at(r){if(typeof r.content=="string")return r.content;if(r.message&&typeof r.message=="object"){const t=r.message;if(typeof t.content=="string")return t.content;if(Array.isArray(t.content))return t.content.filter(s=>s.type==="text"&&typeof s.text=="string").map(s=>s.text).join("")}return""}function Vt(r,t){for(let s=r.length-1;s>=0;s--){const n=r[s];if(n&&n.type==="tool_call"&&n.toolCall.id===t)return s}return-1}const ot="streaming-";function Gt(r){const t=r.message;if(!t||typeof t!="object"||!Array.isArray(t.content))return"";const s=[];for(const n of t.content)if((n==null?void 0:n.type)==="thinking"){const a=typeof n.thinking=="string"&&n.thinking||typeof n.text=="string"&&n.text||"";a&&s.push(a)}return s.join("")}function Yt(r){return r.filter(t=>typeof t.subject=="string"&&t.subject).map(t=>({content:t.subject,priority:"medium",status:t.status==="completed"?"completed":t.status==="in_progress"?"in_progress":"pending"}))}function Jt(r){if(!r||typeof r!="object")return"";const t=r;if(typeof t.target_event_id=="string"&&t.target_event_id)return t.target_event_id;const s=t.raw;if(s&&typeof s=="object"&&!Array.isArray(s)){const n=s.target_event_id;if(typeof n=="string"&&n)return n}return""}class jr{constructor(t,s,n){A(this,"sessionId");A(this,"setEntries");A(this,"unsub",null);A(this,"unsubState",null);A(this,"onStatusChange");A(this,"onError");A(this,"onPermissionRequest");A(this,"onModelsStateChange");A(this,"onSubagentUpdate");A(this,"onControlResponse");A(this,"onPermissionModeChange");A(this,"onUsageChange");A(this,"onElicitationRequest");A(this,"onWorkerInfoChange");A(this,"onTurnStart");A(this,"subagentState",dt());A(this,"seenUuids",new Set);A(this,"seenToolCallIds",new Set);A(this,"pendingToolCallIds",new Set);A(this,"pendingPermissionToolIds",new Map);A(this,"postedUserUuids",new Set);A(this,"pendingControlRequests",new Map);A(this,"turnEnded",!1);A(this,"userSinceTurnEnd",!1);A(this,"turnStartedAt",null);A(this,"closed",!1);this.sessionId=t,this.setEntries=s,this.onStatusChange=n==null?void 0:n.onStatusChange,this.onError=n==null?void 0:n.onError,this.onPermissionRequest=n==null?void 0:n.onPermissionRequest,this.onModelsStateChange=n==null?void 0:n.onModelsStateChange,this.onSubagentUpdate=n==null?void 0:n.onSubagentUpdate,this.onControlResponse=n==null?void 0:n.onControlResponse,this.onPermissionModeChange=n==null?void 0:n.onPermissionModeChange,this.onUsageChange=n==null?void 0:n.onUsageChange,this.onElicitationRequest=n==null?void 0:n.onElicitationRequest,this.onWorkerInfoChange=n==null?void 0:n.onWorkerInfoChange,this.onTurnStart=n==null?void 0:n.onTurnStart}markClosed(){this.closed=!0}setTurnStartedAt(t){var s;this.turnStartedAt!==t&&(this.turnStartedAt=t,(s=this.onTurnStart)==null||s.call(this,t))}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var j,m,h,w,S,I,T;const{events:t}=await Zs(this.sessionId);if(!t||t.length===0)return;const s=new Set;for(const b of t){if(b.type!=="user"||b.direction==="inbound")continue;const E=(j=b.payload)==null?void 0:j.uuid;typeof E=="string"&&E&&s.add(E)}const n=[];let a=null;const d=()=>{a&&(n.push(a),a=null)};for(const b of t){const E=b.payload||{},$=E.uuid;if(typeof $=="string"&&$&&this.seenUuids.add($),b.type==="tool_use"){const R=E.tool_call_id;typeof R=="string"&&R&&this.seenToolCallIds.add(R)}if(b.type==="user"){if(b.direction==="inbound"){const v=E.uuid;if(typeof v!="string"||!v||s.has(v))continue}d();const R=at(E);R&&n.push({type:"user_message",id:b.id||`hist-user-${n.length}`,content:R})}else if(b.type==="assistant"){d();const R=at(E);if(It(R))continue;const v=Gt(E),O=[],L=E.message;if(L&&typeof L=="object"&&Array.isArray(L.content)){for(const Y of L.content)if(Y.type==="tool_use"){const ee=Y.id;ee&&this.seenToolCallIds.add(ee),O.push({type:"tool_call",toolCall:{id:ee||`hist-tool-${n.length}`,title:Y.name||"tool",status:"complete",rawInput:Y.input||{}}})}}if(R||v||O.length>0){a={type:"assistant_message",id:b.id||`hist-asst-${n.length}`,chunks:[...v?[{type:"thought",text:v}]:[],...R?[{type:"message",text:R}]:[]]},n.push(a);for(const Y of O)n.push(Y);a=null}}else if(b.type==="conversation_rewound"){const R=Jt(E);if(R){const v=n.findIndex(O=>$t(O)===R);v>=0&&(n.length=v)}}else if(b.type==="tool_use"){const R=E,v={type:"tool_call",toolCall:{id:R.tool_call_id||`hist-tool-${n.length}`,title:R.tool_name||"tool",status:"complete",rawInput:R.tool_input||{}}};n.push(v)}else if(b.type==="tool_result"){const R=E,v=Vt(n,R.tool_call_id||"");if(v>=0){const O=n[v];n[v]={type:"tool_call",toolCall:{...O.toolCall,rawOutput:{output:R.content||R.output||""}}}}}}d();let i=null;for(const b of t){if(b.type!=="task_state")continue;const E=b.payload||{};Array.isArray(E.tasks)&&(i=E.tasks)}if(i&&i.length>0){const b=Yt(i);b.length>0&&n.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:b})}this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries(n);let u=null,f=null,p=null,g=null,y=0,k=0;for(const b of t){const E=b.payload||{};if(typeof b.createdAt=="number"&&(b.createdAt>k&&(k=b.createdAt),b.type==="user"&&g!=="user"&&b.createdAt>0&&(y=b.createdAt)),b.type==="user"?g="user":(b.type==="result"||b.type==="result_success"||b.type==="interrupt")&&(g="turn_end"),b.type==="system"&&(E.subtype==="init"||((m=E.raw)==null?void 0:m.subtype)==="init")&&(f=zt(E)),b.type==="models_state"){const $=E.raw,R=$&&typeof $=="object"?$.models_state:E.models_state;R&&Array.isArray(R.availableModels)&&typeof R.currentModelId=="string"&&(u=R)}else if(b.type==="result"||b.type==="result_success"){const $=E.usage,R=typeof E.total_cost_usd=="number"?E.total_cost_usd:null;($||R!==null)&&(p={inputTokens:(($==null?void 0:$.input_tokens)??0)+(($==null?void 0:$.cache_read_input_tokens)??0)+(($==null?void 0:$.cache_creation_input_tokens)??0),outputTokens:($==null?void 0:$.output_tokens)??0,totalCostUsd:R})}}let C=!1,_=dt();for(const b of t){if(b.type!=="system")continue;const E=Wt(b.payload||{});E&&(_=Lt(_,E),C=!0)}C&&(this.subagentState=_,(h=this.onSubagentUpdate)==null||h.call(this,this.subagentState)),u&&((w=this.onModelsStateChange)==null||w.call(this,u)),f&&((S=this.onWorkerInfoChange)==null||S.call(this,f)),p&&((I=this.onUsageChange)==null||I.call(this,p)),this.turnEnded=g==="turn_end",this.userSinceTurnEnd=g==="user",this.setTurnStartedAt(!this.closed&&g==="user"&&y>0&&k>=y?Date.now()-(k-y):null),this.turnEnded&&!this.closed&&((T=this.onStatusChange)==null||T.call(this,"idle"))}connectSSE(){ce.connect(this.sessionId),this.unsub=ce.onEvent(t=>this.handleEvent(t)),this.unsubState=ce.onStateChange((t,s)=>{s.resync&&!this.closed&&this.loadHistory().catch(()=>{})})}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),this.unsubState&&(this.unsubState(),this.unsubState=null),ce.disconnect()}handleEvent(t){var a,d,i,u,f,p,g,y,k,C,_,j;const s=t.type,n=t.payload||{};switch(s){case"user":{if(this.applyEmbeddedToolResults(n),this.userSinceTurnEnd=!0,!this.closed&&this.turnStartedAt===null&&this.setTurnStartedAt(Date.now()),t.direction==="inbound"){const m=n.uuid;if(typeof m!="string"||!m||this.postedUserUuids.has(m)||this.seenUuids.has(m))break;this.seenUuids.add(m);const h=at(n);h&&this.setEntries(w=>[...w,{type:"user_message",id:t.id||`user-${Date.now()}`,content:h}])}break}case"assistant":{const m=n.uuid;if(typeof m=="string"&&m){if(this.seenUuids.has(m))break;this.seenUuids.add(m)}const h=typeof n.content=="string"?n.content:"";if(It(h))break;const w=Gt(n);this.setEntries(I=>{const T=I[I.length-1];if((T==null?void 0:T.type)==="assistant_message"&&T.id.startsWith(ot))return[...I.slice(0,-1),{...T,id:`assistant-${Date.now()}`,chunks:[...w?[{type:"thought",text:w}]:[],{type:"message",text:h}]}];if((T==null?void 0:T.type)==="assistant_message"){const b=T.chunks[T.chunks.length-1];return(b==null?void 0:b.type)==="message"?[...I.slice(0,-1),{...T,chunks:[...T.chunks.slice(0,-1),{type:"message",text:b.text+h}]}]:[...I.slice(0,-1),{...T,chunks:[...T.chunks,{type:"message",text:h}]}]}if(h&&h.trim()||w){const b={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...w?[{type:"thought",text:w}]:[],...h?[{type:"message",text:h}]:[]]};return[...I,b]}return I});const S=n.message;if(S&&typeof S=="object"&&Array.isArray(S.content)){const I=S.content.filter(T=>T.type==="tool_use");for(const T of I){const b=T.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(b))continue;this.seenToolCallIds.add(b),this.pendingToolCallIds.add(b);const E={id:b,title:T.name||"tool",status:"running",rawInput:T.input||{}};this.setEntries($=>[...$,{type:"tool_call",toolCall:E}])}}break}case"tool_use":{const m=n,h=m.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(h))break;this.seenToolCallIds.add(h),this.pendingToolCallIds.add(h);const w={id:h,title:m.tool_name||"tool",status:"running",rawInput:m.tool_input||{}};this.setEntries(S=>[...S,{type:"tool_call",toolCall:w}]);break}case"tool_result":{const m=n;this.applyToolResult(m.tool_call_id||"",m.content??m.output);break}case"interrupt":{this.finalizePendingToolCalls("canceled"),this.turnEnded=!0,this.userSinceTurnEnd=!1,this.setTurnStartedAt(null),this.closed||(a=this.onStatusChange)==null||a.call(this,"idle");break}case"control_request":case"permission_request":{const m=n.request;if(m&&m.subtype==="can_use_tool"){const h=n.request_id||"",w=m.tool_name||"unknown",S=m.input||m.tool_input||{},I=m.description||"",T=Array.isArray(m.permission_suggestions)?m.permission_suggestions:[];this.setEntries(b=>{const E=[...b].reverse().findIndex($=>$.type==="tool_call");if(E>=0){const $=b.length-1-E,R=b[$];if(R.toolCall.status==="running")return this.pendingPermissionToolIds.set(h,R.toolCall.id),b.map((v,O)=>O===$?{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:h,options:[]}}}:v)}return b}),(d=this.onPermissionRequest)==null||d.call(this,{requestId:h,toolName:w,toolInput:S,description:I,suggestions:T})}else m&&m.subtype==="elicitation"&&((i=this.onElicitationRequest)==null||i.call(this,{requestId:n.request_id||"",serverName:m.mcp_server_name||"",message:m.message||"",mode:m.mode==="url"?"url":"form",url:typeof m.url=="string"?m.url:void 0,requestedSchema:m.requested_schema||void 0}));break}case"conversation_rewound":{const m=Jt(n);m&&(this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries(h=>{const w=h.findIndex(S=>$t(S)===m);return w===-1?h:h.slice(0,w)}));break}case"session_status":{if(en(n)){this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries([]);break}if(typeof n.status=="string"){if(Ue(n.status))this.closed=!0,this.finalizePendingToolCalls("canceled");else if(this.closed)break;if(n.status==="running"&&this.turnEnded&&!this.userSinceTurnEnd)break;(u=this.onStatusChange)==null||u.call(this,n.status)}break}case"error":{const m=String(n.message||n.content||"Unknown error");(f=this.onError)==null||f.call(this,m);break}case"models_state":{const m=n.raw,h=typeof m=="object"&&m!==null?m.models_state:n.models_state;h&&Array.isArray(h.availableModels)&&typeof h.currentModelId=="string"&&((p=this.onModelsStateChange)==null||p.call(this,h));break}case"system":{const m=n.raw,h=m&&typeof m=="object"?m:n,w=typeof h.subtype=="string"?h.subtype:void 0,S=Wt(n);S&&(this.subagentState=Lt(this.subagentState,S),(g=this.onSubagentUpdate)==null||g.call(this,this.subagentState));const I=typeof h.permissionMode=="string"?h.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;if(I&&((y=this.onPermissionModeChange)==null||y.call(this,I)),w==="init"){const T=zt(n);T&&((k=this.onWorkerInfoChange)==null||k.call(this,T))}break}case"control_response":{const m=n.response;if(m&&typeof m=="object"){const h=typeof m.request_id=="string"?m.request_id:"",w=typeof m.subtype=="string"?m.subtype:"";if(h){(C=this.onControlResponse)==null||C.call(this,{subtype:w,requestId:h,error:typeof m.error=="string"?m.error:void 0});const S=this.pendingControlRequests.get(h);S&&(this.pendingControlRequests.delete(h),S({data:w==="success"&&m.response&&typeof m.response=="object"?m.response:null,...w==="error"&&typeof m.error=="string"?{error:m.error}:{}}))}}break}case"stream_event":{const m=n.event;if(!m||typeof m.type!="string")break;if(m.type==="content_block_delta"){const h=m.delta;if(!h||typeof h.type!="string")break;const w=h.type==="text_delta"?"message":h.type==="thinking_delta"?"thought":null;if(!w)break;const S=h.text??h.thinking;if(typeof S!="string"||!S)break;this.appendStreamingDelta(w,S)}break}case"partial_assistant":{const m=typeof n.content=="string"?n.content:"";m&&this.appendStreamingDelta("message",m);break}case"result":case"result_success":{this.turnEnded=!0,this.userSinceTurnEnd=!1,this.setTurnStartedAt(null),this.finalizePendingToolCalls(n.is_error?"canceled":"complete"),this.closed||(_=this.onStatusChange)==null||_.call(this,"idle");const m=n.usage,h=typeof n.total_cost_usd=="number"?n.total_cost_usd:null;if(m||h!==null){const b=((m==null?void 0:m.input_tokens)??0)+((m==null?void 0:m.cache_read_input_tokens)??0)+((m==null?void 0:m.cache_creation_input_tokens)??0);(j=this.onUsageChange)==null||j.call(this,{inputTokens:b,outputTokens:(m==null?void 0:m.output_tokens)??0,totalCostUsd:h})}const w=typeof n.subtype=="string"?n.subtype:"",S=n.raw&&typeof n.raw=="object"?n.raw:void 0,T=(typeof n.result=="string"?n.result:typeof(S==null?void 0:S.result)=="string"?S.result:"").trim();w.startsWith("error_")&&T&&this.setEntries(b=>[...b,{type:"command_output",id:`exit-error-${typeof n.uuid=="string"?n.uuid:Date.now()}`,commandName:"worker",inputText:"",title:c("adapter.workerCrashed"),outputText:T,variant:"error"}]);break}case"task_state":{const m=Array.isArray(n.tasks)?n.tasks:[];if(m.length===0)break;const h=Yt(m);if(h.length===0)break;this.setEntries(w=>[...w.filter(I=>I.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:h}]);break}}}applyEmbeddedToolResults(t){const s=t.message;if(!(!s||typeof s!="object"||!Array.isArray(s.content)))for(const n of s.content)!n||n.type!=="tool_result"||this.applyToolResult(n.tool_use_id||"",n.content??n.output)}applyToolResult(t,s){t&&(this.pendingToolCallIds.delete(t),this.setEntries(n=>{const a=Vt(n,t);if(a<0)return n;const d=n[a];return d.toolCall.status!=="running"&&d.toolCall.status!=="waiting_for_confirmation"?n:n.map((i,u)=>u===a?{type:"tool_call",toolCall:{...d.toolCall,status:"complete",permissionRequest:void 0,rawOutput:{output:s||""}}}:i)}))}finalizePendingToolCalls(t){if(this.pendingToolCallIds.size===0)return;const s=this.pendingToolCallIds;this.pendingToolCallIds=new Set,this.setEntries(n=>n.map(a=>a.type!=="tool_call"||!s.has(a.toolCall.id)?a:{type:"tool_call",toolCall:{...a.toolCall,status:t,permissionRequest:void 0}}))}appendStreamingDelta(t,s){this.setEntries(n=>{const a=n[n.length-1];if((a==null?void 0:a.type)==="assistant_message"&&a.id.startsWith(ot)){const i=a.chunks[a.chunks.length-1];return(i==null?void 0:i.type)===t?[...n.slice(0,-1),{...a,chunks:[...a.chunks.slice(0,-1),{type:t,text:i.text+s}]}]:[...n.slice(0,-1),{...a,chunks:[...a.chunks,{type:t,text:s}]}]}const d={type:"assistant_message",id:`${ot}${Date.now()}`,chunks:[{type:t,text:s}]};return[...n,d]})}async sendMessage(t,s,n){var p;const a=s&&s.length>0,d=n&&n.length>0;if(!t.trim()&&!a&&!d)return;const i={type:"user_message",id:`user-${Date.now()}`,content:t,images:a?s:void 0,attachments:d?n:void 0};this.setEntries(g=>[...g,i]);const u=[];if(t&&u.push({type:"text",text:t}),a)for(const g of s)u.push({type:"image",source:{type:"base64",media_type:g.mimeType,data:g.data}});if(d){for(const g of n)if(g.kind==="text"||g.kind==="table"){const y=`📎 ${g.name}${g.size!=null?` (${wr(g.size)})`:""}`,k=g.textContent||c("attach.emptyFile");u.push({type:"text",text:`${y}
72
+ \`\`\`
73
+ ${k}
74
+ \`\`\``})}else if(g.kind==="directory"){const y=g.files!=null?`${K("attach.directoryHeader",{name:g.name})} ${K("attach.fileCount",{n:g.files.length})}`:K("attach.directoryHeader",{name:g.name}),k=g.textContent||c("attach.emptyDirectory");u.push({type:"text",text:`${y}
75
+ ${k}`})}}const f=u.length===1&&u[0].type==="text"?u[0].text||t:u.length>0?u:t;try{const g=le();this.postedUserUuids.add(g);const y=await tn(this.sessionId,{type:"user",uuid:g,content:t,message:{content:f}}),k=(p=y==null?void 0:y.event)==null?void 0:p.id;k&&this.setEntries(C=>C.map(_=>_.type==="user_message"&&_.id===i.id?{..._,id:k}:_))}catch(g){throw this.setEntries(y=>y.filter(k=>!(k.type==="user_message"&&k.id===i.id))),g}}async respondPermission(t,s,n){await G(this.sessionId,{type:"permission_response",approved:s,request_id:t,...n});const a=this.pendingPermissionToolIds.get(t);this.pendingPermissionToolIds.delete(t),a&&!s&&this.pendingToolCallIds.delete(a),this.setEntries(d=>d.map(i=>{var u;return i.type!=="tool_call"||((u=i.toolCall.permissionRequest)==null?void 0:u.requestId)!==t?i:{type:"tool_call",toolCall:{...i.toolCall,status:s?"running":"rejected",permissionRequest:void 0}}}))}async interrupt(){this.finalizePendingToolCalls("canceled"),await sn(this.sessionId)}async setPermissionMode(t){const s=le();return await G(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_permission_mode",mode:t}}),s}async controlRoundTrip(t,s=8e3){const n=le(),a=new Promise(i=>{this.pendingControlRequests.set(n,i)}),d=setTimeout(()=>{const i=this.pendingControlRequests.get(n);i&&(this.pendingControlRequests.delete(n),i({data:null,error:"timeout"}))},s);try{return await G(this.sessionId,{type:"control_request",request_id:n,request:t}),await a}catch(i){throw this.pendingControlRequests.delete(n),i}finally{clearTimeout(d)}}async searchFiles(t,s=20){const n=await this.controlRoundTrip({subtype:"file_search",query:t,limit:s});try{if(!n.data||!Array.isArray(n.data.suggestions))return[];const a=[];for(const d of n.data.suggestions)d&&typeof d=="object"&&typeof d.path=="string"&&a.push(d.path);return a}catch{return[]}}async respondElicitation(t,s,n){await G(this.sessionId,{type:"permission_response",approved:s==="accept",request_id:t,response:{subtype:"success",request_id:t,response:{action:s,...n?{content:n}:{}}}})}async askSideQuestion(t){const s=await this.controlRoundTrip({subtype:"side_question",question:t},12e4);if(s.error||!s.data)return null;const n=s.data.response;return typeof n=="string"?n:null}async listResumableSessions(){const t=await this.controlRoundTrip({subtype:"list_sessions"});if(!t.data||!Array.isArray(t.data.sessions))throw new Error(t.error??"list_sessions failed");const s=[];for(const n of t.data.sessions){if(!n||typeof n!="object")continue;const a=n;typeof a.session_id!="string"||!a.session_id||s.push({sessionId:a.session_id,title:typeof a.title=="string"&&a.title?a.title:a.session_id.slice(0,8),modified:typeof a.modified=="number"?a.modified:0,...typeof a.created_at=="number"?{createdAt:a.created_at}:{},...typeof a.git_branch=="string"&&a.git_branch?{gitBranch:a.git_branch}:{}})}return s}async resumeSession(t){const s=await this.controlRoundTrip({subtype:"resume_session",session_id:t},3e4);if(!s.data)throw new Error(s.error??"resume_session failed");return{title:typeof s.data.title=="string"?s.data.title:null,messageCount:typeof s.data.message_count=="number"?s.data.message_count:0}}async setEffort(t){const s=le();return await G(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_effort",...t?{effort:t}:{effort:null}}}),s}async setThinkingBudget(t){const s=le();return await G(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_max_thinking_tokens",max_thinking_tokens:t}}),s}async getContextUsage(){const t=await this.controlRoundTrip({subtype:"get_context_usage"});try{if(!t.data)return null;const s=t.data.totalTokens,n=t.data.rawMaxTokens,a=t.data.percentage;if(typeof s!="number"||typeof n!="number")return null;const d=t.data.categories,i=Array.isArray(d)?d.filter(u=>!!u&&typeof u=="object"&&typeof u.name=="string").map(u=>({name:u.name,tokens:typeof u.tokens=="number"?u.tokens:0,...u.isDeferred===!0?{isDeferred:!0}:{}})):void 0;return{totalTokens:s,rawMaxTokens:n,percentage:typeof a=="number"?a:0,...typeof t.data.model=="string"&&t.data.model?{model:t.data.model}:{},...i&&i.length>0?{categories:i}:{}}}catch{return null}}async stopSubagent(t){const s=await this.controlRoundTrip({subtype:"stop_task",task_id:t});try{return s.error?{ok:!1,error:s.error==="timeout"?c("adapter.stopTimeout"):s.error}:{ok:!0}}catch{return{ok:!1,error:c("adapter.stopFailed")}}}async getMcpServers(){var a;const s=(a=(await this.controlRoundTrip({subtype:"mcp_status"})).data)==null?void 0:a.mcpServers;if(!Array.isArray(s))return[];const n=[];for(const d of s){if(!d||typeof d!="object")continue;const i=d;if(typeof i.name!="string"||!i.name)continue;const u=i.status;if(u!=="connected"&&u!=="failed"&&u!=="needs-auth"&&u!=="pending"&&u!=="disabled")continue;const f=i.serverInfo,p=i.config;n.push({name:i.name,status:u,...f&&typeof f.name=="string"&&typeof f.version=="string"?{serverInfo:{name:f.name,version:f.version}}:{},...typeof i.error=="string"&&i.error?{error:i.error}:{},...typeof(p==null?void 0:p.url)=="string"&&p.url?{url:p.url}:{},...Array.isArray(i.tools)?{toolCount:i.tools.length}:{}})}return n}async toggleMcpServer(t,s){const n=await this.controlRoundTrip({subtype:"mcp_toggle",serverName:t,enabled:s},15e3);return n.error?{ok:!1,error:n.error==="timeout"?c("adapter.requestTimeout"):n.error}:{ok:!0}}async reconnectMcpServer(t){const s=await this.controlRoundTrip({subtype:"mcp_reconnect",serverName:t},2e4);return s.error?{ok:!1,error:s.error==="timeout"?c("adapter.requestTimeout"):s.error}:{ok:!0}}async getRemoteSettings(){const s=(await this.controlRoundTrip({subtype:"get_settings"})).data;if(!s)return null;const n=s.applied,a=s.effective&&typeof s.effective=="object"&&!Array.isArray(s.effective)?s.effective:{},d=s.sources,i=[];if(Array.isArray(d))for(const u of d){if(!u||typeof u!="object")continue;const f=u;typeof f.source=="string"&&i.push({source:f.source,settings:f.settings&&typeof f.settings=="object"&&!Array.isArray(f.settings)?f.settings:{}})}return{applied:{model:typeof(n==null?void 0:n.model)=="string"?n.model:null,effort:typeof(n==null?void 0:n.effort)=="string"?n.effort:null},effective:a,sources:i}}async applyFlagSettings(t){const s=await this.controlRoundTrip({subtype:"apply_flag_settings",settings:t},15e3);return s.error?{ok:!1,error:s.error==="timeout"?c("adapter.requestTimeout"):s.error}:{ok:!0}}async rewindToMessage(t){await nn(this.sessionId,t)}async endSession(t){await G(this.sessionId,{type:"control_request",request_id:le(),request:{subtype:"end_session",...t?{reason:t}:{}}})}}function wr(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function Oe({onBack:r,title:t,meta:s,actions:n}){return Z(),e.jsx("div",{className:"flex-shrink-0 border-b border-nav-rule bg-surface-1/80 backdrop-blur-md",children:e.jsxs("div",{className:"mx-auto flex h-12 w-full page-measure items-center gap-2 px-4 sm:px-8",children:[e.jsx("button",{type:"button",onClick:r,"aria-label":c("nav.dashboard"),title:c("nav.dashboard"),className:"-mx-2 flex-shrink-0 rounded-md px-2 py-1 text-xs text-text-muted transition hover:-translate-x-0.5 hover:bg-surface-2 hover:text-text-primary",children:c("nav.dashboard")}),e.jsx("span",{className:"mx-1 h-4 w-px flex-shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t,s&&e.jsx("div",{className:"flex flex-shrink-0 items-center gap-2",children:s})]}),n&&e.jsx("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:n}),e.jsx("span",{className:"mx-1 h-4 w-px flex-shrink-0 bg-border","aria-hidden":"true"}),e.jsx(an,{}),e.jsx(on,{onSettingsClick:()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))}})]})})}const Xt="rcs:subagent-panel:collapsed";function kr(r){if(r<1e3)return"0s";const t=Math.floor(r/1e3);if(t<60)return`${t}s`;const s=Math.floor(t/60),n=t%60;if(s<60)return n?`${s}m${n}s`:`${s}m`;const a=Math.floor(s/60),d=s%60;return d?`${a}h${d}m`:`${a}h`}function vr(r){return r===void 0||r<=0?"":r<1e3?`${r}`:r<1e6?`${(r/1e3).toFixed(r<1e4?1:0)}k`:`${(r/1e6).toFixed(1)}M`}function Nr({status:r}){return r==="running"?e.jsx(Ce,{className:"h-3 w-3 animate-spin text-brand-text"}):r==="completed"?e.jsx(lr,{className:"h-3 w-3 text-status-success"}):r==="failed"||r==="stopped"?e.jsx(cn,{className:"h-3 w-3 text-status-error"}):null}function ys({task:r,onStopTask:t,fullText:s}){const n=r.status==="running",a=n?r.durationMs??Date.now()-r.startTime:(r.endTime??Date.now())-r.startTime,d=vr(r.tokenCount),i=r.toolUseCount!==void 0&&r.toolUseCount>0?`${r.toolUseCount} tool${r.toolUseCount>1?"s":""}`:"",u=r.summary||r.description||"(no description)";return e.jsxs("div",{className:"group/task 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(Nr,{status:r.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:r.name}),e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:kr(a)})]}),e.jsx("div",{className:`mt-0.5 text-text-secondary ${s?"line-clamp-2 break-words":"truncate"}`,children:u}),(d||i||r.lastToolName)&&e.jsxs("div",{className:"mt-0.5 flex items-center gap-x-2 overflow-hidden whitespace-nowrap font-mono text-[10px] text-text-muted",children:[d&&e.jsxs("span",{className:"flex-shrink-0",children:["↕ ",d," tok"]}),i&&e.jsxs("span",{className:"flex-shrink-0",children:["· ",i]}),r.lastToolName&&e.jsxs("span",{className:"min-w-0 truncate",children:["· last: ",r.lastToolName]})]}),!n&&r.finalSummary&&e.jsx("div",{className:"mt-1 line-clamp-2 rounded bg-status-success/10 px-1.5 py-0.5 text-[10px] text-status-success",children:r.finalSummary})]}),n&&t&&e.jsx("button",{type:"button",onClick:()=>t(r.taskId),title:c("subagent.stop"),className:"mt-0.5 flex-shrink-0 rounded p-0.5 text-text-muted opacity-0 transition-opacity hover:bg-status-error/10 hover:text-status-error focus:opacity-100 group-hover/task:opacity-100",children:e.jsx(ln,{className:"h-3.5 w-3.5"})})]})}function _r({state:r,onStopTask:t}){const[s,n]=l.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Xt)==="1"}catch{return!1}}),a=()=>{n(y=>{const k=!y;try{window.localStorage.setItem(Xt,k?"1":"0")}catch{}return k})},d=Object.values(r.tasks).some(y=>y.status==="running"),i=Object.values(r.tasks).some(y=>y.status!=="running"&&y.evictAfter!==void 0),[,u]=l.useState(0);l.useEffect(()=>{if(!d&&!i)return;const y=setInterval(()=>{u(k=>k+1)},1e3);return()=>clearInterval(y)},[d,i]);const f=gs(r);if(f.length===0)return null;const p=f.filter(y=>y.status==="running").length,g=p>0?`${p} running`:`${f.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:a,"aria-expanded":!s,"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(ms,{className:`h-3 w-3 transition-transform ${s?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:g})]}),!s&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:f.map(y=>e.jsx(ys,{task:y,onStopTask:t},y.taskId))})]})})}function Sr(r){if(!r)return"never";const t=Math.max(0,Date.now()-r);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 Cr(r){return r?Date.now()-r<6e4:!1}function Tr({onClose:r,session:t,liveStatus:s,pendingPermissions:n,onInterrupt:a,onDelete:d,subagentState:i,onStopTask:u,onEndSession:f}){const[p,g]=l.useState(!1),y=async()=>{await navigator.clipboard.writeText(t.id),g(!0),setTimeout(()=>g(!1),1500)},[k,C]=l.useState(!1),_=async()=>{if(!(!f||k)&&window.confirm(c("task.endConfirm"))){C(!0);try{await f(),r()}catch{C(!1)}}},j=n.length,m=t.worker,h=t.work_item,w=t.environment;return e.jsx(me,{open:!0,onOpenChange:S=>{S||r()},children:e.jsxs(xe,{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(fe,{children:e.jsx(pe,{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(Pn,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dn,{status:s||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:m&&(Cr(m.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[m&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Dt,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Sr(m.last_heartbeat_at)})]}),w&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(xs,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:w.machine_name||w.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Dt,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:ds(t.created_at)})]})]})]}),e.jsx(Ar,{state:i,onStopTask:u}),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(Ce,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),j>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[j," permission request",j>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(ur,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:a,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"}),f&&e.jsx("button",{onClick:_,disabled:k,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 disabled:opacity-50 disabled:cursor-not-allowed",title:c("task.endHint"),children:k?"Ending…":"End session"}),e.jsxs("button",{onClick:d,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(un,{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(Zn,{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:y,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:p?"✓":"⧉"})]})]}),h&&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:h.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:h.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})]}),w&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:w.worker_type})]})]})]})]})]})})}const Er={in_process_teammate:"task.type.teammates",local_bash:"task.type.shells",monitor_mcp:"task.type.monitors",remote_agent:"task.type.remoteAgents",local_agent:"task.type.localAgents"},Mr=new Set(["dream"]);function Ar({state:r,onStopTask:t}){const s=Object.values(r.tasks).some(f=>f.status==="running"),n=Object.values(r.tasks).some(f=>f.status!=="running"&&f.evictAfter!==void 0),[,a]=l.useState(0);l.useEffect(()=>{if(!s&&!n)return;const f=setInterval(()=>{a(p=>p+1)},1e3);return()=>clearInterval(f)},[s,n]);const d=gs(r),i=d.filter(f=>f.status==="running").length,u=d.length-i;return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(nr,{className:"h-3.5 w-3.5"}),c("task.backgroundTasks")]}),d.length>0&&e.jsx("span",{className:"font-mono text-[10px] text-text-muted",children:i>0&&u>0?K("task.mixedCount",{running:i,recent:u}):i>0?K("task.runningCount",{count:i}):K("task.recentCount",{count:d.length})})]}),d.length===0?e.jsx("p",{className:"text-xs text-text-muted",children:c("task.noBackgroundTasks")}):e.jsx("div",{className:"max-h-[38vh] space-y-2 overflow-y-auto overscroll-contain pr-1",children:gr(d).map(f=>{const p=!Mr.has(f.taskType),g=Er[f.taskType]??"task.type.tasks";return e.jsxs("div",{className:"space-y-1",children:[p&&e.jsxs("div",{className:"pl-1 text-[10px] font-medium uppercase tracking-wide text-text-muted/80",children:[c(g)," (",f.tasks.length,")"]}),f.tasks.map(y=>e.jsx(ys,{task:y,onStopTask:t,fullText:!0},y.taskId))]},f.taskType)})})]})}const Rr={connected:"bg-status-success/15 text-status-success",failed:"bg-status-error/15 text-status-error","needs-auth":"bg-status-warning/15 text-status-warning",pending:"bg-status-active/15 text-status-active",disabled:"bg-surface-3 text-text-muted"},Ir={connected:"mcp.status.connected",failed:"mcp.status.failed","needs-auth":"mcp.status.needsAuth",pending:"mcp.status.pending",disabled:"mcp.status.disabled"};function $r({onClose:r,fetchServers:t,onToggle:s,onReconnect:n}){Z();const[a,d]=l.useState(null),[i,u]=l.useState(null),[f,p]=l.useState(null),[g,y]=l.useState(null),k=l.useCallback(async()=>{p(null),y(null);try{const j=await t();d(j),u(null)}catch(j){Fe("[McpPanel] fetch failed",j),u(c("mcp.loadFailed"))}},[t]);l.useEffect(()=>{k()},[k]);const C=async j=>{const m=j.status==="disabled";p(`toggle:${j.name}`),y(null);try{const h=await s(j.name,m);h.ok||y(h.error||c("mcp.toggleFailed"))}finally{await k()}},_=async j=>{p(`reconnect:${j.name}`),y(null);try{const m=await n(j.name);m.ok||y(m.error||c("mcp.reconnectFailed"))}finally{await k()}};return e.jsx(me,{open:!0,onOpenChange:j=>{j||r()},children:e.jsxs(xe,{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(fe,{children:e.jsxs(pe,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(ps,{className:"h-4 w-4"}),c("session.mcp.title")]})}),e.jsxs("div",{className:"mt-3 space-y-3 text-sm",children:[g&&e.jsx("div",{className:"rounded-md bg-status-error/10 px-3 py-2 text-xs text-status-error",children:g}),a===null&&!i&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 animate-spin"}),c("mcp.loading")]}),i&&e.jsx("p",{className:"text-xs text-status-error",children:i}),a!==null&&a.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:c("mcp.empty")}),a==null?void 0:a.map(j=>{const m=f===`toggle:${j.name}`,h=f===`reconnect:${j.name}`,w=j.status==="disabled";return e.jsx("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-text-primary",children:j.name}),e.jsx("span",{className:`flex-shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium ${Rr[j.status]}`,children:c(Ir[j.status])})]}),e.jsxs("div",{className:"mt-0.5 truncate text-xs text-text-muted",children:[j.serverInfo?`${j.serverInfo.name} v${j.serverInfo.version}`:j.url||"stdio",j.toolCount!==void 0&&` · ${K("mcp.toolCount",{n:j.toolCount})}`]}),j.error&&e.jsx("div",{className:"mt-1 truncate text-xs text-status-error",title:j.error,children:j.error})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void _(j),disabled:h||w,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-3 hover:text-text-primary transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:c("mcp.reconnect"),children:e.jsx(Un,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`})}),e.jsx("button",{type:"button",role:"switch","aria-checked":!w,onClick:()=>void C(j),disabled:m,className:`relative h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${w?"bg-surface-3":"bg-brand"}`,title:w?c("mcp.enable"):c("mcp.disable"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${w?"left-0.5":"left-4.5"}`})})]})]})},j.name)})]})]})})}function Dr(r){if(r==null)return c("settings.unset");if(typeof r=="string")return r;try{return JSON.stringify(r)}catch{return String(r)}}function Zt(r){if(r==null)return c("settings.unset");if(typeof r=="object")try{return JSON.stringify(r,null,2)}catch{return String(r)}return String(r)}function qr({onClose:r,fetchSettings:t,onApply:s}){Z();const[n,a]=l.useState(null),[d,i]=l.useState(null),[u,f]=l.useState(""),[p,g]=l.useState(null),[y,k]=l.useState(null),[C,_]=l.useState(null),[j,m]=l.useState(!1),h=l.useCallback(async()=>{g(null),k(null),_(null),m(!1);try{const v=await t();a(v),i(v?null:c("settings.loadFailed"))}catch(v){Fe("[SettingsDrawer] fetch failed",v),i(c("settings.loadFailed"))}},[t]);l.useEffect(()=>{h()},[h]);const w=l.useMemo(()=>n?Object.entries(n.effective).filter(([,v])=>v!==void 0).sort(([v],[O])=>v.localeCompare(O)):[],[n]),S=l.useMemo(()=>{const v=u.trim().toLowerCase();return v?w.filter(([O,L])=>`${O} ${Dr(L)}`.toLowerCase().includes(v)):w},[w,u]),I=v=>typeof v[1]=="boolean",T=l.useMemo(()=>S.filter(I),[S]),b=l.useMemo(()=>S.filter(v=>!I(v)),[S]),E=l.useMemo(()=>C===null?null:w.find(([v])=>v===C)??null,[w,C]),$=async()=>{if(E)try{await navigator.clipboard.writeText(Zt(E[1])),m(!0),window.setTimeout(()=>m(!1),1500)}catch(v){Fe("[SettingsDrawer] copy failed",v)}},R=async(v,O)=>{g(v),k(null);try{const L=await s({[v]:!O});L.ok||k(L.error||c("settings.writeFailed"))}finally{await h()}};return e.jsx(me,{open:!0,onOpenChange:v=>{v||r()},children:e.jsxs(xe,{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(fe,{children:e.jsxs(pe,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(hs,{className:"h-4 w-4"}),c("session.settings.title")]})}),e.jsxs("div",{className:"mt-3 space-y-4 text-sm",children:[y&&e.jsx("div",{className:"rounded-md bg-status-error/10 px-3 py-2 text-xs text-status-error",children:y}),n===null&&!d&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 animate-spin"}),c("settings.loading")]}),d&&e.jsx("p",{className:"text-xs text-status-error",children:d}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-text-muted",children:c("settings.model")}),e.jsx("code",{className:"font-mono text-text-secondary",children:n.applied.model||c("settings.defaultModel")})]}),n.applied.effort&&e.jsxs("div",{className:"mt-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-text-muted",children:"Effort"}),e.jsx("code",{className:"font-mono text-text-secondary",children:n.applied.effort})]}),e.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-text-muted",children:c("settings.hint")})]}),E?e.jsxs("section",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>{_(null),m(!1)},className:"flex items-center gap-1.5 text-xs text-text-muted transition-colors hover:text-text-primary",children:[e.jsx(Fn,{className:"h-3.5 w-3.5"}),c("settings.back")]}),e.jsx("div",{className:"break-all font-mono text-xs font-medium text-text-primary",children:E[0]}),e.jsx("pre",{className:"max-h-[60vh] overflow-y-auto whitespace-pre-wrap break-all rounded-md border border-border bg-surface-2 p-3 font-mono text-[10px] leading-relaxed text-text-secondary",children:Zt(E[1])}),e.jsxs("button",{type:"button",onClick:()=>void $(),className:"flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary",children:[j?e.jsx(Te,{className:"h-3.5 w-3.5 text-status-success"}):e.jsx(Ln,{className:"h-3.5 w-3.5"}),j?c("settings.copied"):c("settings.copyValue")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-surface-2 px-2.5 py-1.5",children:[e.jsx(ct,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{value:u,onChange:v=>f(v.target.value),placeholder:c("settings.searchPlaceholder"),className:"w-full bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"})]}),S.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:c("settings.noMatch")}),T.length>0&&e.jsxs("section",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-[10px] font-medium uppercase tracking-wide text-text-muted",children:K("settings.togglable",{n:T.length})}),T.map(([v,O])=>{const L=p===v;return e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border bg-surface-2 px-3 py-2",children:[e.jsx("div",{className:"truncate font-mono text-xs text-text-primary",children:v}),e.jsx("button",{type:"button",role:"switch","aria-checked":O,disabled:L,onClick:()=>void R(v,O),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${O?"bg-brand":"bg-surface-3"}`,title:O?c("settings.turnOff"):c("settings.turnOn"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${O?"left-4.5":"left-0.5"}`})})]},v)})]}),b.length>0&&e.jsxs("section",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-[10px] font-medium uppercase tracking-wide text-text-muted",children:K("settings.readOnly",{n:b.length})}),b.map(([v])=>e.jsxs("button",{type:"button",onClick:()=>_(v),className:"flex w-full items-center justify-between gap-3 rounded-md border border-border bg-surface-2 px-3 py-2 text-left transition-colors hover:bg-surface-3",title:c("settings.viewDetail"),children:[e.jsx("span",{className:"truncate font-mono text-xs text-text-primary",children:v}),e.jsx(ms,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"})]},v))]})]})]})]})]})})}function Pr({onClose:r,onAsk:t}){Z();const[s,n]=l.useState([]),[a,d]=l.useState(""),[i,u]=l.useState(!1),f=async()=>{const p=a.trim();if(!p||i)return;const g=Date.now();n(y=>[...y,{id:g,question:p,answer:null}]),d(""),u(!0);try{const y=await t(p);n(k=>k.map(C=>C.id===g?{...C,answer:y??c("sideQuestion.noAnswer"),error:y===null}:C))}finally{u(!1)}};return e.jsx(me,{open:!0,onOpenChange:p=>{p||r()},children:e.jsxs(xe,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-[26rem] h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md flex flex-col",children:[e.jsx(fe,{children:e.jsxs(pe,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(fs,{className:"h-4 w-4"}),c("sideQuestion.title")]})}),e.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-text-muted",children:c("sideQuestion.desc")}),e.jsxs("div",{className:"mt-3 flex-1 space-y-4 overflow-y-auto",children:[s.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:c("sideQuestion.empty")}),s.map(p=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx("div",{className:"max-w-[85%] rounded-2xl rounded-br-md border border-user-bubble-border bg-user-bubble px-4 py-2 text-sm text-text-primary",children:p.question})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:e.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:24,height:24,className:"object-contain",draggable:!1})}),e.jsx("div",{className:"min-w-0 flex-1 pt-1 text-sm text-text-primary",children:p.answer===null?e.jsxs("span",{className:"chat-typing-indicator inline-flex items-center gap-1","aria-hidden":"true",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}):e.jsx("div",{className:p.error?"text-status-error":"",children:e.jsx(mn,{children:p.answer})})})]})]},p.id))]}),e.jsxs("div",{className:"mt-3 flex items-end gap-2",children:[e.jsx("textarea",{value:a,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&!p.nativeEvent.isComposing&&(p.preventDefault(),f())},rows:Math.min(4,Math.max(1,a.split(`
76
+ `).length)),placeholder:c("sideQuestion.placeholder"),disabled:i,className:"flex-1 resize-none rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none disabled:opacity-50"}),e.jsx("button",{type:"button",onClick:()=>void f(),disabled:i||!a.trim(),className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg bg-brand text-white transition-colors hover:bg-brand-light disabled:opacity-40 disabled:cursor-not-allowed",title:c("sideQuestion.send"),children:i?e.jsx(Ce,{className:"h-4 w-4 animate-spin"}):e.jsx(xn,{className:"h-4 w-4"})})]})]})})}const it="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1";function es(r,t){var a;const s=(a=t==null?void 0:t.find(d=>d.type==="addRules"||d.type==="replaceRules"))==null?void 0:a.rules,n=s==null?void 0:s[0];return n!=null&&n.ruleContent?`${n.toolName}(${n.ruleContent})`:n!=null&&n.toolName?n.toolName:r}function Or({requestId:r,toolName:t,toolInput:s,description:n,suggestions:a,onApprove:d,onApproveAlways:i,onReject:u}){Z();const f=s&&typeof s=="object"&&!Array.isArray(s)?s:{},p=fn(pn(t),f,{writeUnknownLabel:c("permission.writeUnknown")}),g=typeof s=="string"?s:JSON.stringify(s,null,2),y=Array.isArray(a)&&a.length>0;return e.jsxs("div",{role:"group","aria-label":K("permission.requestAria",{tool:t}),className:"rounded-xl border border-approve/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-approve/15 text-approve-text",children:e.jsx(hn,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-semibold font-display text-approve-text",children:c("permission.title")})]}),n&&e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:V(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:V(t)}),t!=="AskUserQuestion"&&(p?e.jsx("div",{className:"mb-3 space-y-2",children:p.map((k,C)=>e.jsx(gn,{filePath:k.filePath,oldString:k.oldString,newString:k.newString,label:k.label},C))}):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:qt(g,500)})),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:d,className:ne("rounded-lg bg-approve px-4 py-2 text-sm font-medium font-display text-white hover:bg-approve-hover transition-colors",it),children:c("permission.approve")}),y&&i&&e.jsxs("button",{onClick:i,className:ne("flex items-center gap-1.5 rounded-lg border border-approve/40 bg-approve/10 px-4 py-2 text-sm font-medium font-display text-approve-text hover:bg-approve/20 transition-colors",it),title:c("permission.alwaysAllowHint").replace("{rule}",es(t,a)),children:[e.jsx(hr,{className:"h-3.5 w-3.5"}),c("permission.alwaysAllow")," ",qt(es(t,a),40)]}),e.jsx("button",{onClick:u,className:ne("rounded-lg border border-status-error/40 px-4 py-2 text-sm font-medium font-display text-status-error hover:bg-status-error/10 transition-colors",it),children:c("permission.reject")})]})]})}function Ur({questions:r,description:t,onSubmit:s,onSkip:n}){const[a,d]=l.useState({}),[i,u]=l.useState({}),[f,p]=l.useState(0),g=(_,j,m)=>{if(m){const h=a[_]||[],w=h.includes(j)?h.filter(S=>S!==j):[...h,j];d({...a,[_]:w})}else d({...a,[_]:j})},y=_=>{var m;const j=(m=i[_])==null?void 0:m.trim();j&&(d({...a,[_]:j}),u({...i,[_]:""}))},k=()=>{var j,m;const _={};for(const[h,w]of Object.entries(a)){const S=r[parseInt(h,10)];S&&(typeof w=="number"?_[h]=((m=(j=S.options)==null?void 0:j[w])==null?void 0:m.label)||String(w):Array.isArray(w)?_[h]=w.map(I=>{var T,b;return((b=(T=S.options)==null?void 0:T[I])==null?void 0:b.label)||String(I)}):_[h]=w)}s(_)};if(r.length<=1){const _=r[0]||{question:t,options:[],multiSelect:!1},j=_.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 font-display text-text-primary",children:V(t||_.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(_.options||[]).map((m,h)=>{const w=j?(a[0]||[]).includes(h):a[0]===h;return e.jsxs("button",{onClick:()=>g(0,h,j),className:ne("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display transition-colors",w?"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 font-display",children:V(m.label)}),m.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:V(m.description)})]},h)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:i[0]||"",onChange:m=>u({...i,0:m.target.value}),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:m=>m.key==="Enter"&&y(0)}),e.jsx("button",{onClick:()=>y(0),className:"rounded-lg border border-border px-3 py-2 text-sm font-display 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:k,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium font-display text-white hover:bg-brand-light transition-colors",children:"Submit"}),e.jsx("button",{onClick:n,className:"rounded-lg border border-border px-4 py-2 text-sm font-display text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})}const C=r[f];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 font-display text-text-primary",children:V(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:r.map((_,j)=>e.jsx("button",{onClick:()=>p(j),className:ne("rounded-md px-3 py-1.5 text-xs font-display whitespace-nowrap transition-colors",f===j?"bg-brand/20 text-brand-text":"text-text-muted hover:bg-surface-2"),children:_.header||`Q${j+1}`},j))}),C&&e.jsx(Fr,{question:C,qIdx:f,answers:a,otherTexts:i,onSelect:g,onOtherTextChange:(_,j)=>u({...i,[_]:j}),onOtherSubmit:y}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-display text-text-muted",children:[f+1," / ",r.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:k,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium font-display text-white hover:bg-brand-light transition-colors",children:"Submit All"}),e.jsx("button",{onClick:n,className:"rounded-lg border border-border px-4 py-2 text-sm font-display text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})]})}function Fr({question:r,qIdx:t,answers:s,otherTexts:n,onSelect:a,onOtherTextChange:d,onOtherSubmit:i}){const u=r.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:V(r.question)}),e.jsxs("div",{className:"space-y-2",children:[(r.options||[]).map((f,p)=>{const g=u?(s[t]||[]).includes(p):s[t]===p;return e.jsxs("button",{onClick:()=>a(t,p,u),className:ne("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display transition-colors",g?"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 font-display",children:V(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:V(f.description)})]},p)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:f=>d(t,f.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:f=>f.key==="Enter"&&i(t)}),e.jsx("button",{onClick:()=>i(t),className:"rounded-lg border border-border px-3 py-2 text-sm font-display text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]})]})}function Kr({planContent:r,description:t,onSubmit:s}){const[n,a]=l.useState(null),[d,i]=l.useState(""),u=!r||!r.trim(),f=()=>{n&&s(n,n==="no"?d: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-text",children:e.jsx(Te,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold font-display text-text-primary",children:u?"Exit plan mode?":"Ready to code?"})]}),!u&&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:Lr(r)}}),e.jsx("div",{className:"space-y-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(Se,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes"}),e.jsx(Se,{selected:n==="no",onClick:()=>a("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{selected:n==="yes-accept-edits",onClick:()=>a("yes-accept-edits"),label:"Yes, auto-accept edits",desc:"Approve plan and auto-accept file edits"}),e.jsx(Se,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(Se,{selected:n==="no",onClick:()=>a("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),n==="no"&&e.jsx("textarea",{value:d,onChange:p=>i(p.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 font-display 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:f,disabled:!n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium font-display text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function Se({selected:r,onClick:t,label:s,desc:n}){return e.jsxs("button",{onClick:t,className:ne("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display transition-colors",r?"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:ne("flex h-4 w-4 items-center justify-center rounded-full border text-[10px] transition-colors",r?"border-brand bg-brand text-white":"border-border"),children:r&&"✓"}),e.jsx("span",{className:"font-medium font-display",children:s})]}),n&&e.jsx("div",{className:"mt-0.5 pl-6 text-xs font-sans text-text-muted",children:n})]})}function Lr(r){let t=V(r);return t=t.replace(/```(\w*)\n?([\s\S]*?)```/g,(s,n,a)=>`<pre class="my-2 overflow-x-auto rounded-lg bg-tool-card p-3 font-mono text-xs">${a.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 Br({request:r,onSubmit:t}){Z();const s=Hr(r.requestedSchema),n=Wr(r.requestedSchema),[a,d]=l.useState({}),i=s.length===0||n.every(u=>(a[u]??"").trim()!=="");return r.mode==="url"&&r.url?e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx(ts,{serverName:r.serverName,message:r.message}),e.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex w-full items-center justify-between rounded-lg border border-border bg-surface-2 px-4 py-2.5 text-sm text-brand-text hover:bg-brand/10 transition-colors",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:r.url}),e.jsx(Bn,{className:"ml-2 h-4 w-4 flex-shrink-0"})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:()=>t("accept"),className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:c("elicitation.done")}),e.jsx("button",{onClick:()=>t("cancel"),className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:c("common.cancel")})]})]}):e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx(ts,{serverName:r.serverName,message:r.message}),s.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:s.map(({name:u,prop:f})=>e.jsxs("label",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-medium text-text-primary",children:u}),n.includes(u)&&e.jsx("span",{className:"text-[10px] font-medium text-warning-text",children:c("elicitation.required")})]}),f.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:V(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:a[u]??"",onChange:p=>d(g=>({...g,[u]:p.target.value})),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"})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const u={};for(const{name:f,prop:p}of s){const g=(a[f]??"").trim();g&&(u[f]=p.type==="number"?Number(g):g)}t("accept",u)},disabled:!i,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:c("elicitation.submit")}),e.jsx("button",{onClick:()=>t("decline"),className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:c("elicitation.decline")})]})]})}function ts({serverName:r,message:t}){return e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 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-text",children:e.jsx(or,{className:"h-3 w-3"})}),e.jsxs("span",{className:"text-sm font-semibold text-text-primary",children:[c("elicitation.title")," ",e.jsx("span",{className:"font-mono text-xs text-text-muted",children:V(r)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:V(t)})]})}function Hr(r){const t=r==null?void 0:r.properties;return!t||typeof t!="object"?[]:Object.entries(t).filter(([,s])=>s&&typeof s=="object").map(([s,n])=>({name:s,prop:n}))}function Wr(r){const t=r==null?void 0:r.required;return Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function Qr(r){const[t,s]=l.useState([]),[n,a]=l.useState(!0),[d,i]=l.useState(null),u=l.useCallback(async()=>{a(!0),i(null);try{const g=await yn(r);s(g)}catch(g){i(g instanceof Error?g.message:"Failed to load shares")}finally{a(!1)}},[r]);l.useEffect(()=>{u()},[u]);const f=l.useCallback(async g=>{i(null);try{const y=await bn(r,g);return await u(),y}catch(y){throw i(y instanceof Error?y.message:"Failed to create share"),y}},[r,u]),p=l.useCallback(async g=>{i(null);try{await jn(r,g),await u()}catch(y){throw i(y instanceof Error?y.message:"Failed to revoke share"),y}},[r,u]);return{shares:t,isLoading:n,error:d,createShare:f,revokeShare:p,refresh:u}}function zr({open:r,onClose:t,sessionId:s,sessionTitle:n}){Z();const{shares:a,isLoading:d,error:i,createShare:u,revokeShare:f}=Qr(s),[p,g]=l.useState("user"),[y,k]=l.useState(""),[C,_]=l.useState(""),[j,m]=l.useState("read"),[h,w]=l.useState(""),[S,I]=l.useState(!1),[T,b]=l.useState(null),[E,$]=l.useState(""),[R,v]=l.useState(!1),[O,L]=l.useState(!1);l.useEffect(()=>{r&&(g("user"),k(""),_(""),m("read"),w(""),I(!1),b(null),$(""),v(!1),L(!1))},[r]);const Y=async()=>{I(!0),$(""),b(null);try{const q={grantedTo:p==="user"?{userId:y.trim()}:{teamId:C.trim()},permission:j};h.trim()&&(q.expiresAt=h.trim());const he=await u(q);b(`${window.location.origin}/code/s/${he.shareToken}`)}catch(q){$(q instanceof Error?q.message:"Failed to create share")}finally{I(!1)}},ee=async q=>{try{await f(q)}catch{}},J=async()=>{if(!T)return;L(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(T),v(!0),setTimeout(()=>v(!1),2e3);return}}catch{}const q=document.createElement("textarea");q.value=T,q.style.position="fixed",q.style.opacity="0",document.body.appendChild(q),q.select();try{document.execCommand("copy"),v(!0),setTimeout(()=>v(!1),2e3)}catch{L(!0)}document.body.removeChild(q)};return e.jsx(me,{open:r,onOpenChange:q=>{q||t()},children:e.jsxs(xe,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(fe,{children:e.jsxs(pe,{className:"font-display text-lg font-semibold text-text-primary",children:[c("share.title"),n?`: ${n}`:""]})}),e.jsxs("div",{className:"space-y-4 min-w-0",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:c("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>g("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${p==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:c("share.user")}),e.jsx("button",{onClick:()=>g("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${p==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:c("share.team")})]}),p==="user"?e.jsx(Kn,{onSelect:k,placeholder:c("share.userIdPlaceholder"),actionLabel:c("share.selectUser")}):e.jsx("input",{type:"text",value:C,onChange:q=>_(q.target.value),placeholder:c("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"}),p==="user"&&y&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[c("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:y})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:c("share.permission")}),e.jsxs("select",{value:j,onChange:q=>m(q.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:c("share.permissionRead")}),e.jsx("option",{value:"write",children:c("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:c("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:h,onChange:q=>w(q.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"})]}),(E||i)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:E||i}),T&&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:c("share.linkCreated")}),e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs text-text-primary",children:T}),e.jsx("button",{onClick:J,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:R?c("share.copied"):c("share.copy")})]}),O&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:c("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:c("share.existingShares")}),d?e.jsx("p",{className:"text-sm text-text-muted",children:c("share.loading")}):a.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:c("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:a.map(q=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md bg-surface-2 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:q.granted_to_user||q.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[q.permission==="write"?c("share.permissionWrite"):c("share.permissionRead"),q.expires_at?` · expires ${q.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>ee(q.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:c("share.revoke")})]},q.id))})]})]}),e.jsxs(On,{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:c("common.close")}),e.jsx("button",{onClick:Y,disabled:S||(p==="user"?!y.trim():!C.trim()),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:S?c("common.creating"):c("share.createShare")})]})]})})}function Vr(r){const t=new Date,s=new Date(t.getTime()-1440*60*1e3),n=(i,u)=>i.getFullYear()===u.getFullYear()&&i.getMonth()===u.getMonth()&&i.getDate()===u.getDate(),a={today:[],yesterday:[],earlier:[]};for(const i of r){const u=new Date(i.modified||0);n(u,t)?a.today.push(i):n(u,s)?a.yesterday.push(i):a.earlier.push(i)}return[["today",c("resume.today")],["yesterday",c("resume.yesterday")],["earlier",c("resume.earlier")]].map(([i,u])=>({label:u,items:a[i]})).filter(i=>i.items.length>0)}function Gr(r){return r?new Date(r).toLocaleString():""}function Yr({open:r,onClose:t,adapter:s,onResume:n}){const a=Z(),[d,i]=l.useState([]),[u,f]=l.useState(!1),[p,g]=l.useState("");l.useEffect(()=>{if(!r)return;let k=!1;return f(!0),g(""),i([]),s.listResumableSessions().then(C=>{k||i(C)}).catch(C=>{k||g(C instanceof Error?C.message:String(C))}).finally(()=>{k||f(!1)}),()=>{k=!0}},[r,s]);const y=l.useMemo(()=>Vr(d),[d,a]);return e.jsx(me,{open:r,onOpenChange:k=>{k||t()},children:e.jsxs(xe,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(fe,{children:e.jsx(pe,{className:"font-display text-lg font-semibold text-text-primary",children:c("session.resume.title")})}),e.jsxs("div",{className:"max-h-96 min-w-0 space-y-4 overflow-y-auto",children:[u&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:c("resume.loading")}),!u&&p&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:p}),!u&&!p&&d.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:c("resume.empty")}),!u&&!p&&y.map(k=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-text-muted",children:k.label}),e.jsx("div",{className:"space-y-1",children:k.items.map(C=>e.jsxs("button",{type:"button",onClick:()=>n(C),className:"w-full rounded-md px-3 py-2 text-left transition-colors hover:bg-surface-3",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:C.title}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[Gr(C.modified),C.gitBranch?` · ${C.gitBranch}`:""]})]},C.sessionId))})]},k.label))]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{type:"button",onClick:t,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary transition-colors hover:bg-surface-2",children:c("common.cancel")})})]})})}class Jr{constructor(t,s,n,a){A(this,"pending",null);this.current=t,this.apply=s,this.send=n,this.onError=a}set(t){if(t===this.current)return;const s=this.current;this.current=t,this.pending={requestId:null,previous:s},this.apply(t);try{Promise.resolve(this.send(t)).then(n=>{this.pending&&(this.pending.requestId=n)}).catch(n=>{this.rollback(s,ss(n),"send")})}catch(n){this.rollback(s,ss(n),"send")}}handleControlResponse(t){const s=this.pending;if(!s||s.requestId!==t.requestId)return!1;const{previous:n}=s;return this.pending=null,t.subtype==="error"&&this.rollback(n,t.error??"","response"),!0}sync(t){t!==this.current&&(this.current=t,this.apply(t),this.pending=null)}adoptExternal(t){this.pending||t!==this.current&&(this.current=t)}getCurrent(){return this.current}rollback(t,s,n){var a;this.pending=null,this.current=t,this.apply(t),s&&((a=this.onError)==null||a.call(this,s,n))}}function ss(r){return r instanceof Error?r.message:String(r)}function lt(r){const t=l.useRef(r);t.current=r;const s=l.useRef(null);s.current||(s.current=new Jr(r.value,a=>t.current.apply(a),a=>t.current.send(a),(a,d)=>{var i,u;return(u=(i=t.current).onError)==null?void 0:u.call(i,a,d)}));const n=s.current;return l.useEffect(()=>{n.adoptExternal(r.value)}),l.useMemo(()=>({set:a=>n.set(a),handleControlResponse:a=>n.handleControlResponse(a),sync:a=>n.sync(a)}),[n])}const bs="rcs_context_usage_";function js(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function ns(){return{totalTokens:0,rawMaxTokens:0,percentage:0}}function Xr(r){if(!r||typeof r!="object"||Array.isArray(r))return null;const t=r,{totalTokens:s,rawMaxTokens:n,percentage:a}=t;if(typeof s!="number"||typeof n!="number"||typeof a!="number")return null;const d=t.categories,i=Array.isArray(d)?d.filter(u=>!!u&&typeof u=="object"&&typeof u.name=="string").map(u=>({name:u.name,tokens:typeof u.tokens=="number"?u.tokens:0,...u.isDeferred===!0?{isDeferred:!0}:{}})):void 0;return{totalTokens:s,rawMaxTokens:n,percentage:a,...typeof t.model=="string"&&t.model?{model:t.model}:{},...i&&i.length>0?{categories:i}:{}}}function Zr(r,t=js()){if(!t||!r)return null;try{const s=t.getItem(bs+r);return s?Xr(JSON.parse(s)):null}catch{return null}}function ea(r,t,s=js()){if(!(!s||!r))try{s.setItem(bs+r,JSON.stringify(t))}catch{}}function ta(r){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${r}`}function sa(r){const t=ta(r),s=kn(),n=s?{proxyUrl:t,token:s}:{proxyUrl:t};return new wn(n)}const de=[{value:"default",labelKey:"session.mode.default",descKey:"session.mode.defaultDesc"},{value:"acceptEdits",labelKey:"session.mode.acceptEdits",descKey:"session.mode.acceptEditsDesc"},{value:"plan",labelKey:"session.mode.plan",descKey:"session.mode.planDesc"},{value:"bypassPermissions",labelKey:"session.mode.bypass",descKey:"session.mode.bypassDesc"}],rs="rcs_permission_mode";function ue(r){return r<1e3?String(r):r<1e6?`${(r/1e3).toFixed(1)}k`:`${(r/1e6).toFixed(1)}M`}function na(r){const t=de.findIndex(s=>s.value===r);return de[(t+1+de.length)%de.length].value}const Ke=[{value:"off",labelKey:"session.thinking.off",descKey:"session.thinking.offDesc",label:void 0,description:void 0,tokens:0},{value:"on",labelKey:"session.thinking.on",descKey:"session.thinking.onDesc",label:void 0,description:void 0,tokens:null},{value:"8192",labelKey:void 0,descKey:void 0,label:"8k",description:"8192 tokens",tokens:8192},{value:"16384",labelKey:void 0,descKey:void 0,label:"16k",description:"16384 tokens",tokens:16384},{value:"32768",labelKey:void 0,descKey:void 0,label:"32k",description:"32768 tokens",tokens:32768}],as="rcs_thinking_budget",ut=[{value:"auto",effort:void 0,labelKey:"session.effort.auto",descKey:"session.effort.autoDesc",label:void 0},{value:"low",effort:"low",labelKey:void 0,descKey:"session.effort.lowDesc",label:"low"},{value:"medium",effort:"medium",labelKey:void 0,descKey:"session.effort.mediumDesc",label:"medium"},{value:"high",effort:"high",labelKey:void 0,descKey:"session.effort.highDesc",label:"high"},{value:"xhigh",effort:"xhigh",labelKey:void 0,descKey:"session.effort.xhighDesc",label:"xhigh"},{value:"max",effort:"max",labelKey:void 0,descKey:"session.effort.maxDesc",label:"max"}],os=r=>r.labelKey?c(r.labelKey):r.label,is=r=>r.labelKey?c(r.labelKey):r.label,ls="rcs_effort";function ra(r){return r!=null&&r.capabilities?r.capabilities:r?{file_search:!0,clear:!0,set_max_thinking_tokens:!0,get_context_usage:!0,stop_task:!0,set_model:!0,set_permission_mode:!0,interrupt:!0,end_session:!0,mcp_management:!0,remote_settings:!0,rewind:!0,resume:!0,set_effort:!0,side_question:!0}:{file_search:!1,clear:!0,set_max_thinking_tokens:!0,get_context_usage:!1,stop_task:!1,set_model:!0,set_permission_mode:!0,interrupt:!0,end_session:!1,mcp_management:!1,remote_settings:!1,rewind:!1,resume:!1,set_effort:!1,side_question:!1}}function aa({budget:r,onBudgetChange:t,disabled:s}){const[n,a]=l.useState(!1),d=Ke.find(i=>i.value===r);return e.jsxs(Le,{open:n,onOpenChange:a,children:[e.jsx(Be,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:s,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:c("session.thinking.title"),children:[e.jsx(qn,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?is(d):c("session.thinking.fallback")}),n?e.jsx(He,{className:"h-3 w-3"}):e.jsx(We,{className:"h-3 w-3"})]})}),e.jsx(Qe,{className:"w-64 p-1",align:"start",children:Ke.map(i=>e.jsxs("button",{type:"button",onClick:()=>{t(i.value,i.tokens),a(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:r===i.value&&e.jsx(Te,{className:"h-3.5 w-3.5 text-brand-text"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:is(i)}),e.jsx("div",{className:"text-xs text-text-muted",children:i.descKey?c(i.descKey):i.description})]})]},i.value))})]})}function oa({effort:r,onEffortChange:t,disabled:s}){const[n,a]=l.useState(!1),d=ut.find(i=>i.value===r);return e.jsxs(Le,{open:n,onOpenChange:a,children:[e.jsx(Be,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:s,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:c("session.effort.title"),children:[e.jsx(Jn,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?os(d):c("session.effort.fallback")}),n?e.jsx(He,{className:"h-3 w-3"}):e.jsx(We,{className:"h-3 w-3"})]})}),e.jsx(Qe,{className:"w-64 p-1",align:"start",children:ut.map(i=>e.jsxs("button",{type:"button",onClick:()=>{t(i.value),a(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:r===i.value&&e.jsx(Te,{className:"h-3.5 w-3.5 text-brand-text"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:os(i)}),e.jsx("div",{className:"text-xs text-text-muted",children:c(i.descKey)})]})]},i.value))})]})}const ia=new Set(["Free space","Autocompact buffer","Compact buffer"]),cs=["bg-brand","bg-status-active","bg-status-success","bg-violet-500","bg-amber-500","bg-pink-500","bg-teal-500"];function la({usage:r}){const t=Math.min(100,Math.max(0,r.percentage)),s=t>=80,n=(r.categories??[]).filter(u=>!u.isDeferred&&!ia.has(u.name)),a=(r.categories??[]).filter(u=>u.isDeferred),d=n.reduce((u,f)=>u+f.tokens,0),i=[`${K("session.context.tooltip",{used:ue(r.totalTokens),max:ue(r.rawMaxTokens)})}${r.model?` · ${r.model}`:""}`,...n.slice(0,8).map(u=>`${u.name}: ${ue(u.tokens)}`),...a.slice(0,3).map(u=>`${u.name}${c("session.context.deferredSuffix")}: ${ue(u.tokens)}`)];return e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-text-muted font-mono",title:i.join(`
77
+ `),children:[e.jsx("span",{className:"relative flex h-1.5 w-16 overflow-hidden rounded-full bg-surface-3",children:n.length>0?n.map((u,f)=>e.jsx("span",{className:s&&f===0?"bg-status-warning":cs[f%cs.length],style:{width:`${Math.min(100,Math.max(0,d>0?u.tokens/d*t:0))}%`}},u.name)):e.jsx("span",{className:`absolute inset-y-0 left-0 rounded-full transition-all ${s?"bg-status-warning":"bg-brand/70"}`,style:{width:`${t}%`}})}),e.jsxs("span",{children:[t,"%"]})]})}function ca({models:r,currentModelId:t,onSelect:s,disabled:n}){const[a,d]=l.useState(!1),i=r.find(p=>p.modelId===t)??null,u=r.length>0,f=async p=>{s(p.modelId),d(!1)};return e.jsxs(Le,{open:a,onOpenChange:u?d:void 0,children:[e.jsx(Be,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:n||!u,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:c("session.model.title"),children:[e.jsx(xs,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(i==null?void 0:i.name)??t??c("session.model.title")}),a?e.jsx(He,{className:"h-3 w-3"}):e.jsx(We,{className:"h-3 w-3"})]})}),e.jsx(Qe,{className:"w-72 p-0",align:"start",children:e.jsx(Dn,{models:r,currentModelId:t,onSelect:f,showSearch:r.length>5})})]})}function da({mode:r,onModeChange:t,disabled:s}){const[n,a]=l.useState(!1),d=de.find(i=>i.value===r);return e.jsxs(Le,{open:n,onOpenChange:a,children:[e.jsx(Be,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:s,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:c("session.mode.title"),children:[e.jsx($n,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?c(d.labelKey):r}),n?e.jsx(He,{className:"h-3 w-3"}):e.jsx(We,{className:"h-3 w-3"})]})}),e.jsx(Qe,{className:"w-64 p-1",align:"start",children:de.map(i=>e.jsxs("button",{type:"button",onClick:()=>{t(i.value),a(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:r===i.value&&e.jsx(Te,{className:"h-3.5 w-3.5 text-brand-text"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:c(i.labelKey)}),e.jsx("div",{className:"text-xs text-text-muted",children:c(i.descKey)})]})]},i.value))})]})}function Sa({sessionId:r,onBack:t}){var Rt;Z();const[s,n]=l.useState(null),[a,d]=l.useState(null),[i,u]=l.useState(""),[f,p]=l.useState(!1),[g,y]=l.useState(!1),[k,C]=l.useState(!1),[_,j]=l.useState(!1),[m,h]=l.useState(!1),[w,S]=l.useState(!1),[I,T]=l.useState(""),[b,E]=l.useState(0),$=l.useRef(null),[R,v]=l.useState({text:"",nonce:0}),[O,L]=l.useState(!1),[Y,ee]=l.useState(!1),[J,q]=l.useState(!1),[he,mt]=l.useState(0),[ws,ks]=l.useState(0),[ge,te]=l.useState([]),[X,ye]=l.useState(!1),[be,ie]=l.useState([]),[z,ze]=l.useState(null),[xt,vs]=l.useState(()=>dt()),[W,Ns]=l.useState(null),[Ee,_s]=l.useState(()=>localStorage.getItem(as)||"off"),[Ss,ft]=l.useState(()=>Zr(r)),[Ve,Ge]=l.useState(!0),[je,Cs]=l.useState(null),[Ts,Es]=l.useState(null),[Me,pt]=l.useState(null),[Ae,Re]=l.useState([]),[Ms,Ye]=l.useState(!1),[Je,ht]=l.useState(""),Xe=l.useRef(null),[Ie,As]=l.useState(()=>localStorage.getItem(rs)||"default"),[gt,yt]=l.useState(null),we=l.useRef(null),[bt,jt]=l.useState(null),ke=l.useRef(null),re=l.useRef(null),wt=l.useRef(ge);wt.current=ge;const $e=l.useRef(null);$e.current||($e.current=new Qn(zn()));const kt=l.useRef(r);kt.current=(s==null?void 0:s.title)||r,l.useEffect(()=>{var o;(o=$e.current)==null||o.reset()},[r]);const ae=l.useCallback(o=>{yt(o),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>yt(null),5e3)},[]),se=l.useCallback(o=>{jt(o),ke.current&&clearTimeout(ke.current),ke.current=setTimeout(()=>jt(null),5e3)},[]),De=lt({value:Ie,apply:o=>{As(o);try{localStorage.setItem(rs,o)}catch{}},send:o=>{const x=re.current;return x?x.setPermissionMode(o):Promise.reject(new Error("adapter not ready"))},onError:(o,x)=>{console.error("[SessionDetail] set permission mode failed:",o),ae(x==="send"?K("session.mode.switchFailedRequest",{message:o}):o||c("session.mode.switchFailed"))}}),Ze=l.useCallback(o=>De.set(o),[De]),et=lt({value:Ee,apply:o=>{_s(o);try{localStorage.setItem(as,o)}catch{}},send:o=>{var M;const x=re.current;if(!x)return Promise.reject(new Error("adapter not ready"));const N=((M=Ke.find(D=>D.value===o))==null?void 0:M.tokens)??null;return x.setThinkingBudget(N)},onError:(o,x)=>{console.error("[SessionDetail] set thinking budget failed:",o),ae(x==="send"?K("session.thinking.failedRequest",{message:o}):o||c("session.thinking.failed"))}}),P=l.useMemo(()=>new jr(r,te,{onStatusChange:o=>{var x;d(o),ye(o==="running"||o==="requires_action"),(x=$e.current)==null||x.onStatus(o,kt.current)},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{ie(x=>x.some(N=>N.requestId===o.requestId)?x:[...x,o])},onModelsStateChange:o=>{ze(o)},onSubagentUpdate:o=>{vs(o)},onControlResponse:o=>{et.handleControlResponse(o)||De.handleControlResponse(o)},onPermissionModeChange:o=>{De.sync(o)},onUsageChange:o=>{Cs(x=>({inputTokens:Math.max((x==null?void 0:x.inputTokens)??0,o.inputTokens),outputTokens:Math.max((x==null?void 0:x.outputTokens)??0,o.outputTokens),totalCostUsd:o.totalCostUsd??(x==null?void 0:x.totalCostUsd)??null}))},onWorkerInfoChange:o=>{Ns(x=>JSON.stringify(x)===JSON.stringify(o)?x:o)},onTurnStart:o=>{Es(o)},onElicitationRequest:o=>{pt(o)}}),[r,ae]);l.useEffect(()=>(re.current=P,()=>{P.disconnect()}),[P]);const F=l.useMemo(()=>ra(W),[W]),vt=l.useRef(!1);l.useEffect(()=>{var N;if(!F.set_max_thinking_tokens||vt.current)return;const o=re.current;if(!o)return;const x=((N=Ke.find(M=>M.value===Ee))==null?void 0:N.tokens)??null;o.setThinkingBudget(x).then(()=>{vt.current=!0}).catch(M=>console.error("[SessionDetail] reconcile thinking budget failed:",M))},[F.set_max_thinking_tokens,Ee,W]);const Nt=F.stop_task?o=>{P.stopSubagent(o).then(x=>{x.ok||se(x.error||c("session.stopTask.failed"))})}:void 0,Rs=Z(),tt=l.useMemo(()=>vn((W==null?void 0:W.commands)??[],(W==null?void 0:W.skills)??[]),[W,Rs]),ve=l.useMemo(()=>Nn(ge,I),[ge,I]),Is=l.useCallback(o=>et.set(o),[et]),[_t,$s]=l.useState(()=>localStorage.getItem(ls)||"auto"),Ds=lt({value:_t,apply:o=>{$s(o);try{localStorage.setItem(ls,o)}catch{}},send:o=>{var M;const x=re.current;if(!x)return Promise.reject(new Error("adapter not ready"));const N=(M=ut.find(D=>D.value===o))==null?void 0:M.effort;return x.setEffort(N)},onError:(o,x)=>{console.error("[SessionDetail] set effort failed:",o),ae(x==="send"?K("session.effort.failedRequest",{message:o}):o||c("session.effort.failed"))}}),st=l.useCallback(()=>{var o;F.get_context_usage&&((o=re.current)==null||o.getContextUsage().then(x=>{x&&(ft(x),ea(r,x))}).catch(()=>{}).finally(()=>Ge(!1)))},[F,r]);l.useEffect(()=>{if(!F.get_context_usage)return;st();const o=setInterval(st,6e4);return()=>clearInterval(o)},[F,X,st]),l.useEffect(()=>{W&&!F.get_context_usage&&Ge(!1)},[W,F]),l.useEffect(()=>{if(!Ve)return;const o=setTimeout(()=>Ge(!1),1e4);return()=>clearTimeout(o)},[Ve]);const St=l.useRef(J);St.current=J,l.useEffect(()=>ce.onEvent(x=>{x.type!=="artifact_created"&&x.type!=="artifact_updated"||(St.current&&ks(N=>N+1),mt(N=>N+1))}),[]);const[Ne,qs]=l.useState("idle");l.useEffect(()=>ce.onStateChange(x=>qs(x)),[]),l.useEffect(()=>{J&&mt(0)},[J]),l.useEffect(()=>{let o=!1;async function x(){u("");try{const N=await Ut(r);if(o)return;n(N),d(N.status),Ue(N.status)&&P.markClosed(),ye(N.status==="running"||N.status==="requires_action")}catch(N){if(o)return;u(N instanceof Error?N.message:c("session.loadFailed"));return}try{await P.init()}catch(N){console.warn("Failed to init adapter:",N)}}return x(),()=>{o=!0}},[r,P]);const U=Ue(a),Ct=l.useRef(a);Ct.current=a,l.useEffect(()=>{if(U)return;let o=!1;const N=setInterval(async()=>{try{const M=await Ut(r);if(o||M.status===Ct.current)return;Ue(M.status)&&P.markClosed(),d(M.status),ye(M.status==="running"||M.status==="requires_action")}catch{}},6e4);return()=>{o=!0,clearInterval(N)}},[r,U,P]);const B=(s==null?void 0:s.access_level)==="read",Tt=Ss??(Ve&&!U&&!B?ns():null),nt=l.useCallback(()=>{te([]),ft(ns()),Pt(r).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[r]),_e=l.useCallback(async(o,x)=>{const N=re.current;if(!N||U)return;if(o.sessionId===r){te(D=>[...D,{type:"command_output",id:`cmd-resume-${Date.now()}`,commandName:"resume",inputText:x??"/resume",title:"Resume",subtitle:c("session.resume.title"),outputText:c("session.resume.currentBlocked"),variant:"error"}]);return}const M=(D,H="default")=>te(oe=>[...oe,{type:"command_output",id:`cmd-resume-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,commandName:"resume",inputText:x??`/resume ${o.sessionId.slice(0,8)}`,title:"Resume",subtitle:c("session.resume.title"),outputText:D,variant:H}]);M(K("session.resume.restoring",{title:o.title??""}));try{await Pt(r),te([]);const D=await N.resumeSession(o.sessionId);M(D.title?K("session.resume.restoredWithTitle",{count:D.messageCount,title:D.title}):K("session.resume.restored",{count:D.messageCount}))}catch(D){M(K("session.resume.failed",{message:D instanceof Error?D.message:String(D)}),"error")}},[U,r]),Ps=l.useCallback(async()=>{if(s!=null&&s.environment_id)try{const o=await _n({environment_id:s.environment_id});window.location.href=`/code/${o.id}?resumeFrom=${r}`}catch(o){se(K("session.createFailedWithReason",{message:o instanceof Error?o.message:String(o)}))}},[s,r,se]),Os=l.useRef(new URLSearchParams(window.location.search).get("resumeFrom")),Et=l.useRef(!1);l.useEffect(()=>{const o=Os.current;!o||Et.current||!W||!F.resume||(Et.current=!0,window.history.replaceState({},"",window.location.pathname),_e({sessionId:o,title:o.slice(0,8),modified:0},null))},[W,F.resume,_e]);const qe=l.useCallback(async o=>{const x=o.text.trim(),N=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!x&&!N||U)return;const M=/^\/resume(?:\s+(.*))?$/.exec(x);if(M){const H=(M[1]??"").trim();if(!F.resume){te(oe=>[...oe,{type:"user_message",id:`user-${Date.now()}`,content:x},{type:"command_output",id:`cmd-${Date.now()}`,commandName:"resume",inputText:x,title:"Resume",subtitle:c("session.resume.title"),outputText:c("session.resume.unsupported"),variant:"error"}]);return}H?await _e({sessionId:H,title:H,modified:0},x):h(!0);return}const D=await Sn(x,{sessionId:r,availableCommands:tt,availableModels:(z==null?void 0:z.availableModels)??[],currentModel:z?{modelId:z.currentModelId,name:z.currentModelId}:null,supportsImages:!0,entries:wt.current,setModel:async H=>{await G(r,{type:"control_request",request:{subtype:"set_model",model:H}}),ze(oe=>oe&&{...oe,currentModelId:H})},onNewSession:()=>{te([])}}).catch(()=>null);if(D){if(Fe("[SessionDetail] local command result",D),"clearEntries"in D&&D.clearEntries){nt();return}if("newSession"in D&&D.newSession){nt();return}if("userEntry"in D){te(H=>[...H,D.userEntry,D.cmdEntry]);return}}ye(!0);try{await P.sendMessage(x,o.images,o.attachments)}catch(H){if(console.error("Send failed:",H),H instanceof Cn&&H.type==="session_closed"){d("archived"),P.markClosed(),se(c("session.closedSendBlocked"));return}se(`${c("session.sendFailed")}${H instanceof Error?`: ${H.message}`:""}`)}},[P,U,r,z,tt,nt,se,_e,F]),Us=l.useCallback(o=>{if(X){Re(x=>[...x,o]);return}qe(o)},[X,qe]),rt=l.useRef(!1);l.useEffect(()=>{if(U){Re(x=>x.length>0?[]:x);return}if(X||Ae.length===0||rt.current)return;const o=Ae[0];o&&(rt.current=!0,Re(x=>x.slice(1)),qe(o).finally(()=>{rt.current=!1}))},[X,Ae,qe,U]);const Fs=l.useCallback((o,x)=>{if(X)return;const N=x==="edit"?c("session.rewind.confirmEdit"):c("session.rewind.confirm");window.confirm(`${N}
78
+ ${c("session.rewind.confirmBody")}`)&&P.rewindToMessage(o.id).then(()=>{x==="edit"&&o.content&&v(M=>({text:o.content,nonce:M.nonce+1}))}).catch(M=>{console.error("[SessionDetail] rewind failed:",M),se(K("session.rewind.failed",{message:M instanceof Error?M.message:String(M)}))})},[X,se]),Ks=l.useCallback(o=>{const x=ve.orderedMatchIds;if(x.length===0)return;const N=(o%x.length+x.length)%x.length;E(N);const M=x[N],D=document.querySelector(`[data-entry-id="${CSS.escape(M)}"]`);D==null||D.scrollIntoView({block:"center",behavior:"smooth"})},[ve]),Mt=l.useCallback(async()=>{try{await P.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{ye(!1)}},[P]),Ls=l.useCallback(()=>{Ze(na(Ie))},[Ze,Ie]);l.useEffect(()=>()=>{we.current&&clearTimeout(we.current),ke.current&&clearTimeout(ke.current)},[]);const Bs=l.useCallback(async()=>{if(s&&window.confirm(c("dashboard.confirmDelete").replace("{id}",s.title||s.id)))try{await Ot(s.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:c("dashboard.deleteFailed"))}},[s]),Hs=l.useCallback(async o=>{try{await P.respondPermission(o,!0)}catch(x){console.error("Failed to approve:",x)}ie(x=>x.filter(N=>N.requestId!==o))},[P]),Ws=l.useCallback(async(o,x)=>{try{await P.respondPermission(o,!0,{updated_permissions:x})}catch(N){console.error("Failed to approve with rules:",N)}ie(N=>N.filter(M=>M.requestId!==o))},[P]),Qs=l.useCallback(async(o,x)=>{const N=Me;if(pt(null),!!N)try{await P.respondElicitation(N.requestId,o,x)}catch(M){console.error("Failed to submit elicitation:",M)}},[Me,P]),zs=l.useCallback(()=>{!s||B||(ht(s.title||""),Ye(!0),setTimeout(()=>{var o,x;(o=Xe.current)==null||o.focus(),(x=Xe.current)==null||x.select()},0))},[s,B]),At=l.useCallback(async()=>{const o=Je.trim();if(Ye(!1),!(!s||!o||o===s.title))try{const x=await Tn(s.id,o);n(N=>N&&{...N,title:x.title??o})}catch(x){console.error("Rename failed:",x),alert(x instanceof Error?x.message:c("session.rename.failed"))}},[s,Je]),Vs=l.useCallback(async o=>{try{await P.respondPermission(o,!1)}catch(x){console.error("Failed to reject:",x)}ie(x=>x.filter(N=>N.requestId!==o))},[P]),Gs=l.useCallback(async(o,x,N)=>{try{await G(r,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:N,answers:x}})}catch(M){console.error("Failed to submit answers:",M)}ie(M=>M.filter(D=>D.requestId!==o))},[r]),Ys=l.useCallback(async(o,x,N)=>{try{x==="no"?await G(r,{type:"permission_response",approved:!1,request_id:o,...N?{message:N}:{}}):await G(r,{type:"permission_response",approved:!0,request_id:o,updated_permissions:[{type:"setMode",mode:{"yes-accept-edits":"acceptEdits","yes-default":"default"}[x]||"default",destination:"session"}]})}catch(M){console.error("Failed to submit plan response:",M)}ie(M=>M.filter(D=>D.requestId!==o))},[r]);return i?e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(Oe,{onBack:t,title:e.jsx("span",{className:"text-xs font-medium text-text-muted",children:c("session.loadFailed")})}),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:i}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:c("session.backToDashboard")})]})})]}):s?s.source==="acp"&&s.environment_id?e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:s.title||s.id}),e.jsx(Oe,{onBack:t,title:e.jsx("span",{className:"truncate text-xs font-semibold text-text-primary",children:s.title||s.id}),meta:e.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand-text",children:"ACP"})}),e.jsx(ma,{sessionId:r,agentId:s.environment_id})]}):e.jsx(us,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:s.title||s.id}),e.jsx(Oe,{onBack:t,title:Ms?e.jsx("input",{ref:Xe,value:Je,onChange:o=>ht(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),At()):o.key==="Escape"&&(o.preventDefault(),Ye(!1))},onBlur:()=>void At(),maxLength:200,className:"w-full max-w-xs rounded-md border border-brand/50 bg-surface-2 px-2 py-0.5 text-xs font-semibold text-text-primary focus:outline-none focus:ring-2 focus:ring-brand/30"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex min-w-0 items-center gap-2 text-xs font-semibold text-text-primary",children:!B&&!U?e.jsx("button",{type:"button",onClick:zs,title:c("session.rename.title"),className:"truncate text-left transition-colors hover:text-text-secondary",children:s.title||s.id}):e.jsx("span",{className:"truncate",children:s.title||s.id})}),s.visibility&&e.jsx(Wn,{visibility:s.visibility||"private",className:"hidden flex-shrink-0 text-[10px] sm:inline-flex"})]}),meta:e.jsx(e.Fragment,{children:(()=>{var N;const o=s.source==="acp"?"acp":(N=s.environment)==null?void 0:N.worker_type,x=Ft(o);return e.jsx("span",{className:`hidden items-center rounded-full px-2 py-0.5 text-[10px] font-medium sm:inline-flex ${x.colorClass}`,children:x.fullLabel})})()}),actions:e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsxs("button",{onClick:()=>q(!J),className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${J?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("artifacts.title"),children:[e.jsx(En,{className:"h-3.5 w-3.5"}),he>0&&!J&&e.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-brand px-0.5 text-[10px] font-bold text-white",children:he>9?"9+":he})]}),F.side_question&&!U&&!B&&e.jsx("button",{onClick:()=>j(!_),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${_?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.sideQuestion.title"),children:e.jsx(fs,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>{const o=!w;S(o),o?setTimeout(()=>{var x;return(x=$.current)==null?void 0:x.focus()},0):(T(""),E(0))},className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors ${w?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.search.title"),children:e.jsx(ct,{className:"h-3.5 w-3.5"})}),F.mcp_management&&!U&&!B&&e.jsx("button",{onClick:()=>y(!g),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${g?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.mcp.title"),children:e.jsx(ps,{className:"h-3.5 w-3.5"})}),F.remote_settings&&!U&&!B&&e.jsx("button",{onClick:()=>C(!k),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${k?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.settings.title"),children:e.jsx(hs,{className:"h-3.5 w-3.5"})}),!B&&(s==null?void 0:s.access_level)!=="write"&&e.jsx("button",{onClick:()=>ee(!0),className:"flex h-7 w-7 items-center justify-center rounded-md text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:c("session.share"),children:e.jsx(fr,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>L(!O),className:"hidden h-7 w-7 items-center justify-center rounded-md text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors sm:flex",title:c("session.info"),children:e.jsx(tr,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>p(!f),className:"ml-0.5 flex items-center gap-1 rounded-md px-2 py-1 text-xs font-semibold text-text-primary hover:bg-brand-light hover:text-white transition-colors",children:[c("session.tasks"),be.length>0&&e.jsx("span",{className:"rounded-full bg-status-warning/15 px-1.5 py-0.5 text-[10px] font-medium text-status-warning",children:be.length})]})]})})}),O&&e.jsx("div",{className:"flex-shrink-0 border-b bg-surface-1 py-2",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8",children:e.jsxs("div",{className:"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:c("session.metaSession")})," ",s.id]}),s.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaEnvironment")})," ",s.environment_id]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaStatus")})," ",a]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaWorker")})," ",Ft(s.source==="acp"?"acp":(Rt=s.environment)==null?void 0:Rt.worker_type).fullLabel]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaCreated")})," ",ds(s.created_at)]})]})})}),(Ne==="reconnecting"||Ne==="failed")&&e.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-1.5 text-xs font-medium ${Ne==="failed"?"bg-status-error/10 text-status-error":"bg-status-warning/10 text-status-warning"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${Ne==="failed"?"bg-status-error":"animate-pulse bg-status-warning"}`}),Ne==="failed"?c("session.sseFailed"):c("session.sseReconnecting")]}),J&&e.jsx("div",{className:"border-b bg-surface-1 py-4",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8",children:e.jsx(Hn,{sessionId:r,embedded:!0,refreshTick:ws})})}),w&&e.jsx("div",{className:"border-b bg-surface-1 py-2",children:e.jsxs("div",{className:"mx-auto flex page-measure px-4 sm:px-8 items-center gap-2",children:[e.jsx(ct,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{ref:$,value:I,onChange:o=>{T(o.target.value),E(0)},onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),Ks(I&&o.shiftKey?b-1:b+1)):o.key==="Escape"&&(o.preventDefault(),S(!1),T(""))},placeholder:c("session.search.placeholder"),className:"w-full bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"}),I.trim()&&e.jsx("span",{className:"flex-shrink-0 font-mono text-[10px] text-text-muted",children:ve.orderedMatchIds.length===0?c("session.search.noResults"):`${b+1}/${ve.orderedMatchIds.length}`})]})}),e.jsx(Mn,{entries:ge,isLoading:X,turnStartedAt:Ts,emptyTitle:c("session.emptyTitle"),emptyDescription:c("session.emptyDescription"),searchMatchIds:I.trim()?ve.matchIds:void 0,onRewindEntry:F.rewind&&!U&&!B&&!X?(o,x)=>Fs(o,x):void 0}),e.jsx(_r,{state:xt,onStopTask:Nt}),be.length>0&&e.jsx("div",{className:"border-t bg-surface-1 py-3",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8 space-y-3",children:be.map(o=>e.jsx(ua,{request:o,onApprove:()=>Hs(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>Ws(o.requestId,o.suggestions??[]):void 0,onReject:()=>Vs(o.requestId),onSubmitAnswers:Gs,onSubmitPlan:Ys},o.requestId))})}),Me&&e.jsx("div",{className:"border-t bg-surface-1 py-3",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8",children:e.jsx(Br,{request:Me,onSubmit:Qs})})}),bt&&e.jsx("div",{className:"mx-auto page-measure w-full px-4 sm:px-8 pb-1",children:e.jsx("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-1.5 text-xs text-red-700 dark:text-red-300",children:bt})}),gt&&e.jsx("div",{className:"mx-auto page-measure w-full px-4 sm:px-8 pb-1",children:e.jsx("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-1.5 text-xs text-red-700 dark:text-red-300",children:gt})}),e.jsxs("div",{className:"page-measure mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(da,{mode:Ie,onModeChange:Ze,disabled:U||B}),e.jsx(ca,{models:(z==null?void 0:z.availableModels)??[],currentModelId:(z==null?void 0:z.currentModelId)??null,onSelect:o=>{G(r,{type:"control_request",request:{subtype:"set_model",model:o}}),ze(x=>x&&{...x,currentModelId:o})},disabled:U||B}),F.set_max_thinking_tokens&&e.jsx(aa,{budget:Ee,onBudgetChange:Is,disabled:U||B}),F.set_effort&&e.jsx(oa,{effort:_t,onEffortChange:o=>Ds.set(o),disabled:U||B})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[Tt&&e.jsx(la,{usage:Tt}),je&&e.jsxs("span",{className:"text-[10px] text-text-muted font-mono",title:c("session.usage.total"),children:[ue(je.inputTokens)," in / ",ue(je.outputTokens)," out",je.totalCostUsd!=null&&` · $${je.totalCostUsd.toFixed(2)}`]})]})]}),U&&(s==null?void 0:s.environment_id)&&e.jsx("div",{className:"mx-auto w-full page-measure px-4 pb-2 sm:px-8",children:e.jsx("button",{type:"button",onClick:()=>void Ps(),className:"w-full rounded-lg border border-border bg-surface-1 px-4 py-2.5 text-sm text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary",children:c("session.resumeInNew")})}),e.jsx(An,{onSubmit:Us,isLoading:X,onInterrupt:Mt,onCycleMode:Ls,disabled:U||B,placeholder:U?c("session.closed"):B?c("session.readOnly"):c("session.inputPlaceholder"),supportsAttachments:!0,commands:tt,queueWhileLoading:!0,queuedCount:Ae.length,onDequeue:o=>Re(x=>x.filter((N,M)=>M!==o)),onSearchFiles:F.file_search?o=>P.searchFiles(o):void 0,historyKey:r,draftOverride:R}),g&&e.jsx($r,{onClose:()=>y(!1),fetchServers:()=>P.getMcpServers(),onToggle:(o,x)=>P.toggleMcpServer(o,x),onReconnect:o=>P.reconnectMcpServer(o)}),k&&e.jsx(qr,{onClose:()=>C(!1),fetchSettings:()=>P.getRemoteSettings(),onApply:o=>P.applyFlagSettings(o)}),_&&e.jsx(Pr,{onClose:()=>j(!1),onAsk:o=>P.askSideQuestion(o)}),f&&s&&e.jsx(Tr,{onClose:()=>p(!1),session:s,liveStatus:a,pendingPermissions:be,subagentState:xt,onStopTask:Nt,onInterrupt:Mt,onDelete:Bs,onEndSession:F.end_session&&!U&&!B?async()=>{await P.endSession("ended from web"),await Ot(s.id),window.location.href="/code/"}:void 0}),e.jsx(zr,{open:Y,onClose:()=>ee(!1),sessionId:s.id,sessionTitle:s.title||void 0}),e.jsx(Yr,{open:m,onClose:()=>h(!1),adapter:P,onResume:o=>{h(!1),_e(o,null)}})]})}):e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(Oe,{onBack:t,title:e.jsx("span",{className:"h-3.5 w-40 animate-pulse rounded bg-surface-2"})}),e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("div",{className:"text-text-muted",children:c("session.loading")})})]})}function ua({request:r,onApprove:t,onApproveAlways:s,onReject:n,onSubmitAnswers:a,onSubmitPlan:d}){const i=r.toolName,u=r.toolInput,f=r.description||"";if(i==="AskUserQuestion"){const p=u.questions||[];return e.jsx(Ur,{requestId:r.requestId,questions:p,description:f,onSubmit:g=>a(r.requestId,g,p),onSkip:n})}if(i==="ExitPlanMode"){const p=u.plan||"";return e.jsx(Kr,{requestId:r.requestId,planContent:p,description:f,onSubmit:(g,y)=>d(r.requestId,g,y)})}return e.jsx(Or,{requestId:r.requestId,toolName:i,toolInput:u,description:f,suggestions:r.suggestions,onApprove:t,onApproveAlways:s,onReject:n})}function ma({sessionId:r,agentId:t}){const[s,n]=l.useState(null),[a,d]=l.useState("disconnected"),[i,u]=l.useState(null),f=l.useRef(null);return l.useEffect(()=>{const p=sa(t);return p.setConnectionStateHandler((g,y)=>{d(g),u(y||null)}),f.current=p,n(p),p.connect().catch(g=>{g instanceof Rn||(u(g.message),d("error"))}),()=>{p.disconnect(),f.current=null,n(null),d("disconnected")}},[t]),e.jsx(us,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&a==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:i}),a==="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:c("session.connectingAgent")})]})}),a==="error"&&!s&&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:c("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:i})]})}),s&&a==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(In,{client:s,agentId:t})})]})})}export{Sa as SessionDetail};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./vendor-DE_-CLIE.js";import{ap as c,V as n,an as i}from"./main-7jP_dqcT.js";/**
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{ap as c,V as n,an as i}from"./main-BopVSHhX.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.