@saluzi/saluzi-edu 0.7.21 → 0.7.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/cli.js +55 -55
  2. package/dist/rcs-web/assets/{AdminPanel-jgwgrsVM.js → AdminPanel-kHOmCjvI.js} +1 -1
  3. package/dist/rcs-web/assets/{ArtifactView-BYrK33ug.js → ArtifactView-DSEwTsDl.js} +1 -1
  4. package/dist/rcs-web/assets/{ArtifactsGallery-CRFsE12L.js → ArtifactsGallery-BBnDfj2k.js} +1 -1
  5. package/{packages/remote-control-server/web/dist/assets/Claim-6emQ-SVR.js → dist/rcs-web/assets/Claim-B2Xu_cvl.js} +1 -1
  6. package/dist/rcs-web/assets/{Dashboard-DBI7CC6n.js → Dashboard-BJqvH4Wh.js} +1 -1
  7. package/dist/rcs-web/assets/{Join-DC_rWotf.js → Join-C3FQBiYX.js} +1 -1
  8. package/{packages/remote-control-server/web/dist/assets/Login-B8gUS3O-.js → dist/rcs-web/assets/Login-DMdqmsTJ.js} +1 -1
  9. package/dist/rcs-web/assets/{MemoriesPage-BsU6Szxn.js → MemoriesPage-CjRfwKDG.js} +1 -1
  10. package/{packages/remote-control-server/web/dist/assets/MemoryTypeChips-CmoLhMX_.js → dist/rcs-web/assets/MemoryTypeChips-DmuM1mnc.js} +1 -1
  11. package/dist/rcs-web/assets/{Register-C8E6Qs1U.js → Register-n4PilsVQ.js} +1 -1
  12. package/dist/rcs-web/assets/{RegisterEmpty-DZsgoKf3.js → RegisterEmpty-X-9vRPKk.js} +1 -1
  13. package/dist/rcs-web/assets/{SessionDetail-B_A6aCRq.js → SessionDetail-CM8lZ9rp.js} +2 -2
  14. package/dist/rcs-web/assets/{SessionVisibilityBadge-DYOhsKVV.js → SessionVisibilityBadge-DuPAMDm1.js} +1 -1
  15. package/dist/rcs-web/assets/{Setup-kURI6wq2.js → Setup-DfGuh7jn.js} +1 -1
  16. package/dist/rcs-web/assets/{ShareLanding-BK4eSvOG.js → ShareLanding-CkVddcMe.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamDetail-EcCza1lF.js → TeamDetail-DuizvSbi.js} +1 -1
  18. package/dist/rcs-web/assets/{TeamList-DAMTHBZt.js → TeamList-BdVZ9Tjt.js} +1 -1
  19. package/dist/rcs-web/assets/{TeamSettings-BcRIGvC4.js → TeamSettings-B8P4jDlV.js} +1 -1
  20. package/dist/rcs-web/assets/{UserSearchInput-BgwNP3Sb.js → UserSearchInput-eNdovFoR.js} +1 -1
  21. package/dist/rcs-web/assets/{UserSettings-NlYkR5UG.js → UserSettings-Bif5fxbq.js} +1 -1
  22. package/dist/rcs-web/assets/{arc-C3mH9Q9f.js → arc-ApDTthsU.js} +1 -1
  23. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-DHjp0FgQ.js → architectureDiagram-3BPJPVTR-bsc4_GGC.js} +1 -1
  24. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-KZfe-1dt.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-fIfab7zF.js} +1 -1
  25. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-B0mzOxKG.js → c4Diagram-AAUBKEIU-CZfXwXa1.js} +1 -1
  26. package/dist/rcs-web/assets/channel-BGtRlTca.js +1 -0
  27. package/dist/rcs-web/assets/{chunk-2J33WTMH-Dm5bnN3F.js → chunk-2J33WTMH-b8OaiWft.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-4BX2VUAB-D4s6TD3B.js → chunk-4BX2VUAB-D3B2lnxT.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-55IACEB6-DxKvmXly.js → chunk-55IACEB6-Cpmx_iFV.js} +1 -1
  30. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-Cr-D6LQ6.js → dist/rcs-web/assets/chunk-727SXJPM-M4sLpc_k.js} +1 -1
  31. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-DI2_e21Y.js → dist/rcs-web/assets/chunk-AQP2D5EJ-CIA-MGb9.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-FMBD7UC4-DUPy18CF.js → chunk-FMBD7UC4-CKNzLHmp.js} +1 -1
  33. package/dist/rcs-web/assets/{chunk-ND2GUHAM-Bk6WZP_y.js → chunk-ND2GUHAM-DN0Pnvc3.js} +1 -1
  34. package/dist/rcs-web/assets/{chunk-QZHKN3VN-DauwjXGF.js → chunk-QZHKN3VN-BLV90OZ4.js} +1 -1
  35. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BgkYB8h2.js +1 -0
  36. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BgkYB8h2.js +1 -0
  37. package/dist/rcs-web/assets/{code-block-IT6T5CEO-BTZXxR5P.js → code-block-IT6T5CEO-YmW1Op0G.js} +1 -1
  38. package/dist/rcs-web/assets/{copy-nuU4lqSF.js → copy-B9nUKyEJ.js} +1 -1
  39. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-DpX9JHxm.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-CcOR8zyS.js} +1 -1
  40. package/dist/rcs-web/assets/{dagre-BM42HDAG-nfHVcSW5.js → dagre-BM42HDAG-L7HbuqzP.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-2AECGRRQ-SD3VQXzS.js → diagram-2AECGRRQ-l1-ofpMb.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-5GNKFQAL-Cbc6TJZr.js → diagram-5GNKFQAL-D2K3iWps.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-KO2AKTUF-DgbsqLrt.js → diagram-KO2AKTUF-CQixgeJD.js} +1 -1
  44. package/dist/rcs-web/assets/{diagram-LMA3HP47-CQRvOl3e.js → diagram-LMA3HP47-Dn_sZo_M.js} +1 -1
  45. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-Dw7PxBc0.js → dist/rcs-web/assets/diagram-OG6HWLK6-1pw2POh5.js} +1 -1
  46. package/dist/rcs-web/assets/{dialog-BnYwGN7f.js → dialog-BrV9mMDa.js} +1 -1
  47. package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-BYDhdF85.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-BQQDCBvA.js} +1 -1
  48. package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-BoX-Rktr.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-B2kdDyaf.js} +1 -1
  49. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CGVflxrp.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-Bpl3yw8I.js} +1 -1
  50. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-CDvTRphH.js → gitGraphDiagram-PVQCEYII-D-G0DXPv.js} +1 -1
  51. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-BPdidON5.js → infoDiagram-5YYISTIA-BZeanrdj.js} +1 -1
  52. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-Duq03F91.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-DnY_nCN3.js} +1 -1
  53. package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-Dl2LCWzd.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-CrEsg35t.js} +1 -1
  54. package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-BcDlHzGd.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-C13u_rgt.js} +1 -1
  55. package/dist/rcs-web/assets/{linear-BAC9tjKk.js → linear-CvzpbjB-.js} +1 -1
  56. package/dist/rcs-web/assets/{main-D4UrY-Md.js → main-B2Nonos_.js} +3 -3
  57. package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-DKH74pwH.js → dist/rcs-web/assets/mermaid-VLURNSYL-CTnstEJM.js} +4 -4
  58. package/dist/rcs-web/assets/{mermaid.core-DeXmOLAa.js → mermaid.core-B3yjGcGs.js} +5 -5
  59. package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-BeseLVV4.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-DAntFhWL.js} +1 -1
  60. package/dist/rcs-web/assets/{notifications-Dy1TLdMd.js → notifications-ohY2H57s.js} +1 -1
  61. package/{packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-DTAlsziT.js → dist/rcs-web/assets/pieDiagram-4H26LBE5-zxkZXG3z.js} +1 -1
  62. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-DPkdJG6-.js → quadrantDiagram-W4KKPZXB-CcUtZsbh.js} +1 -1
  63. package/dist/rcs-web/assets/{refresh-cw-CDGW_U62.js → refresh-cw-Cgx8H9zR.js} +1 -1
  64. package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-BxnovqkB.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-CY2QH1gL.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DRyb3xR-.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DbcEA3qL.js} +1 -1
  66. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-BXEXoeax.js → sequenceDiagram-3UESZ5HK-Dqd1vAf1.js} +1 -1
  67. package/{packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-DEc2DNqh.js → dist/rcs-web/assets/stateDiagram-AJRCARHV-B-atzG-h.js} +1 -1
  68. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-BtSEOTN_.js → stateDiagram-v2-BHNVJYJU-BNE2glm0.js} +1 -1
  69. package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-fS3V0gH0.js → timeline-definition-PNZ67QCA-C4O4XjXc.js} +1 -1
  70. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-D8oebqKY.js → vennDiagram-CIIHVFJN-C60HcUPn.js} +1 -1
  71. package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-CIO62aPg.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-DwrjdIQB.js} +1 -1
  72. package/dist/rcs-web/assets/{workerType-Bjs5mpVV.js → workerType-DA-wSQX5.js} +1 -1
  73. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-CQ-Hfta3.js → xychartDiagram-2RQKCTM6-B-C8mDsp.js} +1 -1
  74. package/dist/rcs-web/index.html +1 -1
  75. package/package.json +1 -1
  76. package/packages/remote-control-server/web/dist/assets/{AdminPanel-jgwgrsVM.js → AdminPanel-kHOmCjvI.js} +1 -1
  77. package/packages/remote-control-server/web/dist/assets/{ArtifactView-BYrK33ug.js → ArtifactView-DSEwTsDl.js} +1 -1
  78. package/packages/remote-control-server/web/dist/assets/{ArtifactsGallery-CRFsE12L.js → ArtifactsGallery-BBnDfj2k.js} +1 -1
  79. package/{dist/rcs-web/assets/Claim-6emQ-SVR.js → packages/remote-control-server/web/dist/assets/Claim-B2Xu_cvl.js} +1 -1
  80. package/packages/remote-control-server/web/dist/assets/{Dashboard-DBI7CC6n.js → Dashboard-BJqvH4Wh.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Join-DC_rWotf.js → Join-C3FQBiYX.js} +1 -1
  82. package/{dist/rcs-web/assets/Login-B8gUS3O-.js → packages/remote-control-server/web/dist/assets/Login-DMdqmsTJ.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/{MemoriesPage-BsU6Szxn.js → MemoriesPage-CjRfwKDG.js} +1 -1
  84. package/{dist/rcs-web/assets/MemoryTypeChips-CmoLhMX_.js → packages/remote-control-server/web/dist/assets/MemoryTypeChips-DmuM1mnc.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/{Register-C8E6Qs1U.js → Register-n4PilsVQ.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/{RegisterEmpty-DZsgoKf3.js → RegisterEmpty-X-9vRPKk.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/{SessionDetail-B_A6aCRq.js → SessionDetail-CM8lZ9rp.js} +2 -2
  88. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-DYOhsKVV.js → SessionVisibilityBadge-DuPAMDm1.js} +1 -1
  89. package/packages/remote-control-server/web/dist/assets/{Setup-kURI6wq2.js → Setup-DfGuh7jn.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/{ShareLanding-BK4eSvOG.js → ShareLanding-CkVddcMe.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/{TeamDetail-EcCza1lF.js → TeamDetail-DuizvSbi.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{TeamList-DAMTHBZt.js → TeamList-BdVZ9Tjt.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{TeamSettings-BcRIGvC4.js → TeamSettings-B8P4jDlV.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-BgwNP3Sb.js → UserSearchInput-eNdovFoR.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/{UserSettings-NlYkR5UG.js → UserSettings-Bif5fxbq.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{arc-C3mH9Q9f.js → arc-ApDTthsU.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-DHjp0FgQ.js → architectureDiagram-3BPJPVTR-bsc4_GGC.js} +1 -1
  98. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-KZfe-1dt.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-fIfab7zF.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-B0mzOxKG.js → c4Diagram-AAUBKEIU-CZfXwXa1.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/channel-BGtRlTca.js +1 -0
  101. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Dm5bnN3F.js → chunk-2J33WTMH-b8OaiWft.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-D4s6TD3B.js → chunk-4BX2VUAB-D3B2lnxT.js} +1 -1
  103. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-DxKvmXly.js → chunk-55IACEB6-Cpmx_iFV.js} +1 -1
  104. package/{dist/rcs-web/assets/chunk-727SXJPM-Cr-D6LQ6.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-M4sLpc_k.js} +1 -1
  105. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-DI2_e21Y.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-CIA-MGb9.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DUPy18CF.js → chunk-FMBD7UC4-CKNzLHmp.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-Bk6WZP_y.js → chunk-ND2GUHAM-DN0Pnvc3.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-DauwjXGF.js → chunk-QZHKN3VN-BLV90OZ4.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BgkYB8h2.js +1 -0
  110. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BgkYB8h2.js +1 -0
  111. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-BTZXxR5P.js → code-block-IT6T5CEO-YmW1Op0G.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{copy-nuU4lqSF.js → copy-B9nUKyEJ.js} +1 -1
  113. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-DpX9JHxm.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CcOR8zyS.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-nfHVcSW5.js → dagre-BM42HDAG-L7HbuqzP.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-SD3VQXzS.js → diagram-2AECGRRQ-l1-ofpMb.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-Cbc6TJZr.js → diagram-5GNKFQAL-D2K3iWps.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-DgbsqLrt.js → diagram-KO2AKTUF-CQixgeJD.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-CQRvOl3e.js → diagram-LMA3HP47-Dn_sZo_M.js} +1 -1
  119. package/{dist/rcs-web/assets/diagram-OG6HWLK6-Dw7PxBc0.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-1pw2POh5.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{dialog-BnYwGN7f.js → dialog-BrV9mMDa.js} +1 -1
  121. package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-BYDhdF85.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-BQQDCBvA.js} +1 -1
  122. package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-BoX-Rktr.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-B2kdDyaf.js} +1 -1
  123. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CGVflxrp.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-Bpl3yw8I.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-CDvTRphH.js → gitGraphDiagram-PVQCEYII-D-G0DXPv.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-BPdidON5.js → infoDiagram-5YYISTIA-BZeanrdj.js} +1 -1
  126. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-Duq03F91.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-DnY_nCN3.js} +1 -1
  127. package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-Dl2LCWzd.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-CrEsg35t.js} +1 -1
  128. package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-BcDlHzGd.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-C13u_rgt.js} +1 -1
  129. package/packages/remote-control-server/web/dist/assets/{linear-BAC9tjKk.js → linear-CvzpbjB-.js} +1 -1
  130. package/packages/remote-control-server/web/dist/assets/{main-D4UrY-Md.js → main-B2Nonos_.js} +3 -3
  131. package/{dist/rcs-web/assets/mermaid-VLURNSYL-DKH74pwH.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-CTnstEJM.js} +4 -4
  132. package/packages/remote-control-server/web/dist/assets/{mermaid.core-DeXmOLAa.js → mermaid.core-B3yjGcGs.js} +5 -5
  133. package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-BeseLVV4.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-DAntFhWL.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{notifications-Dy1TLdMd.js → notifications-ohY2H57s.js} +1 -1
  135. package/{dist/rcs-web/assets/pieDiagram-4H26LBE5-DTAlsziT.js → packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-zxkZXG3z.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-DPkdJG6-.js → quadrantDiagram-W4KKPZXB-CcUtZsbh.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/{refresh-cw-CDGW_U62.js → refresh-cw-Cgx8H9zR.js} +1 -1
  138. package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-BxnovqkB.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-CY2QH1gL.js} +1 -1
  139. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DRyb3xR-.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DbcEA3qL.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-BXEXoeax.js → sequenceDiagram-3UESZ5HK-Dqd1vAf1.js} +1 -1
  141. package/{dist/rcs-web/assets/stateDiagram-AJRCARHV-DEc2DNqh.js → packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-B-atzG-h.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-BtSEOTN_.js → stateDiagram-v2-BHNVJYJU-BNE2glm0.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-fS3V0gH0.js → timeline-definition-PNZ67QCA-C4O4XjXc.js} +1 -1
  144. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-D8oebqKY.js → vennDiagram-CIIHVFJN-C60HcUPn.js} +1 -1
  145. package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-CIO62aPg.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-DwrjdIQB.js} +1 -1
  146. package/packages/remote-control-server/web/dist/assets/{workerType-Bjs5mpVV.js → workerType-DA-wSQX5.js} +1 -1
  147. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-CQ-Hfta3.js → xychartDiagram-2RQKCTM6-B-C8mDsp.js} +1 -1
  148. package/packages/remote-control-server/web/dist/index.html +1 -1
  149. package/dist/rcs-web/assets/channel-CGvAbTqs.js +0 -1
  150. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BydJAcJO.js +0 -1
  151. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BydJAcJO.js +0 -1
  152. package/packages/remote-control-server/web/dist/assets/channel-CGvAbTqs.js +0 -1
  153. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BydJAcJO.js +0 -1
  154. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BydJAcJO.js +0 -1
@@ -1,4 +1,4 @@
1
- var bn=Object.defineProperty;var jn=(r,t,s)=>t in r?bn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var I=(r,t,s)=>jn(r,typeof t!="symbol"?t+"":t,s);import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{aA as J,af as wn,aI as ts,aH as ss,aO as i,aK as vn,aJ as ht,aP as B,aF as je,at as kn,as as X,ai as Nn,ap as Sn,aT as _n,aW as se,T as Cn,Q as Tn,X as Ds,L as ze,H as En,I as Mn,i as ns,aE as Rn,N as An,aB as yt,e as Ae,S as gt,M as In,y as $n,aC as Z,ay as xe,aD as Dn,aQ as qn,G as On,D as Pn,aR as rs,aj as Fn,a1 as Kn,ao as Un,aX as Ln,ad as qs,ab as Bn,a9 as Hn,aq as Qn,al as Wn,P as Yn,t as zn,B as Dt,$ as Vn,A as Gn,aG as Jn,aL as Xn,aM as Zn,Z as as,a0 as er,aS as tr,b as sr,a4 as os,am as nr,K as Os,F as rr,d as ar,C as or,ae as is,l as ir,a as lr,u as Ve,w as Ge,E as cr,g as Je,f as Xe,v as Ze,s as dr}from"./main-D4UrY-Md.js";import{A as ur,g as Ps}from"./workerType-Bjs5mpVV.js";import{D as we,a as ve,c as Ie,d as ke,b as mr}from"./dialog-BnYwGN7f.js";import{R as xr}from"./refresh-cw-CDGW_U62.js";import{A as pr,U as fr}from"./UserSearchInput-BgwNP3Sb.js";import{C as hr}from"./copy-nuU4lqSF.js";import{E as yr,S as gr,A as br}from"./ArtifactsGallery-CRFsE12L.js";import{S as jr}from"./SessionVisibilityBadge-DYOhsKVV.js";import{D as Et,u as wr,d as vr,e as kr,F as ls,c as Nr,b as Sr,T as _r,h as Cr,a as Tr,M as Er}from"./MemoryTypeChips-CmoLhMX_.js";import{S as Mr,b as Rr}from"./notifications-Dy1TLdMd.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";/**
1
+ var bn=Object.defineProperty;var jn=(r,t,s)=>t in r?bn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var I=(r,t,s)=>jn(r,typeof t!="symbol"?t+"":t,s);import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{aA as J,af as wn,aI as ts,aH as ss,aO as i,aK as vn,aJ as ht,aP as B,aF as je,at as kn,as as X,ai as Nn,ap as Sn,aT as _n,aW as se,T as Cn,Q as Tn,X as Ds,L as ze,H as En,I as Mn,i as ns,aE as Rn,N as An,aB as yt,e as Ae,S as gt,M as In,y as $n,aC as Z,ay as xe,aD as Dn,aQ as qn,G as On,D as Pn,aR as rs,aj as Fn,a1 as Kn,ao as Un,aX as Ln,ad as qs,ab as Bn,a9 as Hn,aq as Qn,al as Wn,P as Yn,t as zn,B as Dt,$ as Vn,A as Gn,aG as Jn,aL as Xn,aM as Zn,Z as as,a0 as er,aS as tr,b as sr,a4 as os,am as nr,K as Os,F as rr,d as ar,C as or,ae as is,l as ir,a as lr,u as Ve,w as Ge,E as cr,g as Je,f as Xe,v as Ze,s as dr}from"./main-B2Nonos_.js";import{A as ur,g as Ps}from"./workerType-DA-wSQX5.js";import{D as we,a as ve,c as Ie,d as ke,b as mr}from"./dialog-BrV9mMDa.js";import{R as xr}from"./refresh-cw-Cgx8H9zR.js";import{A as pr,U as fr}from"./UserSearchInput-eNdovFoR.js";import{C as hr}from"./copy-B9nUKyEJ.js";import{E as yr,S as gr,A as br}from"./ArtifactsGallery-BBnDfj2k.js";import{S as jr}from"./SessionVisibilityBadge-DuPAMDm1.js";import{D as Et,u as wr,d as vr,e as kr,F as ls,c as Nr,b as Sr,T as _r,h as Cr,a as Tr,M as Er}from"./MemoryTypeChips-DmuM1mnc.js";import{S as Mr,b as Rr}from"./notifications-ohY2H57s.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.
@@ -73,6 +73,6 @@ var bn=Object.defineProperty;var jn=(r,t,s)=>t in r?bn(r,t,{enumerable:!0,config
73
73
  ${_}
74
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}),_=g.textContent||i("attach.emptyDirectory");u.push({type:"text",text:`${b}
75
75
  ${_}`})}}const f=u.length===1&&u[0].type==="text"?u[0].text||t:u.length>0?u:t;try{const g=je();this.postedUserUuids.add(g);const b=await kn(this.sessionId,{type:"user",uuid:g,content:t,message:{content:f}}),_=(p=b==null?void 0:b.event)==null?void 0:p.id;_&&this.setEntries(T=>T.map(C=>C.type==="user_message"&&C.id===c.id?{...C,id:_}:C))}catch(g){throw this.setEntries(b=>b.filter(_=>!(_.type==="user_message"&&_.id===c.id))),g}}async respondPermission(t,s,n){await X(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 Nn(this.sessionId)}async setPermissionMode(t){const s=je();return await X(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_permission_mode",mode:t}}),s}async controlRoundTrip(t,s=8e3){const n=je(),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 X(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 X(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=je();return await X(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_effort",...t?{effort:t}:{effort:null}}}),s}async setTokenMode(t){const s=je();return await X(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_token_mode",mode:t}}),s}async setThinkingBudget(t){const s=je();return await X(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 f=c.serverInfo,p=c.config;n.push({name:c.name,status:u,...f&&typeof f.name=="string"&&typeof f.version=="string"?{serverInfo:{name:f.name,version:f.version}}:{},...typeof c.error=="string"&&c.error?{error:c.error}:{},...typeof(p==null?void 0:p.url)=="string"&&p.url?{url:p.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 f=u;typeof f.source=="string"&&c.push({source:f.source,settings:f.settings&&typeof f.settings=="object"&&!Array.isArray(f.settings)?f.settings:{}})}return{applied:{model:typeof(n==null?void 0:n.model)=="string"?n.model:null,effort:typeof(n==null?void 0:n.effort)=="string"?n.effort:null,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 Sn(this.sessionId,t)}async endSession(t){await X(this.sessionId,{type:"control_request",request_id:je(),request:{subtype:"end_session",...t?{reason:t}:{}}})}}function aa(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function xt({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(Cn,{className:"h-7 w-7"}),e.jsx(Tn,{compact:!0,onSettingsClick:()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))}})]})})}const js="rcs:subagent-panel:collapsed";function oa(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 ia(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 la({status:r}){return r==="running"?e.jsx(ze,{className:"h-3 w-3 animate-spin text-brand-text"}):r==="completed"?e.jsx(Wr,{className:"h-3 w-3 text-status-success"}):r==="failed"||r==="stopped"?e.jsx(En,{className:"h-3 w-3 text-status-error"}):null}function Qs({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=ia(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(la,{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:oa(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(Ds,{className:"h-3.5 w-3.5"})})]})}function ca({state:r,onStopTask:t}){const[s,n]=l.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(js)==="1"}catch{return!1}}),a=()=>{n(b=>{const _=!b;try{window.localStorage.setItem(js,_?"1":"0")}catch{}return _})},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(_=>_+1)},1e3);return()=>clearInterval(b)},[d,c]);const f=Hs(r);if(f.length===0)return null;const p=f.filter(b=>b.status==="running").length,g=p>0?`${p} running`:`${f.length} recent`;return e.jsx("section",{"aria-label":"Subagents",className:"border-t border-border bg-surface-1 px-4 py-2",children:e.jsxs("div",{className:"mx-auto max-w-3xl space-y-1.5",children:[e.jsxs("button",{type:"button",onClick:a,"aria-expanded":!s,"aria-controls":"subagent-list",className:"flex w-full items-center justify-between text-[10px] font-medium uppercase tracking-wide text-text-muted hover:text-text-secondary transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Fs,{className:`h-3 w-3 transition-transform ${s?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:g})]}),!s&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:f.map(b=>e.jsx(Qs,{task:b,onStopTask:t},b.taskId))})]})})}function da(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 ua(r){return r?Date.now()-r<6e4:!1}function ma({onClose:r,session:t,liveStatus:s,pendingPermissions:n,onInterrupt:a,onDelete:d,subagentState:c,onStopTask:u,onEndSession:f}){const[p,g]=l.useState(!1),b=async()=>{await navigator.clipboard.writeText(t.id),g(!0),setTimeout(()=>g(!1),1500)},[_,T]=l.useState(!1),C=async()=>{if(!(!f||_)&&window.confirm(i("task.endConfirm"))){T(!0);try{await f(),r()}catch{T(!1)}}},m=n.length,h=t.worker,v=t.work_item,k=t.environment;return e.jsx(we,{open:!0,onOpenChange:R=>{R||r()},children:e.jsxs(ve,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-96 h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md overflow-y-auto",children:[e.jsx(Ie,{children:e.jsx(ke,{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(ur,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mn,{status:s||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:h&&(ua(h.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[h&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(ns,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:da(h.last_heartbeat_at)})]}),(t.environment_id||k)&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Ks,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:(k==null?void 0:k.machine_name)||t.environment_id||(k==null?void 0:k.id)})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(ns,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Rn(t.created_at)})]})]})]}),e.jsx(fa,{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(ze,{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(Vr,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:a,className:"flex-1 rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-2 transition-colors",children:"Interrupt"}),f&&e.jsx("button",{onClick:C,disabled:_,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:_?"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(An,{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(Fr,{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:p?"✓":"⧉"})]})]}),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:Ps(t.source==="acp"?"acp":k==null?void 0:k.worker_type).fullLabel})]})]})]})]})]})})}const xa={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"},pa=new Set(["dream"]);function fa({state:r,onStopTask:t}){const s=Object.values(r.tasks).some(f=>f.status==="running"),n=Object.values(r.tasks).some(f=>f.status!=="running"&&f.evictAfter!==void 0),[,a]=l.useState(0);l.useEffect(()=>{if(!s&&!n)return;const f=setInterval(()=>{a(p=>p+1)},1e3);return()=>clearInterval(f)},[s,n]);const d=Hs(r),c=d.filter(f=>f.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(Ur,{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:ta(d).map(f=>{const p=!pa.has(f.taskType),g=xa[f.taskType]??"task.type.tasks";return e.jsxs("div",{className:"space-y-1",children:[p&&e.jsxs("div",{className:"pl-1 text-[10px] font-medium uppercase tracking-wide text-text-muted/80",children:[i(g)," (",f.tasks.length,")"]}),f.tasks.map(b=>e.jsx(Qs,{task:b,onStopTask:t,fullText:!0},b.taskId))]},f.taskType)})})]})}const ha={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"},ya={connected:"mcp.status.connected",failed:"mcp.status.failed","needs-auth":"mcp.status.needsAuth",pending:"mcp.status.pending",disabled:"mcp.status.disabled"};function ga({onClose:r,fetchServers:t,onToggle:s,onReconnect:n}){se();const[a,d]=l.useState(null),[c,u]=l.useState(null),[f,p]=l.useState(null),[g,b]=l.useState(null),_=l.useCallback(async()=>{p(null),b(null);try{const m=await t();d(m),u(null)}catch(m){yt("[McpPanel] fetch failed",m),u(i("mcp.loadFailed"))}},[t]);l.useEffect(()=>{_()},[_]);const T=async m=>{const h=m.status==="disabled";p(`toggle:${m.name}`),b(null);try{const v=await s(m.name,h);v.ok||b(v.error||i("mcp.toggleFailed"))}finally{await _()}},C=async m=>{p(`reconnect:${m.name}`),b(null);try{const h=await n(m.name);h.ok||b(h.error||i("mcp.reconnectFailed"))}finally{await _()}};return e.jsx(we,{open:!0,onOpenChange:m=>{m||r()},children:e.jsxs(ve,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-96 h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md overflow-y-auto",children:[e.jsx(Ie,{children:e.jsxs(ke,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Ls,{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(ze,{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 h=f===`toggle:${m.name}`,v=f===`reconnect:${m.name}`,k=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 ${ha[m.status]}`,children:i(ya[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 C(m),disabled:v||k,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(xr,{className:`h-3.5 w-3.5 ${v?"animate-spin":""}`})}),e.jsx("button",{type:"button",role:"switch","aria-checked":!k,onClick:()=>void T(m),disabled:h,className:`relative h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${k?"bg-surface-3":"bg-brand"}`,title:k?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 ${k?"left-0.5":"left-4.5"}`})})]})]})},m.name)})]})]})})}const Ws=[{key:"autoMemoryEnabled",labelKey:"settings.autoMemory",defaultValue:!0},{key:"teamMemoryEnabled",labelKey:"settings.teamMemory",defaultValue:!1}],ba=new Set(Ws.map(r=>r.key));function ja(r){if(r==null)return i("settings.unset");if(typeof r=="string")return r;try{return JSON.stringify(r)}catch{return String(r)}}function ws(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 wa({onClose:r,fetchSettings:t,onApply:s}){se();const[n,a]=l.useState(null),[d,c]=l.useState(null),[u,f]=l.useState(""),[p,g]=l.useState(null),[b,_]=l.useState(null),[T,C]=l.useState(null),[m,h]=l.useState(!1),v=l.useCallback(async()=>{g(null),_(null),C(null),h(!1);try{const N=await t();a(N),c(N?null:i("settings.loadFailed"))}catch(N){yt("[SettingsDrawer] fetch failed",N),c(i("settings.loadFailed"))}},[t]);l.useEffect(()=>{v()},[v]);const k=l.useMemo(()=>n?Object.entries(n.effective).filter(([,N])=>N!==void 0).filter(([N])=>!N.startsWith("memoryV2")).sort(([N],[q])=>N.localeCompare(q)):[],[n]),R=l.useMemo(()=>{const N=u.trim().toLowerCase();return N?k.filter(([q,K])=>`${q} ${ja(K)}`.toLowerCase().includes(N)):k},[k,u]),j=N=>typeof N[1]=="boolean",w=l.useMemo(()=>R.filter(j).filter(([N])=>!ba.has(N)),[R]),F=l.useMemo(()=>R.filter(N=>!j(N)),[R]),E=l.useMemo(()=>T===null?null:k.find(([N])=>N===T)??null,[k,T]),P=async()=>{if(E)try{await navigator.clipboard.writeText(ws(E[1])),h(!0),window.setTimeout(()=>h(!1),1500)}catch(N){yt("[SettingsDrawer] copy failed",N)}},D=async(N,q)=>{g(N),_(null);try{const K=await s({[N]:!q});K.ok||_(K.error||i("settings.writeFailed"))}finally{await v()}};return e.jsx(we,{open:!0,onOpenChange:N=>{N||r()},children:e.jsxs(ve,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-96 h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md overflow-y-auto",children:[e.jsx(Ie,{children:e.jsxs(ke,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Bs,{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(ze,{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:()=>{C(null),h(!1)},className:"flex items-center gap-1.5 text-xs text-text-muted transition-colors hover:text-text-primary",children:[e.jsx(pr,{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:ws(E[1])}),e.jsxs("button",{type:"button",onClick:()=>void P(),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(Ae,{className:"h-3.5 w-3.5 text-status-success"}):e.jsx(hr,{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(gt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{value:u,onChange:N=>f(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")}),Ws.map(N=>{const q=n.effective[N.key],K=typeof q=="boolean"?q:N.defaultValue,G=p===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":K,disabled:G,onClick:()=>void D(N.key,K),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${K?"bg-brand":"bg-surface-3"}`,title:K?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 ${K?"left-4.5":"left-0.5"}`})})]},N.key)}),e.jsx("p",{className:"text-[10px] leading-relaxed text-text-muted",children:i("settings.memoryHint")})]}),w.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:w.length})}),w.map(([N,q])=>{const K=p===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":q,disabled:K,onClick:()=>void D(N,q),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${q?"bg-brand":"bg-surface-3"}`,title:q?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 ${q?"left-4.5":"left-0.5"}`})})]},N)})]}),F.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:F.length})}),F.map(([N])=>e.jsxs("button",{type:"button",onClick:()=>C(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(Fs,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"})]},N))]})]})]})]})]})})}function va({onClose:r,onAsk:t}){se();const[s,n]=l.useState([]),[a,d]=l.useState(""),[c,u]=l.useState(!1),f=async()=>{const p=a.trim();if(!p||c)return;const g=Date.now();n(b=>[...b,{id:g,question:p,answer:null}]),d(""),u(!0);try{const b=await t(p);n(_=>_.map(T=>T.id===g?{...T,answer:b??i("sideQuestion.noAnswer"),error:b===null}:T))}finally{u(!1)}};return e.jsx(we,{open:!0,onOpenChange:p=>{p||r()},children:e.jsxs(ve,{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(Ie,{children:e.jsxs(ke,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Us,{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(p=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx("div",{className:"max-w-[85%] rounded-2xl rounded-br-md border border-user-bubble-border bg-user-bubble px-4 py-2 text-sm text-text-primary",children:p.question})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:e.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:24,height:24,className:"object-contain",draggable:!1})}),e.jsx("div",{className:"min-w-0 flex-1 pt-1 text-sm text-text-primary",children:p.answer===null?e.jsxs("span",{className:"chat-typing-indicator inline-flex items-center gap-1","aria-hidden":"true",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}):e.jsx("div",{className:p.error?"text-status-error":"",children:e.jsx(In,{children:p.answer})})})]})]},p.id))]}),e.jsxs("div",{className:"mt-3 flex items-end gap-2",children:[e.jsx("textarea",{value:a,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&!p.nativeEvent.isComposing&&(p.preventDefault(),f())},rows:Math.min(4,Math.max(1,a.split(`
76
- `).length)),placeholder: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 f(),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(ze,{className:"h-4 w-4 animate-spin"}):e.jsx($n,{className:"h-4 w-4"})})]})]})})}const At="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1";function vs(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 ka({requestId:r,toolName:t,toolInput:s,description:n,suggestions:a,onApprove:d,onApproveAlways:c,onReject:u}){se();const f=s&&typeof s=="object"&&!Array.isArray(s)?s:{},p=Dn(qn(t),f,{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(On,{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:Z(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:Z(t)}),t!=="AskUserQuestion"&&(p?e.jsx("div",{className:"mb-3 space-y-2",children:p.map((_,T)=>e.jsx(Pn,{filePath:_.filePath,oldString:_.oldString,newString:_.newString,label:_.label},T))}):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:rs(g,500)})),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:d,className:xe("rounded-lg bg-approve px-4 py-2 text-sm font-medium font-display text-white hover:bg-approve-hover transition-colors",At),children:i("permission.approve")}),b&&c&&e.jsxs("button",{onClick:c,className:xe("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",At),title:i("permission.alwaysAllowHint").replace("{rule}",vs(t,a)),children:[e.jsx(ea,{className:"h-3.5 w-3.5"}),i("permission.alwaysAllow")," ",rs(vs(t,a),40)]}),e.jsx("button",{onClick:u,className:xe("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",At),children:i("permission.reject")})]})]})}function Na({questions:r,description:t,onSubmit:s,onSkip:n}){const[a,d]=l.useState({}),[c,u]=l.useState({}),[f,p]=l.useState(0),g=(C,m,h)=>{if(h){const v=a[C]||[],k=v.includes(m)?v.filter(R=>R!==m):[...v,m];d({...a,[C]:k})}else d({...a,[C]:m})},b=C=>{var h;const m=(h=c[C])==null?void 0:h.trim();m&&(d({...a,[C]:m}),u({...c,[C]:""}))},_=()=>{var m,h;const C={};for(const[v,k]of Object.entries(a)){const R=r[parseInt(v,10)];R&&(typeof k=="number"?C[v]=((h=(m=R.options)==null?void 0:m[k])==null?void 0:h.label)||String(k):Array.isArray(k)?C[v]=k.map(j=>{var w,F;return((F=(w=R.options)==null?void 0:w[j])==null?void 0:F.label)||String(j)}):C[v]=k)}s(C)};if(r.length<=1){const C=r[0]||{question:t,options:[],multiSelect:!1},m=C.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:Z(t||C.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(C.options||[]).map((h,v)=>{const k=m?(a[0]||[]).includes(v):a[0]===v;return e.jsxs("button",{onClick:()=>g(0,v,m),className:xe("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display transition-colors",k?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium font-display",children:Z(h.label)}),h.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:Z(h.description)})]},v)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:c[0]||"",onChange:h=>u({...c,0:h.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:h=>h.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:_,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 T=r[f];return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold font-display text-text-primary",children:Z(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:r.map((C,m)=>e.jsx("button",{onClick:()=>p(m),className:xe("rounded-md px-3 py-1.5 text-xs font-display whitespace-nowrap transition-colors",f===m?"bg-brand/20 text-brand-text":"text-text-muted hover:bg-surface-2"),children:C.header||`Q${m+1}`},m))}),T&&e.jsx(Sa,{question:T,qIdx:f,answers:a,otherTexts:c,onSelect:g,onOtherTextChange:(C,m)=>u({...c,[C]: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:[f+1," / ",r.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:_,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 Sa({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:Z(r.question)}),e.jsxs("div",{className:"space-y-2",children:[(r.options||[]).map((f,p)=>{const g=u?(s[t]||[]).includes(p):s[t]===p;return e.jsxs("button",{onClick:()=>a(t,p,u),className:xe("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:Z(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:Z(f.description)})]},p)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:f=>d(t,f.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:f=>f.key==="Enter"&&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 _a({planContent:r,description:t,onSubmit:s}){const[n,a]=l.useState(null),[d,c]=l.useState(""),u=!r||!r.trim(),f=()=>{n&&s(n,n==="no"?d:void 0)};return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand-text",children:e.jsx(Ae,{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:Ca(r)}}),e.jsx("div",{className:"space-y-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(Ye,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes"}),e.jsx(Ye,{selected:n==="no",onClick:()=>a("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ye,{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(Ye,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(Ye,{selected:n==="no",onClick:()=>a("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),n==="no"&&e.jsx("textarea",{value:d,onChange:p=>c(p.target.value),placeholder:"Tell Saluzi what to change...",className:"mt-3 w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",rows:3}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:f,disabled:!n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium font-display text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function Ye({selected:r,onClick:t,label:s,desc:n}){return e.jsxs("button",{onClick:t,className:xe("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:xe("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 Ca(r){let t=Z(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 Ta({request:r,onSubmit:t}){se();const s=Ea(r.requestedSchema),n=Ma(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(ks,{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(yr,{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(ks,{serverName:r.serverName,message:r.message}),s.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:s.map(({name:u,prop:f})=>e.jsxs("label",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-medium text-text-primary",children:u}),n.includes(u)&&e.jsx("span",{className:"text-[10px] font-medium text-warning-text",children:i("elicitation.required")})]}),f.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:Z(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:a[u]??"",onChange:p=>d(g=>({...g,[u]:p.target.value})),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const u={};for(const{name:f,prop:p}of s){const g=(a[f]??"").trim();g&&(u[f]=p.type==="number"?Number(g):g)}t("accept",u)},disabled:!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 ks({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(Hr,{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:Z(r)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:Z(t)})]})}function Ea(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 Ma(r){const t=r==null?void 0:r.required;return Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function Ra(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 Fn(r);s(g)}catch(g){c(g instanceof Error?g.message:"Failed to load shares")}finally{a(!1)}},[r]);l.useEffect(()=>{u()},[u]);const f=l.useCallback(async g=>{c(null);try{const b=await Kn(r,g);return await u(),b}catch(b){throw c(b instanceof Error?b.message:"Failed to create share"),b}},[r,u]),p=l.useCallback(async g=>{c(null);try{await Un(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:f,revokeShare:p,refresh:u}}function Aa({open:r,onClose:t,sessionId:s,sessionTitle:n}){se();const{shares:a,isLoading:d,error:c,createShare:u,revokeShare:f}=Ra(s),[p,g]=l.useState("user"),[b,_]=l.useState(""),[T,C]=l.useState(""),[m,h]=l.useState("read"),[v,k]=l.useState(""),[R,j]=l.useState(!1),[w,F]=l.useState(null),[E,P]=l.useState(""),[D,N]=l.useState(!1),[q,K]=l.useState(!1);l.useEffect(()=>{r&&(g("user"),_(""),C(""),h("read"),k(""),j(!1),F(null),P(""),N(!1),K(!1))},[r]);const G=async()=>{j(!0),P(""),F(null);try{const $={grantedTo:p==="user"?{userId:b.trim()}:{teamId:T.trim()},permission:m};v.trim()&&($.expiresAt=v.trim());const Ne=await u($);F(`${window.location.origin}/code/s/${Ne.shareToken}`)}catch($){P($ instanceof Error?$.message:"Failed to create share")}finally{j(!1)}},pe=async $=>{try{await f($)}catch{}},oe=async()=>{if(!w)return;K(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(w),N(!0),setTimeout(()=>N(!1),2e3);return}}catch{}const $=document.createElement("textarea");$.value=w,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();try{document.execCommand("copy"),N(!0),setTimeout(()=>N(!1),2e3)}catch{K(!0)}document.body.removeChild($)};return e.jsx(we,{open:r,onOpenChange:$=>{$||t()},children:e.jsxs(ve,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Ie,{children:e.jsxs(ke,{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 ${p==="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 ${p==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:i("share.team")})]}),p==="user"?e.jsx(fr,{onSelect:_,placeholder:i("share.userIdPlaceholder"),actionLabel:i("share.selectUser")}):e.jsx("input",{type:"text",value:T,onChange:$=>C($.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"}),p==="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:$=>h($.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:$=>k($.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}),w&&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:w}),e.jsx("button",{onClick:oe,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:D?i("share.copied"):i("share.copy")})]}),q&&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($=>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:$.granted_to_user||$.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[$.permission==="write"?i("share.permissionWrite"):i("share.permissionRead"),$.expires_at?` · expires ${$.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>pe($.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")})]},$.id))})]})]}),e.jsxs(mr,{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:G,disabled:R||(p==="user"?!b.trim():!T.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 Ia(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 $a(r){return r?new Date(r).toLocaleString():""}function Da({open:r,onClose:t,adapter:s,onResume:n}){const a=se(),[d,c]=l.useState([]),[u,f]=l.useState(!1),[p,g]=l.useState("");l.useEffect(()=>{if(!r)return;let _=!1;return f(!0),g(""),c([]),s.listResumableSessions().then(T=>{_||c(T)}).catch(T=>{_||g(T instanceof Error?T.message:String(T))}).finally(()=>{_||f(!1)}),()=>{_=!0}},[r,s]);const b=l.useMemo(()=>Ia(d),[d,a]);return e.jsx(we,{open:r,onOpenChange:_=>{_||t()},children:e.jsxs(ve,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Ie,{children:e.jsx(ke,{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&&p&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:p}),!u&&!p&&d.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:i("resume.empty")}),!u&&!p&&b.map(_=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-text-muted",children:_.label}),e.jsx("div",{className:"space-y-1",children:_.items.map(T=>e.jsxs("button",{type:"button",onClick:()=>n(T),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:T.title}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[$a(T.modified),T.gitBranch?` · ${T.gitBranch}`:""]})]},T.sessionId))})]},_.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 Ns=["working","episodic","semantic","procedural"],qa=["user","feedback","project","reference"];function Oa({refreshTick:r,recall:t,dreaming:s,onDreamTrigger:n}){se();const{myTeams:a}=Ln(),[d,c]=l.useState(null),[u,f]=l.useState("memories"),[p,g]=l.useState("personal"),[b,_]=l.useState([]),[T,C]=l.useState(!1),[m,h]=l.useState(""),[v,k]=l.useState(""),[R,j]=l.useState(null),[w,F]=l.useState(null),[E,P]=l.useState(!1),[D,N]=l.useState(Et),q=wr(),[K,G]=l.useState(""),[pe,oe]=l.useState(null),[$,Ne]=l.useState(!1),fe=l.useRef(null);l.useEffect(()=>{qs().then(c).catch(()=>c(null))},[]);const ee=l.useCallback(async()=>{C(!0),h("");try{_(await Bn(p))}catch{h(i("memorySidebar.loadFailed"))}finally{C(!1)}},[p]);l.useEffect(()=>{ee()},[ee,r]),l.useEffect(()=>{const y=()=>void ee();return window.addEventListener("focus",y),()=>window.removeEventListener("focus",y)},[ee]),l.useEffect(()=>{u==="governance"&&Hn().then(F).catch(()=>F(null))},[u,r]),l.useEffect(()=>{fe.current&&clearTimeout(fe.current);const y=v.trim();if(!y){j(null);return}return fe.current=setTimeout(()=>{Qn(y).then(j).catch(()=>j([]))},300),()=>{fe.current&&clearTimeout(fe.current)}},[v]);const te=y=>q.expandedKey===y?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:q.fileContent[y]??"…"}):null,H=(d==null?void 0:d.mode)==="sqlite",[ne,re]=l.useState(!1),[ae,z]=l.useState(""),[Se,$e]=l.useState(""),[et,W]=l.useState("project"),[De,he]=l.useState(""),[qe,tt]=l.useState(""),[Oe,_e]=l.useState(!1),Pe=()=>{var y;re(!0),z(""),$e(""),W("project"),he(""),tt(((y=a[0])==null?void 0:y.id)??"")},Fe=H&&p==="team",st=ae.trim().length>0&&De.trim().length>0&&!Oe&&(!Fe||!!qe),Ce=async()=>{if(st){_e(!0),h("");try{await Vn({scope:p,name:ae.trim(),description:Se.trim()||void 0,type:et,content:De,...Fe?{teamId:qe}:{}}),re(!1),await ee()}catch(y){h(y instanceof Error?y.message:i("memorySidebar.createFailed"))}finally{_e(!1)}}},nt=()=>{n==null||n()},ye=l.useCallback(async()=>{const y=K.trim();if(!(!y||$)){Ne(!0),oe(null);try{oe(await Wn(y,5))}catch{oe([])}finally{Ne(!1)}}},[K,$]),ie=(d==null?void 0:d.teamEnabled)===!0,Ke=d==null?void 0:d.automation,Ue=ie&&u==="memories"&&!v,Te=l.useMemo(()=>vr(b,D),[b,D]),rt=l.useMemo(()=>kr(b),[b]),ge=(D.types.size>0?1:0)+(D.layers.size>0?1:0)+(D.days!==null?1:0)+(D.minConfidence>0?1:0)+(D.minAccessCount>0?1:0);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:()=>f("memories"),className:`rounded-md px-2 py-1 text-xs font-medium ${u==="memories"?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2"}`,children:i("memorySidebar.memoriesTab")}),e.jsx("button",{type:"button",onClick:()=>f("governance"),className:`rounded-md px-2 py-1 text-xs font-medium ${u==="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:[u==="memories"&&!v&&e.jsx("button",{type:"button",onClick:ne?()=>re(!1):Pe,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:ne?e.jsx(Yn,{className:"h-3 w-3"}):e.jsx(zn,{className:"h-3 w-3"})}),u==="memories"&&!v&&e.jsxs("button",{type:"button",onClick:()=>P(y=>!y),"data-testid":"memory-filter-toggle",className:`relative rounded p-1 transition-colors ${E||ge>0?"bg-brand-light text-white":"text-text-secondary hover:bg-surface-2 hover:text-text-primary"}`,title:i("memorySidebar.filters"),children:[e.jsx(ls,{className:"h-3 w-3"}),ge>0&&!E&&e.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-3 min-w-3 items-center justify-center rounded-full bg-brand px-0.5 text-[9px] font-bold text-white",children:ge})]}),e.jsx(gt,{className:"h-3 w-3 text-text-muted"}),e.jsx("input",{value:v,onChange:y=>k(y.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"})]})]}),m&&e.jsx("p",{className:"px-3 py-1 text-xs text-status-error",children:m}),E&&u==="memories"&&!v&&e.jsxs("div",{className:"space-y-2 border-b border-border px-2 py-2","data-testid":"memory-filter-panel",children:[e.jsx(Nr,{filters:D,onChange:N}),e.jsx(Sr,{filters:D,onChange:N,counts:rt}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-text-muted",children:i("memories.filter.time")}),e.jsx("div",{className:"flex rounded-md bg-surface-2 p-0.5 text-[10px]",children:_r.map(y=>e.jsx("button",{type:"button",onClick:()=>N(V=>({...V,days:y.value})),className:`rounded px-1.5 py-0.5 ${D.days===y.value?"bg-brand-light text-white":"text-text-muted hover:text-text-secondary"}`,children:i(y.labelKey)},String(y.value)))})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:i("memories.filter.confidence"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:i("memories.filter.confidence")}),e.jsx("input",{type:"range",min:0,max:100,step:10,value:D.minConfidence*100,onChange:y=>N(V=>({...V,minConfidence:Number(y.target.value)/100})),className:"h-1 min-w-16 flex-1 accent-brand"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${D.minConfidence>0?"text-brand-text":"text-text-muted"}`,children:B("memories.filter.minConfidence",{pct:D.minConfidence*100})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:i("memories.filter.access"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:i("memories.filter.access")}),e.jsx("input",{type:"range",min:0,max:10,step:1,value:D.minAccessCount,onChange:y=>N(V=>({...V,minAccessCount:Number(y.target.value)})),className:"h-1 min-w-12 flex-1 accent-brand"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${D.minAccessCount>0?"text-brand-text":"text-text-muted"}`,children:B("memories.filter.minAccess",{n:D.minAccessCount})}),Cr(D)&&e.jsx("button",{type:"button",onClick:()=>N(Et),className:"flex-shrink-0 rounded px-1 py-0.5 text-[10px] text-text-muted hover:bg-surface-2 hover:text-text-primary",children:i("memories.filter.clear")})]})]}),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")}),R!==null&&e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:R.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:R.map(y=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void q.toggleExpand({path:y.path}),className:"w-full rounded-md px-2 py-1.5 text-left hover:bg-surface-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-xs font-medium text-text-primary",children:y.name}),e.jsx(Tr,{layer:y.layer})]}),e.jsx("ul",{className:"mt-0.5 space-y-0.5",children:y.matches.map((V,Ee)=>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:V.line===0?"file":`L${V.line}`}),e.jsx("span",{className:"truncate text-text-secondary",children:V.text})]},Ee))})]}),te(y.path)]},y.path))})}),R===null&&u==="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(y=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void q.toggleExpand({path:y.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:y.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:y.path.replace(/^team\//,"").replace(/\.md$/,"")}),y.score!==void 0&&e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(y.score*100).toFixed(0),"%"]})]}),te(y.path)]},y.path))})]}),Ue&&e.jsx("div",{className:"mb-2 flex rounded-md bg-surface-2 p-0.5 text-xs",children:["personal","team"].map(y=>e.jsx("button",{type:"button",onClick:()=>g(y),className:`flex-1 rounded px-2 py-1 ${p===y?"bg-brand-light text-white":"text-text-muted"}`,children:y==="personal"?i("memorySidebar.personal"):i("memorySidebar.team")},y))}),p==="team"&&ie&&!ne&&e.jsx("p",{className:"mb-2 px-1 text-[10px] leading-relaxed text-text-muted",children:i("memorySidebar.teamHint")}),ne&&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:ae,onChange:y=>z(y.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:Se,onChange:y=>$e(y.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:et,onChange:y=>W(y.target.value),className:"flex-shrink-0 rounded bg-surface-3 px-1.5 py-1 text-xs text-text-primary focus:outline-none",children:qa.map(y=>e.jsx("option",{value:y,children:y},y))}),Fe?e.jsxs("select",{value:qe,onChange:y=>tt(y.target.value),"aria-label":i("memories.scope.team"),className:"min-w-0 flex-1 rounded bg-surface-3 px-1.5 py-1 text-xs text-text-primary focus:outline-none",children:[a.length===0&&e.jsx("option",{value:"",children:"—"}),a.map(y=>e.jsx("option",{value:y.id,children:y.name},y.id))]}):e.jsx("span",{className:"truncate text-[10px] text-text-muted",children:p==="team"?i("memorySidebar.team"):i("memorySidebar.personal")})]}),e.jsx("textarea",{value:De,onChange:y=>he(y.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 Ce(),disabled:!st,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:Oe?"…":i("memorySidebar.new")}),e.jsx("button",{type:"button",onClick:()=>re(!1),className:"rounded px-2 py-0.5 text-[10px] text-text-muted hover:bg-surface-3",children:i("memorySidebar.cancel")})]})]}),T?e.jsx("div",{className:"space-y-2",children:[0,1,2].map(y=>e.jsx("div",{className:"h-12 animate-pulse rounded-md bg-surface-2"},y))}):b.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(Dt,{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")})]}):Te.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(ls,{className:"mx-auto h-6 w-6 text-text-muted/40"}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:i("memories.filter.empty")}),e.jsx("button",{type:"button",onClick:()=>N(Et),className:"mt-2 rounded-md border border-border px-2.5 py-1 text-[11px] text-text-secondary hover:bg-surface-2",children:i("memories.filter.clear")})]}):e.jsx(Er,{files:Te,teamEnabled:ie,teams:H?a:void 0,onChanged:ee,expandedKey:q.expandedKey,fileContent:q.fileContent,onToggleExpand:q.toggleExpand})]}),R===null&&u==="governance"&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 text-xs",children:w?e.jsxs("div",{className:"space-y-4",children:[n&&e.jsxs("div",{children:[e.jsxs("button",{type:"button",disabled:s||!w.automation.autoDream,onClick:nt,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(gr,{className:"h-3.5 w-3.5"}),s?i("memorySidebar.dreaming"):i("memorySidebar.dream")]}),!w.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:K,onChange:y=>G(y.target.value),onKeyDown:y=>{y.key==="Enter"&&!y.nativeEvent.isComposing&&ye()},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 ye(),disabled:$||!K.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:$?i("memorySidebar.recallTest.running"):i("memorySidebar.recallTest.run")})]}),pe!==null&&e.jsx("ul",{className:"mt-1.5 space-y-0.5 rounded-md bg-surface-2 p-2",children:pe.length===0?e.jsx("li",{className:"text-[10px] text-text-muted",children:i("memorySidebar.recallTest.noResults")}):pe.map(y=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void q.toggleExpand({path:y.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:y.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:y.path.replace(/^team\//,"").replace(/\.md$/,"")}),e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(y.score*100).toFixed(0),"%",y.confidence!==void 0?` · conf ${y.confidence.toFixed(2)}`:""]})]}),te(y.path)]},y.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:Ns.map(y=>{const V=w.layers[y],Ee=Math.max(...Ns.map(at=>w.layers[at]),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:y}),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:`${V/Ee*100}%`}})}),e.jsx("span",{className:"w-6 text-right text-text-muted",children:V})]},y)})})]}),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:w.health.totalMemories})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.capacity")}),e.jsxs("span",{className:w.health.capacity.tier==="critical"?"text-status-error":w.health.capacity.tier==="warning"?"text-status-warning":"text-status-active",children:[w.health.capacity.utilizationPct.toFixed(0),"% · ",w.health.capacity.tier]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.avgConfidence")}),e.jsx("span",{children:w.health.avgConfidence.toFixed(2)})]})]})]}),w.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")," (",w.alerts.length,")"]}),e.jsx("ul",{className:"space-y-1 rounded-md bg-status-warning/5 p-2",children:w.alerts.slice(-8).reverse().map((y,V)=>e.jsx("li",{className:"text-[10px] leading-relaxed text-text-secondary",children:y},V))})]}),w.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:w.conflicts})]})]}):e.jsx("p",{className:"py-10 text-center text-text-muted",children:i("memorySidebar.loadFailed")})})]})}class Pa{constructor(t,s,n,a){I(this,"pending",null);this.current=t,this.apply=s,this.send=n,this.onError=a}set(t){if(t===this.current)return;const s=this.current;this.current=t,this.pending={requestId:null,previous:s},this.apply(t);try{Promise.resolve(this.send(t)).then(n=>{this.pending&&(this.pending.requestId=n)}).catch(n=>{this.rollback(s,Ss(n),"send")})}catch(n){this.rollback(s,Ss(n),"send")}}handleControlResponse(t){const s=this.pending;if(!s||s.requestId!==t.requestId)return!1;const{previous:n}=s;return this.pending=null,t.subtype==="error"&&this.rollback(n,t.error??"","response"),!0}sync(t){t!==this.current&&(this.current=t,this.apply(t),this.pending=null)}adoptExternal(t){this.pending||t!==this.current&&(this.current=t)}getCurrent(){return this.current}rollback(t,s,n){var a;this.pending=null,this.current=t,this.apply(t),s&&((a=this.onError)==null||a.call(this,s,n))}}function Ss(r){return r instanceof Error?r.message:String(r)}function pt(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 Ys="rcs_context_usage_";function zs(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function _s(){return{totalTokens:0,rawMaxTokens:0,percentage:0}}function Fa(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 Ka(r,t=zs()){if(!t||!r)return null;try{const s=t.getItem(Ys+r);return s?Fa(JSON.parse(s)):null}catch{return null}}function Ua(r,t,s=zs()){if(!(!s||!r))try{s.setItem(Ys+r,JSON.stringify(t))}catch{}}function La(r){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${r}`}function Ba(r){const t=La(r),s=Jn(),n=s?{proxyUrl:t,token:s}:{proxyUrl:t};return new Gn(n)}const Re=[{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"}],Cs="rcs_permission_mode";function ft(r){return r<1e3?String(r):r<1e6?`${(r/1e3).toFixed(1)}k`:`${(r/1e6).toFixed(1)}M`}function Ha(r){const t=Re.findIndex(s=>s.value===r);return Re[(t+1+Re.length)%Re.length].value}const bt=[{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}],Ts="rcs_thinking_budget",$t=[{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"}],Es=r=>r.labelKey?i(r.labelKey):r.label,Ms=r=>r.labelKey?i(r.labelKey):r.label,Rs="rcs_effort",As=[{value:"normal",descKey:"session.tokenMode.normalDesc"},{value:"poor",descKey:"session.tokenMode.poorDesc"},{value:"sa",descKey:"session.tokenMode.saDesc"}],Is="rcs_token_mode";function Qa(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 Wa({budget:r,onBudgetChange:t,disabled:s}){const[n,a]=l.useState(!1),d=bt.find(c=>c.value===r);return e.jsxs(Ve,{open:n,onOpenChange:a,children:[e.jsx(Ge,{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(Dt,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?Ms(d):i("session.thinking.fallback")}),n?e.jsx(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-64 p-1",align:"start",children:bt.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(Ae,{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:Ms(c)}),e.jsx("div",{className:"text-xs text-text-muted",children:c.descKey?i(c.descKey):c.description})]})]},c.value))})]})}function Ya({effort:r,onEffortChange:t,disabled:s}){const[n,a]=l.useState(!1),d=$t.find(c=>c.value===r);return e.jsxs(Ve,{open:n,onOpenChange:a,children:[e.jsx(Ge,{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(Or,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?Es(d):i("session.effort.fallback")}),n?e.jsx(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-64 p-1",align:"start",children:$t.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(Ae,{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:Es(c)}),e.jsx("div",{className:"text-xs text-text-muted",children:i(c.descKey)})]})]},c.value))})]})}function za({mode:r,onModeChange:t,disabled:s}){const[n,a]=l.useState(!1),d=As.find(c=>c.value===r);return e.jsxs(Ve,{open:n,onOpenChange:a,children:[e.jsx(Ge,{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($r,{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(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-64 p-1",align:"start",children:As.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(Ae,{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 Va=new Set(["Free space","Autocompact buffer","Compact buffer"]),$s=["bg-brand","bg-status-active","bg-status-success","bg-violet-500","bg-amber-500","bg-pink-500","bg-teal-500"];function Ga({usage:r}){const t=Math.min(100,Math.max(0,r.percentage)),s=t>=80,n=(r.categories??[]).filter(u=>!u.isDeferred&&!Va.has(u.name)),a=(r.categories??[]).filter(u=>u.isDeferred),d=n.reduce((u,f)=>u+f.tokens,0),c=[`${B("session.context.tooltip",{used:ft(r.totalTokens),max:ft(r.rawMaxTokens)})}${r.model?` · ${r.model}`:""}`,...n.slice(0,8).map(u=>`${u.name}: ${ft(u.tokens)}`),...a.slice(0,3).map(u=>`${u.name}${i("session.context.deferredSuffix")}: ${ft(u.tokens)}`)];return e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-text-muted font-mono",title:c.join(`
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 f(),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(ze,{className:"h-4 w-4 animate-spin"}):e.jsx($n,{className:"h-4 w-4"})})]})]})})}const At="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1";function vs(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 ka({requestId:r,toolName:t,toolInput:s,description:n,suggestions:a,onApprove:d,onApproveAlways:c,onReject:u}){se();const f=s&&typeof s=="object"&&!Array.isArray(s)?s:{},p=Dn(qn(t),f,{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(On,{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:Z(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:Z(t)}),t!=="AskUserQuestion"&&(p?e.jsx("div",{className:"mb-3 space-y-2",children:p.map((_,T)=>e.jsx(Pn,{filePath:_.filePath,oldString:_.oldString,newString:_.newString,label:_.label},T))}):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:rs(g,500)})),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:d,className:xe("rounded-lg bg-approve px-4 py-2 text-sm font-medium font-display text-white hover:bg-approve-hover transition-colors",At),children:i("permission.approve")}),b&&c&&e.jsxs("button",{onClick:c,className:xe("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",At),title:i("permission.alwaysAllowHint").replace("{rule}",vs(t,a)),children:[e.jsx(ea,{className:"h-3.5 w-3.5"}),i("permission.alwaysAllow")," ",rs(vs(t,a),40)]}),e.jsx("button",{onClick:u,className:xe("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",At),children:i("permission.reject")})]})]})}function Na({questions:r,description:t,onSubmit:s,onSkip:n}){const[a,d]=l.useState({}),[c,u]=l.useState({}),[f,p]=l.useState(0),g=(C,m,h)=>{if(h){const v=a[C]||[],k=v.includes(m)?v.filter(R=>R!==m):[...v,m];d({...a,[C]:k})}else d({...a,[C]:m})},b=C=>{var h;const m=(h=c[C])==null?void 0:h.trim();m&&(d({...a,[C]:m}),u({...c,[C]:""}))},_=()=>{var m,h;const C={};for(const[v,k]of Object.entries(a)){const R=r[parseInt(v,10)];R&&(typeof k=="number"?C[v]=((h=(m=R.options)==null?void 0:m[k])==null?void 0:h.label)||String(k):Array.isArray(k)?C[v]=k.map(j=>{var w,F;return((F=(w=R.options)==null?void 0:w[j])==null?void 0:F.label)||String(j)}):C[v]=k)}s(C)};if(r.length<=1){const C=r[0]||{question:t,options:[],multiSelect:!1},m=C.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:Z(t||C.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(C.options||[]).map((h,v)=>{const k=m?(a[0]||[]).includes(v):a[0]===v;return e.jsxs("button",{onClick:()=>g(0,v,m),className:xe("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display transition-colors",k?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium font-display",children:Z(h.label)}),h.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:Z(h.description)})]},v)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:c[0]||"",onChange:h=>u({...c,0:h.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:h=>h.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:_,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 T=r[f];return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold font-display text-text-primary",children:Z(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:r.map((C,m)=>e.jsx("button",{onClick:()=>p(m),className:xe("rounded-md px-3 py-1.5 text-xs font-display whitespace-nowrap transition-colors",f===m?"bg-brand/20 text-brand-text":"text-text-muted hover:bg-surface-2"),children:C.header||`Q${m+1}`},m))}),T&&e.jsx(Sa,{question:T,qIdx:f,answers:a,otherTexts:c,onSelect:g,onOtherTextChange:(C,m)=>u({...c,[C]: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:[f+1," / ",r.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:_,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 Sa({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:Z(r.question)}),e.jsxs("div",{className:"space-y-2",children:[(r.options||[]).map((f,p)=>{const g=u?(s[t]||[]).includes(p):s[t]===p;return e.jsxs("button",{onClick:()=>a(t,p,u),className:xe("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:Z(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:Z(f.description)})]},p)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:f=>d(t,f.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:f=>f.key==="Enter"&&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 _a({planContent:r,description:t,onSubmit:s}){const[n,a]=l.useState(null),[d,c]=l.useState(""),u=!r||!r.trim(),f=()=>{n&&s(n,n==="no"?d:void 0)};return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand-text",children:e.jsx(Ae,{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:Ca(r)}}),e.jsx("div",{className:"space-y-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(Ye,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes"}),e.jsx(Ye,{selected:n==="no",onClick:()=>a("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ye,{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(Ye,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(Ye,{selected:n==="no",onClick:()=>a("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),n==="no"&&e.jsx("textarea",{value:d,onChange:p=>c(p.target.value),placeholder:"Tell Saluzi what to change...",className:"mt-3 w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",rows:3}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:f,disabled:!n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium font-display text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function Ye({selected:r,onClick:t,label:s,desc:n}){return e.jsxs("button",{onClick:t,className:xe("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:xe("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 Ca(r){let t=Z(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 Ta({request:r,onSubmit:t}){se();const s=Ea(r.requestedSchema),n=Ma(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(ks,{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(yr,{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(ks,{serverName:r.serverName,message:r.message}),s.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:s.map(({name:u,prop:f})=>e.jsxs("label",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-medium text-text-primary",children:u}),n.includes(u)&&e.jsx("span",{className:"text-[10px] font-medium text-warning-text",children:i("elicitation.required")})]}),f.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:Z(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:a[u]??"",onChange:p=>d(g=>({...g,[u]:p.target.value})),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const u={};for(const{name:f,prop:p}of s){const g=(a[f]??"").trim();g&&(u[f]=p.type==="number"?Number(g):g)}t("accept",u)},disabled:!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 ks({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(Hr,{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:Z(r)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:Z(t)})]})}function Ea(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 Ma(r){const t=r==null?void 0:r.required;return Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function Ra(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 Fn(r);s(g)}catch(g){c(g instanceof Error?g.message:"Failed to load shares")}finally{a(!1)}},[r]);l.useEffect(()=>{u()},[u]);const f=l.useCallback(async g=>{c(null);try{const b=await Kn(r,g);return await u(),b}catch(b){throw c(b instanceof Error?b.message:"Failed to create share"),b}},[r,u]),p=l.useCallback(async g=>{c(null);try{await Un(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:f,revokeShare:p,refresh:u}}function Aa({open:r,onClose:t,sessionId:s,sessionTitle:n}){se();const{shares:a,isLoading:d,error:c,createShare:u,revokeShare:f}=Ra(s),[p,g]=l.useState("user"),[b,_]=l.useState(""),[T,C]=l.useState(""),[m,h]=l.useState("read"),[v,k]=l.useState(""),[R,j]=l.useState(!1),[w,F]=l.useState(null),[E,P]=l.useState(""),[D,N]=l.useState(!1),[q,K]=l.useState(!1);l.useEffect(()=>{r&&(g("user"),_(""),C(""),h("read"),k(""),j(!1),F(null),P(""),N(!1),K(!1))},[r]);const G=async()=>{j(!0),P(""),F(null);try{const $={grantedTo:p==="user"?{userId:b.trim()}:{teamId:T.trim()},permission:m};v.trim()&&($.expiresAt=v.trim());const Ne=await u($);F(`${window.location.origin}/code/s/${Ne.shareToken}`)}catch($){P($ instanceof Error?$.message:"Failed to create share")}finally{j(!1)}},pe=async $=>{try{await f($)}catch{}},oe=async()=>{if(!w)return;K(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(w),N(!0),setTimeout(()=>N(!1),2e3);return}}catch{}const $=document.createElement("textarea");$.value=w,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();try{document.execCommand("copy"),N(!0),setTimeout(()=>N(!1),2e3)}catch{K(!0)}document.body.removeChild($)};return e.jsx(we,{open:r,onOpenChange:$=>{$||t()},children:e.jsxs(ve,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Ie,{children:e.jsxs(ke,{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 ${p==="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 ${p==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:i("share.team")})]}),p==="user"?e.jsx(fr,{onSelect:_,placeholder:i("share.userIdPlaceholder"),actionLabel:i("share.selectUser")}):e.jsx("input",{type:"text",value:T,onChange:$=>C($.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"}),p==="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:$=>h($.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:$=>k($.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}),w&&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:w}),e.jsx("button",{onClick:oe,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:D?i("share.copied"):i("share.copy")})]}),q&&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($=>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:$.granted_to_user||$.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[$.permission==="write"?i("share.permissionWrite"):i("share.permissionRead"),$.expires_at?` · expires ${$.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>pe($.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")})]},$.id))})]})]}),e.jsxs(mr,{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:G,disabled:R||(p==="user"?!b.trim():!T.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 Ia(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 $a(r){return r?new Date(r).toLocaleString():""}function Da({open:r,onClose:t,adapter:s,onResume:n}){const a=se(),[d,c]=l.useState([]),[u,f]=l.useState(!1),[p,g]=l.useState("");l.useEffect(()=>{if(!r)return;let _=!1;return f(!0),g(""),c([]),s.listResumableSessions().then(T=>{_||c(T)}).catch(T=>{_||g(T instanceof Error?T.message:String(T))}).finally(()=>{_||f(!1)}),()=>{_=!0}},[r,s]);const b=l.useMemo(()=>Ia(d),[d,a]);return e.jsx(we,{open:r,onOpenChange:_=>{_||t()},children:e.jsxs(ve,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Ie,{children:e.jsx(ke,{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&&p&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:p}),!u&&!p&&d.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:i("resume.empty")}),!u&&!p&&b.map(_=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-text-muted",children:_.label}),e.jsx("div",{className:"space-y-1",children:_.items.map(T=>e.jsxs("button",{type:"button",onClick:()=>n(T),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:T.title}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[$a(T.modified),T.gitBranch?` · ${T.gitBranch}`:""]})]},T.sessionId))})]},_.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 Ns=["working","episodic","semantic","procedural"],qa=["user","feedback","project","reference"];function Oa({refreshTick:r,recall:t,dreaming:s,onDreamTrigger:n}){se();const{myTeams:a}=Ln(),[d,c]=l.useState(null),[u,f]=l.useState("memories"),[p,g]=l.useState("personal"),[b,_]=l.useState([]),[T,C]=l.useState(!1),[m,h]=l.useState(""),[v,k]=l.useState(""),[R,j]=l.useState(null),[w,F]=l.useState(null),[E,P]=l.useState(!1),[D,N]=l.useState(Et),q=wr(),[K,G]=l.useState(""),[pe,oe]=l.useState(null),[$,Ne]=l.useState(!1),fe=l.useRef(null);l.useEffect(()=>{qs().then(c).catch(()=>c(null))},[]);const ee=l.useCallback(async()=>{C(!0),h("");try{_(await Bn(p))}catch{h(i("memorySidebar.loadFailed"))}finally{C(!1)}},[p]);l.useEffect(()=>{ee()},[ee,r]),l.useEffect(()=>{const y=()=>void ee();return window.addEventListener("focus",y),()=>window.removeEventListener("focus",y)},[ee]),l.useEffect(()=>{u==="governance"&&Hn().then(F).catch(()=>F(null))},[u,r]),l.useEffect(()=>{fe.current&&clearTimeout(fe.current);const y=v.trim();if(!y){j(null);return}return fe.current=setTimeout(()=>{Qn(y).then(j).catch(()=>j([]))},300),()=>{fe.current&&clearTimeout(fe.current)}},[v]);const te=y=>q.expandedKey===y?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:q.fileContent[y]??"…"}):null,H=(d==null?void 0:d.mode)==="sqlite",[ne,re]=l.useState(!1),[ae,z]=l.useState(""),[Se,$e]=l.useState(""),[et,W]=l.useState("project"),[De,he]=l.useState(""),[qe,tt]=l.useState(""),[Oe,_e]=l.useState(!1),Pe=()=>{var y;re(!0),z(""),$e(""),W("project"),he(""),tt(((y=a[0])==null?void 0:y.id)??"")},Fe=H&&p==="team",st=ae.trim().length>0&&De.trim().length>0&&!Oe&&(!Fe||!!qe),Ce=async()=>{if(st){_e(!0),h("");try{await Vn({scope:p,name:ae.trim(),description:Se.trim()||void 0,type:et,content:De,...Fe?{teamId:qe}:{}}),re(!1),await ee()}catch(y){h(y instanceof Error?y.message:i("memorySidebar.createFailed"))}finally{_e(!1)}}},nt=()=>{n==null||n()},ye=l.useCallback(async()=>{const y=K.trim();if(!(!y||$)){Ne(!0),oe(null);try{oe(await Wn(y,5))}catch{oe([])}finally{Ne(!1)}}},[K,$]),ie=(d==null?void 0:d.teamEnabled)===!0,Ke=d==null?void 0:d.automation,Ue=ie&&u==="memories"&&!v,Te=l.useMemo(()=>vr(b,D),[b,D]),rt=l.useMemo(()=>kr(b),[b]),ge=(D.types.size>0?1:0)+(D.layers.size>0?1:0)+(D.days!==null?1:0)+(D.minConfidence>0?1:0)+(D.minAccessCount>0?1:0);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:()=>f("memories"),className:`rounded-md px-2 py-1 text-xs font-medium ${u==="memories"?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2"}`,children:i("memorySidebar.memoriesTab")}),e.jsx("button",{type:"button",onClick:()=>f("governance"),className:`rounded-md px-2 py-1 text-xs font-medium ${u==="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:[u==="memories"&&!v&&e.jsx("button",{type:"button",onClick:ne?()=>re(!1):Pe,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:ne?e.jsx(Yn,{className:"h-3 w-3"}):e.jsx(zn,{className:"h-3 w-3"})}),u==="memories"&&!v&&e.jsxs("button",{type:"button",onClick:()=>P(y=>!y),"data-testid":"memory-filter-toggle",className:`relative rounded p-1 transition-colors ${E||ge>0?"bg-brand-light text-white":"text-text-secondary hover:bg-surface-2 hover:text-text-primary"}`,title:i("memorySidebar.filters"),children:[e.jsx(ls,{className:"h-3 w-3"}),ge>0&&!E&&e.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-3 min-w-3 items-center justify-center rounded-full bg-brand px-0.5 text-[9px] font-bold text-white",children:ge})]}),e.jsx(gt,{className:"h-3 w-3 text-text-muted"}),e.jsx("input",{value:v,onChange:y=>k(y.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"})]})]}),m&&e.jsx("p",{className:"px-3 py-1 text-xs text-status-error",children:m}),E&&u==="memories"&&!v&&e.jsxs("div",{className:"space-y-2 border-b border-border px-2 py-2","data-testid":"memory-filter-panel",children:[e.jsx(Nr,{filters:D,onChange:N}),e.jsx(Sr,{filters:D,onChange:N,counts:rt}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-text-muted",children:i("memories.filter.time")}),e.jsx("div",{className:"flex rounded-md bg-surface-2 p-0.5 text-[10px]",children:_r.map(y=>e.jsx("button",{type:"button",onClick:()=>N(V=>({...V,days:y.value})),className:`rounded px-1.5 py-0.5 ${D.days===y.value?"bg-brand-light text-white":"text-text-muted hover:text-text-secondary"}`,children:i(y.labelKey)},String(y.value)))})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:i("memories.filter.confidence"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:i("memories.filter.confidence")}),e.jsx("input",{type:"range",min:0,max:100,step:10,value:D.minConfidence*100,onChange:y=>N(V=>({...V,minConfidence:Number(y.target.value)/100})),className:"h-1 min-w-16 flex-1 accent-brand"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${D.minConfidence>0?"text-brand-text":"text-text-muted"}`,children:B("memories.filter.minConfidence",{pct:D.minConfidence*100})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:i("memories.filter.access"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:i("memories.filter.access")}),e.jsx("input",{type:"range",min:0,max:10,step:1,value:D.minAccessCount,onChange:y=>N(V=>({...V,minAccessCount:Number(y.target.value)})),className:"h-1 min-w-12 flex-1 accent-brand"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${D.minAccessCount>0?"text-brand-text":"text-text-muted"}`,children:B("memories.filter.minAccess",{n:D.minAccessCount})}),Cr(D)&&e.jsx("button",{type:"button",onClick:()=>N(Et),className:"flex-shrink-0 rounded px-1 py-0.5 text-[10px] text-text-muted hover:bg-surface-2 hover:text-text-primary",children:i("memories.filter.clear")})]})]}),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")}),R!==null&&e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:R.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:R.map(y=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void q.toggleExpand({path:y.path}),className:"w-full rounded-md px-2 py-1.5 text-left hover:bg-surface-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-xs font-medium text-text-primary",children:y.name}),e.jsx(Tr,{layer:y.layer})]}),e.jsx("ul",{className:"mt-0.5 space-y-0.5",children:y.matches.map((V,Ee)=>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:V.line===0?"file":`L${V.line}`}),e.jsx("span",{className:"truncate text-text-secondary",children:V.text})]},Ee))})]}),te(y.path)]},y.path))})}),R===null&&u==="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(y=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void q.toggleExpand({path:y.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:y.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:y.path.replace(/^team\//,"").replace(/\.md$/,"")}),y.score!==void 0&&e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(y.score*100).toFixed(0),"%"]})]}),te(y.path)]},y.path))})]}),Ue&&e.jsx("div",{className:"mb-2 flex rounded-md bg-surface-2 p-0.5 text-xs",children:["personal","team"].map(y=>e.jsx("button",{type:"button",onClick:()=>g(y),className:`flex-1 rounded px-2 py-1 ${p===y?"bg-brand-light text-white":"text-text-muted"}`,children:y==="personal"?i("memorySidebar.personal"):i("memorySidebar.team")},y))}),p==="team"&&ie&&!ne&&e.jsx("p",{className:"mb-2 px-1 text-[10px] leading-relaxed text-text-muted",children:i("memorySidebar.teamHint")}),ne&&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:ae,onChange:y=>z(y.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:Se,onChange:y=>$e(y.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:et,onChange:y=>W(y.target.value),className:"flex-shrink-0 rounded bg-surface-3 px-1.5 py-1 text-xs text-text-primary focus:outline-none",children:qa.map(y=>e.jsx("option",{value:y,children:y},y))}),Fe?e.jsxs("select",{value:qe,onChange:y=>tt(y.target.value),"aria-label":i("memories.scope.team"),className:"min-w-0 flex-1 rounded bg-surface-3 px-1.5 py-1 text-xs text-text-primary focus:outline-none",children:[a.length===0&&e.jsx("option",{value:"",children:"—"}),a.map(y=>e.jsx("option",{value:y.id,children:y.name},y.id))]}):e.jsx("span",{className:"truncate text-[10px] text-text-muted",children:p==="team"?i("memorySidebar.team"):i("memorySidebar.personal")})]}),e.jsx("textarea",{value:De,onChange:y=>he(y.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 Ce(),disabled:!st,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:Oe?"…":i("memorySidebar.new")}),e.jsx("button",{type:"button",onClick:()=>re(!1),className:"rounded px-2 py-0.5 text-[10px] text-text-muted hover:bg-surface-3",children:i("memorySidebar.cancel")})]})]}),T?e.jsx("div",{className:"space-y-2",children:[0,1,2].map(y=>e.jsx("div",{className:"h-12 animate-pulse rounded-md bg-surface-2"},y))}):b.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(Dt,{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")})]}):Te.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(ls,{className:"mx-auto h-6 w-6 text-text-muted/40"}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:i("memories.filter.empty")}),e.jsx("button",{type:"button",onClick:()=>N(Et),className:"mt-2 rounded-md border border-border px-2.5 py-1 text-[11px] text-text-secondary hover:bg-surface-2",children:i("memories.filter.clear")})]}):e.jsx(Er,{files:Te,teamEnabled:ie,teams:H?a:void 0,onChanged:ee,expandedKey:q.expandedKey,fileContent:q.fileContent,onToggleExpand:q.toggleExpand})]}),R===null&&u==="governance"&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 text-xs",children:w?e.jsxs("div",{className:"space-y-4",children:[n&&e.jsxs("div",{children:[e.jsxs("button",{type:"button",disabled:s||!w.automation.autoDream,onClick:nt,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(gr,{className:"h-3.5 w-3.5"}),s?i("memorySidebar.dreaming"):i("memorySidebar.dream")]}),!w.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:K,onChange:y=>G(y.target.value),onKeyDown:y=>{y.key==="Enter"&&!y.nativeEvent.isComposing&&ye()},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 ye(),disabled:$||!K.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:$?i("memorySidebar.recallTest.running"):i("memorySidebar.recallTest.run")})]}),pe!==null&&e.jsx("ul",{className:"mt-1.5 space-y-0.5 rounded-md bg-surface-2 p-2",children:pe.length===0?e.jsx("li",{className:"text-[10px] text-text-muted",children:i("memorySidebar.recallTest.noResults")}):pe.map(y=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void q.toggleExpand({path:y.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:y.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:y.path.replace(/^team\//,"").replace(/\.md$/,"")}),e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(y.score*100).toFixed(0),"%",y.confidence!==void 0?` · conf ${y.confidence.toFixed(2)}`:""]})]}),te(y.path)]},y.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:Ns.map(y=>{const V=w.layers[y],Ee=Math.max(...Ns.map(at=>w.layers[at]),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:y}),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:`${V/Ee*100}%`}})}),e.jsx("span",{className:"w-6 text-right text-text-muted",children:V})]},y)})})]}),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:w.health.totalMemories})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.capacity")}),e.jsxs("span",{className:w.health.capacity.tier==="critical"?"text-status-error":w.health.capacity.tier==="warning"?"text-status-warning":"text-status-active",children:[w.health.capacity.utilizationPct.toFixed(0),"% · ",w.health.capacity.tier]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.avgConfidence")}),e.jsx("span",{children:w.health.avgConfidence.toFixed(2)})]})]})]}),w.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")," (",w.alerts.length,")"]}),e.jsx("ul",{className:"space-y-1 rounded-md bg-status-warning/5 p-2",children:w.alerts.slice(-8).reverse().map((y,V)=>e.jsx("li",{className:"text-[10px] leading-relaxed text-text-secondary",children:y},V))})]}),w.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:w.conflicts})]})]}):e.jsx("p",{className:"py-10 text-center text-text-muted",children:i("memorySidebar.loadFailed")})})]})}class Pa{constructor(t,s,n,a){I(this,"pending",null);this.current=t,this.apply=s,this.send=n,this.onError=a}set(t){if(t===this.current)return;const s=this.current;this.current=t,this.pending={requestId:null,previous:s},this.apply(t);try{Promise.resolve(this.send(t)).then(n=>{this.pending&&(this.pending.requestId=n)}).catch(n=>{this.rollback(s,Ss(n),"send")})}catch(n){this.rollback(s,Ss(n),"send")}}handleControlResponse(t){const s=this.pending;if(!s||s.requestId!==t.requestId)return!1;const{previous:n}=s;return this.pending=null,t.subtype==="error"&&this.rollback(n,t.error??"","response"),!0}sync(t){t!==this.current&&(this.current=t,this.apply(t),this.pending=null)}adoptExternal(t){this.pending||t!==this.current&&(this.current=t)}getCurrent(){return this.current}rollback(t,s,n){var a;this.pending=null,this.current=t,this.apply(t),s&&((a=this.onError)==null||a.call(this,s,n))}}function Ss(r){return r instanceof Error?r.message:String(r)}function pt(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 Ys="rcs_context_usage_";function zs(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function _s(){return{totalTokens:0,rawMaxTokens:0,percentage:0}}function Fa(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 Ka(r,t=zs()){if(!t||!r)return null;try{const s=t.getItem(Ys+r);return s?Fa(JSON.parse(s)):null}catch{return null}}function Ua(r,t,s=zs()){if(!(!s||!r))try{s.setItem(Ys+r,JSON.stringify(t))}catch{}}function La(r){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${r}`}function Ba(r){const t=La(r),s=Jn(),n=s?{proxyUrl:t,token:s}:{proxyUrl:t};return new Gn(n)}const Re=[{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"}],Cs="rcs_permission_mode";function ft(r){return r<1e3?String(r):r<1e6?`${(r/1e3).toFixed(1)}k`:`${(r/1e6).toFixed(1)}M`}function Ha(r){const t=Re.findIndex(s=>s.value===r);return Re[(t+1+Re.length)%Re.length].value}const bt=[{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}],Ts="rcs_thinking_budget",$t=[{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"}],Es=r=>r.labelKey?i(r.labelKey):r.label,Ms=r=>r.labelKey?i(r.labelKey):r.label,Rs="rcs_effort",As=[{value:"normal",descKey:"session.tokenMode.normalDesc"},{value:"poor",descKey:"session.tokenMode.poorDesc"},{value:"sa",descKey:"session.tokenMode.saDesc"}],Is="rcs_token_mode";function Qa(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:!0,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 Wa({budget:r,onBudgetChange:t,disabled:s}){const[n,a]=l.useState(!1),d=bt.find(c=>c.value===r);return e.jsxs(Ve,{open:n,onOpenChange:a,children:[e.jsx(Ge,{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(Dt,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?Ms(d):i("session.thinking.fallback")}),n?e.jsx(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-64 p-1",align:"start",children:bt.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(Ae,{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:Ms(c)}),e.jsx("div",{className:"text-xs text-text-muted",children:c.descKey?i(c.descKey):c.description})]})]},c.value))})]})}function Ya({effort:r,onEffortChange:t,disabled:s}){const[n,a]=l.useState(!1),d=$t.find(c=>c.value===r);return e.jsxs(Ve,{open:n,onOpenChange:a,children:[e.jsx(Ge,{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(Or,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?Es(d):i("session.effort.fallback")}),n?e.jsx(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-64 p-1",align:"start",children:$t.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(Ae,{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:Es(c)}),e.jsx("div",{className:"text-xs text-text-muted",children:i(c.descKey)})]})]},c.value))})]})}function za({mode:r,onModeChange:t,disabled:s}){const[n,a]=l.useState(!1),d=As.find(c=>c.value===r);return e.jsxs(Ve,{open:n,onOpenChange:a,children:[e.jsx(Ge,{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($r,{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(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-64 p-1",align:"start",children:As.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(Ae,{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 Va=new Set(["Free space","Autocompact buffer","Compact buffer"]),$s=["bg-brand","bg-status-active","bg-status-success","bg-violet-500","bg-amber-500","bg-pink-500","bg-teal-500"];function Ga({usage:r}){const t=Math.min(100,Math.max(0,r.percentage)),s=t>=80,n=(r.categories??[]).filter(u=>!u.isDeferred&&!Va.has(u.name)),a=(r.categories??[]).filter(u=>u.isDeferred),d=n.reduce((u,f)=>u+f.tokens,0),c=[`${B("session.context.tooltip",{used:ft(r.totalTokens),max:ft(r.rawMaxTokens)})}${r.model?` · ${r.model}`:""}`,...n.slice(0,8).map(u=>`${u.name}: ${ft(u.tokens)}`),...a.slice(0,3).map(u=>`${u.name}${i("session.context.deferredSuffix")}: ${ft(u.tokens)}`)];return e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-text-muted font-mono",title:c.join(`
77
77
  `),children:[e.jsx("span",{className:"relative flex h-1.5 w-16 overflow-hidden rounded-full bg-surface-3",children:n.length>0?n.map((u,f)=>e.jsx("span",{className:s&&f===0?"bg-status-warning":$s[f%$s.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 Ja({models:r,currentModelId:t,onSelect:s,disabled:n}){const[a,d]=l.useState(!1),c=r.find(p=>p.modelId===t)??null,u=r.length>0,f=async p=>{s(p.modelId),d(!1)};return e.jsxs(Ve,{open:a,onOpenChange:u?d:void 0,children:[e.jsx(Ge,{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(Ks,{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(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-72 p-0",align:"start",children:e.jsx(dr,{models:r,currentModelId:t,onSelect:f,showSearch:r.length>5})})]})}function Xa({mode:r,onModeChange:t,disabled:s}){const[n,a]=l.useState(!1),d=Re.find(c=>c.value===r);return e.jsxs(Ve,{open:n,onOpenChange:a,children:[e.jsx(Ge,{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(cr,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?i(d.labelKey):r}),n?e.jsx(Je,{className:"h-3 w-3"}):e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsx(Ze,{className:"w-64 p-1",align:"start",children:Re.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(Ae,{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 ho({sessionId:r,onBack:t}){se();const[s,n]=l.useState(null),[a,d]=l.useState(null),[c,u]=l.useState(""),[f,p]=l.useState(!1),[g,b]=l.useState(!1),[_,T]=l.useState(!1),[C,m]=l.useState(!1),[h,v]=l.useState(!1),[k,R]=l.useState(!1),[j,w]=l.useState(""),[F,E]=l.useState(0),P=l.useRef(null),[D,N]=l.useState({text:"",nonce:0}),[q,K]=l.useState(!1),[G,pe]=l.useState(!1),[oe,$]=l.useState(0),[Ne,fe]=l.useState(0),[ee,te]=l.useState([]),[H,ne]=l.useState(!1),[re,ae]=l.useState([]),[z,Se]=l.useState(null),[$e,et]=l.useState(()=>It()),[W,De]=l.useState(null),[he,qe]=l.useState(()=>localStorage.getItem(Ts)||"off"),[tt,Oe]=l.useState(()=>Ka(r)),[_e,Pe]=l.useState(!0),[Fe,st]=l.useState(null),[Ce,nt]=l.useState(null),[ye,ie]=l.useState([]),[Ke,Ue]=l.useState(!1),[Te,rt]=l.useState(""),ge=l.useRef(null),[y,V]=l.useState(()=>localStorage.getItem(Cs)||"default"),[Ee,at]=l.useState(null),Le=l.useRef(null),[qt,Ot]=l.useState(null),Be=l.useRef(null),le=l.useRef(null),Pt=l.useRef(ee);Pt.current=ee;const ot=l.useRef(null);ot.current||(ot.current=new Mr(Rr()));const Ft=l.useRef(r);Ft.current=(s==null?void 0:s.title)||r,l.useEffect(()=>{var o;(o=ot.current)==null||o.reset()},[r]);const ce=l.useCallback(o=>{at(o),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>at(null),5e3)},[]),de=l.useCallback(o=>{Ot(o),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>Ot(null),5e3)},[]),it=pt({value:y,apply:o=>{V(o);try{localStorage.setItem(Cs,o)}catch{}},send:o=>{const x=le.current;return x?x.setPermissionMode(o):Promise.reject(new Error("adapter not ready"))},onError:(o,x)=>{console.error("[SessionDetail] set permission mode failed:",o),ce(x==="send"?B("session.mode.switchFailedRequest",{message:o}):o||i("session.mode.switchFailed"))}}),jt=l.useCallback(o=>it.set(o),[it]),[Kt,Vs]=l.useState(()=>localStorage.getItem(Is)||"normal"),lt=pt({value:Kt,apply:o=>{Vs(o);try{localStorage.setItem(Is,o)}catch{}},send:o=>{const x=le.current;return x?x.setTokenMode(o):Promise.reject(new Error("adapter not ready"))},onError:(o,x)=>{console.error("[SessionDetail] set token mode failed:",o),ce(x==="send"?B("session.tokenMode.failedRequest",{message:o}):o||i("session.tokenMode.failed"))}}),wt=pt({value:he,apply:o=>{qe(o);try{localStorage.setItem(Ts,o)}catch{}},send:o=>{var M;const x=le.current;if(!x)return Promise.reject(new Error("adapter not ready"));const S=((M=bt.find(A=>A.value===o))==null?void 0:M.tokens)??null;return x.setThinkingBudget(S)},onError:(o,x)=>{console.error("[SessionDetail] set thinking budget failed:",o),ce(x==="send"?B("session.thinking.failedRequest",{message:o}):o||i("session.thinking.failed"))}}),O=l.useMemo(()=>new ra(r,te,{onStatusChange:o=>{var x;d(o),ne(o==="running"||o==="requires_action"),(x=ot.current)==null||x.onStatus(o,Ft.current)},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{ae(x=>x.some(S=>S.requestId===o.requestId)?x:[...x,o])},onModelsStateChange:o=>{Se(o)},onSubagentUpdate:o=>{et(o)},onControlResponse:o=>{wt.handleControlResponse(o)||lt.handleControlResponse(o)||Qt.handleControlResponse(o)||it.handleControlResponse(o)},onPermissionModeChange:o=>{it.sync(o)},onWorkerInfoChange:o=>{De(x=>JSON.stringify(x)===JSON.stringify(o)?x:o)},onTurnStart:o=>{st(o)},onElicitationRequest:o=>{nt(o)}}),[r,ce]);l.useEffect(()=>(le.current=O,()=>{O.disconnect()}),[O]);const U=l.useMemo(()=>Qa(W),[W]),Ut=l.useRef(!1);l.useEffect(()=>{var S;if(!U.set_max_thinking_tokens||Ut.current)return;const o=le.current;if(!o)return;const x=((S=bt.find(M=>M.value===he))==null?void 0:S.tokens)??null;o.setThinkingBudget(x).then(()=>{Ut.current=!0}).catch(M=>console.error("[SessionDetail] reconcile thinking budget failed:",M))},[U.set_max_thinking_tokens,he,W]);const Lt=U.stop_task?o=>{O.stopSubagent(o).then(x=>{x.ok||de(x.error||i("session.stopTask.failed"))})}:void 0,Bt=l.useRef(!1);l.useEffect(()=>{if(!U.set_token_mode||Bt.current)return;const o=le.current;o&&(Bt.current=!0,o.getRemoteSettings().then(x=>{const S=x==null?void 0:x.applied.tokenMode;(S==="normal"||S==="poor"||S==="sa")&&lt.sync(S)}).catch(x=>console.error("[SessionDetail] reconcile token mode failed:",x)))},[U.set_token_mode,lt]);const Gs=se(),vt=l.useMemo(()=>Xn((W==null?void 0:W.commands)??[],(W==null?void 0:W.skills)??[]),[W,Gs]),He=l.useMemo(()=>Zn(ee,j),[ee,j]),Js=l.useCallback(o=>wt.set(o),[wt]),[Ht,Xs]=l.useState(()=>localStorage.getItem(Rs)||"auto"),Qt=pt({value:Ht,apply:o=>{Xs(o);try{localStorage.setItem(Rs,o)}catch{}},send:o=>{var M;const x=le.current;if(!x)return Promise.reject(new Error("adapter not ready"));const S=(M=$t.find(A=>A.value===o))==null?void 0:M.effort;return x.setEffort(S)},onError:(o,x)=>{console.error("[SessionDetail] set effort failed:",o),ce(x==="send"?B("session.effort.failedRequest",{message:o}):o||i("session.effort.failed"))}}),kt=l.useCallback(()=>{var o;U.get_context_usage&&((o=le.current)==null||o.getContextUsage().then(x=>{x&&(Oe(x),Ua(r,x))}).catch(()=>{}).finally(()=>Pe(!1)))},[U,r]);l.useEffect(()=>{if(!U.get_context_usage)return;kt();const o=setInterval(kt,6e4);return()=>clearInterval(o)},[U,H,kt]),l.useEffect(()=>{W&&!U.get_context_usage&&Pe(!1)},[W,U]),l.useEffect(()=>{if(!_e)return;const o=setTimeout(()=>Pe(!1),1e4);return()=>clearTimeout(o)},[_e]);const Wt=l.useRef(G);Wt.current=G,l.useEffect(()=>me.onEvent(x=>{x.type!=="artifact_created"&&x.type!=="artifact_updated"||(Wt.current&&fe(S=>S+1),$(S=>S+1))}),[]);const[Zs,ct]=l.useState(0),[dt,Yt]=l.useState(null),[ue,Nt]=l.useState(!1),[St,zt]=l.useState(0),[en,tn]=l.useState(void 0),ut=l.useRef(ue);ut.current=ue,l.useEffect(()=>me.onEvent(x=>{x.type==="memory_synced"&&ut.current&&ct(S=>S+1)}),[]),l.useEffect(()=>{qs().then(o=>Yt(o.mode)).catch(()=>Yt("sqlite"))},[]),l.useEffect(()=>me.onEvent(x=>{var S,M;if(x.type==="memory_changed")ut.current?ct(A=>A+1):zt(A=>A+1);else if(x.type==="memory_recall"){const A=Array.isArray((S=x.payload)==null?void 0:S.hits)?x.payload.hits:void 0;A&&tn({query:typeof((M=x.payload)==null?void 0:M.query)=="string"?x.payload.query:"",hits:A}),ut.current&&ct(Q=>Q+1)}}),[]),l.useEffect(()=>{ue&&zt(0)},[ue]);const[Qe,sn]=l.useState("idle");l.useEffect(()=>me.onStateChange(x=>sn(x)),[]),l.useEffect(()=>{G&&$(0)},[G]),l.useEffect(()=>{let o=!1;async function x(){u("");try{const S=await is(r);if(o)return;n(S),d(S.status),ht(S.status)&&O.markClosed(),ne(S.status==="running"||S.status==="requires_action")}catch(S){if(o)return;u(S instanceof Error?S.message:i("session.loadFailed"));return}try{await O.init()}catch(S){console.warn("Failed to init adapter:",S)}}return x(),()=>{o=!0}},[r,O]);const L=ht(a),Vt=l.useRef(a);Vt.current=a,l.useEffect(()=>{if(L)return;let o=!1;const S=setInterval(async()=>{try{const M=await is(r);if(o||M.status===Vt.current)return;ht(M.status)&&O.markClosed(),d(M.status),ne(M.status==="running"||M.status==="requires_action")}catch{}},6e4);return()=>{o=!0,clearInterval(S)}},[r,L,O]);const Y=(s==null?void 0:s.access_level)==="read",Gt=tt??(_e&&!L&&!Y?_s():null),_t=l.useCallback(()=>{te([]),Oe(_s()),as(r).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[r]),We=l.useCallback(async(o,x)=>{const S=le.current;if(!S||L)return;if(o.sessionId===r){te(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,Q="default")=>te(be=>[...be,{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:Q}]);M(B("session.resume.restoring",{title:o.title??""}));try{await as(r),te([]);const A=await S.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]),nn=l.useCallback(async()=>{if(s!=null&&s.environment_id)try{const o=await er({environment_id:s.environment_id});window.location.href=`/code/${o.id}?resumeFrom=${r}`}catch(o){de(B("session.createFailedWithReason",{message:o instanceof Error?o.message:String(o)}))}},[s,r,de]),rn=l.useRef(new URLSearchParams(window.location.search).get("resumeFrom")),Jt=l.useRef(!1);l.useEffect(()=>{const o=rn.current;!o||Jt.current||!W||!U.resume||(Jt.current=!0,window.history.replaceState({},"",window.location.pathname),We({sessionId:o,title:o.slice(0,8),modified:0},null))},[W,U.resume,We]);const Me=l.useCallback(async o=>{const x=o.text.trim(),S=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!x&&!S||L)return;const M=/^\/resume(?:\s+(.*))?$/.exec(x);if(M){const Q=(M[1]??"").trim();if(!U.resume){te(be=>[...be,{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}Q?await We({sessionId:Q,title:Q,modified:0},x):v(!0);return}const A=await tr(x,{sessionId:r,availableCommands:vt,availableModels:(z==null?void 0:z.availableModels)??[],currentModel:z?{modelId:z.currentModelId,name:z.currentModelId}:null,supportsImages:!0,entries:Pt.current,setModel:async Q=>{await X(r,{type:"control_request",request:{subtype:"set_model",model:Q}}),Se(be=>be&&{...be,currentModelId:Q})},onNewSession:()=>{te([])}}).catch(()=>null);if(A){if(yt("[SessionDetail] local command result",A),"clearEntries"in A&&A.clearEntries){_t();return}if("newSession"in A&&A.newSession){_t();return}if("userEntry"in A){te(Q=>[...Q,A.userEntry,A.cmdEntry]);return}}ne(!0);try{await O.sendMessage(x,o.images,o.attachments)}catch(Q){if(console.error("Send failed:",Q),Q instanceof sr&&Q.type==="session_closed"){d("archived"),O.markClosed(),de(i("session.closedSendBlocked"));return}de(`${i("session.sendFailed")}${Q instanceof Error?`: ${Q.message}`:""}`)}},[O,L,r,z,vt,_t,de,We,U]),an=l.useCallback(o=>{if(H){ie(x=>[...x,o]);return}Me(o)},[H,Me]),[Ct,Xt]=l.useState(!1),on=l.useCallback(()=>{H||(Xt(!0),Me({text:"/dream"}))},[H,Me]);l.useEffect(()=>{!H&&Ct&&(Xt(!1),ct(o=>o+1))},[H,Ct]);const Tt=l.useRef(!1);l.useEffect(()=>{if(L){ie(x=>x.length>0?[]:x);return}if(H||ye.length===0||Tt.current)return;const o=ye[0];o&&(Tt.current=!0,ie(x=>x.slice(1)),Me(o).finally(()=>{Tt.current=!1}))},[H,ye,Me,L]);const ln=l.useCallback((o,x)=>{if(H)return;const S=x==="edit"?i("session.rewind.confirmEdit"):i("session.rewind.confirm");window.confirm(`${S}
78
78
  ${i("session.rewind.confirmBody")}`)&&O.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),de(B("session.rewind.failed",{message:M instanceof Error?M.message:String(M)}))})},[H,de]),cn=l.useCallback(o=>{const x=He.orderedMatchIds;if(x.length===0)return;const S=(o%x.length+x.length)%x.length;E(S);const M=x[S],A=document.querySelector(`[data-entry-id="${CSS.escape(M)}"]`);A==null||A.scrollIntoView({block:"center",behavior:"smooth"})},[He]),Zt=l.useCallback(async()=>{try{await O.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{ne(!1)}},[O]),dn=l.useCallback(()=>{jt(Ha(y))},[jt,y]);l.useEffect(()=>()=>{Le.current&&clearTimeout(Le.current),Be.current&&clearTimeout(Be.current)},[]);const un=l.useCallback(async()=>{if(s&&window.confirm(i("dashboard.confirmDelete").replace("{id}",s.title||s.id)))try{await os(s.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:i("dashboard.deleteFailed"))}},[s]),mn=l.useCallback(async o=>{try{await O.respondPermission(o,!0)}catch(x){console.error("Failed to approve:",x)}ae(x=>x.filter(S=>S.requestId!==o))},[O]),xn=l.useCallback(async(o,x)=>{try{await O.respondPermission(o,!0,{updated_permissions:x})}catch(S){console.error("Failed to approve with rules:",S)}ae(S=>S.filter(M=>M.requestId!==o))},[O]),pn=l.useCallback(async(o,x)=>{const S=Ce;if(nt(null),!!S)try{await O.respondElicitation(S.requestId,o,x)}catch(M){console.error("Failed to submit elicitation:",M)}},[Ce,O]),fn=l.useCallback(()=>{!s||Y||(rt(s.title||""),Ue(!0),setTimeout(()=>{var o,x;(o=ge.current)==null||o.focus(),(x=ge.current)==null||x.select()},0))},[s,Y]),es=l.useCallback(async()=>{const o=Te.trim();if(Ue(!1),!(!s||!o||o===s.title))try{const x=await nr(s.id,o);n(S=>S&&{...S,title:x.title??o})}catch(x){console.error("Rename failed:",x),alert(x instanceof Error?x.message:i("session.rename.failed"))}},[s,Te]),hn=l.useCallback(async o=>{try{await O.respondPermission(o,!1)}catch(x){console.error("Failed to reject:",x)}ae(x=>x.filter(S=>S.requestId!==o))},[O]),yn=l.useCallback(async(o,x,S)=>{try{await X(r,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:S,answers:x}})}catch(M){console.error("Failed to submit answers:",M)}ae(M=>M.filter(A=>A.requestId!==o))},[r]),gn=l.useCallback(async(o,x,S)=>{try{x==="no"?await X(r,{type:"permission_response",approved:!1,request_id:o,...S?{message:S}:{}}):await X(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)}ae(M=>M.filter(A=>A.requestId!==o))},[r]);return c?e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(xt,{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(xt,{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(eo,{sessionId:r,agentId:s.environment_id})]}):e.jsx(Os,{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(xt,{onBack:t,title:Ke?e.jsx("input",{ref:ge,value:Te,onChange:o=>rt(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),es()):o.key==="Escape"&&(o.preventDefault(),Ue(!1))},onBlur:()=>void es(),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:fn,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(jr,{visibility:s.visibility||"private",className:"hidden flex-shrink-0 text-[10px] sm:inline-flex"})]}),meta:e.jsx(e.Fragment,{children:(()=>{var S;const o=s.source==="acp"?"acp":(S=s.environment)==null?void 0:S.worker_type,x=Ps(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:()=>pe(!G),className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${G?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("artifacts.title"),children:[e.jsx(rr,{className:"h-3.5 w-3.5"}),oe>0&&!G&&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:oe>9?"9+":oe})]}),e.jsxs("button",{onClick:()=>Nt(!ue),className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${ue?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("memories.title"),children:[e.jsx(Dt,{className:"h-3.5 w-3.5"}),St>0&&!ue&&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:St>9?"9+":St})]}),U.side_question&&!L&&!Y&&e.jsx("button",{onClick:()=>m(!C),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${C?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("session.sideQuestion.title"),children:e.jsx(Us,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>{const o=!k;R(o),o?setTimeout(()=>{var x;return(x=P.current)==null?void 0:x.focus()},0):(w(""),E(0))},className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors ${k?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("session.search.title"),children:e.jsx(gt,{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(Ls,{className:"h-3.5 w-3.5"})}),U.remote_settings&&!L&&!Y&&e.jsx("button",{onClick:()=>T(!_),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${_?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("session.settings.title"),children:e.jsx(Bs,{className:"h-3.5 w-3.5"})}),!Y&&(s==null?void 0:s.access_level)!=="write"&&e.jsx("button",{onClick:()=>K(!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(Xr,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>p(!f),className:"ml-0.5 flex items-center gap-1 rounded-md px-2 py-1 text-xs font-semibold text-text-primary hover:bg-brand-light hover:text-white transition-colors",title:i("session.info"),children:[i("session.tasks"),re.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:re.length})]})]})})}),(Qe==="reconnecting"||Qe==="failed")&&e.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-1.5 text-xs font-medium ${Qe==="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 ${Qe==="failed"?"bg-status-error":"animate-pulse bg-status-warning"}`}),Qe==="failed"?i("session.sseFailed"):i("session.sseReconnecting")]}),G&&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(br,{sessionId:r,embedded:!0,refreshTick:Ne})})}),k&&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(gt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{ref:P,value:j,onChange:o=>{w(o.target.value),E(0)},onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),cn(j&&o.shiftKey?F-1:F+1)):o.key==="Escape"&&(o.preventDefault(),R(!1),w(""))},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:He.orderedMatchIds.length===0?i("session.search.noResults"):`${F+1}/${He.orderedMatchIds.length}`})]})}),e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(ar,{entries:ee,isLoading:H,turnStartedAt:Fe,emptyTitle:i("session.emptyTitle"),emptyDescription:i("session.emptyDescription"),searchMatchIds:j.trim()?He.matchIds:void 0,onRewindEntry:U.rewind&&!L&&!Y&&!H?(o,x)=>ln(o,x):void 0})}),dt!==null&&e.jsx(we,{open:ue,onOpenChange:Nt,children:e.jsxs(ve,{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(ke,{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:()=>Nt(!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(Ds,{className:"h-4 w-4"})})}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx(Oa,{refreshTick:Zs,recall:dt==="memdir"?en:void 0,dreaming:dt==="memdir"?H&&Ct:void 0,onDreamTrigger:dt==="memdir"?on:void 0})})]})}),e.jsx(ca,{state:$e,onStopTask:Lt}),re.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:re.map(o=>e.jsx(Za,{request:o,onApprove:()=>mn(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>xn(o.requestId,o.suggestions??[]):void 0,onReject:()=>hn(o.requestId),onSubmitAnswers:yn,onSubmitPlan:gn},o.requestId))})}),Ce&&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(Ta,{request:Ce,onSubmit:pn})})}),qt&&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:qt})}),Ee&&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:Ee})}),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(Xa,{mode:y,onModeChange:jt,disabled:L||Y}),e.jsx(Ja,{models:(z==null?void 0:z.availableModels)??[],currentModelId:(z==null?void 0:z.currentModelId)??null,onSelect:o=>{X(r,{type:"control_request",request:{subtype:"set_model",model:o}}),Se(x=>x&&{...x,currentModelId:o})},disabled:L||Y}),U.set_max_thinking_tokens&&e.jsx(Wa,{budget:he,onBudgetChange:Js,disabled:L||Y}),U.set_effort&&e.jsx(Ya,{effort:Ht,onEffortChange:o=>Qt.set(o),disabled:L||Y}),U.set_token_mode&&e.jsx(za,{mode:Kt,onModeChange:o=>lt.set(o),disabled:L||Y})]}),e.jsx("div",{className:"flex flex-shrink-0 items-center gap-3",children:Gt&&e.jsx(Ga,{usage:Gt})})]}),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 nn(),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(or,{onSubmit:an,isLoading:H,onInterrupt:Zt,onCycleMode:dn,disabled:L||Y,placeholder:L?i("session.closed"):Y?i("session.readOnly"):i("session.inputPlaceholder"),supportsAttachments:!0,commands:vt,queueWhileLoading:!0,queuedCount:ye.length,onDequeue:o=>ie(x=>x.filter((S,M)=>M!==o)),onSearchFiles:U.file_search?o=>O.searchFiles(o):void 0,historyKey:r,draftOverride:D}),g&&e.jsx(ga,{onClose:()=>b(!1),fetchServers:()=>O.getMcpServers(),onToggle:(o,x)=>O.toggleMcpServer(o,x),onReconnect:o=>O.reconnectMcpServer(o)}),_&&e.jsx(wa,{onClose:()=>T(!1),fetchSettings:()=>O.getRemoteSettings(),onApply:o=>O.applyFlagSettings(o)}),C&&e.jsx(va,{onClose:()=>m(!1),onAsk:o=>O.askSideQuestion(o)}),f&&s&&e.jsx(ma,{onClose:()=>p(!1),session:s,liveStatus:a,pendingPermissions:re,subagentState:$e,onStopTask:Lt,onInterrupt:Zt,onDelete:un,onEndSession:U.end_session&&!L&&!Y?async()=>{await O.endSession("ended from web"),await os(s.id),window.location.href="/code/"}:void 0}),e.jsx(Aa,{open:q,onClose:()=>K(!1),sessionId:s.id,sessionTitle:s.title||void 0}),e.jsx(Da,{open:h,onClose:()=>v(!1),adapter:O,onResume:o=>{v(!1),We(o,null)}})]})}):e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(xt,{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 Za({request:r,onApprove:t,onApproveAlways:s,onReject:n,onSubmitAnswers:a,onSubmitPlan:d}){const c=r.toolName,u=r.toolInput,f=r.description||"";if(c==="AskUserQuestion"){const p=u.questions||[];return e.jsx(Na,{requestId:r.requestId,questions:p,description:f,onSubmit:g=>a(r.requestId,g,p),onSkip:n})}if(c==="ExitPlanMode"){const p=u.plan||"";return e.jsx(_a,{requestId:r.requestId,planContent:p,description:f,onSubmit:(g,b)=>d(r.requestId,g,b)})}return e.jsx(ka,{requestId:r.requestId,toolName:c,toolInput:u,description:f,suggestions:r.suggestions,onApprove:t,onApproveAlways:s,onReject:n})}function eo({sessionId:r,agentId:t}){const[s,n]=l.useState(null),[a,d]=l.useState("disconnected"),[c,u]=l.useState(null),f=l.useRef(null);return l.useEffect(()=>{const p=Ba(t);return p.setConnectionStateHandler((g,b)=>{d(g),u(b||null)}),f.current=p,n(p),p.connect().catch(g=>{g instanceof ir||(u(g.message),d("error"))}),()=>{p.disconnect(),f.current=null,n(null),d("disconnected")}},[t]),e.jsx(Os,{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(lr,{client:s,agentId:t})})]})})}export{ho as SessionDetail};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./vendor-DE_-CLIE.js";import{aA as c,V as n,ay as i}from"./main-D4UrY-Md.js";/**
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{aA as c,V as n,ay as i}from"./main-B2Nonos_.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{aV as v,c as N,aO as t}from"./main-D4UrY-Md.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{aV as v,c as N,aO as t}from"./main-B2Nonos_.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{an as m,b as h}from"./main-D4UrY-Md.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{an as m,b as h}from"./main-B2Nonos_.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{aA as q,W as T,aW as M,aO as t,e as B,X as F,aP as W,ay as G,U as V,aE as X,a8 as Y,av as J,au as K,aV as Q,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-D4UrY-Md.js";import{R as U,E as oe}from"./RegisterEmpty-DZsgoKf3.js";import{U as le,A as O}from"./UserSearchInput-BgwNP3Sb.js";import{C as D}from"./copy-nuU4lqSF.js";import{g as ce}from"./workerType-Bjs5mpVV.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";/**
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aA as q,W as T,aW as M,aO as t,e as B,X as F,aP as W,ay as G,U as V,aE as X,a8 as Y,av as J,au as K,aV as Q,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-B2Nonos_.js";import{R as U,E as oe}from"./RegisterEmpty-X-9vRPKk.js";import{U as le,A as O}from"./UserSearchInput-eNdovFoR.js";import{C as D}from"./copy-B9nUKyEJ.js";import{g as ce}from"./workerType-DA-wSQX5.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{aW as b,aX as v,aO as a,aV as C,aP as f,N as D,W as S}from"./main-D4UrY-Md.js";import{D as E,a as T,d as k}from"./dialog-BnYwGN7f.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 z(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 I(){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=z(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{I as TeamList};
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{aW as b,aX as v,aO as a,aV as C,aP as f,N as D,W as S}from"./main-B2Nonos_.js";import{D as E,a as T,d as k}from"./dialog-BrV9mMDa.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 z(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 I(){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=z(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{I as TeamList};