@saluzi/saluzi-edu 0.7.13 → 0.7.15

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 (158) hide show
  1. package/dist/cli.js +42 -42
  2. package/dist/rcs-web/assets/{AdminPanel-DugQ1zJs.js → AdminPanel-CoSNNH8v.js} +1 -1
  3. package/dist/rcs-web/assets/{ArtifactView-rXn5UHd0.js → ArtifactView-CaZ6Bn-5.js} +1 -1
  4. package/{packages/remote-control-server/web/dist/assets/ArtifactsGallery-DYZ5MTsU.js → dist/rcs-web/assets/ArtifactsGallery-CMBl4_tW.js} +1 -1
  5. package/{packages/remote-control-server/web/dist/assets/Claim-55pIPPu9.js → dist/rcs-web/assets/Claim-BZ03VZxd.js} +1 -1
  6. package/dist/rcs-web/assets/{Dashboard-CC-Am4QG.js → Dashboard-DNk4dBkp.js} +1 -1
  7. package/dist/rcs-web/assets/{Join-Bv_quRru.js → Join-CL9s-HWG.js} +1 -1
  8. package/{packages/remote-control-server/web/dist/assets/Login-CQvhBtmI.js → dist/rcs-web/assets/Login-DypP2NZb.js} +1 -1
  9. package/dist/rcs-web/assets/{MemoriesGallery-DmhB-a-r.js → MemoriesGallery-BZi7L7O1.js} +1 -1
  10. package/dist/rcs-web/assets/{Register-CWCr9uhR.js → Register-BF2mhSpw.js} +1 -1
  11. package/dist/rcs-web/assets/{RegisterEmpty-BxED5Dy8.js → RegisterEmpty-40NZTQDf.js} +1 -1
  12. package/dist/rcs-web/assets/SessionDetail-Czr-xzEy.js +78 -0
  13. package/dist/rcs-web/assets/{SessionVisibilityBadge-mclra9a1.js → SessionVisibilityBadge-CrG4pyXD.js} +1 -1
  14. package/dist/rcs-web/assets/{Setup-BOa1QZgo.js → Setup-CVwnJSHR.js} +1 -1
  15. package/dist/rcs-web/assets/{ShareLanding-DUksxKDO.js → ShareLanding-DzIeZduO.js} +1 -1
  16. package/{packages/remote-control-server/web/dist/assets/TeamDetail-N4R7QgkK.js → dist/rcs-web/assets/TeamDetail-Bx5Dwc5B.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamList-Dkroa-DR.js → TeamList-wAXXbAI0.js} +1 -1
  18. package/dist/rcs-web/assets/{TeamSettings-sH6k3cBB.js → TeamSettings-BH6epZ5p.js} +1 -1
  19. package/dist/rcs-web/assets/{UserSearchInput-B8gKPGEK.js → UserSearchInput-zZQ--3Ir.js} +1 -1
  20. package/dist/rcs-web/assets/{UserSettings-Cnr-Z5oi.js → UserSettings-CXKAmil9.js} +1 -1
  21. package/dist/rcs-web/assets/{arc-BaScP50H.js → arc-C2C2gTUa.js} +1 -1
  22. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-LpUmudjN.js → architectureDiagram-3BPJPVTR-C52vQ2yU.js} +1 -1
  23. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BahEW4lQ.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-BCeJ7dZv.js} +1 -1
  24. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-NNZbDHKK.js → c4Diagram-AAUBKEIU-DfGvJnoF.js} +1 -1
  25. package/dist/rcs-web/assets/channel-Dk8Mq-sv.js +1 -0
  26. package/dist/rcs-web/assets/{chunk-2J33WTMH-69YYeEie.js → chunk-2J33WTMH-SqwYjXR7.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-4BX2VUAB-CoMWvtbi.js → chunk-4BX2VUAB-Cd1lbVto.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-55IACEB6-BhdS00Z_.js → chunk-55IACEB6-Dxz0QJbP.js} +1 -1
  29. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-B-X0tTCc.js → dist/rcs-web/assets/chunk-727SXJPM-D_RP38k0.js} +1 -1
  30. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-uNpZ8YVO.js → dist/rcs-web/assets/chunk-AQP2D5EJ-CoK7QXm2.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-FMBD7UC4-INF2n4DE.js → chunk-FMBD7UC4-B7eZscRi.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-ND2GUHAM-CGoZKqoJ.js → chunk-ND2GUHAM-Bvpp9Nsj.js} +1 -1
  33. package/dist/rcs-web/assets/{chunk-QZHKN3VN-B0_Eodir.js → chunk-QZHKN3VN-B44Qhl3N.js} +1 -1
  34. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DBfm1aim.js +1 -0
  35. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DBfm1aim.js +1 -0
  36. package/dist/rcs-web/assets/{code-block-IT6T5CEO-Dqe2MgFE.js → code-block-IT6T5CEO-Bsu934p0.js} +1 -1
  37. package/dist/rcs-web/assets/{copy-BM16nNhl.js → copy-WjRHDSJw.js} +1 -1
  38. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CnkedUmD.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-CRqEQHqF.js} +1 -1
  39. package/dist/rcs-web/assets/{dagre-BM42HDAG-C3C2M9Dc.js → dagre-BM42HDAG-BDwZiG9l.js} +1 -1
  40. package/{packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-ESFaqWFA.js → dist/rcs-web/assets/diagram-2AECGRRQ-1zqGFe6d.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-5GNKFQAL-18y3Di-Z.js → diagram-5GNKFQAL-CK6r1W7f.js} +1 -1
  42. package/{packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-HRfgxVLi.js → dist/rcs-web/assets/diagram-KO2AKTUF-BwN2jZs0.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-LMA3HP47-BGXS1MbV.js → diagram-LMA3HP47-k7cBgmg8.js} +1 -1
  44. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-mTYLV8qh.js → dist/rcs-web/assets/diagram-OG6HWLK6-XBGYM6sm.js} +1 -1
  45. package/dist/rcs-web/assets/{dialog-BY4fOXc_.js → dialog-tLY80h3R.js} +1 -1
  46. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-DS5hbsJs.js → erDiagram-TEJ5UH35-BOUhUwWy.js} +1 -1
  47. package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-CZdy8yJc.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-BtWAyBVD.js} +1 -1
  48. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DSBnE024.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-BGxCZ0WS.js} +1 -1
  49. package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-SPF9bGwd.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BWvEdHPG.js} +1 -1
  50. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-BHH_W4WL.js → infoDiagram-5YYISTIA-cFmh_D91.js} +1 -1
  51. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-Dk_V2DBo.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-KQ8Hx0X-.js} +1 -1
  52. package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-D9V0wEAf.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-DmxNxWUD.js} +1 -1
  53. package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-CsqaKKO9.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-CB1YdgUa.js} +1 -1
  54. package/dist/rcs-web/assets/{linear-B41O4W2v.js → linear-BOVhyWJg.js} +1 -1
  55. package/dist/rcs-web/assets/main-B--R2IYC.css +1 -0
  56. package/dist/rcs-web/assets/{main-BEcUh0F7.js → main-DifWL4zR.js} +25 -25
  57. package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-C1VVhmLq.js → dist/rcs-web/assets/mermaid-VLURNSYL-Bh10UEb0.js} +4 -4
  58. package/dist/rcs-web/assets/{mermaid.core-DQfCv5Cg.js → mermaid.core-C2g8nuIa.js} +5 -5
  59. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-BD1xoQCh.js → mindmap-definition-RKZ34NQL-svJpj9yT.js} +1 -1
  60. package/dist/rcs-web/assets/{notifications-BPvB-uGE.js → notifications-BYK9k_gx.js} +1 -1
  61. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-C9VTG-uO.js → pieDiagram-4H26LBE5-SVCCRmI6.js} +1 -1
  62. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-CcdAz31R.js → quadrantDiagram-W4KKPZXB-7PTV2sCP.js} +1 -1
  63. package/dist/rcs-web/assets/{refresh-cw-D-EyhwSL.js → refresh-cw-MOW7habc.js} +1 -1
  64. package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-56ONxGl0.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-BcQxVg5g.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-ECkEyAfb.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DvO2xXKc.js} +1 -1
  66. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-C_31JcIA.js → sequenceDiagram-3UESZ5HK-klx9nfJu.js} +1 -1
  67. package/{packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-BCCWavRG.js → dist/rcs-web/assets/stateDiagram-AJRCARHV-CwJT8yW5.js} +1 -1
  68. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CErSQlCd.js → stateDiagram-v2-BHNVJYJU-Cc4iVBiV.js} +1 -1
  69. package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-Bq1dpAT8.js → timeline-definition-PNZ67QCA-CePQ_Ywg.js} +1 -1
  70. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-C0gZpyFU.js → vennDiagram-CIIHVFJN-D285USzy.js} +1 -1
  71. package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-qPrWLnjV.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-BHk_TcK3.js} +1 -1
  72. package/dist/rcs-web/assets/{workerType-CWB4ZW61.js → workerType-DXaJtQ7o.js} +1 -1
  73. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-p83OQUAm.js → xychartDiagram-2RQKCTM6-DSZgafuZ.js} +1 -1
  74. package/dist/rcs-web/index.html +3 -3
  75. package/package.json +1 -1
  76. package/packages/remote-control-server/web/dist/assets/{AdminPanel-DugQ1zJs.js → AdminPanel-CoSNNH8v.js} +1 -1
  77. package/packages/remote-control-server/web/dist/assets/{ArtifactView-rXn5UHd0.js → ArtifactView-CaZ6Bn-5.js} +1 -1
  78. package/{dist/rcs-web/assets/ArtifactsGallery-DYZ5MTsU.js → packages/remote-control-server/web/dist/assets/ArtifactsGallery-CMBl4_tW.js} +1 -1
  79. package/{dist/rcs-web/assets/Claim-55pIPPu9.js → packages/remote-control-server/web/dist/assets/Claim-BZ03VZxd.js} +1 -1
  80. package/packages/remote-control-server/web/dist/assets/{Dashboard-CC-Am4QG.js → Dashboard-DNk4dBkp.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Join-Bv_quRru.js → Join-CL9s-HWG.js} +1 -1
  82. package/{dist/rcs-web/assets/Login-CQvhBtmI.js → packages/remote-control-server/web/dist/assets/Login-DypP2NZb.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/{MemoriesGallery-DmhB-a-r.js → MemoriesGallery-BZi7L7O1.js} +1 -1
  84. package/packages/remote-control-server/web/dist/assets/{Register-CWCr9uhR.js → Register-BF2mhSpw.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/{RegisterEmpty-BxED5Dy8.js → RegisterEmpty-40NZTQDf.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/SessionDetail-Czr-xzEy.js +78 -0
  87. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-mclra9a1.js → SessionVisibilityBadge-CrG4pyXD.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{Setup-BOa1QZgo.js → Setup-CVwnJSHR.js} +1 -1
  89. package/packages/remote-control-server/web/dist/assets/{ShareLanding-DUksxKDO.js → ShareLanding-DzIeZduO.js} +1 -1
  90. package/{dist/rcs-web/assets/TeamDetail-N4R7QgkK.js → packages/remote-control-server/web/dist/assets/TeamDetail-Bx5Dwc5B.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/{TeamList-Dkroa-DR.js → TeamList-wAXXbAI0.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{TeamSettings-sH6k3cBB.js → TeamSettings-BH6epZ5p.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-B8gKPGEK.js → UserSearchInput-zZQ--3Ir.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{UserSettings-Cnr-Z5oi.js → UserSettings-CXKAmil9.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/{arc-BaScP50H.js → arc-C2C2gTUa.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-LpUmudjN.js → architectureDiagram-3BPJPVTR-C52vQ2yU.js} +1 -1
  97. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-BahEW4lQ.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BCeJ7dZv.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-NNZbDHKK.js → c4Diagram-AAUBKEIU-DfGvJnoF.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/channel-Dk8Mq-sv.js +1 -0
  100. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-69YYeEie.js → chunk-2J33WTMH-SqwYjXR7.js} +1 -1
  101. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-CoMWvtbi.js → chunk-4BX2VUAB-Cd1lbVto.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-BhdS00Z_.js → chunk-55IACEB6-Dxz0QJbP.js} +1 -1
  103. package/{dist/rcs-web/assets/chunk-727SXJPM-B-X0tTCc.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-D_RP38k0.js} +1 -1
  104. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-uNpZ8YVO.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-CoK7QXm2.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-INF2n4DE.js → chunk-FMBD7UC4-B7eZscRi.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CGoZKqoJ.js → chunk-ND2GUHAM-Bvpp9Nsj.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-B0_Eodir.js → chunk-QZHKN3VN-B44Qhl3N.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DBfm1aim.js +1 -0
  109. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DBfm1aim.js +1 -0
  110. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-Dqe2MgFE.js → code-block-IT6T5CEO-Bsu934p0.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{copy-BM16nNhl.js → copy-WjRHDSJw.js} +1 -1
  112. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-CnkedUmD.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CRqEQHqF.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-C3C2M9Dc.js → dagre-BM42HDAG-BDwZiG9l.js} +1 -1
  114. package/{dist/rcs-web/assets/diagram-2AECGRRQ-ESFaqWFA.js → packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-1zqGFe6d.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-18y3Di-Z.js → diagram-5GNKFQAL-CK6r1W7f.js} +1 -1
  116. package/{dist/rcs-web/assets/diagram-KO2AKTUF-HRfgxVLi.js → packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-BwN2jZs0.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-BGXS1MbV.js → diagram-LMA3HP47-k7cBgmg8.js} +1 -1
  118. package/{dist/rcs-web/assets/diagram-OG6HWLK6-mTYLV8qh.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-XBGYM6sm.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/{dialog-BY4fOXc_.js → dialog-tLY80h3R.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-DS5hbsJs.js → erDiagram-TEJ5UH35-BOUhUwWy.js} +1 -1
  121. package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-CZdy8yJc.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-BtWAyBVD.js} +1 -1
  122. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DSBnE024.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-BGxCZ0WS.js} +1 -1
  123. package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-SPF9bGwd.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BWvEdHPG.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-BHH_W4WL.js → infoDiagram-5YYISTIA-cFmh_D91.js} +1 -1
  125. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-Dk_V2DBo.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-KQ8Hx0X-.js} +1 -1
  126. package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-D9V0wEAf.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-DmxNxWUD.js} +1 -1
  127. package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-CsqaKKO9.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-CB1YdgUa.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/{linear-B41O4W2v.js → linear-BOVhyWJg.js} +1 -1
  129. package/packages/remote-control-server/web/dist/assets/main-B--R2IYC.css +1 -0
  130. package/packages/remote-control-server/web/dist/assets/{main-BEcUh0F7.js → main-DifWL4zR.js} +25 -25
  131. package/{dist/rcs-web/assets/mermaid-VLURNSYL-C1VVhmLq.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-Bh10UEb0.js} +4 -4
  132. package/packages/remote-control-server/web/dist/assets/{mermaid.core-DQfCv5Cg.js → mermaid.core-C2g8nuIa.js} +5 -5
  133. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-BD1xoQCh.js → mindmap-definition-RKZ34NQL-svJpj9yT.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{notifications-BPvB-uGE.js → notifications-BYK9k_gx.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-C9VTG-uO.js → pieDiagram-4H26LBE5-SVCCRmI6.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-CcdAz31R.js → quadrantDiagram-W4KKPZXB-7PTV2sCP.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/{refresh-cw-D-EyhwSL.js → refresh-cw-MOW7habc.js} +1 -1
  138. package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-56ONxGl0.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-BcQxVg5g.js} +1 -1
  139. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-ECkEyAfb.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DvO2xXKc.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-C_31JcIA.js → sequenceDiagram-3UESZ5HK-klx9nfJu.js} +1 -1
  141. package/{dist/rcs-web/assets/stateDiagram-AJRCARHV-BCCWavRG.js → packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-CwJT8yW5.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CErSQlCd.js → stateDiagram-v2-BHNVJYJU-Cc4iVBiV.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-Bq1dpAT8.js → timeline-definition-PNZ67QCA-CePQ_Ywg.js} +1 -1
  144. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-C0gZpyFU.js → vennDiagram-CIIHVFJN-D285USzy.js} +1 -1
  145. package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-qPrWLnjV.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-BHk_TcK3.js} +1 -1
  146. package/packages/remote-control-server/web/dist/assets/{workerType-CWB4ZW61.js → workerType-DXaJtQ7o.js} +1 -1
  147. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-p83OQUAm.js → xychartDiagram-2RQKCTM6-DSZgafuZ.js} +1 -1
  148. package/packages/remote-control-server/web/dist/index.html +3 -3
  149. package/dist/rcs-web/assets/SessionDetail-BtVDoMg8.js +0 -83
  150. package/dist/rcs-web/assets/channel-S5Y2JIsm.js +0 -1
  151. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BftkaBF6.js +0 -1
  152. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BftkaBF6.js +0 -1
  153. package/dist/rcs-web/assets/main-B7U6M5cC.css +0 -1
  154. package/packages/remote-control-server/web/dist/assets/SessionDetail-BtVDoMg8.js +0 -83
  155. package/packages/remote-control-server/web/dist/assets/channel-S5Y2JIsm.js +0 -1
  156. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BftkaBF6.js +0 -1
  157. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BftkaBF6.js +0 -1
  158. package/packages/remote-control-server/web/dist/assets/main-B7U6M5cC.css +0 -1
@@ -0,0 +1,78 @@
1
+ var kn=Object.defineProperty;var Nn=(r,t,s)=>t in r?kn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var $=(r,t,s)=>Nn(r,typeof t!="symbol"?t+"":t,s);import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{aF as X,ai as Sn,aN as rs,aM as as,aT as i,aP as _n,aO as xt,aU as B,aK as Se,ax as Cn,aw as ee,al as Tn,at as En,aY as Mn,a$ as se,T as Rn,Q as An,X as Fs,L as Ve,H as In,I as $n,i as os,aJ as Dn,N as Ks,aG as pt,e as qe,S as ft,M as qn,y as Pn,aH as te,aD as pe,aI as On,aV as Fn,G as Kn,D as Un,aW as is,am as Ln,a2 as Bn,as as Hn,ae as Us,ad as Qn,ab as Wn,au as Vn,ap as Yn,P as ls,t as zn,B as $t,V as Gn,ac as cs,$ as Jn,an as Xn,a4 as Zn,aB as er,A as tr,aL as sr,aQ as nr,aR as rr,Z as ds,a1 as ar,aX as or,b as ir,a6 as us,aq as lr,K as Ls,F as cr,d as dr,C as ur,ah as ms,l as mr,a as xr,u as Ye,w as ze,E as pr,g as Ge,f as Je,v as Xe,s as fr}from"./main-DifWL4zR.js";import{A as hr,g as Bs}from"./workerType-DXaJtQ7o.js";import{D as _e,a as Ce,c as Pe,d as Te,b as yr}from"./dialog-tLY80h3R.js";import{R as gr}from"./refresh-cw-MOW7habc.js";import{A as br,U as jr}from"./UserSearchInput-zZQ--3Ir.js";import{C as wr}from"./copy-WjRHDSJw.js";import{E as vr,S as kr,A as Nr}from"./ArtifactsGallery-CMBl4_tW.js";import{S as Sr}from"./SessionVisibilityBadge-CrG4pyXD.js";import{MemoriesGallery as _r}from"./MemoriesGallery-BZi7L7O1.js";import{S as Cr,b as Tr}from"./notifications-BYK9k_gx.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 Er=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Hs=X("chevron-right",Er);/**
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 Mr=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],Rr=X("coins",Mr);/**
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 Ar=[["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"}]],Qs=X("cpu",Ar);/**
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 Ir=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],$r=X("gauge",Ir);/**
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 Dr=[["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"}]],qr=X("hash",Dr);/**
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 Pr=[["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"}]],Or=X("layers",Pr);/**
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 Fr=[["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"}]],Ws=X("message-circle-question-mark",Fr);/**
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 Kr=[["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"}]],Ur=X("message-square-text",Kr);/**
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 Lr=[["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"}]],Br=X("play",Lr);/**
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 Hr=[["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"}]],Vs=X("plug",Hr);/**
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 Qr=[["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"}]],Wr=X("server-cog",Qr);/**
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 Vr=[["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"}]],Ys=X("settings-2",Vr);/**
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 Yr=[["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"}]],zr=X("share-2",Yr);/**
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 Gr=[["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"}]],Jr=X("shield-check",Gr);function At(){return{tasks:{}}}const xs=3e4;function ct(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 ps(r,t){var c,u,p,h,g,b,S,C,T,m,y,v;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:ct(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:ct(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:ct(w),description:w,toolUseId:t.tool_use_id,status:"running",startTime:a,tokenCount:(c=t.usage)==null?void 0:c.total_tokens,toolUseCount:(u=t.usage)==null?void 0:u.tool_uses,durationMs:(p=t.usage)==null?void 0:p.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...r.tasks,[n]:{...d,description:t.description??d.description,tokenCount:((h=t.usage)==null?void 0:h.total_tokens)??d.tokenCount,toolUseCount:((g=t.usage)==null?void 0:g.tool_uses)??d.toolUseCount,durationMs:((b=t.usage)==null?void 0:b.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:((m=t.usage)==null?void 0:m.total_tokens)??d.tokenCount,toolUseCount:((y=t.usage)==null?void 0:y.tool_uses)??d.toolUseCount,durationMs:((v=t.usage)==null?void 0:v.duration_ms)??d.durationMs,evictAfter:a+xs}}}:{tasks:{...r.tasks,[n]:{taskId:n,name:ct(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:a,endTime:a,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(S=t.usage)==null?void 0:S.total_tokens,toolUseCount:(C=t.usage)==null?void 0:C.tool_uses,durationMs:(T=t.usage)==null?void 0:T.duration_ms,evictAfter:a+xs}}}}function zs(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 fs={in_process_teammate:0,local_bash:1,monitor_mcp:2,remote_agent:3,local_agent:4,dream:5},hs=100;function Xr(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=fs[s]??hs,d=fs[n]??hs;return a===d?s.localeCompare(n):a-d}).map(([s,n])=>({taskType:s,tasks:[...n].sort((a,d)=>a.startTime-d.startTime)}))}function ys(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 Zr(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,set_token_mode:t.set_token_mode===!0,side_question:t.side_question===!0};return Object.values(s).some(Boolean)?s:null}function gs(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 bs(r){const t=r.raw&&typeof r.raw=="object"&&!Array.isArray(r.raw)?r.raw:r,s=gs(t.slash_command_details??r.slash_command_details,t.slash_commands??r.slash_commands),n=gs(t.skill_details??r.skill_details,t.skills??r.skills),a=Zr(t.remote_capabilities??r.remote_capabilities);return s.length===0&&n.length===0&&!a?null:{commands:s,skills:n,capabilities:a}}class ea{constructor(t){$(this,"listeners",new Set);$(this,"stateListeners",new Set);$(this,"eventSource",null);$(this,"sessionId",null);$(this,"_lastSeqNum",0);$(this,"lastFrameAt",0);$(this,"firstEventAfterOpen",!1);$(this,"watchdogTimer",null);$(this,"visibilityHandler",null);$(this,"reconnectTimer",null);$(this,"reconnectAttempts",0);$(this,"_state","idle");$(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 Mn(),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 xe=new ea;function Et(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 js(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 Mt="streaming-";function ws(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 vs(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 ks(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 ta{constructor(t,s,n){$(this,"sessionId");$(this,"setEntries");$(this,"unsub",null);$(this,"unsubState",null);$(this,"onStatusChange");$(this,"onError");$(this,"onPermissionRequest");$(this,"onModelsStateChange");$(this,"onSubagentUpdate");$(this,"onControlResponse");$(this,"onPermissionModeChange");$(this,"onElicitationRequest");$(this,"onWorkerInfoChange");$(this,"onTurnStart");$(this,"subagentState",At());$(this,"seenUuids",new Set);$(this,"seenToolCallIds",new Set);$(this,"pendingToolCallIds",new Set);$(this,"pendingPermissionToolIds",new Map);$(this,"postedUserUuids",new Set);$(this,"pendingControlRequests",new Map);$(this,"turnEnded",!1);$(this,"userSinceTurnEnd",!1);$(this,"turnStartedAt",null);$(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.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 T,m,y,v,w,R;const{events:t}=await Sn(this.sessionId);if(!t||t.length===0)return;const s=new Set;for(const j of t){if(j.type!=="user"||j.direction==="inbound")continue;const _=(T=j.payload)==null?void 0:T.uuid;typeof _=="string"&&_&&s.add(_)}const n=[];let a=null;const d=()=>{a&&(n.push(a),a=null)};for(const j of t){const _=j.payload||{},O=_.uuid;if(typeof O=="string"&&O&&this.seenUuids.add(O),j.type==="tool_use"){const E=_.tool_call_id;typeof E=="string"&&E&&this.seenToolCallIds.add(E)}if(j.type==="user"){if(j.direction==="inbound"){const q=_.uuid;if(typeof q!="string"||!q||s.has(q))continue}d();const E=Et(_);E&&n.push({type:"user_message",id:j.id||`hist-user-${n.length}`,content:E})}else if(j.type==="assistant"){d();const E=Et(_);if(rs(E))continue;const q=ws(_),Q=[],N=_.message;if(N&&typeof N=="object"&&Array.isArray(N.content)){for(const F of N.content)if(F.type==="tool_use"){const I=F.id;I&&this.seenToolCallIds.add(I),Q.push({type:"tool_call",toolCall:{id:I||`hist-tool-${n.length}`,title:F.name||"tool",status:"complete",rawInput:F.input||{}}})}}if(E||q||Q.length>0){a={type:"assistant_message",id:j.id||`hist-asst-${n.length}`,chunks:[...q?[{type:"thought",text:q}]:[],...E?[{type:"message",text:E}]:[]]},n.push(a);for(const F of Q)n.push(F);a=null}}else if(j.type==="conversation_rewound"){const E=ks(_);if(E){const q=n.findIndex(Q=>as(Q)===E);q>=0&&(n.length=q)}}else if(j.type==="tool_use"){const E=_,q={type:"tool_call",toolCall:{id:E.tool_call_id||`hist-tool-${n.length}`,title:E.tool_name||"tool",status:"complete",rawInput:E.tool_input||{}}};n.push(q)}else if(j.type==="tool_result"){const E=_,q=js(n,E.tool_call_id||"");if(q>=0){const Q=n[q];n[q]={type:"tool_call",toolCall:{...Q.toolCall,rawOutput:{output:E.content||E.output||""}}}}}}d();let c=null;for(const j of t){if(j.type!=="task_state")continue;const _=j.payload||{};Array.isArray(_.tasks)&&(c=_.tasks)}if(c&&c.length>0){const j=vs(c);j.length>0&&n.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:j})}this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries(n);let u=null,p=null,h=null,g=0,b=0;for(const j of t){const _=j.payload||{};if(typeof j.createdAt=="number"&&(j.createdAt>b&&(b=j.createdAt),j.type==="user"&&h!=="user"&&j.createdAt>0&&(g=j.createdAt)),j.type==="user"?h="user":(j.type==="result"||j.type==="result_success"||j.type==="interrupt")&&(h="turn_end"),j.type==="system"&&(_.subtype==="init"||((m=_.raw)==null?void 0:m.subtype)==="init")&&(p=bs(_)),j.type==="models_state"){const O=_.raw,E=O&&typeof O=="object"?O.models_state:_.models_state;E&&Array.isArray(E.availableModels)&&typeof E.currentModelId=="string"&&(u=E)}}let S=!1,C=At();for(const j of t){if(j.type!=="system")continue;const _=ys(j.payload||{});_&&(C=ps(C,_),S=!0)}S&&(this.subagentState=C,(y=this.onSubagentUpdate)==null||y.call(this,this.subagentState)),u&&((v=this.onModelsStateChange)==null||v.call(this,u)),p&&((w=this.onWorkerInfoChange)==null||w.call(this,p)),this.turnEnded=h==="turn_end",this.userSinceTurnEnd=h==="user",this.setTurnStartedAt(!this.closed&&h==="user"&&g>0&&b>=g?Date.now()-(b-g):null),this.turnEnded&&!this.closed&&((R=this.onStatusChange)==null||R.call(this,"idle"))}connectSSE(){xe.connect(this.sessionId),this.unsub=xe.onEvent(t=>this.handleEvent(t)),this.unsubState=xe.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),xe.disconnect()}handleEvent(t){var a,d,c,u,p,h,g,b,S,C,T;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 y=Et(n);y&&this.setEntries(v=>[...v,{type:"user_message",id:t.id||`user-${Date.now()}`,content:y}])}break}case"assistant":{const m=n.uuid;if(typeof m=="string"&&m){if(this.seenUuids.has(m))break;this.seenUuids.add(m)}const y=typeof n.content=="string"?n.content:"";if(rs(y))break;const v=ws(n);this.setEntries(R=>{const j=R[R.length-1];if((j==null?void 0:j.type)==="assistant_message"&&j.id.startsWith(Mt))return[...R.slice(0,-1),{...j,id:`assistant-${Date.now()}`,chunks:[...v?[{type:"thought",text:v}]:[],{type:"message",text:y}]}];if((j==null?void 0:j.type)==="assistant_message"){const _=j.chunks[j.chunks.length-1];return(_==null?void 0:_.type)==="message"?[...R.slice(0,-1),{...j,chunks:[...j.chunks.slice(0,-1),{type:"message",text:_.text+y}]}]:[...R.slice(0,-1),{...j,chunks:[...j.chunks,{type:"message",text:y}]}]}if(y&&y.trim()||v){const _={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...v?[{type:"thought",text:v}]:[],...y?[{type:"message",text:y}]:[]]};return[...R,_]}return R});const w=n.message;if(w&&typeof w=="object"&&Array.isArray(w.content)){const R=w.content.filter(j=>j.type==="tool_use");for(const j of R){const _=j.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(_))continue;this.seenToolCallIds.add(_),this.pendingToolCallIds.add(_);const O={id:_,title:j.name||"tool",status:"running",rawInput:j.input||{}};this.setEntries(E=>[...E,{type:"tool_call",toolCall:O}])}}break}case"tool_use":{const m=n,y=m.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(y))break;this.seenToolCallIds.add(y),this.pendingToolCallIds.add(y);const v={id:y,title:m.tool_name||"tool",status:"running",rawInput:m.tool_input||{}};this.setEntries(w=>[...w,{type:"tool_call",toolCall:v}]);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 y=n.request_id||"",v=m.tool_name||"unknown",w=m.input||m.tool_input||{},R=m.description||"",j=Array.isArray(m.permission_suggestions)?m.permission_suggestions:[];this.setEntries(_=>{const O=[..._].reverse().findIndex(E=>E.type==="tool_call");if(O>=0){const E=_.length-1-O,q=_[E];if(q.toolCall.status==="running")return this.pendingPermissionToolIds.set(y,q.toolCall.id),_.map((Q,N)=>N===E?{type:"tool_call",toolCall:{...q.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:y,options:[]}}}:Q)}return _}),(d=this.onPermissionRequest)==null||d.call(this,{requestId:y,toolName:v,toolInput:w,description:R,suggestions:j})}else m&&m.subtype==="elicitation"&&((c=this.onElicitationRequest)==null||c.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=ks(n);m&&(this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries(y=>{const v=y.findIndex(w=>as(w)===m);return v===-1?y:y.slice(0,v)}));break}case"session_status":{if(_n(n)){this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries([]);break}if(typeof n.status=="string"){if(xt(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");(p=this.onError)==null||p.call(this,m);break}case"models_state":{const m=n.raw,y=typeof m=="object"&&m!==null?m.models_state:n.models_state;y&&Array.isArray(y.availableModels)&&typeof y.currentModelId=="string"&&((h=this.onModelsStateChange)==null||h.call(this,y));break}case"system":{const m=n.raw,y=m&&typeof m=="object"?m:n,v=typeof y.subtype=="string"?y.subtype:void 0,w=ys(n);w&&(this.subagentState=ps(this.subagentState,w),(g=this.onSubagentUpdate)==null||g.call(this,this.subagentState));const R=typeof y.permissionMode=="string"?y.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;if(R&&((b=this.onPermissionModeChange)==null||b.call(this,R)),v==="init"){const j=bs(n);j&&((S=this.onWorkerInfoChange)==null||S.call(this,j))}break}case"control_response":{const m=n.response;if(m&&typeof m=="object"){const y=typeof m.request_id=="string"?m.request_id:"",v=typeof m.subtype=="string"?m.subtype:"";if(y){(C=this.onControlResponse)==null||C.call(this,{subtype:v,requestId:y,error:typeof m.error=="string"?m.error:void 0});const w=this.pendingControlRequests.get(y);w&&(this.pendingControlRequests.delete(y),w({data:v==="success"&&m.response&&typeof m.response=="object"?m.response:null,...v==="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 y=m.delta;if(!y||typeof y.type!="string")break;const v=y.type==="text_delta"?"message":y.type==="thinking_delta"?"thought":null;if(!v)break;const w=y.text??y.thinking;if(typeof w!="string"||!w)break;this.appendStreamingDelta(v,w)}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||(T=this.onStatusChange)==null||T.call(this,"idle");const m=typeof n.subtype=="string"?n.subtype:"",y=n.raw&&typeof n.raw=="object"?n.raw:void 0,w=(typeof n.result=="string"?n.result:typeof(y==null?void 0:y.result)=="string"?y.result:"").trim();m.startsWith("error_")&&w&&this.setEntries(R=>[...R,{type:"command_output",id:`exit-error-${typeof n.uuid=="string"?n.uuid:Date.now()}`,commandName:"worker",inputText:"",title:i("adapter.workerCrashed"),outputText:w,variant:"error"}]);break}case"task_state":{const m=Array.isArray(n.tasks)?n.tasks:[];if(m.length===0)break;const y=vs(m);if(y.length===0)break;this.setEntries(v=>[...v.filter(R=>R.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:y}]);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=js(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((c,u)=>u===a?{type:"tool_call",toolCall:{...d.toolCall,status:"complete",permissionRequest:void 0,rawOutput:{output:s||""}}}:c)}))}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(Mt)){const c=a.chunks[a.chunks.length-1];return(c==null?void 0:c.type)===t?[...n.slice(0,-1),{...a,chunks:[...a.chunks.slice(0,-1),{type:t,text:c.text+s}]}]:[...n.slice(0,-1),{...a,chunks:[...a.chunks,{type:t,text:s}]}]}const d={type:"assistant_message",id:`${Mt}${Date.now()}`,chunks:[{type:t,text:s}]};return[...n,d]})}async sendMessage(t,s,n){var h;const a=s&&s.length>0,d=n&&n.length>0;if(!t.trim()&&!a&&!d)return;const c={type:"user_message",id:`user-${Date.now()}`,content:t,images:a?s:void 0,attachments:d?n:void 0};this.setEntries(g=>[...g,c]);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 b=`📎 ${g.name}${g.size!=null?` (${sa(g.size)})`:""}`,S=g.textContent||i("attach.emptyFile");u.push({type:"text",text:`${b}
72
+ \`\`\`
73
+ ${S}
74
+ \`\`\``})}else if(g.kind==="directory"){const b=g.files!=null?`${B("attach.directoryHeader",{name:g.name})} ${B("attach.fileCount",{n:g.files.length})}`:B("attach.directoryHeader",{name:g.name}),S=g.textContent||i("attach.emptyDirectory");u.push({type:"text",text:`${b}
75
+ ${S}`})}}const p=u.length===1&&u[0].type==="text"?u[0].text||t:u.length>0?u:t;try{const g=Se();this.postedUserUuids.add(g);const b=await Cn(this.sessionId,{type:"user",uuid:g,content:t,message:{content:p}}),S=(h=b==null?void 0:b.event)==null?void 0:h.id;S&&this.setEntries(C=>C.map(T=>T.type==="user_message"&&T.id===c.id?{...T,id:S}:T))}catch(g){throw this.setEntries(b=>b.filter(S=>!(S.type==="user_message"&&S.id===c.id))),g}}async respondPermission(t,s,n){await ee(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(c=>{var u;return c.type!=="tool_call"||((u=c.toolCall.permissionRequest)==null?void 0:u.requestId)!==t?c:{type:"tool_call",toolCall:{...c.toolCall,status:s?"running":"rejected",permissionRequest:void 0}}}))}async interrupt(){this.finalizePendingToolCalls("canceled"),await Tn(this.sessionId)}async setPermissionMode(t){const s=Se();return await ee(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_permission_mode",mode:t}}),s}async controlRoundTrip(t,s=8e3){const n=Se(),a=new Promise(c=>{this.pendingControlRequests.set(n,c)}),d=setTimeout(()=>{const c=this.pendingControlRequests.get(n);c&&(this.pendingControlRequests.delete(n),c({data:null,error:"timeout"}))},s);try{return await ee(this.sessionId,{type:"control_request",request_id:n,request:t}),await a}catch(c){throw this.pendingControlRequests.delete(n),c}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 ee(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=Se();return await ee(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_effort",...t?{effort:t}:{effort:null}}}),s}async setTokenMode(t){const s=Se();return await ee(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_token_mode",mode:t}}),s}async setThinkingBudget(t){const s=Se();return await ee(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,c=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}:{},...c&&c.length>0?{categories:c}:{}}}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"?i("adapter.stopTimeout"):s.error}:{ok:!0}}catch{return{ok:!1,error:i("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 c=d;if(typeof c.name!="string"||!c.name)continue;const u=c.status;if(u!=="connected"&&u!=="failed"&&u!=="needs-auth"&&u!=="pending"&&u!=="disabled")continue;const p=c.serverInfo,h=c.config;n.push({name:c.name,status:u,...p&&typeof p.name=="string"&&typeof p.version=="string"?{serverInfo:{name:p.name,version:p.version}}:{},...typeof c.error=="string"&&c.error?{error:c.error}:{},...typeof(h==null?void 0:h.url)=="string"&&h.url?{url:h.url}:{},...Array.isArray(c.tools)?{toolCount:c.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"?i("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"?i("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,c=[];if(Array.isArray(d))for(const u of d){if(!u||typeof u!="object")continue;const p=u;typeof p.source=="string"&&c.push({source:p.source,settings:p.settings&&typeof p.settings=="object"&&!Array.isArray(p.settings)?p.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,tokenMode:typeof(n==null?void 0:n.tokenMode)=="string"?n.tokenMode:null},effective:a,sources:c}}async applyFlagSettings(t){const s=await this.controlRoundTrip({subtype:"apply_flag_settings",settings:t},15e3);return s.error?{ok:!1,error:s.error==="timeout"?i("adapter.requestTimeout"):s.error}:{ok:!0}}async rewindToMessage(t){await En(this.sessionId,t)}async endSession(t){await ee(this.sessionId,{type:"control_request",request_id:Se(),request:{subtype:"end_session",...t?{reason:t}:{}}})}}function sa(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function dt({onBack:r,title:t,meta:s,actions:n}){return se(),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":i("nav.dashboard"),title:i("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:i("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-0.5 h-4 w-px flex-shrink-0 bg-border","aria-hidden":"true"}),e.jsx(Rn,{className:"h-7 w-7"}),e.jsx(An,{compact:!0,onSettingsClick:()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))}})]})})}const Ns="rcs:subagent-panel:collapsed";function na(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 ra(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 aa({status:r}){return r==="running"?e.jsx(Ve,{className:"h-3 w-3 animate-spin text-brand-text"}):r==="completed"?e.jsx(Br,{className:"h-3 w-3 text-status-success"}):r==="failed"||r==="stopped"?e.jsx(In,{className:"h-3 w-3 text-status-error"}):null}function Gs({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=ra(r.tokenCount),c=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(aa,{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:na(a)})]}),e.jsx("div",{className:`mt-0.5 text-text-secondary ${s?"line-clamp-2 break-words":"truncate"}`,children:u}),(d||c||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"]}),c&&e.jsxs("span",{className:"flex-shrink-0",children:["· ",c]}),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:i("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(Fs,{className:"h-3.5 w-3.5"})})]})}function oa({state:r,onStopTask:t}){const[s,n]=l.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ns)==="1"}catch{return!1}}),a=()=>{n(b=>{const S=!b;try{window.localStorage.setItem(Ns,S?"1":"0")}catch{}return S})},d=Object.values(r.tasks).some(b=>b.status==="running"),c=Object.values(r.tasks).some(b=>b.status!=="running"&&b.evictAfter!==void 0),[,u]=l.useState(0);l.useEffect(()=>{if(!d&&!c)return;const b=setInterval(()=>{u(S=>S+1)},1e3);return()=>clearInterval(b)},[d,c]);const p=zs(r);if(p.length===0)return null;const h=p.filter(b=>b.status==="running").length,g=h>0?`${h} running`:`${p.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(Hs,{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:p.map(b=>e.jsx(Gs,{task:b,onStopTask:t},b.taskId))})]})})}function ia(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 la(r){return r?Date.now()-r<6e4:!1}function ca({onClose:r,session:t,liveStatus:s,pendingPermissions:n,onInterrupt:a,onDelete:d,subagentState:c,onStopTask:u,onEndSession:p}){const[h,g]=l.useState(!1),b=async()=>{await navigator.clipboard.writeText(t.id),g(!0),setTimeout(()=>g(!1),1500)},[S,C]=l.useState(!1),T=async()=>{if(!(!p||S)&&window.confirm(i("task.endConfirm"))){C(!0);try{await p(),r()}catch{C(!1)}}},m=n.length,y=t.worker,v=t.work_item,w=t.environment;return e.jsx(_e,{open:!0,onOpenChange:R=>{R||r()},children:e.jsxs(Ce,{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(Pe,{children:e.jsx(Te,{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(hr,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($n,{status:s||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:y&&(la(y.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[y&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(os,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:ia(y.last_heartbeat_at)})]}),(t.environment_id||w)&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Qs,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:(w==null?void 0:w.machine_name)||t.environment_id||(w==null?void 0: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(os,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Dn(t.created_at)})]})]})]}),e.jsx(ma,{state:c,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(Ve,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),m>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[m," permission request",m>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(Wr,{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"}),p&&e.jsx("button",{onClick:T,disabled:S,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:i("task.endHint"),children:S?"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(Ks,{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(qr,{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:b,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:h?"✓":"⧉"})]})]}),v&&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:v.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:v.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})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Bs(t.source==="acp"?"acp":w==null?void 0:w.worker_type).fullLabel})]})]})]})]})]})})}const da={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"},ua=new Set(["dream"]);function ma({state:r,onStopTask:t}){const s=Object.values(r.tasks).some(p=>p.status==="running"),n=Object.values(r.tasks).some(p=>p.status!=="running"&&p.evictAfter!==void 0),[,a]=l.useState(0);l.useEffect(()=>{if(!s&&!n)return;const p=setInterval(()=>{a(h=>h+1)},1e3);return()=>clearInterval(p)},[s,n]);const d=zs(r),c=d.filter(p=>p.status==="running").length,u=d.length-c;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(Or,{className:"h-3.5 w-3.5"}),i("task.backgroundTasks")]}),d.length>0&&e.jsx("span",{className:"font-mono text-[10px] text-text-muted",children:c>0&&u>0?B("task.mixedCount",{running:c,recent:u}):c>0?B("task.runningCount",{count:c}):B("task.recentCount",{count:d.length})})]}),d.length===0?e.jsx("p",{className:"text-xs text-text-muted",children:i("task.noBackgroundTasks")}):e.jsx("div",{className:"max-h-[38vh] space-y-2 overflow-y-auto overscroll-contain pr-1",children:Xr(d).map(p=>{const h=!ua.has(p.taskType),g=da[p.taskType]??"task.type.tasks";return e.jsxs("div",{className:"space-y-1",children:[h&&e.jsxs("div",{className:"pl-1 text-[10px] font-medium uppercase tracking-wide text-text-muted/80",children:[i(g)," (",p.tasks.length,")"]}),p.tasks.map(b=>e.jsx(Gs,{task:b,onStopTask:t,fullText:!0},b.taskId))]},p.taskType)})})]})}const xa={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"},pa={connected:"mcp.status.connected",failed:"mcp.status.failed","needs-auth":"mcp.status.needsAuth",pending:"mcp.status.pending",disabled:"mcp.status.disabled"};function fa({onClose:r,fetchServers:t,onToggle:s,onReconnect:n}){se();const[a,d]=l.useState(null),[c,u]=l.useState(null),[p,h]=l.useState(null),[g,b]=l.useState(null),S=l.useCallback(async()=>{h(null),b(null);try{const m=await t();d(m),u(null)}catch(m){pt("[McpPanel] fetch failed",m),u(i("mcp.loadFailed"))}},[t]);l.useEffect(()=>{S()},[S]);const C=async m=>{const y=m.status==="disabled";h(`toggle:${m.name}`),b(null);try{const v=await s(m.name,y);v.ok||b(v.error||i("mcp.toggleFailed"))}finally{await S()}},T=async m=>{h(`reconnect:${m.name}`),b(null);try{const y=await n(m.name);y.ok||b(y.error||i("mcp.reconnectFailed"))}finally{await S()}};return e.jsx(_e,{open:!0,onOpenChange:m=>{m||r()},children:e.jsxs(Ce,{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(Pe,{children:e.jsxs(Te,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Vs,{className:"h-4 w-4"}),i("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&&!c&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),i("mcp.loading")]}),c&&e.jsx("p",{className:"text-xs text-status-error",children:c}),a!==null&&a.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:i("mcp.empty")}),a==null?void 0:a.map(m=>{const y=p===`toggle:${m.name}`,v=p===`reconnect:${m.name}`,w=m.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:m.name}),e.jsx("span",{className:`flex-shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium ${xa[m.status]}`,children:i(pa[m.status])})]}),e.jsxs("div",{className:"mt-0.5 truncate text-xs text-text-muted",children:[m.serverInfo?`${m.serverInfo.name} v${m.serverInfo.version}`:m.url||"stdio",m.toolCount!==void 0&&` · ${B("mcp.toolCount",{n:m.toolCount})}`]}),m.error&&e.jsx("div",{className:"mt-1 truncate text-xs text-status-error",title:m.error,children:m.error})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void T(m),disabled:v||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:i("mcp.reconnect"),children:e.jsx(gr,{className:`h-3.5 w-3.5 ${v?"animate-spin":""}`})}),e.jsx("button",{type:"button",role:"switch","aria-checked":!w,onClick:()=>void C(m),disabled:y,className:`relative h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${w?"bg-surface-3":"bg-brand"}`,title:w?i("mcp.enable"):i("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"}`})})]})]})},m.name)})]})]})})}const Js=[{key:"autoMemoryEnabled",labelKey:"settings.autoMemory",defaultValue:!0},{key:"teamMemoryEnabled",labelKey:"settings.teamMemory",defaultValue:!1}],ha=new Set(Js.map(r=>r.key));function ya(r){if(r==null)return i("settings.unset");if(typeof r=="string")return r;try{return JSON.stringify(r)}catch{return String(r)}}function Ss(r){if(r==null)return i("settings.unset");if(typeof r=="object")try{return JSON.stringify(r,null,2)}catch{return String(r)}return String(r)}function ga({onClose:r,fetchSettings:t,onApply:s}){se();const[n,a]=l.useState(null),[d,c]=l.useState(null),[u,p]=l.useState(""),[h,g]=l.useState(null),[b,S]=l.useState(null),[C,T]=l.useState(null),[m,y]=l.useState(!1),v=l.useCallback(async()=>{g(null),S(null),T(null),y(!1);try{const N=await t();a(N),c(N?null:i("settings.loadFailed"))}catch(N){pt("[SettingsDrawer] fetch failed",N),c(i("settings.loadFailed"))}},[t]);l.useEffect(()=>{v()},[v]);const w=l.useMemo(()=>n?Object.entries(n.effective).filter(([,N])=>N!==void 0).filter(([N])=>!N.startsWith("memoryV2")).sort(([N],[F])=>N.localeCompare(F)):[],[n]),R=l.useMemo(()=>{const N=u.trim().toLowerCase();return N?w.filter(([F,I])=>`${F} ${ya(I)}`.toLowerCase().includes(N)):w},[w,u]),j=N=>typeof N[1]=="boolean",_=l.useMemo(()=>R.filter(j).filter(([N])=>!ha.has(N)),[R]),O=l.useMemo(()=>R.filter(N=>!j(N)),[R]),E=l.useMemo(()=>C===null?null:w.find(([N])=>N===C)??null,[w,C]),q=async()=>{if(E)try{await navigator.clipboard.writeText(Ss(E[1])),y(!0),window.setTimeout(()=>y(!1),1500)}catch(N){pt("[SettingsDrawer] copy failed",N)}},Q=async(N,F)=>{g(N),S(null);try{const I=await s({[N]:!F});I.ok||S(I.error||i("settings.writeFailed"))}finally{await v()}};return e.jsx(_e,{open:!0,onOpenChange:N=>{N||r()},children:e.jsxs(Ce,{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(Pe,{children:e.jsxs(Te,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Ys,{className:"h-4 w-4"}),i("session.settings.title")]})}),e.jsxs("div",{className:"mt-3 space-y-4 text-sm",children:[b&&e.jsx("div",{className:"rounded-md bg-status-error/10 px-3 py-2 text-xs text-status-error",children:b}),n===null&&!d&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),i("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:i("settings.model")}),e.jsx("code",{className:"font-mono text-text-secondary",children:n.applied.model||i("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:i("settings.hint")})]}),E?e.jsxs("section",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>{T(null),y(!1)},className:"flex items-center gap-1.5 text-xs text-text-muted transition-colors hover:text-text-primary",children:[e.jsx(br,{className:"h-3.5 w-3.5"}),i("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:Ss(E[1])}),e.jsxs("button",{type:"button",onClick:()=>void q(),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:[m?e.jsx(qe,{className:"h-3.5 w-3.5 text-status-success"}):e.jsx(wr,{className:"h-3.5 w-3.5"}),m?i("settings.copied"):i("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(ft,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{value:u,onChange:N=>p(N.target.value),placeholder:i("settings.searchPlaceholder"),className:"w-full bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"})]}),R.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:i("settings.noMatch")}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-[10px] font-medium uppercase tracking-wide text-text-muted",children:i("settings.memorySection")}),Js.map(N=>{const F=n.effective[N.key],I=typeof F=="boolean"?F:N.defaultValue,z=h===N.key;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 text-xs text-text-primary",children:i(N.labelKey)}),e.jsx("button",{type:"button",role:"switch","aria-checked":I,disabled:z,onClick:()=>void Q(N.key,I),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${I?"bg-brand":"bg-surface-3"}`,title:I?i("settings.turnOff"):i("settings.turnOn"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${I?"left-4.5":"left-0.5"}`})})]},N.key)}),e.jsx("p",{className:"text-[10px] leading-relaxed text-text-muted",children:i("settings.memoryHint")})]}),_.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:B("settings.togglable",{n:_.length})}),_.map(([N,F])=>{const I=h===N;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:N}),e.jsx("button",{type:"button",role:"switch","aria-checked":F,disabled:I,onClick:()=>void Q(N,F),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${F?"bg-brand":"bg-surface-3"}`,title:F?i("settings.turnOff"):i("settings.turnOn"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${F?"left-4.5":"left-0.5"}`})})]},N)})]}),O.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:B("settings.readOnly",{n:O.length})}),O.map(([N])=>e.jsxs("button",{type:"button",onClick:()=>T(N),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:i("settings.viewDetail"),children:[e.jsx("span",{className:"truncate font-mono text-xs text-text-primary",children:N}),e.jsx(Hs,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"})]},N))]})]})]})]})]})})}function ba({onClose:r,onAsk:t}){se();const[s,n]=l.useState([]),[a,d]=l.useState(""),[c,u]=l.useState(!1),p=async()=>{const h=a.trim();if(!h||c)return;const g=Date.now();n(b=>[...b,{id:g,question:h,answer:null}]),d(""),u(!0);try{const b=await t(h);n(S=>S.map(C=>C.id===g?{...C,answer:b??i("sideQuestion.noAnswer"),error:b===null}:C))}finally{u(!1)}};return e.jsx(_e,{open:!0,onOpenChange:h=>{h||r()},children:e.jsxs(Ce,{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(Pe,{children:e.jsxs(Te,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Ws,{className:"h-4 w-4"}),i("sideQuestion.title")]})}),e.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-text-muted",children:i("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:i("sideQuestion.empty")}),s.map(h=>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:h.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:h.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:h.error?"text-status-error":"",children:e.jsx(qn,{children:h.answer})})})]})]},h.id))]}),e.jsxs("div",{className:"mt-3 flex items-end gap-2",children:[e.jsx("textarea",{value:a,onChange:h=>d(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&!h.nativeEvent.isComposing&&(h.preventDefault(),p())},rows:Math.min(4,Math.max(1,a.split(`
76
+ `).length)),placeholder:i("sideQuestion.placeholder"),disabled:c,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 p(),disabled:c||!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:i("sideQuestion.send"),children:c?e.jsx(Ve,{className:"h-4 w-4 animate-spin"}):e.jsx(Pn,{className:"h-4 w-4"})})]})]})})}const Rt="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1";function _s(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 ja({requestId:r,toolName:t,toolInput:s,description:n,suggestions:a,onApprove:d,onApproveAlways:c,onReject:u}){se();const p=s&&typeof s=="object"&&!Array.isArray(s)?s:{},h=On(Fn(t),p,{writeUnknownLabel:i("permission.writeUnknown")}),g=typeof s=="string"?s:JSON.stringify(s,null,2),b=Array.isArray(a)&&a.length>0;return e.jsxs("div",{role:"group","aria-label":B("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(Kn,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-semibold font-display text-approve-text",children:i("permission.title")})]}),n&&e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:te(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:te(t)}),t!=="AskUserQuestion"&&(h?e.jsx("div",{className:"mb-3 space-y-2",children:h.map((S,C)=>e.jsx(Un,{filePath:S.filePath,oldString:S.oldString,newString:S.newString,label:S.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:is(g,500)})),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:d,className:pe("rounded-lg bg-approve px-4 py-2 text-sm font-medium font-display text-white hover:bg-approve-hover transition-colors",Rt),children:i("permission.approve")}),b&&c&&e.jsxs("button",{onClick:c,className:pe("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",Rt),title:i("permission.alwaysAllowHint").replace("{rule}",_s(t,a)),children:[e.jsx(Jr,{className:"h-3.5 w-3.5"}),i("permission.alwaysAllow")," ",is(_s(t,a),40)]}),e.jsx("button",{onClick:u,className:pe("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",Rt),children:i("permission.reject")})]})]})}function wa({questions:r,description:t,onSubmit:s,onSkip:n}){const[a,d]=l.useState({}),[c,u]=l.useState({}),[p,h]=l.useState(0),g=(T,m,y)=>{if(y){const v=a[T]||[],w=v.includes(m)?v.filter(R=>R!==m):[...v,m];d({...a,[T]:w})}else d({...a,[T]:m})},b=T=>{var y;const m=(y=c[T])==null?void 0:y.trim();m&&(d({...a,[T]:m}),u({...c,[T]:""}))},S=()=>{var m,y;const T={};for(const[v,w]of Object.entries(a)){const R=r[parseInt(v,10)];R&&(typeof w=="number"?T[v]=((y=(m=R.options)==null?void 0:m[w])==null?void 0:y.label)||String(w):Array.isArray(w)?T[v]=w.map(j=>{var _,O;return((O=(_=R.options)==null?void 0:_[j])==null?void 0:O.label)||String(j)}):T[v]=w)}s(T)};if(r.length<=1){const T=r[0]||{question:t,options:[],multiSelect:!1},m=T.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:te(t||T.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(T.options||[]).map((y,v)=>{const w=m?(a[0]||[]).includes(v):a[0]===v;return e.jsxs("button",{onClick:()=>g(0,v,m),className:pe("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:te(y.label)}),y.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:te(y.description)})]},v)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:c[0]||"",onChange:y=>u({...c,0:y.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:y=>y.key==="Enter"&&b(0)}),e.jsx("button",{onClick:()=>b(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:S,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[p];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:te(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:r.map((T,m)=>e.jsx("button",{onClick:()=>h(m),className:pe("rounded-md px-3 py-1.5 text-xs font-display whitespace-nowrap transition-colors",p===m?"bg-brand/20 text-brand-text":"text-text-muted hover:bg-surface-2"),children:T.header||`Q${m+1}`},m))}),C&&e.jsx(va,{question:C,qIdx:p,answers:a,otherTexts:c,onSelect:g,onOtherTextChange:(T,m)=>u({...c,[T]:m}),onOtherSubmit:b}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-display text-text-muted",children:[p+1," / ",r.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:S,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 va({question:r,qIdx:t,answers:s,otherTexts:n,onSelect:a,onOtherTextChange:d,onOtherSubmit:c}){const u=r.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:te(r.question)}),e.jsxs("div",{className:"space-y-2",children:[(r.options||[]).map((p,h)=>{const g=u?(s[t]||[]).includes(h):s[t]===h;return e.jsxs("button",{onClick:()=>a(t,h,u),className:pe("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:te(p.label)}),p.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:te(p.description)})]},h)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:p=>d(t,p.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:p=>p.key==="Enter"&&c(t)}),e.jsx("button",{onClick:()=>c(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 ka({planContent:r,description:t,onSubmit:s}){const[n,a]=l.useState(null),[d,c]=l.useState(""),u=!r||!r.trim(),p=()=>{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(qe,{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:Na(r)}}),e.jsx("div",{className:"space-y-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(We,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes"}),e.jsx(We,{selected:n==="no",onClick:()=>a("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(We,{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(We,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(We,{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:h=>c(h.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:p,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 We({selected:r,onClick:t,label:s,desc:n}){return e.jsxs("button",{onClick:t,className:pe("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:pe("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 Na(r){let t=te(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 Sa({request:r,onSubmit:t}){se();const s=_a(r.requestedSchema),n=Ca(r.requestedSchema),[a,d]=l.useState({}),c=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(Cs,{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(vr,{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:i("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:i("common.cancel")})]})]}):e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx(Cs,{serverName:r.serverName,message:r.message}),s.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:s.map(({name:u,prop:p})=>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:i("elicitation.required")})]}),p.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:te(p.description)}),e.jsx("input",{type:p.type==="number"?"number":"text",value:a[u]??"",onChange:h=>d(g=>({...g,[u]:h.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:p,prop:h}of s){const g=(a[p]??"").trim();g&&(u[p]=h.type==="number"?Number(g):g)}t("accept",u)},disabled:!c,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:i("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:i("elicitation.decline")})]})]})}function Cs({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(Ur,{className:"h-3 w-3"})}),e.jsxs("span",{className:"text-sm font-semibold text-text-primary",children:[i("elicitation.title")," ",e.jsx("span",{className:"font-mono text-xs text-text-muted",children:te(r)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:te(t)})]})}function _a(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 Ca(r){const t=r==null?void 0:r.required;return Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function Ta(r){const[t,s]=l.useState([]),[n,a]=l.useState(!0),[d,c]=l.useState(null),u=l.useCallback(async()=>{a(!0),c(null);try{const g=await Ln(r);s(g)}catch(g){c(g instanceof Error?g.message:"Failed to load shares")}finally{a(!1)}},[r]);l.useEffect(()=>{u()},[u]);const p=l.useCallback(async g=>{c(null);try{const b=await Bn(r,g);return await u(),b}catch(b){throw c(b instanceof Error?b.message:"Failed to create share"),b}},[r,u]),h=l.useCallback(async g=>{c(null);try{await Hn(r,g),await u()}catch(b){throw c(b instanceof Error?b.message:"Failed to revoke share"),b}},[r,u]);return{shares:t,isLoading:n,error:d,createShare:p,revokeShare:h,refresh:u}}function Ea({open:r,onClose:t,sessionId:s,sessionTitle:n}){se();const{shares:a,isLoading:d,error:c,createShare:u,revokeShare:p}=Ta(s),[h,g]=l.useState("user"),[b,S]=l.useState(""),[C,T]=l.useState(""),[m,y]=l.useState("read"),[v,w]=l.useState(""),[R,j]=l.useState(!1),[_,O]=l.useState(null),[E,q]=l.useState(""),[Q,N]=l.useState(!1),[F,I]=l.useState(!1);l.useEffect(()=>{r&&(g("user"),S(""),T(""),y("read"),w(""),j(!1),O(null),q(""),N(!1),I(!1))},[r]);const z=async()=>{j(!0),q(""),O(null);try{const D={grantedTo:h==="user"?{userId:b.trim()}:{teamId:C.trim()},permission:m};v.trim()&&(D.expiresAt=v.trim());const ae=await u(D);O(`${window.location.origin}/code/s/${ae.shareToken}`)}catch(D){q(D instanceof Error?D.message:"Failed to create share")}finally{j(!1)}},le=async D=>{try{await p(D)}catch{}},re=async()=>{if(!_)return;I(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(_),N(!0),setTimeout(()=>N(!1),2e3);return}}catch{}const D=document.createElement("textarea");D.value=_,D.style.position="fixed",D.style.opacity="0",document.body.appendChild(D),D.select();try{document.execCommand("copy"),N(!0),setTimeout(()=>N(!1),2e3)}catch{I(!0)}document.body.removeChild(D)};return e.jsx(_e,{open:r,onOpenChange:D=>{D||t()},children:e.jsxs(Ce,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Pe,{children:e.jsxs(Te,{className:"font-display text-lg font-semibold text-text-primary",children:[i("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:i("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 ${h==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:i("share.user")}),e.jsx("button",{onClick:()=>g("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${h==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:i("share.team")})]}),h==="user"?e.jsx(jr,{onSelect:S,placeholder:i("share.userIdPlaceholder"),actionLabel:i("share.selectUser")}):e.jsx("input",{type:"text",value:C,onChange:D=>T(D.target.value),placeholder:i("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"}),h==="user"&&b&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[i("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:b})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:i("share.permission")}),e.jsxs("select",{value:m,onChange:D=>y(D.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:i("share.permissionRead")}),e.jsx("option",{value:"write",children:i("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:i("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:v,onChange:D=>w(D.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||c)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:E||c}),_&&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:i("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:_}),e.jsx("button",{onClick:re,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:Q?i("share.copied"):i("share.copy")})]}),F&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:i("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:i("share.existingShares")}),d?e.jsx("p",{className:"text-sm text-text-muted",children:i("share.loading")}):a.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:i("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:a.map(D=>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:D.granted_to_user||D.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[D.permission==="write"?i("share.permissionWrite"):i("share.permissionRead"),D.expires_at?` · expires ${D.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>le(D.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:i("share.revoke")})]},D.id))})]})]}),e.jsxs(yr,{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:i("common.close")}),e.jsx("button",{onClick:z,disabled:R||(h==="user"?!b.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:R?i("common.creating"):i("share.createShare")})]})]})})}function Ma(r){const t=new Date,s=new Date(t.getTime()-1440*60*1e3),n=(c,u)=>c.getFullYear()===u.getFullYear()&&c.getMonth()===u.getMonth()&&c.getDate()===u.getDate(),a={today:[],yesterday:[],earlier:[]};for(const c of r){const u=new Date(c.modified||0);n(u,t)?a.today.push(c):n(u,s)?a.yesterday.push(c):a.earlier.push(c)}return[["today",i("resume.today")],["yesterday",i("resume.yesterday")],["earlier",i("resume.earlier")]].map(([c,u])=>({label:u,items:a[c]})).filter(c=>c.items.length>0)}function Ra(r){return r?new Date(r).toLocaleString():""}function Aa({open:r,onClose:t,adapter:s,onResume:n}){const a=se(),[d,c]=l.useState([]),[u,p]=l.useState(!1),[h,g]=l.useState("");l.useEffect(()=>{if(!r)return;let S=!1;return p(!0),g(""),c([]),s.listResumableSessions().then(C=>{S||c(C)}).catch(C=>{S||g(C instanceof Error?C.message:String(C))}).finally(()=>{S||p(!1)}),()=>{S=!0}},[r,s]);const b=l.useMemo(()=>Ma(d),[d,a]);return e.jsx(_e,{open:r,onOpenChange:S=>{S||t()},children:e.jsxs(Ce,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Pe,{children:e.jsx(Te,{className:"font-display text-lg font-semibold text-text-primary",children:i("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:i("resume.loading")}),!u&&h&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:h}),!u&&!h&&d.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:i("resume.empty")}),!u&&!h&&b.map(S=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-text-muted",children:S.label}),e.jsx("div",{className:"space-y-1",children:S.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:[Ra(C.modified),C.gitBranch?` · ${C.gitBranch}`:""]})]},C.sessionId))})]},S.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:i("common.cancel")})})]})})}const Ts=["working","episodic","semantic","procedural"],Ia=["user","feedback","project","reference"];function $a(r){switch(r){case"user":return"bg-accent/15 text-accent";case"feedback":return"bg-status-warning/15 text-status-warning";case"project":return"bg-status-active/15 text-status-active";default:return"bg-surface-3 text-text-muted"}}function Da(r){try{return new Date(r).toLocaleDateString()}catch{return"—"}}function qa({refreshTick:r,recall:t,dreaming:s,onDreamTrigger:n}){se();const[a,d]=l.useState(null),[c,u]=l.useState("memories"),[p,h]=l.useState("personal"),[g,b]=l.useState([]),[S,C]=l.useState(!1),[T,m]=l.useState(""),[y,v]=l.useState(null),[w,R]=l.useState({}),[j,_]=l.useState(null),[O,E]=l.useState(""),[q,Q]=l.useState(""),[N,F]=l.useState(null),[I,z]=l.useState(null),[le,re]=l.useState(""),[D,ae]=l.useState(null),[fe,Ze]=l.useState(!1),he=l.useRef(null);l.useEffect(()=>{Us().then(d).catch(()=>d(null))},[]);const ne=l.useCallback(async()=>{C(!0),m("");try{b(await Qn(p))}catch{m(i("memorySidebar.loadFailed"))}finally{C(!1)}},[p]);l.useEffect(()=>{(a==null?void 0:a.mode)==="memdir"&&ne()},[a==null?void 0:a.mode,ne,r]),l.useEffect(()=>{c!=="governance"||(a==null?void 0:a.mode)!=="memdir"||Wn().then(z).catch(()=>z(null))},[c,a==null?void 0:a.mode,r]),l.useEffect(()=>{he.current&&clearTimeout(he.current);const f=q.trim();if(!f){F(null);return}return he.current=setTimeout(()=>{Vn(f).then(F).catch(()=>F([]))},300),()=>{he.current&&clearTimeout(he.current)}},[q]);const Z=async f=>{if(y===f){v(null);return}if(v(f),!w[f])try{const{content:K}=await cs(f);R(J=>({...J,[f]:K}))}catch{R(K=>({...K,[f]:i("memorySidebar.loadFailed")}))}},H=f=>y===f?e.jsx("pre",{className:"mt-1 max-h-48 overflow-y-auto whitespace-pre-wrap rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-secondary",children:w[f]??"…"}):null,ye=async f=>{if(w[f])E(w[f]);else try{const{content:K}=await cs(f);R(J=>({...J,[f]:K})),E(K)}catch{E("")}_(f)},ge=async()=>{if(j)try{await er(j,O),R(f=>({...f,[j]:O})),_(null)}catch{m(i("memorySidebar.updateFailed"))}},ce=async f=>{try{await Zn(f),b(K=>K.filter(J=>J.path!==f)),v(K=>K===f?null:K)}catch{m(i("memorySidebar.deleteFailed"))}},G=async f=>{try{await Xn(f),await ne()}catch(K){m(K instanceof Error?K.message:i("memorySidebar.promoteFailed"))}},[de,be]=l.useState(!1),[Oe,V]=l.useState(""),[et,je]=l.useState(""),[tt,st]=l.useState("project"),[Ee,Me]=l.useState(""),[Re,nt]=l.useState(!1),yt=()=>{be(!0),V(""),je(""),st("project"),Me("")},we=Oe.trim().length>0&&Ee.trim().length>0&&!Re,rt=async()=>{if(we){nt(!0),m("");try{await Jn({scope:p,name:Oe.trim(),description:et.trim()||void 0,type:tt,content:Ee}),be(!1),await ne()}catch(f){m(f instanceof Error?f.message:i("memorySidebar.createFailed"))}finally{nt(!1)}}},Ae=()=>{n==null||n()},ve=l.useCallback(async()=>{const f=le.trim();if(!(!f||fe)){Ze(!0),ae(null);try{ae(await Yn(f,5))}catch{ae([])}finally{Ze(!1)}}},[le,fe]),Ie=(a==null?void 0:a.teamEnabled)===!0,ke=a==null?void 0:a.automation,Fe=Ie&&c==="memories"&&!q;return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[e.jsx("button",{type:"button",onClick:()=>u("memories"),className:`rounded-md px-2 py-1 text-xs font-medium ${c==="memories"?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2"}`,children:i("memorySidebar.memoriesTab")}),e.jsx("button",{type:"button",onClick:()=>u("governance"),className:`rounded-md px-2 py-1 text-xs font-medium ${c==="governance"?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2"}`,children:i("memorySidebar.governanceTab")}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(a==null?void 0:a.mode)==="memdir"&&c==="memories"&&!q&&e.jsx("button",{type:"button",onClick:de?()=>be(!1):yt,disabled:p==="team"&&!Ie,className:"rounded p-1 text-text-secondary hover:bg-surface-2 hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-50",title:i("memorySidebar.new"),children:de?e.jsx(ls,{className:"h-3 w-3"}):e.jsx(zn,{className:"h-3 w-3"})}),e.jsx(ft,{className:"h-3 w-3 text-text-muted"}),e.jsx("input",{value:q,onChange:f=>Q(f.target.value),placeholder:i("memorySidebar.searchPlaceholder"),title:i("memorySidebar.searchHint"),className:"w-28 bg-transparent text-xs text-text-primary placeholder:text-text-muted focus:outline-none"})]})]}),T&&e.jsx("p",{className:"px-3 py-1 text-xs text-status-error",children:T}),ke&&ke.mode!=="normal"&&e.jsx("div",{className:"border-b border-status-warning/30 bg-status-warning/10 px-3 py-1.5 text-xs text-status-warning",children:ke.mode==="sa"?i("memorySidebar.saModeBanner"):i("memorySidebar.poorModeBanner")}),N!==null&&e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:N.length===0?e.jsx("p",{className:"py-8 text-center text-xs text-text-muted",children:i("memorySidebar.noResults")}):e.jsx("ul",{className:"space-y-1",children:N.map(f=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void Z(f.path),className:"w-full rounded-md px-2 py-1.5 text-left hover:bg-surface-2",children:[e.jsx("span",{className:"block truncate text-xs font-medium text-text-primary",children:f.name}),e.jsx("ul",{className:"mt-0.5 space-y-0.5",children:f.matches.map((K,J)=>e.jsxs("li",{className:"flex gap-1.5 text-[10px] leading-relaxed",children:[e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:K.line===0?"file":`L${K.line}`}),e.jsx("span",{className:"truncate text-text-secondary",children:K.text})]},J))})]}),H(f.path)]},f.path))})}),N===null&&c==="memories"&&e.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[t&&t.hits.length>0&&e.jsxs("div",{className:"mb-2 rounded-md border border-brand/30 bg-brand/5 p-2",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-brand-text",children:i("memorySidebar.recallTitle")}),e.jsxs("p",{className:"mb-1 truncate text-[10px] text-text-muted",title:t.query,children:[i("memorySidebar.recallQuery"),": ",t.query]}),e.jsx("ul",{className:"space-y-0.5",children:t.hits.slice(0,5).map(f=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void Z(f.path),className:"flex w-full items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-xs hover:bg-surface-2",title:f.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:f.path.replace(/^team\//,"").replace(/\.md$/,"")}),f.score!==void 0&&e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(f.score*100).toFixed(0),"%"]})]}),H(f.path)]},f.path))})]}),Fe&&e.jsx("div",{className:"mb-2 flex rounded-md bg-surface-2 p-0.5 text-xs",children:["personal","team"].map(f=>e.jsx("button",{type:"button",onClick:()=>h(f),className:`flex-1 rounded px-2 py-1 ${p===f?"bg-brand-light text-white":"text-text-muted"}`,children:f==="personal"?i("memorySidebar.personal"):i("memorySidebar.team")},f))}),p==="team"&&Ie&&!de&&e.jsx("p",{className:"mb-2 px-1 text-[10px] leading-relaxed text-text-muted",children:i("memorySidebar.teamHint")}),de&&e.jsxs("div",{className:"mb-2 space-y-1.5 rounded-md border border-border bg-surface-2 p-2",children:[e.jsx("input",{value:Oe,onChange:f=>V(f.target.value),placeholder:i("memorySidebar.create.namePlaceholder"),className:"w-full rounded bg-surface-3 px-2 py-1 text-xs text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsx("input",{value:et,onChange:f=>je(f.target.value),placeholder:i("memorySidebar.create.descriptionPlaceholder"),className:"w-full rounded bg-surface-3 px-2 py-1 text-xs text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("select",{value:tt,onChange:f=>st(f.target.value),className:"flex-shrink-0 rounded bg-surface-3 px-1.5 py-1 text-xs text-text-primary focus:outline-none",children:Ia.map(f=>e.jsx("option",{value:f,children:f},f))}),e.jsx("span",{className:"truncate text-[10px] text-text-muted",children:p==="team"?i("memorySidebar.team"):i("memorySidebar.personal")})]}),e.jsx("textarea",{value:Ee,onChange:f=>Me(f.target.value),placeholder:i("memorySidebar.create.contentPlaceholder"),rows:6,className:"w-full rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void rt(),disabled:!we,className:"rounded bg-accent px-2 py-0.5 text-[10px] font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50",children:Re?"…":i("memorySidebar.new")}),e.jsx("button",{type:"button",onClick:()=>be(!1),className:"rounded px-2 py-0.5 text-[10px] text-text-muted hover:bg-surface-3",children:i("memorySidebar.cancel")})]})]}),S?e.jsx("div",{className:"space-y-2",children:[0,1,2].map(f=>e.jsx("div",{className:"h-12 animate-pulse rounded-md bg-surface-2"},f))}):g.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx($t,{className:"mx-auto h-6 w-6 text-text-muted/40"}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:i("memorySidebar.empty")})]}):e.jsx("ul",{className:"space-y-1",children:g.map(f=>e.jsxs("li",{className:"group rounded-md hover:bg-surface-2",children:[e.jsxs("button",{type:"button",onClick:()=>void Z(f.path),className:"w-full px-2 py-1.5 text-left",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-xs font-medium text-text-primary",children:f.name}),f.type&&e.jsx("span",{className:`flex-shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-medium ${$a(f.type)}`,children:f.type}),e.jsx("span",{className:"ml-auto flex-shrink-0 text-[9px] text-text-muted",children:Da(f.mtimeMs)})]}),f.description&&e.jsx("p",{className:"mt-0.5 truncate text-[10px] text-text-muted",children:f.description})]}),e.jsxs("div",{className:"flex items-center gap-0.5 px-2 pb-1 opacity-0 transition-opacity group-hover:opacity-100",children:[e.jsx("button",{type:"button",onClick:()=>void ye(f.path),className:"rounded p-1 text-text-secondary hover:bg-surface-3 hover:text-text-primary",title:i("memorySidebar.edit"),children:e.jsx(ls,{className:"h-3 w-3"})}),f.scope==="personal"&&Ie&&e.jsx("button",{type:"button",onClick:()=>void G(f.path),className:"rounded p-1 text-text-secondary hover:bg-surface-3 hover:text-text-primary",title:i("memorySidebar.promote"),children:e.jsx(Gn,{className:"h-3 w-3"})}),e.jsx("button",{type:"button",onClick:()=>void ce(f.path),className:"ml-auto rounded p-1 text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:i("memorySidebar.delete"),children:e.jsx(Ks,{className:"h-3 w-3"})})]}),y===f.path&&j!==f.path&&e.jsx("pre",{className:"mx-2 mb-2 max-h-48 overflow-y-auto whitespace-pre-wrap rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-secondary",children:w[f.path]??"…"}),y===f.path&&j===f.path&&e.jsxs("div",{className:"mx-2 mb-2",children:[e.jsx("textarea",{value:O,onChange:K=>E(K.target.value),rows:8,className:"w-full rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-primary focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsxs("div",{className:"mt-1 flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void ge(),className:"rounded bg-accent px-2 py-0.5 text-[10px] font-medium text-white hover:bg-accent/90",children:i("memorySidebar.save")}),e.jsx("button",{type:"button",onClick:()=>_(null),className:"rounded px-2 py-0.5 text-[10px] text-text-muted hover:bg-surface-2",children:i("memorySidebar.cancel")})]})]})]},f.path))})]}),N===null&&c==="governance"&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 text-xs",children:I?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("button",{type:"button",disabled:s||!I.automation.autoDream,onClick:Ae,className:"inline-flex w-full items-center justify-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(kr,{className:"h-3.5 w-3.5"}),s?i("memorySidebar.dreaming"):i("memorySidebar.dream")]}),!I.automation.autoDream&&e.jsx("p",{className:"mt-1 text-center text-[10px] text-text-muted",children:i("memorySidebar.dreamDisabled")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:i("memorySidebar.recallTest.title")}),e.jsx("p",{className:"mb-1.5 text-[10px] leading-relaxed text-text-muted",children:i("memorySidebar.recallTest.hint")}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{value:le,onChange:f=>re(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.nativeEvent.isComposing&&ve()},placeholder:i("memorySidebar.recallTest.placeholder"),className:"min-w-0 flex-1 rounded-md bg-surface-2 px-2 py-1 text-xs text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsx("button",{type:"button",onClick:()=>void ve(),disabled:fe||!le.trim(),className:"flex-shrink-0 rounded-md bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50",children:fe?i("memorySidebar.recallTest.running"):i("memorySidebar.recallTest.run")})]}),D!==null&&e.jsx("ul",{className:"mt-1.5 space-y-0.5 rounded-md bg-surface-2 p-2",children:D.length===0?e.jsx("li",{className:"text-[10px] text-text-muted",children:i("memorySidebar.recallTest.noResults")}):D.map(f=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void Z(f.path),className:"flex w-full items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-xs hover:bg-surface-3",title:f.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:f.path.replace(/^team\//,"").replace(/\.md$/,"")}),e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(f.score*100).toFixed(0),"%",f.confidence!==void 0?` · conf ${f.confidence.toFixed(2)}`:""]})]}),H(f.path)]},f.path))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:i("memorySidebar.layers")}),e.jsx("ul",{className:"space-y-1",children:Ts.map(f=>{const K=I.layers[f],J=Math.max(...Ts.map(gt=>I.layers[gt]),1);return e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-16 flex-shrink-0 text-text-secondary",children:f}),e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-surface-2",children:e.jsx("div",{className:"h-full rounded-full bg-brand",style:{width:`${K/J*100}%`}})}),e.jsx("span",{className:"w-6 text-right text-text-muted",children:K})]},f)})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:i("memorySidebar.health")}),e.jsxs("div",{className:"rounded-md bg-surface-2 p-2 text-[10px] text-text-secondary",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.total")}),e.jsx("span",{children:I.health.totalMemories})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.capacity")}),e.jsxs("span",{className:I.health.capacity.tier==="critical"?"text-status-error":I.health.capacity.tier==="warning"?"text-status-warning":"text-status-active",children:[I.health.capacity.utilizationPct.toFixed(0),"% · ",I.health.capacity.tier]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.avgConfidence")}),e.jsx("span",{children:I.health.avgConfidence.toFixed(2)})]})]})]}),I.alerts.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:[i("memorySidebar.alerts")," (",I.alerts.length,")"]}),e.jsx("ul",{className:"space-y-1 rounded-md bg-status-warning/5 p-2",children:I.alerts.slice(-8).reverse().map((f,K)=>e.jsx("li",{className:"text-[10px] leading-relaxed text-text-secondary",children:f},K))})]}),I.conflicts&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-status-warning",children:i("memorySidebar.conflicts")}),e.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap rounded-md bg-surface-2 p-2 text-[10px] leading-relaxed text-text-secondary",children:I.conflicts})]})]}):e.jsx("p",{className:"py-10 text-center text-text-muted",children:i("memorySidebar.loadFailed")})})]})}class Pa{constructor(t,s,n,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,Es(n),"send")})}catch(n){this.rollback(s,Es(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 Es(r){return r instanceof Error?r.message:String(r)}function ut(r){const t=l.useRef(r);t.current=r;const s=l.useRef(null);s.current||(s.current=new Pa(r.value,a=>t.current.apply(a),a=>t.current.send(a),(a,d)=>{var c,u;return(u=(c=t.current).onError)==null?void 0:u.call(c,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 Xs="rcs_context_usage_";function Zs(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function Ms(){return{totalTokens:0,rawMaxTokens:0,percentage:0}}function Oa(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,c=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}:{},...c&&c.length>0?{categories:c}:{}}}function Fa(r,t=Zs()){if(!t||!r)return null;try{const s=t.getItem(Xs+r);return s?Oa(JSON.parse(s)):null}catch{return null}}function Ka(r,t,s=Zs()){if(!(!s||!r))try{s.setItem(Xs+r,JSON.stringify(t))}catch{}}function Ua(r){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${r}`}function La(r){const t=Ua(r),s=sr(),n=s?{proxyUrl:t,token:s}:{proxyUrl:t};return new tr(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 mt(r){return r<1e3?String(r):r<1e6?`${(r/1e3).toFixed(1)}k`:`${(r/1e6).toFixed(1)}M`}function Ba(r){const t=De.findIndex(s=>s.value===r);return De[(t+1+De.length)%De.length].value}const ht=[{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",It=[{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"}],Is=r=>r.labelKey?i(r.labelKey):r.label,$s=r=>r.labelKey?i(r.labelKey):r.label,Ds="rcs_effort",qs=[{value:"normal",descKey:"session.tokenMode.normalDesc"},{value:"poor",descKey:"session.tokenMode.poorDesc"},{value:"sa",descKey:"session.tokenMode.saDesc"}],Ps="rcs_token_mode";function Ha(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,set_token_mode:!1,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,set_token_mode:!1,side_question:!1}}function Qa({budget:r,onBudgetChange:t,disabled:s}){const[n,a]=l.useState(!1),d=ht.find(c=>c.value===r);return e.jsxs(Ye,{open:n,onOpenChange:a,children:[e.jsx(ze,{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:i("session.thinking.title"),children:[e.jsx($t,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?$s(d):i("session.thinking.fallback")}),n?e.jsx(Ge,{className:"h-3 w-3"}):e.jsx(Je,{className:"h-3 w-3"})]})}),e.jsx(Xe,{className:"w-64 p-1",align:"start",children:ht.map(c=>e.jsxs("button",{type:"button",onClick:()=>{t(c.value,c.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===c.value&&e.jsx(qe,{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:$s(c)}),e.jsx("div",{className:"text-xs text-text-muted",children:c.descKey?i(c.descKey):c.description})]})]},c.value))})]})}function Wa({effort:r,onEffortChange:t,disabled:s}){const[n,a]=l.useState(!1),d=It.find(c=>c.value===r);return e.jsxs(Ye,{open:n,onOpenChange:a,children:[e.jsx(ze,{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:i("session.effort.title"),children:[e.jsx($r,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?Is(d):i("session.effort.fallback")}),n?e.jsx(Ge,{className:"h-3 w-3"}):e.jsx(Je,{className:"h-3 w-3"})]})}),e.jsx(Xe,{className:"w-64 p-1",align:"start",children:It.map(c=>e.jsxs("button",{type:"button",onClick:()=>{t(c.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===c.value&&e.jsx(qe,{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(c)}),e.jsx("div",{className:"text-xs text-text-muted",children:i(c.descKey)})]})]},c.value))})]})}function Va({mode:r,onModeChange:t,disabled:s}){const[n,a]=l.useState(!1),d=qs.find(c=>c.value===r);return e.jsxs(Ye,{open:n,onOpenChange:a,children:[e.jsx(ze,{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:i("session.tokenMode.title"),children:[e.jsx(Rr,{className:"h-3 w-3"}),e.jsx("span",{className:`max-w-24 truncate ${r!=="normal"?"font-medium text-brand-text":""}`,children:d?i(`session.tokenMode.${d.value}`):i("session.tokenMode.fallback")}),n?e.jsx(Ge,{className:"h-3 w-3"}):e.jsx(Je,{className:"h-3 w-3"})]})}),e.jsx(Xe,{className:"w-64 p-1",align:"start",children:qs.map(c=>e.jsxs("button",{type:"button",onClick:()=>{t(c.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===c.value&&e.jsx(qe,{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:i(`session.tokenMode.${c.value}`)}),e.jsx("div",{className:"text-xs text-text-muted",children:i(c.descKey)})]})]},c.value))})]})}const Ya=new Set(["Free space","Autocompact buffer","Compact buffer"]),Os=["bg-brand","bg-status-active","bg-status-success","bg-violet-500","bg-amber-500","bg-pink-500","bg-teal-500"];function za({usage:r}){const t=Math.min(100,Math.max(0,r.percentage)),s=t>=80,n=(r.categories??[]).filter(u=>!u.isDeferred&&!Ya.has(u.name)),a=(r.categories??[]).filter(u=>u.isDeferred),d=n.reduce((u,p)=>u+p.tokens,0),c=[`${B("session.context.tooltip",{used:mt(r.totalTokens),max:mt(r.rawMaxTokens)})}${r.model?` · ${r.model}`:""}`,...n.slice(0,8).map(u=>`${u.name}: ${mt(u.tokens)}`),...a.slice(0,3).map(u=>`${u.name}${i("session.context.deferredSuffix")}: ${mt(u.tokens)}`)];return e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-text-muted font-mono",title:c.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,p)=>e.jsx("span",{className:s&&p===0?"bg-status-warning":Os[p%Os.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 Ga({models:r,currentModelId:t,onSelect:s,disabled:n}){const[a,d]=l.useState(!1),c=r.find(h=>h.modelId===t)??null,u=r.length>0,p=async h=>{s(h.modelId),d(!1)};return e.jsxs(Ye,{open:a,onOpenChange:u?d:void 0,children:[e.jsx(ze,{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:i("session.model.title"),children:[e.jsx(Qs,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(c==null?void 0:c.name)??t??i("session.model.title")}),a?e.jsx(Ge,{className:"h-3 w-3"}):e.jsx(Je,{className:"h-3 w-3"})]})}),e.jsx(Xe,{className:"w-72 p-0",align:"start",children:e.jsx(fr,{models:r,currentModelId:t,onSelect:p,showSearch:r.length>5})})]})}function Ja({mode:r,onModeChange:t,disabled:s}){const[n,a]=l.useState(!1),d=De.find(c=>c.value===r);return e.jsxs(Ye,{open:n,onOpenChange:a,children:[e.jsx(ze,{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:i("session.mode.title"),children:[e.jsx(pr,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?i(d.labelKey):r}),n?e.jsx(Ge,{className:"h-3 w-3"}):e.jsx(Je,{className:"h-3 w-3"})]})}),e.jsx(Xe,{className:"w-64 p-1",align:"start",children:De.map(c=>e.jsxs("button",{type:"button",onClick:()=>{t(c.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===c.value&&e.jsx(qe,{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:i(c.labelKey)}),e.jsx("div",{className:"text-xs text-text-muted",children:i(c.descKey)})]})]},c.value))})]})}function fo({sessionId:r,onBack:t}){se();const[s,n]=l.useState(null),[a,d]=l.useState(null),[c,u]=l.useState(""),[p,h]=l.useState(!1),[g,b]=l.useState(!1),[S,C]=l.useState(!1),[T,m]=l.useState(!1),[y,v]=l.useState(!1),[w,R]=l.useState(!1),[j,_]=l.useState(""),[O,E]=l.useState(0),q=l.useRef(null),[Q,N]=l.useState({text:"",nonce:0}),[F,I]=l.useState(!1),[z,le]=l.useState(!1),[re,D]=l.useState(!1),[ae,fe]=l.useState(0),[Ze,he]=l.useState(0),[ne,Z]=l.useState([]),[H,ye]=l.useState(!1),[ge,ce]=l.useState([]),[G,de]=l.useState(null),[be,Oe]=l.useState(()=>At()),[V,et]=l.useState(null),[je,tt]=l.useState(()=>localStorage.getItem(As)||"off"),[st,Ee]=l.useState(()=>Fa(r)),[Me,Re]=l.useState(!0),[nt,yt]=l.useState(null),[we,rt]=l.useState(null),[Ae,ve]=l.useState([]),[Ie,ke]=l.useState(!1),[Fe,f]=l.useState(""),K=l.useRef(null),[J,gt]=l.useState(()=>localStorage.getItem(Rs)||"default"),[Dt,qt]=l.useState(null),Ke=l.useRef(null),[Pt,Ot]=l.useState(null),Ue=l.useRef(null),oe=l.useRef(null),Ft=l.useRef(ne);Ft.current=ne;const at=l.useRef(null);at.current||(at.current=new Cr(Tr()));const Kt=l.useRef(r);Kt.current=(s==null?void 0:s.title)||r,l.useEffect(()=>{var o;(o=at.current)==null||o.reset()},[r]);const ie=l.useCallback(o=>{qt(o),Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(()=>qt(null),5e3)},[]),ue=l.useCallback(o=>{Ot(o),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>Ot(null),5e3)},[]),ot=ut({value:J,apply:o=>{gt(o);try{localStorage.setItem(Rs,o)}catch{}},send:o=>{const x=oe.current;return x?x.setPermissionMode(o):Promise.reject(new Error("adapter not ready"))},onError:(o,x)=>{console.error("[SessionDetail] set permission mode failed:",o),ie(x==="send"?B("session.mode.switchFailedRequest",{message:o}):o||i("session.mode.switchFailed"))}}),bt=l.useCallback(o=>ot.set(o),[ot]),[Ut,en]=l.useState(()=>localStorage.getItem(Ps)||"normal"),it=ut({value:Ut,apply:o=>{en(o);try{localStorage.setItem(Ps,o)}catch{}},send:o=>{const x=oe.current;return x?x.setTokenMode(o):Promise.reject(new Error("adapter not ready"))},onError:(o,x)=>{console.error("[SessionDetail] set token mode failed:",o),ie(x==="send"?B("session.tokenMode.failedRequest",{message:o}):o||i("session.tokenMode.failed"))}}),jt=ut({value:je,apply:o=>{tt(o);try{localStorage.setItem(As,o)}catch{}},send:o=>{var M;const x=oe.current;if(!x)return Promise.reject(new Error("adapter not ready"));const k=((M=ht.find(A=>A.value===o))==null?void 0:M.tokens)??null;return x.setThinkingBudget(k)},onError:(o,x)=>{console.error("[SessionDetail] set thinking budget failed:",o),ie(x==="send"?B("session.thinking.failedRequest",{message:o}):o||i("session.thinking.failed"))}}),P=l.useMemo(()=>new ta(r,Z,{onStatusChange:o=>{var x;d(o),ye(o==="running"||o==="requires_action"),(x=at.current)==null||x.onStatus(o,Kt.current)},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{ce(x=>x.some(k=>k.requestId===o.requestId)?x:[...x,o])},onModelsStateChange:o=>{de(o)},onSubagentUpdate:o=>{Oe(o)},onControlResponse:o=>{jt.handleControlResponse(o)||it.handleControlResponse(o)||Wt.handleControlResponse(o)||ot.handleControlResponse(o)},onPermissionModeChange:o=>{ot.sync(o)},onWorkerInfoChange:o=>{et(x=>JSON.stringify(x)===JSON.stringify(o)?x:o)},onTurnStart:o=>{yt(o)},onElicitationRequest:o=>{rt(o)}}),[r,ie]);l.useEffect(()=>(oe.current=P,()=>{P.disconnect()}),[P]);const U=l.useMemo(()=>Ha(V),[V]),Lt=l.useRef(!1);l.useEffect(()=>{var k;if(!U.set_max_thinking_tokens||Lt.current)return;const o=oe.current;if(!o)return;const x=((k=ht.find(M=>M.value===je))==null?void 0:k.tokens)??null;o.setThinkingBudget(x).then(()=>{Lt.current=!0}).catch(M=>console.error("[SessionDetail] reconcile thinking budget failed:",M))},[U.set_max_thinking_tokens,je,V]);const Bt=U.stop_task?o=>{P.stopSubagent(o).then(x=>{x.ok||ue(x.error||i("session.stopTask.failed"))})}:void 0,Ht=l.useRef(!1);l.useEffect(()=>{if(!U.set_token_mode||Ht.current)return;const o=oe.current;o&&(Ht.current=!0,o.getRemoteSettings().then(x=>{const k=x==null?void 0:x.applied.tokenMode;(k==="normal"||k==="poor"||k==="sa")&&it.sync(k)}).catch(x=>console.error("[SessionDetail] reconcile token mode failed:",x)))},[U.set_token_mode,it]);const tn=se(),wt=l.useMemo(()=>nr((V==null?void 0:V.commands)??[],(V==null?void 0:V.skills)??[]),[V,tn]),Le=l.useMemo(()=>rr(ne,j),[ne,j]),sn=l.useCallback(o=>jt.set(o),[jt]),[Qt,nn]=l.useState(()=>localStorage.getItem(Ds)||"auto"),Wt=ut({value:Qt,apply:o=>{nn(o);try{localStorage.setItem(Ds,o)}catch{}},send:o=>{var M;const x=oe.current;if(!x)return Promise.reject(new Error("adapter not ready"));const k=(M=It.find(A=>A.value===o))==null?void 0:M.effort;return x.setEffort(k)},onError:(o,x)=>{console.error("[SessionDetail] set effort failed:",o),ie(x==="send"?B("session.effort.failedRequest",{message:o}):o||i("session.effort.failed"))}}),vt=l.useCallback(()=>{var o;U.get_context_usage&&((o=oe.current)==null||o.getContextUsage().then(x=>{x&&(Ee(x),Ka(r,x))}).catch(()=>{}).finally(()=>Re(!1)))},[U,r]);l.useEffect(()=>{if(!U.get_context_usage)return;vt();const o=setInterval(vt,6e4);return()=>clearInterval(o)},[U,H,vt]),l.useEffect(()=>{V&&!U.get_context_usage&&Re(!1)},[V,U]),l.useEffect(()=>{if(!Me)return;const o=setTimeout(()=>Re(!1),1e4);return()=>clearTimeout(o)},[Me]);const Vt=l.useRef(z);Vt.current=z,l.useEffect(()=>xe.onEvent(x=>{x.type!=="artifact_created"&&x.type!=="artifact_updated"||(Vt.current&&he(k=>k+1),fe(k=>k+1))}),[]);const[Yt,lt]=l.useState(0),zt=l.useRef(re);zt.current=re;const[Be,Gt]=l.useState(null),[me,kt]=l.useState(!1),[Nt,Jt]=l.useState(0),[rn,an]=l.useState(void 0),St=l.useRef(me);St.current=me,l.useEffect(()=>xe.onEvent(x=>{x.type==="memory_synced"&&zt.current&&lt(k=>k+1)}),[]),l.useEffect(()=>{Us().then(o=>Gt(o.mode)).catch(()=>Gt("sqlite"))},[]),l.useEffect(()=>xe.onEvent(x=>{var k,M;if(x.type==="memory_changed")St.current?lt(A=>A+1):Jt(A=>A+1);else if(x.type==="memory_recall"){const A=Array.isArray((k=x.payload)==null?void 0:k.hits)?x.payload.hits:void 0;A&&an({query:typeof((M=x.payload)==null?void 0:M.query)=="string"?x.payload.query:"",hits:A}),St.current&&lt(W=>W+1)}}),[]),l.useEffect(()=>{me&&Jt(0)},[me]);const[He,on]=l.useState("idle");l.useEffect(()=>xe.onStateChange(x=>on(x)),[]),l.useEffect(()=>{z&&fe(0)},[z]),l.useEffect(()=>{let o=!1;async function x(){u("");try{const k=await ms(r);if(o)return;n(k),d(k.status),xt(k.status)&&P.markClosed(),ye(k.status==="running"||k.status==="requires_action")}catch(k){if(o)return;u(k instanceof Error?k.message:i("session.loadFailed"));return}try{await P.init()}catch(k){console.warn("Failed to init adapter:",k)}}return x(),()=>{o=!0}},[r,P]);const L=xt(a),Xt=l.useRef(a);Xt.current=a,l.useEffect(()=>{if(L)return;let o=!1;const k=setInterval(async()=>{try{const M=await ms(r);if(o||M.status===Xt.current)return;xt(M.status)&&P.markClosed(),d(M.status),ye(M.status==="running"||M.status==="requires_action")}catch{}},6e4);return()=>{o=!0,clearInterval(k)}},[r,L,P]);const Y=(s==null?void 0:s.access_level)==="read",Zt=st??(Me&&!L&&!Y?Ms():null),_t=l.useCallback(()=>{Z([]),Ee(Ms()),ds(r).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[r]),Qe=l.useCallback(async(o,x)=>{const k=oe.current;if(!k||L)return;if(o.sessionId===r){Z(A=>[...A,{type:"command_output",id:`cmd-resume-${Date.now()}`,commandName:"resume",inputText:x??"/resume",title:"Resume",subtitle:i("session.resume.title"),outputText:i("session.resume.currentBlocked"),variant:"error"}]);return}const M=(A,W="default")=>Z(Ne=>[...Ne,{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:i("session.resume.title"),outputText:A,variant:W}]);M(B("session.resume.restoring",{title:o.title??""}));try{await ds(r),Z([]);const A=await k.resumeSession(o.sessionId);M(A.title?B("session.resume.restoredWithTitle",{count:A.messageCount,title:A.title}):B("session.resume.restored",{count:A.messageCount}))}catch(A){M(B("session.resume.failed",{message:A instanceof Error?A.message:String(A)}),"error")}},[L,r]),ln=l.useCallback(async()=>{if(s!=null&&s.environment_id)try{const o=await ar({environment_id:s.environment_id});window.location.href=`/code/${o.id}?resumeFrom=${r}`}catch(o){ue(B("session.createFailedWithReason",{message:o instanceof Error?o.message:String(o)}))}},[s,r,ue]),cn=l.useRef(new URLSearchParams(window.location.search).get("resumeFrom")),es=l.useRef(!1);l.useEffect(()=>{const o=cn.current;!o||es.current||!V||!U.resume||(es.current=!0,window.history.replaceState({},"",window.location.pathname),Qe({sessionId:o,title:o.slice(0,8),modified:0},null))},[V,U.resume,Qe]);const $e=l.useCallback(async o=>{const x=o.text.trim(),k=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!x&&!k||L)return;const M=/^\/resume(?:\s+(.*))?$/.exec(x);if(M){const W=(M[1]??"").trim();if(!U.resume){Z(Ne=>[...Ne,{type:"user_message",id:`user-${Date.now()}`,content:x},{type:"command_output",id:`cmd-${Date.now()}`,commandName:"resume",inputText:x,title:"Resume",subtitle:i("session.resume.title"),outputText:i("session.resume.unsupported"),variant:"error"}]);return}W?await Qe({sessionId:W,title:W,modified:0},x):v(!0);return}const A=await or(x,{sessionId:r,availableCommands:wt,availableModels:(G==null?void 0:G.availableModels)??[],currentModel:G?{modelId:G.currentModelId,name:G.currentModelId}:null,supportsImages:!0,entries:Ft.current,setModel:async W=>{await ee(r,{type:"control_request",request:{subtype:"set_model",model:W}}),de(Ne=>Ne&&{...Ne,currentModelId:W})},onNewSession:()=>{Z([])}}).catch(()=>null);if(A){if(pt("[SessionDetail] local command result",A),"clearEntries"in A&&A.clearEntries){_t();return}if("newSession"in A&&A.newSession){_t();return}if("userEntry"in A){Z(W=>[...W,A.userEntry,A.cmdEntry]);return}}ye(!0);try{await P.sendMessage(x,o.images,o.attachments)}catch(W){if(console.error("Send failed:",W),W instanceof ir&&W.type==="session_closed"){d("archived"),P.markClosed(),ue(i("session.closedSendBlocked"));return}ue(`${i("session.sendFailed")}${W instanceof Error?`: ${W.message}`:""}`)}},[P,L,r,G,wt,_t,ue,Qe,U]),dn=l.useCallback(o=>{if(H){ve(x=>[...x,o]);return}$e(o)},[H,$e]),[Ct,ts]=l.useState(!1),un=l.useCallback(()=>{H||(ts(!0),$e({text:"/dream"}))},[H,$e]);l.useEffect(()=>{!H&&Ct&&(ts(!1),lt(o=>o+1))},[H,Ct]);const Tt=l.useRef(!1);l.useEffect(()=>{if(L){ve(x=>x.length>0?[]:x);return}if(H||Ae.length===0||Tt.current)return;const o=Ae[0];o&&(Tt.current=!0,ve(x=>x.slice(1)),$e(o).finally(()=>{Tt.current=!1}))},[H,Ae,$e,L]);const mn=l.useCallback((o,x)=>{if(H)return;const k=x==="edit"?i("session.rewind.confirmEdit"):i("session.rewind.confirm");window.confirm(`${k}
78
+ ${i("session.rewind.confirmBody")}`)&&P.rewindToMessage(o.id).then(()=>{x==="edit"&&o.content&&N(M=>({text:o.content,nonce:M.nonce+1}))}).catch(M=>{console.error("[SessionDetail] rewind failed:",M),ue(B("session.rewind.failed",{message:M instanceof Error?M.message:String(M)}))})},[H,ue]),xn=l.useCallback(o=>{const x=Le.orderedMatchIds;if(x.length===0)return;const k=(o%x.length+x.length)%x.length;E(k);const M=x[k],A=document.querySelector(`[data-entry-id="${CSS.escape(M)}"]`);A==null||A.scrollIntoView({block:"center",behavior:"smooth"})},[Le]),ss=l.useCallback(async()=>{try{await P.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{ye(!1)}},[P]),pn=l.useCallback(()=>{bt(Ba(J))},[bt,J]);l.useEffect(()=>()=>{Ke.current&&clearTimeout(Ke.current),Ue.current&&clearTimeout(Ue.current)},[]);const fn=l.useCallback(async()=>{if(s&&window.confirm(i("dashboard.confirmDelete").replace("{id}",s.title||s.id)))try{await us(s.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:i("dashboard.deleteFailed"))}},[s]),hn=l.useCallback(async o=>{try{await P.respondPermission(o,!0)}catch(x){console.error("Failed to approve:",x)}ce(x=>x.filter(k=>k.requestId!==o))},[P]),yn=l.useCallback(async(o,x)=>{try{await P.respondPermission(o,!0,{updated_permissions:x})}catch(k){console.error("Failed to approve with rules:",k)}ce(k=>k.filter(M=>M.requestId!==o))},[P]),gn=l.useCallback(async(o,x)=>{const k=we;if(rt(null),!!k)try{await P.respondElicitation(k.requestId,o,x)}catch(M){console.error("Failed to submit elicitation:",M)}},[we,P]),bn=l.useCallback(()=>{!s||Y||(f(s.title||""),ke(!0),setTimeout(()=>{var o,x;(o=K.current)==null||o.focus(),(x=K.current)==null||x.select()},0))},[s,Y]),ns=l.useCallback(async()=>{const o=Fe.trim();if(ke(!1),!(!s||!o||o===s.title))try{const x=await lr(s.id,o);n(k=>k&&{...k,title:x.title??o})}catch(x){console.error("Rename failed:",x),alert(x instanceof Error?x.message:i("session.rename.failed"))}},[s,Fe]),jn=l.useCallback(async o=>{try{await P.respondPermission(o,!1)}catch(x){console.error("Failed to reject:",x)}ce(x=>x.filter(k=>k.requestId!==o))},[P]),wn=l.useCallback(async(o,x,k)=>{try{await ee(r,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:k,answers:x}})}catch(M){console.error("Failed to submit answers:",M)}ce(M=>M.filter(A=>A.requestId!==o))},[r]),vn=l.useCallback(async(o,x,k)=>{try{x==="no"?await ee(r,{type:"permission_response",approved:!1,request_id:o,...k?{message:k}:{}}):await ee(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)}ce(M=>M.filter(A=>A.requestId!==o))},[r]);return c?e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(dt,{onBack:t,title:e.jsx("span",{className:"text-xs font-medium text-text-muted",children:i("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:c}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:i("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(dt,{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(Za,{sessionId:r,agentId:s.environment_id})]}):e.jsx(Ls,{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(dt,{onBack:t,title:Ie?e.jsx("input",{ref:K,value:Fe,onChange:o=>f(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),ns()):o.key==="Escape"&&(o.preventDefault(),ke(!1))},onBlur:()=>void ns(),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:!Y&&!L?e.jsx("button",{type:"button",onClick:bn,title:i("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(Sr,{visibility:s.visibility||"private",className:"hidden flex-shrink-0 text-[10px] sm:inline-flex"})]}),meta:e.jsx(e.Fragment,{children:(()=>{var k;const o=s.source==="acp"?"acp":(k=s.environment)==null?void 0:k.worker_type,x=Bs(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:()=>le(!z),className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${z?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("artifacts.title"),children:[e.jsx(cr,{className:"h-3.5 w-3.5"}),ae>0&&!z&&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:ae>9?"9+":ae})]}),e.jsxs("button",{onClick:()=>{Be==="memdir"?kt(!me):D(!re)},className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${Be==="memdir"?me?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary":re?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("memories.title"),children:[e.jsx($t,{className:"h-3.5 w-3.5"}),Be==="memdir"&&Nt>0&&!me&&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:Nt>9?"9+":Nt})]}),U.side_question&&!L&&!Y&&e.jsx("button",{onClick:()=>m(!T),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${T?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("session.sideQuestion.title"),children:e.jsx(Ws,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>{const o=!w;R(o),o?setTimeout(()=>{var x;return(x=q.current)==null?void 0:x.focus()},0):(_(""),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:i("session.search.title"),children:e.jsx(ft,{className:"h-3.5 w-3.5"})}),U.mcp_management&&!L&&!Y&&e.jsx("button",{onClick:()=>b(!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:i("session.mcp.title"),children:e.jsx(Vs,{className:"h-3.5 w-3.5"})}),U.remote_settings&&!L&&!Y&&e.jsx("button",{onClick:()=>C(!S),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${S?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("session.settings.title"),children:e.jsx(Ys,{className:"h-3.5 w-3.5"})}),!Y&&(s==null?void 0:s.access_level)!=="write"&&e.jsx("button",{onClick:()=>I(!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:i("session.share"),children:e.jsx(zr,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>h(!p),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",title:i("session.info"),children:[i("session.tasks"),ge.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:ge.length})]})]})})}),(He==="reconnecting"||He==="failed")&&e.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-1.5 text-xs font-medium ${He==="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 ${He==="failed"?"bg-status-error":"animate-pulse bg-status-warning"}`}),He==="failed"?i("session.sseFailed"):i("session.sseReconnecting")]}),z&&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(Nr,{sessionId:r,embedded:!0,refreshTick:Ze})})}),re&&Be!=="memdir"&&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(_r,{sessionId:r,embedded:!0,refreshTick:Yt})})}),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(ft,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{ref:q,value:j,onChange:o=>{_(o.target.value),E(0)},onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),xn(j&&o.shiftKey?O-1:O+1)):o.key==="Escape"&&(o.preventDefault(),R(!1),_(""))},placeholder:i("session.search.placeholder"),className:"w-full bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"}),j.trim()&&e.jsx("span",{className:"flex-shrink-0 font-mono text-[10px] text-text-muted",children:Le.orderedMatchIds.length===0?i("session.search.noResults"):`${O+1}/${Le.orderedMatchIds.length}`})]})}),e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(dr,{entries:ne,isLoading:H,turnStartedAt:nt,emptyTitle:i("session.emptyTitle"),emptyDescription:i("session.emptyDescription"),searchMatchIds:j.trim()?Le.matchIds:void 0,onRewindEntry:U.rewind&&!L&&!Y&&!H?(o,x)=>mn(o,x):void 0})}),Be==="memdir"&&e.jsx(_e,{open:me,onOpenChange:kt,children:e.jsxs(Ce,{showCloseButton:!1,"data-testid":"memory-sidebar",className:"fixed inset-y-0 left-0 top-auto right-auto translate-x-0 translate-y-0 flex h-full w-full flex-col overflow-hidden rounded-none border-r border-border bg-surface-1 p-0 max-w-none max-h-none sm:w-96 sm:max-w-md",children:[e.jsx(Te,{className:"sr-only",children:i("memorySidebar.title")}),e.jsx("div",{className:"flex flex-shrink-0 items-center justify-end px-2 pt-2 sm:hidden",children:e.jsx("button",{type:"button",onClick:()=>kt(!1),className:"flex h-8 w-8 items-center justify-center rounded-md text-text-muted hover:bg-surface-2 hover:text-text-primary","aria-label":i("common.close"),title:i("common.close"),children:e.jsx(Fs,{className:"h-4 w-4"})})}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx(qa,{refreshTick:Yt,recall:rn,dreaming:H&&Ct,onDreamTrigger:un})})]})}),e.jsx(oa,{state:be,onStopTask:Bt}),ge.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:ge.map(o=>e.jsx(Xa,{request:o,onApprove:()=>hn(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>yn(o.requestId,o.suggestions??[]):void 0,onReject:()=>jn(o.requestId),onSubmitAnswers:wn,onSubmitPlan:vn},o.requestId))})}),we&&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(Sa,{request:we,onSubmit:gn})})}),Pt&&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:Pt})}),Dt&&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:Dt})}),e.jsxs("div",{className:"page-measure mx-auto w-full px-4 sm:px-8 pb-1 flex flex-wrap items-center justify-between gap-x-1 gap-y-1.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsx(Ja,{mode:J,onModeChange:bt,disabled:L||Y}),e.jsx(Ga,{models:(G==null?void 0:G.availableModels)??[],currentModelId:(G==null?void 0:G.currentModelId)??null,onSelect:o=>{ee(r,{type:"control_request",request:{subtype:"set_model",model:o}}),de(x=>x&&{...x,currentModelId:o})},disabled:L||Y}),U.set_max_thinking_tokens&&e.jsx(Qa,{budget:je,onBudgetChange:sn,disabled:L||Y}),U.set_effort&&e.jsx(Wa,{effort:Qt,onEffortChange:o=>Wt.set(o),disabled:L||Y}),U.set_token_mode&&e.jsx(Va,{mode:Ut,onModeChange:o=>it.set(o),disabled:L||Y})]}),e.jsx("div",{className:"flex flex-shrink-0 items-center gap-3",children:Zt&&e.jsx(za,{usage:Zt})})]}),L&&(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 ln(),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:i("session.resumeInNew")})}),e.jsx(ur,{onSubmit:dn,isLoading:H,onInterrupt:ss,onCycleMode:pn,disabled:L||Y,placeholder:L?i("session.closed"):Y?i("session.readOnly"):i("session.inputPlaceholder"),supportsAttachments:!0,commands:wt,queueWhileLoading:!0,queuedCount:Ae.length,onDequeue:o=>ve(x=>x.filter((k,M)=>M!==o)),onSearchFiles:U.file_search?o=>P.searchFiles(o):void 0,historyKey:r,draftOverride:Q}),g&&e.jsx(fa,{onClose:()=>b(!1),fetchServers:()=>P.getMcpServers(),onToggle:(o,x)=>P.toggleMcpServer(o,x),onReconnect:o=>P.reconnectMcpServer(o)}),S&&e.jsx(ga,{onClose:()=>C(!1),fetchSettings:()=>P.getRemoteSettings(),onApply:o=>P.applyFlagSettings(o)}),T&&e.jsx(ba,{onClose:()=>m(!1),onAsk:o=>P.askSideQuestion(o)}),p&&s&&e.jsx(ca,{onClose:()=>h(!1),session:s,liveStatus:a,pendingPermissions:ge,subagentState:be,onStopTask:Bt,onInterrupt:ss,onDelete:fn,onEndSession:U.end_session&&!L&&!Y?async()=>{await P.endSession("ended from web"),await us(s.id),window.location.href="/code/"}:void 0}),e.jsx(Ea,{open:F,onClose:()=>I(!1),sessionId:s.id,sessionTitle:s.title||void 0}),e.jsx(Aa,{open:y,onClose:()=>v(!1),adapter:P,onResume:o=>{v(!1),Qe(o,null)}})]})}):e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(dt,{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:i("session.loading")})})]})}function Xa({request:r,onApprove:t,onApproveAlways:s,onReject:n,onSubmitAnswers:a,onSubmitPlan:d}){const c=r.toolName,u=r.toolInput,p=r.description||"";if(c==="AskUserQuestion"){const h=u.questions||[];return e.jsx(wa,{requestId:r.requestId,questions:h,description:p,onSubmit:g=>a(r.requestId,g,h),onSkip:n})}if(c==="ExitPlanMode"){const h=u.plan||"";return e.jsx(ka,{requestId:r.requestId,planContent:h,description:p,onSubmit:(g,b)=>d(r.requestId,g,b)})}return e.jsx(ja,{requestId:r.requestId,toolName:c,toolInput:u,description:p,suggestions:r.suggestions,onApprove:t,onApproveAlways:s,onReject:n})}function Za({sessionId:r,agentId:t}){const[s,n]=l.useState(null),[a,d]=l.useState("disconnected"),[c,u]=l.useState(null),p=l.useRef(null);return l.useEffect(()=>{const h=La(t);return h.setConnectionStateHandler((g,b)=>{d(g),u(b||null)}),p.current=h,n(h),h.connect().catch(g=>{g instanceof mr||(u(g.message),d("error"))}),()=>{h.disconnect(),p.current=null,n(null),d("disconnected")}},[t]),e.jsx(Ls,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[c&&a==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:c}),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:i("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:i("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:c})]})}),s&&a==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(xr,{client:s,agentId:t})})]})})}export{fo as SessionDetail};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./vendor-DE_-CLIE.js";import{aF as c,V as n,aD as i}from"./main-BEcUh0F7.js";/**
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{aF as c,V as n,aD as i}from"./main-DifWL4zR.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{a_ as v,c as N,aT as t}from"./main-BEcUh0F7.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function E({onSuccess:p,onAlreadyDone:b}){const{setup:h}=v(),[d,f]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[u,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==u){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await h(d,l,a),p()}catch(x){const n=x instanceof Error?x.message:"Setup failed";if(n.includes("already")||n.includes("409")){b();return}o(n)}finally{m(!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.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,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.setup.apiKey")}),e.jsx("input",{type:"password",value:d,onChange:s=>f(s.target.value),required:!0,autoComplete:"off",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.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",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.setup.password")}),e.jsx("input",{type:"password",value:a,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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:u,onChange:s=>w(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"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,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:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{E as Setup};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a_ as v,c as N,aT as t}from"./main-DifWL4zR.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function E({onSuccess:p,onAlreadyDone:b}){const{setup:h}=v(),[d,f]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[u,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==u){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await h(d,l,a),p()}catch(x){const n=x instanceof Error?x.message:"Setup failed";if(n.includes("already")||n.includes("409")){b();return}o(n)}finally{m(!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.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,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.setup.apiKey")}),e.jsx("input",{type:"password",value:d,onChange:s=>f(s.target.value),required:!0,autoComplete:"off",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.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",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.setup.password")}),e.jsx("input",{type:"password",value:a,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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:u,onChange:s=>w(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"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,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:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{E as Setup};
@@ -1 +1 @@
1
- import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ar as m,b as h}from"./main-BEcUh0F7.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function j(){const[t,r]=d.useState("loading"),[i,a]=d.useState(""),l=(typeof window<"u"?window.location.pathname:"").match(/\/code\/s\/([^/?]+)/),o=l?l[1]:null;return d.useEffect(()=>{if(!o){r("invalid"),a("Share link is invalid — no token found.");return}if(!o.startsWith("shr_")){r("invalid"),a("Invalid share token format.");return}let n=!1;async function c(){try{const s=await m(o);if(n)return;window.location.href=`/code/${s.id}`}catch(s){if(n)return;s instanceof h?s.status===401&&s.message.toLowerCase().includes("expired")?(r("expired"),a("This share has expired.")):s.status===404?s.message.toLowerCase().includes("session")?(r("not_found"),a("Session not found.")):(r("invalid"),a("Share not found or has been revoked.")):s.status===403?(r("invalid"),a("You do not have permission to access this share.")):(r("error"),a(s.message||"Failed to resolve share.")):(r("error"),a(s instanceof Error?s.message:"Failed to resolve share."))}}return c(),()=>{n=!0}},[o]),d.useEffect(()=>{if(t!=="loading"&&t!=="error"){const n=setTimeout(()=>{window.location.href="/code"},3e3);return()=>clearTimeout(n)}},[t]),t==="loading"?e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",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",{children:"Resolving share link..."})]})}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-primary",children:e.jsxs("div",{className:"text-center max-w-md px-4",children:[t==="expired"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Share Expired"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share has expired."})]}),t==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Invalid Share"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share link is invalid or has been revoked."})]}),t==="not_found"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Not Found"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"The session could not be found."})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Error"}),e.jsx("p",{className:"text-status-error mb-4",children:i})]}),e.jsx("a",{href:"/code",className:"text-brand-text hover:underline",children:"← Back to Dashboard"})]})})}export{j as ShareLanding};
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ar as m,b as h}from"./main-DifWL4zR.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function j(){const[t,r]=d.useState("loading"),[i,a]=d.useState(""),l=(typeof window<"u"?window.location.pathname:"").match(/\/code\/s\/([^/?]+)/),o=l?l[1]:null;return d.useEffect(()=>{if(!o){r("invalid"),a("Share link is invalid — no token found.");return}if(!o.startsWith("shr_")){r("invalid"),a("Invalid share token format.");return}let n=!1;async function c(){try{const s=await m(o);if(n)return;window.location.href=`/code/${s.id}`}catch(s){if(n)return;s instanceof h?s.status===401&&s.message.toLowerCase().includes("expired")?(r("expired"),a("This share has expired.")):s.status===404?s.message.toLowerCase().includes("session")?(r("not_found"),a("Session not found.")):(r("invalid"),a("Share not found or has been revoked.")):s.status===403?(r("invalid"),a("You do not have permission to access this share.")):(r("error"),a(s.message||"Failed to resolve share.")):(r("error"),a(s instanceof Error?s.message:"Failed to resolve share."))}}return c(),()=>{n=!0}},[o]),d.useEffect(()=>{if(t!=="loading"&&t!=="error"){const n=setTimeout(()=>{window.location.href="/code"},3e3);return()=>clearTimeout(n)}},[t]),t==="loading"?e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",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",{children:"Resolving share link..."})]})}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-primary",children:e.jsxs("div",{className:"text-center max-w-md px-4",children:[t==="expired"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Share Expired"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share has expired."})]}),t==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Invalid Share"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share link is invalid or has been revoked."})]}),t==="not_found"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Not Found"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"The session could not be found."})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Error"}),e.jsx("p",{className:"text-status-error mb-4",children:i})]}),e.jsx("a",{href:"/code",className:"text-brand-text hover:underline",children:"← Back to Dashboard"})]})})}export{j as ShareLanding};
@@ -1,4 +1,4 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aF as q,W as T,a$ as U,aT as t,e as B,X as M,aU as G,aD as I,U as J,aJ as X,aa as Y,az as K,ay as Q,a_ as V,z as Z,m as ee,r as te,P as se,n as ae,p as ne,o as H,q as re,N as ie}from"./main-BEcUh0F7.js";import{R as D,E as oe}from"./RegisterEmpty-BxED5Dy8.js";import{U as le,A as O}from"./UserSearchInput-B8gKPGEK.js";import{C as F}from"./copy-BM16nNhl.js";import{g as ce}from"./workerType-CWB4ZW61.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";/**
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aF as q,W as T,a$ as U,aT as t,e as B,X as M,aU as G,aD as I,U as J,aJ as X,aa as Y,az as K,ay as Q,a_ as V,z as Z,m as ee,r as te,P as se,n as ae,p as ne,o as H,q as re,N as ie}from"./main-DifWL4zR.js";import{R as D,E as oe}from"./RegisterEmpty-40NZTQDf.js";import{U as le,A as O}from"./UserSearchInput-zZQ--3Ir.js";import{C as F}from"./copy-WjRHDSJw.js";import{g as ce}from"./workerType-DXaJtQ7o.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 d,j as e}from"./vendor-DE_-CLIE.js";import{a$ as b,b0 as v,aT as a,a_ as C,aU as f,N as D,W as S}from"./main-BEcUh0F7.js";import{D as E,a as T,d as k}from"./dialog-BY4fOXc_.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function L({open:c,onClose:n,onCreated:m}){b();const{createTeam:N}=v(),[l,h]=d.useState(""),[i,o]=d.useState(""),[x,p]=d.useState(""),[s,r]=d.useState(""),[u,j]=d.useState(!1);d.useEffect(()=>{c&&(h(""),o(""),p(""),r(""),j(!1))},[c]);const w=t=>{h(t),i||o(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},y=async t=>{t.preventDefault(),r(""),j(!0);try{const g=await N({name:l,slug:i,description:x||void 0});m(g)}catch(g){r(g instanceof Error?g.message:a("team.create.failed"))}finally{j(!1)}};return e.jsx(E,{open:c,onOpenChange:t=>{t||n()},children:e.jsx(T,{className:"nsd-shell max-w-md",children:e.jsxs("form",{className:"nsd-box nsd-box--single",onSubmit:y,children:[e.jsx(k,{className:"nsd-h",children:a("team.create.title")}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.name")}),e.jsx("input",{type:"text",required:!0,value:l,onChange:t=>w(t.target.value),placeholder:"Engineering",className:"nsd-title"}),e.jsx("span",{className:"text-xs text-text-muted",children:a("team.create.nameHint")})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.slug")}),e.jsx("input",{type:"text",required:!0,value:i,onChange:t=>o(t.target.value),pattern:"^[a-z0-9-]{3,32}$",placeholder:"engineering",className:"nsd-title"}),e.jsx("span",{className:"text-xs text-text-muted",children:a("team.create.slugHint")})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.description")}),e.jsx("textarea",{value:x,onChange:t=>p(t.target.value),rows:3,className:"nsd-title nsd-area"})]}),s&&e.jsx("p",{className:"nsd-error",children:s}),e.jsxs("div",{className:"nsd-foot",children:[e.jsx("button",{type:"button",onClick:n,className:"nsd-cancel",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:u||!l||!i,className:"btn-ticket nsd-create",children:u?a("common.creating"):a("team.create.submit")})]})]})})})}function $(c,n){const m=new Date(c);return Number.isNaN(m.getTime())?"":new Intl.DateTimeFormat(n==="zh"?"zh-CN":"en-US",{year:"numeric",month:"short"}).format(m)}function H(){const c=b(),{myTeams:n,isLoading:m,refetch:N}=v(),{user:l}=C(),[h,i]=d.useState(!1),o=s=>{i(!1),window.history.pushState(null,"",`/teams/${s.slug}`),window.dispatchEvent(new PopStateEvent("popstate"))},x=s=>(l==null?void 0:l.role)==="admin"||s.created_by===(l==null?void 0:l.userId),p=async s=>{if(window.confirm(f("team.list.deleteConfirm",{name:s.name})))try{await S("DELETE",`/web/teams/${s.id}`),await N()}catch(r){alert(r instanceof Error?r.message:a("team.list.deleteFailed"))}};return m?e.jsxs("div",{className:"ds-page",children:[e.jsxs("header",{className:"ds-page-head",children:[e.jsx("div",{className:"ds-page-runhead",children:e.jsx("div",{className:"h-2.5 w-20 animate-pulse rounded bg-surface-2"})}),e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("div",{className:"h-12 w-44 animate-pulse rounded bg-surface-2"}),e.jsxs("div",{className:"ds-page-titlerow-end",children:[e.jsx("div",{className:"h-2.5 w-14 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-7 w-24 animate-pulse rounded-sm bg-surface-2"})]})]}),e.jsx("div",{className:"h-4 w-72 animate-pulse rounded bg-surface-2"})]}),e.jsx("div",{className:"space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]}):e.jsxs("div",{className:"ds-page",children:[e.jsxs("header",{className:"ds-page-head",children:[e.jsx("div",{className:"ds-page-runhead",children:e.jsx("span",{className:"ds-page-runhead-label",children:a("team.list.kicker")})}),e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:a("team.list.title")}),e.jsxs("div",{className:"ds-page-titlerow-end",children:[n.length>0&&e.jsx("span",{className:"ds-page-count",children:f("team.list.count",{n:n.length})}),e.jsx("button",{type:"button",onClick:()=>i(!0),className:"btn-ticket",children:a("team.list.create")})]})]}),e.jsx("p",{className:"ds-page-lede",children:n.length===0?a("team.list.empty"):a("team.list.lede")})]}),n.length>0&&e.jsx("ul",{className:"space-y-10",children:n.map((s,r)=>{const u=$(s.created_at,c);return e.jsxs("li",{className:"ds-team-item group",children:[e.jsxs("a",{href:`/teams/${s.slug}`,className:"ds-team-link",children:[e.jsxs("div",{className:"ds-team-name",children:[e.jsx("span",{className:"ds-team-idx","aria-hidden":"true",children:String(r+1).padStart(2,"0")}),e.jsx("h2",{className:"font-display text-lg font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:a("team.list.noDescription")})]}),e.jsxs("div",{className:"ds-team-aside",children:[u&&e.jsxs("span",{className:"ds-team-date",children:[a("team.list.founded")," ",u]}),x(s)&&e.jsx("button",{type:"button",onClick:()=>p(s),className:"ds-team-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:a("team.list.delete"),"aria-label":a("team.list.delete"),children:e.jsx(D,{className:"h-4 w-4"})})]})]},s.id)})}),e.jsx(L,{open:h,onClose:()=>i(!1),onCreated:o})]})}export{H as TeamList};
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a$ as b,b0 as v,aT as a,a_ as C,aU as f,N as D,W as S}from"./main-DifWL4zR.js";import{D as E,a as T,d as k}from"./dialog-tLY80h3R.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function L({open:c,onClose:n,onCreated:m}){b();const{createTeam:N}=v(),[l,h]=d.useState(""),[i,o]=d.useState(""),[x,p]=d.useState(""),[s,r]=d.useState(""),[u,j]=d.useState(!1);d.useEffect(()=>{c&&(h(""),o(""),p(""),r(""),j(!1))},[c]);const w=t=>{h(t),i||o(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},y=async t=>{t.preventDefault(),r(""),j(!0);try{const g=await N({name:l,slug:i,description:x||void 0});m(g)}catch(g){r(g instanceof Error?g.message:a("team.create.failed"))}finally{j(!1)}};return e.jsx(E,{open:c,onOpenChange:t=>{t||n()},children:e.jsx(T,{className:"nsd-shell max-w-md",children:e.jsxs("form",{className:"nsd-box nsd-box--single",onSubmit:y,children:[e.jsx(k,{className:"nsd-h",children:a("team.create.title")}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.name")}),e.jsx("input",{type:"text",required:!0,value:l,onChange:t=>w(t.target.value),placeholder:"Engineering",className:"nsd-title"}),e.jsx("span",{className:"text-xs text-text-muted",children:a("team.create.nameHint")})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.slug")}),e.jsx("input",{type:"text",required:!0,value:i,onChange:t=>o(t.target.value),pattern:"^[a-z0-9-]{3,32}$",placeholder:"engineering",className:"nsd-title"}),e.jsx("span",{className:"text-xs text-text-muted",children:a("team.create.slugHint")})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.description")}),e.jsx("textarea",{value:x,onChange:t=>p(t.target.value),rows:3,className:"nsd-title nsd-area"})]}),s&&e.jsx("p",{className:"nsd-error",children:s}),e.jsxs("div",{className:"nsd-foot",children:[e.jsx("button",{type:"button",onClick:n,className:"nsd-cancel",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:u||!l||!i,className:"btn-ticket nsd-create",children:u?a("common.creating"):a("team.create.submit")})]})]})})})}function $(c,n){const m=new Date(c);return Number.isNaN(m.getTime())?"":new Intl.DateTimeFormat(n==="zh"?"zh-CN":"en-US",{year:"numeric",month:"short"}).format(m)}function H(){const c=b(),{myTeams:n,isLoading:m,refetch:N}=v(),{user:l}=C(),[h,i]=d.useState(!1),o=s=>{i(!1),window.history.pushState(null,"",`/teams/${s.slug}`),window.dispatchEvent(new PopStateEvent("popstate"))},x=s=>(l==null?void 0:l.role)==="admin"||s.created_by===(l==null?void 0:l.userId),p=async s=>{if(window.confirm(f("team.list.deleteConfirm",{name:s.name})))try{await S("DELETE",`/web/teams/${s.id}`),await N()}catch(r){alert(r instanceof Error?r.message:a("team.list.deleteFailed"))}};return m?e.jsxs("div",{className:"ds-page",children:[e.jsxs("header",{className:"ds-page-head",children:[e.jsx("div",{className:"ds-page-runhead",children:e.jsx("div",{className:"h-2.5 w-20 animate-pulse rounded bg-surface-2"})}),e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("div",{className:"h-12 w-44 animate-pulse rounded bg-surface-2"}),e.jsxs("div",{className:"ds-page-titlerow-end",children:[e.jsx("div",{className:"h-2.5 w-14 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-7 w-24 animate-pulse rounded-sm bg-surface-2"})]})]}),e.jsx("div",{className:"h-4 w-72 animate-pulse rounded bg-surface-2"})]}),e.jsx("div",{className:"space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]}):e.jsxs("div",{className:"ds-page",children:[e.jsxs("header",{className:"ds-page-head",children:[e.jsx("div",{className:"ds-page-runhead",children:e.jsx("span",{className:"ds-page-runhead-label",children:a("team.list.kicker")})}),e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:a("team.list.title")}),e.jsxs("div",{className:"ds-page-titlerow-end",children:[n.length>0&&e.jsx("span",{className:"ds-page-count",children:f("team.list.count",{n:n.length})}),e.jsx("button",{type:"button",onClick:()=>i(!0),className:"btn-ticket",children:a("team.list.create")})]})]}),e.jsx("p",{className:"ds-page-lede",children:n.length===0?a("team.list.empty"):a("team.list.lede")})]}),n.length>0&&e.jsx("ul",{className:"space-y-10",children:n.map((s,r)=>{const u=$(s.created_at,c);return e.jsxs("li",{className:"ds-team-item group",children:[e.jsxs("a",{href:`/teams/${s.slug}`,className:"ds-team-link",children:[e.jsxs("div",{className:"ds-team-name",children:[e.jsx("span",{className:"ds-team-idx","aria-hidden":"true",children:String(r+1).padStart(2,"0")}),e.jsx("h2",{className:"font-display text-lg font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:a("team.list.noDescription")})]}),e.jsxs("div",{className:"ds-team-aside",children:[u&&e.jsxs("span",{className:"ds-team-date",children:[a("team.list.founded")," ",u]}),x(s)&&e.jsx("button",{type:"button",onClick:()=>p(s),className:"ds-team-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:a("team.list.delete"),"aria-label":a("team.list.delete"),children:e.jsx(D,{className:"h-4 w-4"})})]})]},s.id)})}),e.jsx(L,{open:h,onClose:()=>i(!1),onCreated:o})]})}export{H as TeamList};
@@ -1 +1 @@
1
- import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{W as c}from"./main-BEcUh0F7.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";async function j(s){try{const r=s.startsWith("team_")?`/web/teams/${s}`:`/web/teams/by-slug/${s}`;return await c("GET",r)}catch{return null}}async function w(s,r){await c("PATCH",`/web/teams/${s}`,r)}async function N(s){await c("DELETE",`/web/teams/${s}`)}function k(){const s=window.location.pathname.split("/"),r=s[s.length-2]||"",[a,f]=n.useState(null),[b,g]=n.useState(!0),[i,m]=n.useState(""),[d,l]=n.useState(""),[u,o]=n.useState(null),[x,h]=n.useState(!1);n.useEffect(()=>{r&&j(r).then(t=>{t&&(f(t),m(t.name),l(t.description||"")),g(!1)})},[r]);const v=async t=>{if(t.preventDefault(),!!a){o(null),h(!0);try{await w(a.id,{name:i,description:d}),window.location.href=`/teams/${a.slug}`}catch(p){o(p instanceof Error?p.message:"Failed to update")}finally{h(!1)}}},y=async()=>{if(a&&window.confirm("Delete this team? Environments must be transferred first."))try{await N(a.id),window.location.href="/teams"}catch(t){o(t instanceof Error?t.message:"Failed to delete")}};return b?e.jsx("div",{className:"ds-page text-text-muted",children:"Loading..."}):a?e.jsx("div",{className:"ds-page",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-12",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:a.name}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:["/",a.slug]})]}),e.jsxs("form",{onSubmit:v,className:"mb-16 max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:"Team Name"}),e.jsx("input",{id:"name",type:"text",required:!0,value:i,onChange:t=>m(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:"Description"}),e.jsx("textarea",{id:"description",value:d,onChange:t=>l(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),u&&e.jsx("p",{className:"text-sm text-destructive",children:u}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:x||!i,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:x?"Saving...":"Save Changes"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-sm font-medium text-destructive",children:"Delete team"}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Deleting a team requires all environments to be transferred first."}),e.jsx("button",{type:"button",onClick:y,className:"rounded-md border border-destructive/60 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors",children:"Delete Team"})]})]})}):e.jsx("div",{className:"ds-page",children:e.jsxs("div",{className:"max-w-lg",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})})}export{k as TeamSettings};
1
+ import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{W as c}from"./main-DifWL4zR.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";async function j(s){try{const r=s.startsWith("team_")?`/web/teams/${s}`:`/web/teams/by-slug/${s}`;return await c("GET",r)}catch{return null}}async function w(s,r){await c("PATCH",`/web/teams/${s}`,r)}async function N(s){await c("DELETE",`/web/teams/${s}`)}function k(){const s=window.location.pathname.split("/"),r=s[s.length-2]||"",[a,f]=n.useState(null),[b,g]=n.useState(!0),[i,m]=n.useState(""),[d,l]=n.useState(""),[u,o]=n.useState(null),[x,h]=n.useState(!1);n.useEffect(()=>{r&&j(r).then(t=>{t&&(f(t),m(t.name),l(t.description||"")),g(!1)})},[r]);const v=async t=>{if(t.preventDefault(),!!a){o(null),h(!0);try{await w(a.id,{name:i,description:d}),window.location.href=`/teams/${a.slug}`}catch(p){o(p instanceof Error?p.message:"Failed to update")}finally{h(!1)}}},y=async()=>{if(a&&window.confirm("Delete this team? Environments must be transferred first."))try{await N(a.id),window.location.href="/teams"}catch(t){o(t instanceof Error?t.message:"Failed to delete")}};return b?e.jsx("div",{className:"ds-page text-text-muted",children:"Loading..."}):a?e.jsx("div",{className:"ds-page",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-12",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:a.name}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:["/",a.slug]})]}),e.jsxs("form",{onSubmit:v,className:"mb-16 max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:"Team Name"}),e.jsx("input",{id:"name",type:"text",required:!0,value:i,onChange:t=>m(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:"Description"}),e.jsx("textarea",{id:"description",value:d,onChange:t=>l(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),u&&e.jsx("p",{className:"text-sm text-destructive",children:u}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:x||!i,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:x?"Saving...":"Save Changes"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-sm font-medium text-destructive",children:"Delete team"}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Deleting a team requires all environments to be transferred first."}),e.jsx("button",{type:"button",onClick:y,className:"rounded-md border border-destructive/60 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors",children:"Delete Team"})]})]})}):e.jsx("div",{className:"ds-page",children:e.jsxs("div",{className:"max-w-lg",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})})}export{k as TeamSettings};