@saluzi/saluzi-edu 0.7.13 → 0.7.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/cli.js +42 -42
  2. package/dist/rcs-web/assets/{AdminPanel-DugQ1zJs.js → AdminPanel-CoSNNH8v.js} +1 -1
  3. package/dist/rcs-web/assets/{ArtifactView-rXn5UHd0.js → ArtifactView-CaZ6Bn-5.js} +1 -1
  4. package/{packages/remote-control-server/web/dist/assets/ArtifactsGallery-DYZ5MTsU.js → dist/rcs-web/assets/ArtifactsGallery-CMBl4_tW.js} +1 -1
  5. package/{packages/remote-control-server/web/dist/assets/Claim-55pIPPu9.js → dist/rcs-web/assets/Claim-BZ03VZxd.js} +1 -1
  6. package/dist/rcs-web/assets/{Dashboard-CC-Am4QG.js → Dashboard-DNk4dBkp.js} +1 -1
  7. package/dist/rcs-web/assets/{Join-Bv_quRru.js → Join-CL9s-HWG.js} +1 -1
  8. package/{packages/remote-control-server/web/dist/assets/Login-CQvhBtmI.js → dist/rcs-web/assets/Login-DypP2NZb.js} +1 -1
  9. package/dist/rcs-web/assets/{MemoriesGallery-DmhB-a-r.js → MemoriesGallery-BZi7L7O1.js} +1 -1
  10. package/dist/rcs-web/assets/{Register-CWCr9uhR.js → Register-BF2mhSpw.js} +1 -1
  11. package/dist/rcs-web/assets/{RegisterEmpty-BxED5Dy8.js → RegisterEmpty-40NZTQDf.js} +1 -1
  12. package/dist/rcs-web/assets/SessionDetail-Czr-xzEy.js +78 -0
  13. package/dist/rcs-web/assets/{SessionVisibilityBadge-mclra9a1.js → SessionVisibilityBadge-CrG4pyXD.js} +1 -1
  14. package/dist/rcs-web/assets/{Setup-BOa1QZgo.js → Setup-CVwnJSHR.js} +1 -1
  15. package/dist/rcs-web/assets/{ShareLanding-DUksxKDO.js → ShareLanding-DzIeZduO.js} +1 -1
  16. package/{packages/remote-control-server/web/dist/assets/TeamDetail-N4R7QgkK.js → dist/rcs-web/assets/TeamDetail-Bx5Dwc5B.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamList-Dkroa-DR.js → TeamList-wAXXbAI0.js} +1 -1
  18. package/dist/rcs-web/assets/{TeamSettings-sH6k3cBB.js → TeamSettings-BH6epZ5p.js} +1 -1
  19. package/dist/rcs-web/assets/{UserSearchInput-B8gKPGEK.js → UserSearchInput-zZQ--3Ir.js} +1 -1
  20. package/dist/rcs-web/assets/{UserSettings-Cnr-Z5oi.js → UserSettings-CXKAmil9.js} +1 -1
  21. package/dist/rcs-web/assets/{arc-BaScP50H.js → arc-C2C2gTUa.js} +1 -1
  22. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-LpUmudjN.js → architectureDiagram-3BPJPVTR-C52vQ2yU.js} +1 -1
  23. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BahEW4lQ.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-BCeJ7dZv.js} +1 -1
  24. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-NNZbDHKK.js → c4Diagram-AAUBKEIU-DfGvJnoF.js} +1 -1
  25. package/dist/rcs-web/assets/channel-Dk8Mq-sv.js +1 -0
  26. package/dist/rcs-web/assets/{chunk-2J33WTMH-69YYeEie.js → chunk-2J33WTMH-SqwYjXR7.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-4BX2VUAB-CoMWvtbi.js → chunk-4BX2VUAB-Cd1lbVto.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-55IACEB6-BhdS00Z_.js → chunk-55IACEB6-Dxz0QJbP.js} +1 -1
  29. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-B-X0tTCc.js → dist/rcs-web/assets/chunk-727SXJPM-D_RP38k0.js} +1 -1
  30. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-uNpZ8YVO.js → dist/rcs-web/assets/chunk-AQP2D5EJ-CoK7QXm2.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-FMBD7UC4-INF2n4DE.js → chunk-FMBD7UC4-B7eZscRi.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-ND2GUHAM-CGoZKqoJ.js → chunk-ND2GUHAM-Bvpp9Nsj.js} +1 -1
  33. package/dist/rcs-web/assets/{chunk-QZHKN3VN-B0_Eodir.js → chunk-QZHKN3VN-B44Qhl3N.js} +1 -1
  34. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DBfm1aim.js +1 -0
  35. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DBfm1aim.js +1 -0
  36. package/dist/rcs-web/assets/{code-block-IT6T5CEO-Dqe2MgFE.js → code-block-IT6T5CEO-Bsu934p0.js} +1 -1
  37. package/dist/rcs-web/assets/{copy-BM16nNhl.js → copy-WjRHDSJw.js} +1 -1
  38. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CnkedUmD.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-CRqEQHqF.js} +1 -1
  39. package/dist/rcs-web/assets/{dagre-BM42HDAG-C3C2M9Dc.js → dagre-BM42HDAG-BDwZiG9l.js} +1 -1
  40. package/{packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-ESFaqWFA.js → dist/rcs-web/assets/diagram-2AECGRRQ-1zqGFe6d.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-5GNKFQAL-18y3Di-Z.js → diagram-5GNKFQAL-CK6r1W7f.js} +1 -1
  42. package/{packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-HRfgxVLi.js → dist/rcs-web/assets/diagram-KO2AKTUF-BwN2jZs0.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-LMA3HP47-BGXS1MbV.js → diagram-LMA3HP47-k7cBgmg8.js} +1 -1
  44. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-mTYLV8qh.js → dist/rcs-web/assets/diagram-OG6HWLK6-XBGYM6sm.js} +1 -1
  45. package/dist/rcs-web/assets/{dialog-BY4fOXc_.js → dialog-tLY80h3R.js} +1 -1
  46. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-DS5hbsJs.js → erDiagram-TEJ5UH35-BOUhUwWy.js} +1 -1
  47. package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-CZdy8yJc.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-BtWAyBVD.js} +1 -1
  48. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DSBnE024.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-BGxCZ0WS.js} +1 -1
  49. package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-SPF9bGwd.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BWvEdHPG.js} +1 -1
  50. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-BHH_W4WL.js → infoDiagram-5YYISTIA-cFmh_D91.js} +1 -1
  51. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-Dk_V2DBo.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-KQ8Hx0X-.js} +1 -1
  52. package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-D9V0wEAf.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-DmxNxWUD.js} +1 -1
  53. package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-CsqaKKO9.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-CB1YdgUa.js} +1 -1
  54. package/dist/rcs-web/assets/{linear-B41O4W2v.js → linear-BOVhyWJg.js} +1 -1
  55. package/dist/rcs-web/assets/main-B--R2IYC.css +1 -0
  56. package/dist/rcs-web/assets/{main-BEcUh0F7.js → main-DifWL4zR.js} +25 -25
  57. package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-C1VVhmLq.js → dist/rcs-web/assets/mermaid-VLURNSYL-Bh10UEb0.js} +4 -4
  58. package/dist/rcs-web/assets/{mermaid.core-DQfCv5Cg.js → mermaid.core-C2g8nuIa.js} +5 -5
  59. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-BD1xoQCh.js → mindmap-definition-RKZ34NQL-svJpj9yT.js} +1 -1
  60. package/dist/rcs-web/assets/{notifications-BPvB-uGE.js → notifications-BYK9k_gx.js} +1 -1
  61. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-C9VTG-uO.js → pieDiagram-4H26LBE5-SVCCRmI6.js} +1 -1
  62. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-CcdAz31R.js → quadrantDiagram-W4KKPZXB-7PTV2sCP.js} +1 -1
  63. package/dist/rcs-web/assets/{refresh-cw-D-EyhwSL.js → refresh-cw-MOW7habc.js} +1 -1
  64. package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-56ONxGl0.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-BcQxVg5g.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-ECkEyAfb.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DvO2xXKc.js} +1 -1
  66. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-C_31JcIA.js → sequenceDiagram-3UESZ5HK-klx9nfJu.js} +1 -1
  67. package/{packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-BCCWavRG.js → dist/rcs-web/assets/stateDiagram-AJRCARHV-CwJT8yW5.js} +1 -1
  68. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CErSQlCd.js → stateDiagram-v2-BHNVJYJU-Cc4iVBiV.js} +1 -1
  69. package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-Bq1dpAT8.js → timeline-definition-PNZ67QCA-CePQ_Ywg.js} +1 -1
  70. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-C0gZpyFU.js → vennDiagram-CIIHVFJN-D285USzy.js} +1 -1
  71. package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-qPrWLnjV.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-BHk_TcK3.js} +1 -1
  72. package/dist/rcs-web/assets/{workerType-CWB4ZW61.js → workerType-DXaJtQ7o.js} +1 -1
  73. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-p83OQUAm.js → xychartDiagram-2RQKCTM6-DSZgafuZ.js} +1 -1
  74. package/dist/rcs-web/index.html +3 -3
  75. package/package.json +1 -1
  76. package/packages/remote-control-server/web/dist/assets/{AdminPanel-DugQ1zJs.js → AdminPanel-CoSNNH8v.js} +1 -1
  77. package/packages/remote-control-server/web/dist/assets/{ArtifactView-rXn5UHd0.js → ArtifactView-CaZ6Bn-5.js} +1 -1
  78. package/{dist/rcs-web/assets/ArtifactsGallery-DYZ5MTsU.js → packages/remote-control-server/web/dist/assets/ArtifactsGallery-CMBl4_tW.js} +1 -1
  79. package/{dist/rcs-web/assets/Claim-55pIPPu9.js → packages/remote-control-server/web/dist/assets/Claim-BZ03VZxd.js} +1 -1
  80. package/packages/remote-control-server/web/dist/assets/{Dashboard-CC-Am4QG.js → Dashboard-DNk4dBkp.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Join-Bv_quRru.js → Join-CL9s-HWG.js} +1 -1
  82. package/{dist/rcs-web/assets/Login-CQvhBtmI.js → packages/remote-control-server/web/dist/assets/Login-DypP2NZb.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/{MemoriesGallery-DmhB-a-r.js → MemoriesGallery-BZi7L7O1.js} +1 -1
  84. package/packages/remote-control-server/web/dist/assets/{Register-CWCr9uhR.js → Register-BF2mhSpw.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/{RegisterEmpty-BxED5Dy8.js → RegisterEmpty-40NZTQDf.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/SessionDetail-Czr-xzEy.js +78 -0
  87. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-mclra9a1.js → SessionVisibilityBadge-CrG4pyXD.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{Setup-BOa1QZgo.js → Setup-CVwnJSHR.js} +1 -1
  89. package/packages/remote-control-server/web/dist/assets/{ShareLanding-DUksxKDO.js → ShareLanding-DzIeZduO.js} +1 -1
  90. package/{dist/rcs-web/assets/TeamDetail-N4R7QgkK.js → packages/remote-control-server/web/dist/assets/TeamDetail-Bx5Dwc5B.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/{TeamList-Dkroa-DR.js → TeamList-wAXXbAI0.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{TeamSettings-sH6k3cBB.js → TeamSettings-BH6epZ5p.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-B8gKPGEK.js → UserSearchInput-zZQ--3Ir.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{UserSettings-Cnr-Z5oi.js → UserSettings-CXKAmil9.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/{arc-BaScP50H.js → arc-C2C2gTUa.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-LpUmudjN.js → architectureDiagram-3BPJPVTR-C52vQ2yU.js} +1 -1
  97. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-BahEW4lQ.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BCeJ7dZv.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-NNZbDHKK.js → c4Diagram-AAUBKEIU-DfGvJnoF.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/channel-Dk8Mq-sv.js +1 -0
  100. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-69YYeEie.js → chunk-2J33WTMH-SqwYjXR7.js} +1 -1
  101. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-CoMWvtbi.js → chunk-4BX2VUAB-Cd1lbVto.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-BhdS00Z_.js → chunk-55IACEB6-Dxz0QJbP.js} +1 -1
  103. package/{dist/rcs-web/assets/chunk-727SXJPM-B-X0tTCc.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-D_RP38k0.js} +1 -1
  104. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-uNpZ8YVO.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-CoK7QXm2.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-INF2n4DE.js → chunk-FMBD7UC4-B7eZscRi.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CGoZKqoJ.js → chunk-ND2GUHAM-Bvpp9Nsj.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-B0_Eodir.js → chunk-QZHKN3VN-B44Qhl3N.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DBfm1aim.js +1 -0
  109. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DBfm1aim.js +1 -0
  110. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-Dqe2MgFE.js → code-block-IT6T5CEO-Bsu934p0.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{copy-BM16nNhl.js → copy-WjRHDSJw.js} +1 -1
  112. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-CnkedUmD.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CRqEQHqF.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-C3C2M9Dc.js → dagre-BM42HDAG-BDwZiG9l.js} +1 -1
  114. package/{dist/rcs-web/assets/diagram-2AECGRRQ-ESFaqWFA.js → packages/remote-control-server/web/dist/assets/diagram-2AECGRRQ-1zqGFe6d.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-18y3Di-Z.js → diagram-5GNKFQAL-CK6r1W7f.js} +1 -1
  116. package/{dist/rcs-web/assets/diagram-KO2AKTUF-HRfgxVLi.js → packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-BwN2jZs0.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-BGXS1MbV.js → diagram-LMA3HP47-k7cBgmg8.js} +1 -1
  118. package/{dist/rcs-web/assets/diagram-OG6HWLK6-mTYLV8qh.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-XBGYM6sm.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/{dialog-BY4fOXc_.js → dialog-tLY80h3R.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-DS5hbsJs.js → erDiagram-TEJ5UH35-BOUhUwWy.js} +1 -1
  121. package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-CZdy8yJc.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-BtWAyBVD.js} +1 -1
  122. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DSBnE024.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-BGxCZ0WS.js} +1 -1
  123. package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-SPF9bGwd.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BWvEdHPG.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-BHH_W4WL.js → infoDiagram-5YYISTIA-cFmh_D91.js} +1 -1
  125. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-Dk_V2DBo.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-KQ8Hx0X-.js} +1 -1
  126. package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-D9V0wEAf.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-DmxNxWUD.js} +1 -1
  127. package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-CsqaKKO9.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-CB1YdgUa.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/{linear-B41O4W2v.js → linear-BOVhyWJg.js} +1 -1
  129. package/packages/remote-control-server/web/dist/assets/main-B--R2IYC.css +1 -0
  130. package/packages/remote-control-server/web/dist/assets/{main-BEcUh0F7.js → main-DifWL4zR.js} +25 -25
  131. package/{dist/rcs-web/assets/mermaid-VLURNSYL-C1VVhmLq.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-Bh10UEb0.js} +4 -4
  132. package/packages/remote-control-server/web/dist/assets/{mermaid.core-DQfCv5Cg.js → mermaid.core-C2g8nuIa.js} +5 -5
  133. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-BD1xoQCh.js → mindmap-definition-RKZ34NQL-svJpj9yT.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{notifications-BPvB-uGE.js → notifications-BYK9k_gx.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-C9VTG-uO.js → pieDiagram-4H26LBE5-SVCCRmI6.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-CcdAz31R.js → quadrantDiagram-W4KKPZXB-7PTV2sCP.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/{refresh-cw-D-EyhwSL.js → refresh-cw-MOW7habc.js} +1 -1
  138. package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-56ONxGl0.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-BcQxVg5g.js} +1 -1
  139. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-ECkEyAfb.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DvO2xXKc.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-C_31JcIA.js → sequenceDiagram-3UESZ5HK-klx9nfJu.js} +1 -1
  141. package/{dist/rcs-web/assets/stateDiagram-AJRCARHV-BCCWavRG.js → packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-CwJT8yW5.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CErSQlCd.js → stateDiagram-v2-BHNVJYJU-Cc4iVBiV.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-Bq1dpAT8.js → timeline-definition-PNZ67QCA-CePQ_Ywg.js} +1 -1
  144. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-C0gZpyFU.js → vennDiagram-CIIHVFJN-D285USzy.js} +1 -1
  145. package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-qPrWLnjV.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-BHk_TcK3.js} +1 -1
  146. package/packages/remote-control-server/web/dist/assets/{workerType-CWB4ZW61.js → workerType-DXaJtQ7o.js} +1 -1
  147. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-p83OQUAm.js → xychartDiagram-2RQKCTM6-DSZgafuZ.js} +1 -1
  148. package/packages/remote-control-server/web/dist/index.html +3 -3
  149. package/dist/rcs-web/assets/SessionDetail-BtVDoMg8.js +0 -83
  150. package/dist/rcs-web/assets/channel-S5Y2JIsm.js +0 -1
  151. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BftkaBF6.js +0 -1
  152. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BftkaBF6.js +0 -1
  153. package/dist/rcs-web/assets/main-B7U6M5cC.css +0 -1
  154. package/packages/remote-control-server/web/dist/assets/SessionDetail-BtVDoMg8.js +0 -83
  155. package/packages/remote-control-server/web/dist/assets/channel-S5Y2JIsm.js +0 -1
  156. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BftkaBF6.js +0 -1
  157. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BftkaBF6.js +0 -1
  158. package/packages/remote-control-server/web/dist/assets/main-B7U6M5cC.css +0 -1
@@ -1,10 +1,10 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-C1VVhmLq.js","assets/preload-helper-BiaRt2Oj.js","assets/vendor-DE_-CLIE.js","assets/shiki-ChKhlm5h.js","assets/Dashboard-CC-Am4QG.js","assets/RegisterEmpty-BxED5Dy8.js","assets/workerType-CWB4ZW61.js","assets/SessionVisibilityBadge-mclra9a1.js","assets/dialog-BY4fOXc_.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-BtVDoMg8.js","assets/refresh-cw-D-EyhwSL.js","assets/UserSearchInput-B8gKPGEK.js","assets/copy-BM16nNhl.js","assets/ArtifactsGallery-DYZ5MTsU.js","assets/MemoriesGallery-DmhB-a-r.js","assets/notifications-BPvB-uGE.js","assets/ShareLanding-DUksxKDO.js","assets/ArtifactView-rXn5UHd0.js","assets/Claim-55pIPPu9.js","assets/Login-CQvhBtmI.js","assets/Register-CWCr9uhR.js","assets/Setup-BOa1QZgo.js","assets/Join-Bv_quRru.js","assets/UserSettings-Cnr-Z5oi.js","assets/TeamList-Dkroa-DR.js","assets/TeamDetail-N4R7QgkK.js","assets/TeamSettings-sH6k3cBB.js","assets/AdminPanel-DugQ1zJs.js"])))=>i.map(i=>d[i]);
2
- var Fc=Object.defineProperty;var $c=(e,t,n)=>t in e?Fc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>$c(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as mt,j as d,R as us,r as da,b as Uc,c as fs,d as zc}from"./vendor-DE_-CLIE.js";import{_ as Ne}from"./preload-helper-BiaRt2Oj.js";import{m as Hc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function ua(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=ua(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function fa(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=ua(e))&&(r&&(r+=" "),r+=t);return r}const Bc=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Wc=(e,t)=>({classGroupId:e,validator:t}),ma=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),zn="-",eo=[],Gc="arbitrary..",Vc=e=>{const t=Kc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return qc(a);const i=a.split(zn),m=i[0]===""&&i.length>1?1:0;return pa(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=r[a],f=n[a];return m?f?Bc(f,m):m:f||eo}return n[a]||eo}}},pa=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const f=pa(e,t+1,o);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(zn):e.slice(t).join(zn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},qc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Gc+r:void 0})(),Kc=e=>{const{theme:t,classGroups:n}=e;return Yc(n,t)},Yc=(e,t)=>{const n=ma();for(const r in e){const s=e[r];ms(s,n,r,t)}return n},ms=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const a=e[o];Xc(a,t,n,r)}},Xc=(e,t,n,r)=>{if(typeof e=="string"){Qc(e,t,n);return}if(typeof e=="function"){Jc(e,t,n,r);return}Zc(e,t,n,r)},Qc=(e,t,n)=>{const r=e===""?t:ha(t,e);r.classGroupId=n},Jc=(e,t,n,r)=>{if(ed(e)){ms(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Wc(n,e))},Zc=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let a=0;a<o;a++){const[i,m]=s[a];ms(m,ha(t,i),n,r)}},ha=(e,t)=>{let n=e;const r=t.split(zn),s=r.length;for(let o=0;o<s;o++){const a=r[o];let i=n.nextPart.get(a);i||(i=ma(),n.nextPart.set(a,i)),n=i}return n},ed=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,td=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,a)=>{n[o]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=r[o])!==void 0)return s(o,a),a},set(o,a){o in n?n[o]=a:s(o,a)}}},Hr="!",to=":",nd=[],no=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),rd=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let a=0,i=0,m=0,f;const l=s.length;for(let v=0;v<l;v++){const w=s[v];if(a===0&&i===0){if(w===to){o.push(s.slice(m,v)),m=v+1;continue}if(w==="/"){f=v;continue}}w==="["?a++:w==="]"?a--:w==="("?i++:w===")"&&i--}const c=o.length===0?s:s.slice(m);let u=c,h=!1;c.endsWith(Hr)?(u=c.slice(0,-1),h=!0):c.startsWith(Hr)&&(u=c.slice(1),h=!0);const b=f&&f>m?f-m:void 0;return no(o,h,u,b)};if(t){const s=t+to,o=r;r=a=>a.startsWith(s)?o(a.slice(s.length)):no(nd,!1,a,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},sd=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const a=n[o],i=a[0]==="[",m=t.has(a);i||m?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},od=e=>({cache:td(e.cacheSize),parseClassName:rd(e),sortModifiers:sd(e),postfixLookupClassGroupIds:ad(e),...Vc(e)}),ad=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},id=/\s+/,ld=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(id);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:u,modifiers:h,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:w}=n(c);if(u){f=c+(f.length>0?" "+f:f);continue}let y=!!w,T;if(y){const _=v.substring(0,w);T=r(_);const g=T&&a[T]?r(v):void 0;g&&g!==T&&(T=g,y=!1)}else T=r(v);if(!T){if(!y){f=c+(f.length>0?" "+f:f);continue}if(T=r(v),!T){f=c+(f.length>0?" "+f:f);continue}y=!1}const A=h.length===0?"":h.length===1?h[0]:o(h).join(":"),k=b?A+Hr:A,O=k+T;if(i.indexOf(O)>-1)continue;i.push(O);const E=s(T,y);for(let _=0;_<E.length;++_){const g=E[_];i.push(k+g)}f=c+(f.length>0?" "+f:f)}return f},cd=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=ga(n))&&(s&&(s+=" "),s+=r);return s},ga=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=ga(e[r]))&&(n&&(n+=" "),n+=t);return n},dd=(e,...t)=>{let n,r,s,o;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=od(f),r=n.cache.get,s=n.cache.set,o=i,i(m)},i=m=>{const f=r(m);if(f)return f;const l=ld(m,n);return s(m,l),l};return o=a,(...m)=>o(cd(...m))},ud=[],Te=e=>{const t=n=>n[e]||ud;return t.isThemeGetter=!0,t},ba=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,md=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pd=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ft=e=>fd.test(e),ie=e=>!!e&&!Number.isNaN(Number(e)),Ke=e=>!!e&&Number.isInteger(Number(e)),yr=e=>e.endsWith("%")&&ie(e.slice(0,-1)),nt=e=>md.test(e),ya=()=>!0,xd=e=>pd.test(e)&&!hd.test(e),ps=()=>!1,yd=e=>gd.test(e),vd=e=>bd.test(e),wd=e=>!Q(e)&&!J(e),Sd=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Cd=e=>vt(e,Sa,ps),Q=e=>ba.test(e),Et=e=>vt(e,Ca,xd),ro=e=>vt(e,Nd,ie),kd=e=>vt(e,Ea,ya),Ed=e=>vt(e,ka,ps),so=e=>vt(e,va,ps),Ad=e=>vt(e,wa,vd),_n=e=>vt(e,Aa,yd),J=e=>xa.test(e),on=e=>It(e,Ca),Td=e=>It(e,ka),oo=e=>It(e,va),_d=e=>It(e,Sa),Rd=e=>It(e,wa),Rn=e=>It(e,Aa,!0),Md=e=>It(e,Ea,!0),vt=(e,t,n)=>{const r=ba.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},It=(e,t,n=!1)=>{const r=xa.exec(e);return r?r[1]?t(r[1]):n:!1},va=e=>e==="position"||e==="percentage",wa=e=>e==="image"||e==="url",Sa=e=>e==="length"||e==="size"||e==="bg-size",Ca=e=>e==="length",Nd=e=>e==="number",ka=e=>e==="family-name",Ea=e=>e==="number"||e==="weight",Aa=e=>e==="shadow",jd=()=>{const e=Te("color"),t=Te("font"),n=Te("text"),r=Te("font-weight"),s=Te("tracking"),o=Te("leading"),a=Te("breakpoint"),i=Te("container"),m=Te("spacing"),f=Te("radius"),l=Te("shadow"),c=Te("inset-shadow"),u=Te("text-shadow"),h=Te("drop-shadow"),b=Te("blur"),v=Te("perspective"),w=Te("aspect"),y=Te("ease"),T=Te("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...k(),J,Q],E=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],g=()=>[J,Q,m],x=()=>[ft,"full","auto",...g()],M=()=>[Ke,"none","subgrid",J,Q],I=()=>["auto",{span:["full",Ke,J,Q]},Ke,J,Q],D=()=>[Ke,"auto",J,Q],F=()=>["auto","min","max","fr",J,Q],j=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...g()],S=()=>[ft,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...g()],H=()=>[ft,"screen","full","dvw","lvw","svw","min","max","fit",...g()],P=()=>[ft,"screen","full","lh","dvh","lvh","svh","min","max","fit",...g()],U=()=>[e,J,Q],Y=()=>[...k(),oo,so,{position:[J,Q]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",_d,Cd,{size:[J,Q]}],$=()=>[yr,on,Et],R=()=>["","none","full",f,J,Q],B=()=>["",ie,on,Et],V=()=>["solid","dashed","dotted","double"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[ie,yr,oo,so],oe=()=>["","none",b,J,Q],ee=()=>["none",ie,J,Q],re=()=>["none",ie,J,Q],ce=()=>[ie,J,Q],ve=()=>[ft,"full",...g()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[nt],breakpoint:[nt],color:[ya],container:[nt],"drop-shadow":[nt],ease:["in","out","in-out"],font:[wd],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[nt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[nt],shadow:[nt],spacing:["px",ie],text:[nt],"text-shadow":[nt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ft,Q,J,w]}],container:["container"],"container-type":[{"@container":["","normal","size",J,Q]}],"container-named":[Sd],columns:[{columns:[ie,Q,J,i]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[Ke,"auto",J,Q]}],basis:[{basis:[ft,"full","auto",i,...g()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ie,ft,"auto","initial","none",Q]}],grow:[{grow:["",ie,J,Q]}],shrink:[{shrink:["",ie,J,Q]}],order:[{order:[Ke,"first","last","none",J,Q]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:g()}],"gap-x":[{"gap-x":g()}],"gap-y":[{"gap-y":g()}],"justify-content":[{justify:[...j(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...j()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":j()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:g()}],px:[{px:g()}],py:[{py:g()}],ps:[{ps:g()}],pe:[{pe:g()}],pbs:[{pbs:g()}],pbe:[{pbe:g()}],pt:[{pt:g()}],pr:[{pr:g()}],pb:[{pb:g()}],pl:[{pl:g()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mbs:[{mbs:C()}],mbe:[{mbe:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":g()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":g()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...S()]}],"min-w":[{"min-w":[i,"screen","none",...S()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...S()]}],h:[{h:["screen","lh",...S()]}],"min-h":[{"min-h":["screen","lh","none",...S()]}],"max-h":[{"max-h":["screen","lh",...S()]}],"font-size":[{text:["base",n,on,Et]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Md,kd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yr,Q]}],"font-family":[{font:[Td,Ed,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,J,Q]}],"line-clamp":[{"line-clamp":[ie,"none",J,ro]}],leading:[{leading:[o,...g()]}],"list-image":[{"list-image":["none",J,Q]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",J,Q]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[ie,"from-font","auto",J,Et]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ie,"auto",J,Q]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:g()}],"tab-size":[{tab:[Ke,J,Q]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",J,Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",J,Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ke,J,Q],radial:["",J,Q],conic:[Ke,J,Q]},Rd,Ad]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ie,J,Q]}],"outline-w":[{outline:["",ie,on,Et]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,Rn,_n]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,Rn,_n]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ie,Et]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",u,Rn,_n]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ie,J,Q]}],"mix-blend":[{"mix-blend":[...q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[J,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",J,Q]}],filter:[{filter:["","none",J,Q]}],blur:[{blur:oe()}],brightness:[{brightness:[ie,J,Q]}],contrast:[{contrast:[ie,J,Q]}],"drop-shadow":[{"drop-shadow":["","none",h,Rn,_n]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ie,J,Q]}],"hue-rotate":[{"hue-rotate":[ie,J,Q]}],invert:[{invert:["",ie,J,Q]}],saturate:[{saturate:[ie,J,Q]}],sepia:[{sepia:["",ie,J,Q]}],"backdrop-filter":[{"backdrop-filter":["","none",J,Q]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[ie,J,Q]}],"backdrop-contrast":[{"backdrop-contrast":[ie,J,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ie,J,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ie,J,Q]}],"backdrop-invert":[{"backdrop-invert":["",ie,J,Q]}],"backdrop-opacity":[{"backdrop-opacity":[ie,J,Q]}],"backdrop-saturate":[{"backdrop-saturate":[ie,J,Q]}],"backdrop-sepia":[{"backdrop-sepia":["",ie,J,Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":g()}],"border-spacing-x":[{"border-spacing-x":g()}],"border-spacing-y":[{"border-spacing-y":g()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",J,Q]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ie,"initial",J,Q]}],ease:[{ease:["linear","initial",y,J,Q]}],delay:[{delay:[ie,J,Q]}],animate:[{animate:["none",T,J,Q]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,J,Q]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[J,Q,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],zoom:[{zoom:[Ke,J,Q]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",J,Q]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":g()}],"scroll-mx":[{"scroll-mx":g()}],"scroll-my":[{"scroll-my":g()}],"scroll-ms":[{"scroll-ms":g()}],"scroll-me":[{"scroll-me":g()}],"scroll-mbs":[{"scroll-mbs":g()}],"scroll-mbe":[{"scroll-mbe":g()}],"scroll-mt":[{"scroll-mt":g()}],"scroll-mr":[{"scroll-mr":g()}],"scroll-mb":[{"scroll-mb":g()}],"scroll-ml":[{"scroll-ml":g()}],"scroll-p":[{"scroll-p":g()}],"scroll-px":[{"scroll-px":g()}],"scroll-py":[{"scroll-py":g()}],"scroll-ps":[{"scroll-ps":g()}],"scroll-pe":[{"scroll-pe":g()}],"scroll-pbs":[{"scroll-pbs":g()}],"scroll-pbe":[{"scroll-pbe":g()}],"scroll-pt":[{"scroll-pt":g()}],"scroll-pr":[{"scroll-pr":g()}],"scroll-pb":[{"scroll-pb":g()}],"scroll-pl":[{"scroll-pl":g()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",J,Q]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ie,on,Et,ro]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Pd=dd(jd);function Z(...e){return Pd(fa(e))}function Id(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function ov(e){return e?new Date(e*1e3).toLocaleString():""}function av(e){return e==="archived"||e==="inactive"}function iv(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function Dd(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function lv(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),Dd(t)}function cv(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}const Od=/^Remote Control connecting(?:…|\.\.\.)$/;function dv(e){return typeof e=="string"&&Od.test(e.trim())}/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-Bh10UEb0.js","assets/preload-helper-BiaRt2Oj.js","assets/vendor-DE_-CLIE.js","assets/shiki-ChKhlm5h.js","assets/Dashboard-DNk4dBkp.js","assets/RegisterEmpty-40NZTQDf.js","assets/workerType-DXaJtQ7o.js","assets/SessionVisibilityBadge-CrG4pyXD.js","assets/dialog-tLY80h3R.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-Czr-xzEy.js","assets/refresh-cw-MOW7habc.js","assets/UserSearchInput-zZQ--3Ir.js","assets/copy-WjRHDSJw.js","assets/ArtifactsGallery-CMBl4_tW.js","assets/MemoriesGallery-BZi7L7O1.js","assets/notifications-BYK9k_gx.js","assets/ShareLanding-DzIeZduO.js","assets/ArtifactView-CaZ6Bn-5.js","assets/Claim-BZ03VZxd.js","assets/Login-DypP2NZb.js","assets/Register-BF2mhSpw.js","assets/Setup-CVwnJSHR.js","assets/Join-CL9s-HWG.js","assets/UserSettings-CXKAmil9.js","assets/TeamList-wAXXbAI0.js","assets/TeamDetail-Bx5Dwc5B.js","assets/TeamSettings-BH6epZ5p.js","assets/AdminPanel-CoSNNH8v.js"])))=>i.map(i=>d[i]);
2
+ var Fc=Object.defineProperty;var $c=(e,t,n)=>t in e?Fc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>$c(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as mt,j as d,R as us,r as da,b as Uc,c as fs,d as zc}from"./vendor-DE_-CLIE.js";import{_ as Ne}from"./preload-helper-BiaRt2Oj.js";import{m as Hc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function ua(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=ua(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function fa(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=ua(e))&&(s&&(s+=" "),s+=t);return s}const Bc=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},Wc=(e,t)=>({classGroupId:e,validator:t}),ma=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),zn="-",eo=[],Gc="arbitrary..",Vc=e=>{const t=Kc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return qc(a);const i=a.split(zn),m=i[0]===""&&i.length>1?1:0;return pa(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=s[a],f=n[a];return m?f?Bc(f,m):m:f||eo}return n[a]||eo}}},pa=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const f=pa(e,t+1,o);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(zn):e.slice(t).join(zn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},qc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?Gc+s:void 0})(),Kc=e=>{const{theme:t,classGroups:n}=e;return Yc(n,t)},Yc=(e,t)=>{const n=ma();for(const s in e){const r=e[s];ms(r,n,s,t)}return n},ms=(e,t,n,s)=>{const r=e.length;for(let o=0;o<r;o++){const a=e[o];Xc(a,t,n,s)}},Xc=(e,t,n,s)=>{if(typeof e=="string"){Qc(e,t,n);return}if(typeof e=="function"){Jc(e,t,n,s);return}Zc(e,t,n,s)},Qc=(e,t,n)=>{const s=e===""?t:ha(t,e);s.classGroupId=n},Jc=(e,t,n,s)=>{if(ed(e)){ms(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(Wc(n,e))},Zc=(e,t,n,s)=>{const r=Object.entries(e),o=r.length;for(let a=0;a<o;a++){const[i,m]=r[a];ms(m,ha(t,i),n,s)}},ha=(e,t)=>{let n=e;const s=t.split(zn),r=s.length;for(let o=0;o<r;o++){const a=s[o];let i=n.nextPart.get(a);i||(i=ma(),n.nextPart.set(a,i)),n=i}return n},ed=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,td=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(o,a)=>{n[o]=a,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=s[o])!==void 0)return r(o,a),a},set(o,a){o in n?n[o]=a:r(o,a)}}},Hr="!",to=":",nd=[],no=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),rd=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const o=[];let a=0,i=0,m=0,f;const l=r.length;for(let v=0;v<l;v++){const w=r[v];if(a===0&&i===0){if(w===to){o.push(r.slice(m,v)),m=v+1;continue}if(w==="/"){f=v;continue}}w==="["?a++:w==="]"?a--:w==="("?i++:w===")"&&i--}const c=o.length===0?r:r.slice(m);let u=c,h=!1;c.endsWith(Hr)?(u=c.slice(0,-1),h=!0):c.startsWith(Hr)&&(u=c.slice(1),h=!0);const b=f&&f>m?f-m:void 0;return no(o,h,u,b)};if(t){const r=t+to,o=s;s=a=>a.startsWith(r)?o(a.slice(r.length)):no(nd,!1,a,void 0,!0)}if(n){const r=s;s=o=>n({className:o,parseClassName:r})}return s},sd=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let o=0;o<n.length;o++){const a=n[o],i=a[0]==="[",m=t.has(a);i||m?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(a)):r.push(a)}return r.length>0&&(r.sort(),s.push(...r)),s}},od=e=>({cache:td(e.cacheSize),parseClassName:rd(e),sortModifiers:sd(e),postfixLookupClassGroupIds:ad(e),...Vc(e)}),ad=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let s=0;s<n.length;s++)t[n[s]]=!0;return t},id=/\s+/,ld=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:o,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(id);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:u,modifiers:h,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:w}=n(c);if(u){f=c+(f.length>0?" "+f:f);continue}let y=!!w,T;if(y){const _=v.substring(0,w);T=s(_);const g=T&&a[T]?s(v):void 0;g&&g!==T&&(T=g,y=!1)}else T=s(v);if(!T){if(!y){f=c+(f.length>0?" "+f:f);continue}if(T=s(v),!T){f=c+(f.length>0?" "+f:f);continue}y=!1}const A=h.length===0?"":h.length===1?h[0]:o(h).join(":"),k=b?A+Hr:A,O=k+T;if(i.indexOf(O)>-1)continue;i.push(O);const E=r(T,y);for(let _=0;_<E.length;++_){const g=E[_];i.push(k+g)}f=c+(f.length>0?" "+f:f)}return f},cd=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=ga(n))&&(r&&(r+=" "),r+=s);return r},ga=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=ga(e[s]))&&(n&&(n+=" "),n+=t);return n},dd=(e,...t)=>{let n,s,r,o;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=od(f),s=n.cache.get,r=n.cache.set,o=i,i(m)},i=m=>{const f=s(m);if(f)return f;const l=ld(m,n);return r(m,l),l};return o=a,(...m)=>o(cd(...m))},ud=[],Te=e=>{const t=n=>n[e]||ud;return t.isThemeGetter=!0,t},ba=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,md=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pd=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ft=e=>fd.test(e),ie=e=>!!e&&!Number.isNaN(Number(e)),Ke=e=>!!e&&Number.isInteger(Number(e)),yr=e=>e.endsWith("%")&&ie(e.slice(0,-1)),nt=e=>md.test(e),ya=()=>!0,xd=e=>pd.test(e)&&!hd.test(e),ps=()=>!1,yd=e=>gd.test(e),vd=e=>bd.test(e),wd=e=>!J(e)&&!Z(e),Sd=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Cd=e=>vt(e,Sa,ps),J=e=>ba.test(e),Et=e=>vt(e,Ca,xd),ro=e=>vt(e,Nd,ie),kd=e=>vt(e,Ea,ya),Ed=e=>vt(e,ka,ps),so=e=>vt(e,va,ps),Ad=e=>vt(e,wa,vd),_n=e=>vt(e,Aa,yd),Z=e=>xa.test(e),on=e=>It(e,Ca),Td=e=>It(e,ka),oo=e=>It(e,va),_d=e=>It(e,Sa),Rd=e=>It(e,wa),Rn=e=>It(e,Aa,!0),Md=e=>It(e,Ea,!0),vt=(e,t,n)=>{const s=ba.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},It=(e,t,n=!1)=>{const s=xa.exec(e);return s?s[1]?t(s[1]):n:!1},va=e=>e==="position"||e==="percentage",wa=e=>e==="image"||e==="url",Sa=e=>e==="length"||e==="size"||e==="bg-size",Ca=e=>e==="length",Nd=e=>e==="number",ka=e=>e==="family-name",Ea=e=>e==="number"||e==="weight",Aa=e=>e==="shadow",jd=()=>{const e=Te("color"),t=Te("font"),n=Te("text"),s=Te("font-weight"),r=Te("tracking"),o=Te("leading"),a=Te("breakpoint"),i=Te("container"),m=Te("spacing"),f=Te("radius"),l=Te("shadow"),c=Te("inset-shadow"),u=Te("text-shadow"),h=Te("drop-shadow"),b=Te("blur"),v=Te("perspective"),w=Te("aspect"),y=Te("ease"),T=Te("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...k(),Z,J],E=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],g=()=>[Z,J,m],x=()=>[ft,"full","auto",...g()],M=()=>[Ke,"none","subgrid",Z,J],I=()=>["auto",{span:["full",Ke,Z,J]},Ke,Z,J],D=()=>[Ke,"auto",Z,J],F=()=>["auto","min","max","fr",Z,J],j=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...g()],S=()=>[ft,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...g()],H=()=>[ft,"screen","full","dvw","lvw","svw","min","max","fit",...g()],P=()=>[ft,"screen","full","lh","dvh","lvh","svh","min","max","fit",...g()],U=()=>[e,Z,J],Y=()=>[...k(),oo,so,{position:[Z,J]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",_d,Cd,{size:[Z,J]}],$=()=>[yr,on,Et],R=()=>["","none","full",f,Z,J],B=()=>["",ie,on,Et],V=()=>["solid","dashed","dotted","double"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[ie,yr,oo,so],oe=()=>["","none",b,Z,J],ee=()=>["none",ie,Z,J],re=()=>["none",ie,Z,J],ce=()=>[ie,Z,J],ve=()=>[ft,"full",...g()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[nt],breakpoint:[nt],color:[ya],container:[nt],"drop-shadow":[nt],ease:["in","out","in-out"],font:[wd],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[nt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[nt],shadow:[nt],spacing:["px",ie],text:[nt],"text-shadow":[nt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ft,J,Z,w]}],container:["container"],"container-type":[{"@container":["","normal","size",Z,J]}],"container-named":[Sd],columns:[{columns:[ie,J,Z,i]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[Ke,"auto",Z,J]}],basis:[{basis:[ft,"full","auto",i,...g()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ie,ft,"auto","initial","none",J]}],grow:[{grow:["",ie,Z,J]}],shrink:[{shrink:["",ie,Z,J]}],order:[{order:[Ke,"first","last","none",Z,J]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:g()}],"gap-x":[{"gap-x":g()}],"gap-y":[{"gap-y":g()}],"justify-content":[{justify:[...j(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...j()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":j()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:g()}],px:[{px:g()}],py:[{py:g()}],ps:[{ps:g()}],pe:[{pe:g()}],pbs:[{pbs:g()}],pbe:[{pbe:g()}],pt:[{pt:g()}],pr:[{pr:g()}],pb:[{pb:g()}],pl:[{pl:g()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mbs:[{mbs:C()}],mbe:[{mbe:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":g()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":g()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...S()]}],"min-w":[{"min-w":[i,"screen","none",...S()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...S()]}],h:[{h:["screen","lh",...S()]}],"min-h":[{"min-h":["screen","lh","none",...S()]}],"max-h":[{"max-h":["screen","lh",...S()]}],"font-size":[{text:["base",n,on,Et]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Md,kd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yr,J]}],"font-family":[{font:[Td,Ed,t]}],"font-features":[{"font-features":[J]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Z,J]}],"line-clamp":[{"line-clamp":[ie,"none",Z,ro]}],leading:[{leading:[o,...g()]}],"list-image":[{"list-image":["none",Z,J]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Z,J]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[ie,"from-font","auto",Z,Et]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ie,"auto",Z,J]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:g()}],"tab-size":[{tab:[Ke,Z,J]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Z,J]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Z,J]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ke,Z,J],radial:["",Z,J],conic:[Ke,Z,J]},Rd,Ad]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ie,Z,J]}],"outline-w":[{outline:["",ie,on,Et]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,Rn,_n]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,Rn,_n]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ie,Et]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",u,Rn,_n]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ie,Z,J]}],"mix-blend":[{"mix-blend":[...q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Z,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Z,J]}],filter:[{filter:["","none",Z,J]}],blur:[{blur:oe()}],brightness:[{brightness:[ie,Z,J]}],contrast:[{contrast:[ie,Z,J]}],"drop-shadow":[{"drop-shadow":["","none",h,Rn,_n]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ie,Z,J]}],"hue-rotate":[{"hue-rotate":[ie,Z,J]}],invert:[{invert:["",ie,Z,J]}],saturate:[{saturate:[ie,Z,J]}],sepia:[{sepia:["",ie,Z,J]}],"backdrop-filter":[{"backdrop-filter":["","none",Z,J]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[ie,Z,J]}],"backdrop-contrast":[{"backdrop-contrast":[ie,Z,J]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ie,Z,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ie,Z,J]}],"backdrop-invert":[{"backdrop-invert":["",ie,Z,J]}],"backdrop-opacity":[{"backdrop-opacity":[ie,Z,J]}],"backdrop-saturate":[{"backdrop-saturate":[ie,Z,J]}],"backdrop-sepia":[{"backdrop-sepia":["",ie,Z,J]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":g()}],"border-spacing-x":[{"border-spacing-x":g()}],"border-spacing-y":[{"border-spacing-y":g()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Z,J]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ie,"initial",Z,J]}],ease:[{ease:["linear","initial",y,Z,J]}],delay:[{delay:[ie,Z,J]}],animate:[{animate:["none",T,Z,J]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Z,J]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[Z,J,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],zoom:[{zoom:[Ke,Z,J]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Z,J]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":g()}],"scroll-mx":[{"scroll-mx":g()}],"scroll-my":[{"scroll-my":g()}],"scroll-ms":[{"scroll-ms":g()}],"scroll-me":[{"scroll-me":g()}],"scroll-mbs":[{"scroll-mbs":g()}],"scroll-mbe":[{"scroll-mbe":g()}],"scroll-mt":[{"scroll-mt":g()}],"scroll-mr":[{"scroll-mr":g()}],"scroll-mb":[{"scroll-mb":g()}],"scroll-ml":[{"scroll-ml":g()}],"scroll-p":[{"scroll-p":g()}],"scroll-px":[{"scroll-px":g()}],"scroll-py":[{"scroll-py":g()}],"scroll-ps":[{"scroll-ps":g()}],"scroll-pe":[{"scroll-pe":g()}],"scroll-pbs":[{"scroll-pbs":g()}],"scroll-pbe":[{"scroll-pbe":g()}],"scroll-pt":[{"scroll-pt":g()}],"scroll-pr":[{"scroll-pr":g()}],"scroll-pb":[{"scroll-pb":g()}],"scroll-pl":[{"scroll-pl":g()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Z,J]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ie,on,Et,ro]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Pd=dd(jd);function Q(...e){return Pd(fa(e))}function Id(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function ov(e){return e?new Date(e*1e3).toLocaleString():""}function av(e){return e==="archived"||e==="inactive"}function iv(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function Dd(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function lv(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),Dd(t)}function cv(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}const Od=/^Remote Control connecting(?:…|\.\.\.)$/;function dv(e){return typeof e=="string"&&Od.test(e.trim())}/**
3
3
  * @license lucide-react v0.555.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const Ld=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),ao=e=>{const t=Fd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ta=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),$d=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
7
+ */const Ld=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),ao=e=>{const t=Fd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ta=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),$d=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
8
8
  * @license lucide-react v0.555.0 - ISC
9
9
  *
10
10
  * This source code is licensed under the ISC license.
@@ -14,12 +14,12 @@ var Fc=Object.defineProperty;var $c=(e,t,n)=>t in e?Fc(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the ISC license.
16
16
  * See the LICENSE file in the root directory of this source tree.
17
- */const zd=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:a,...i},m)=>p.createElement("svg",{ref:m,...Ud,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ta("lucide",s),...!o&&!$d(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...Array.isArray(o)?o:[o]]));/**
17
+ */const zd=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:o,iconNode:a,...i},m)=>p.createElement("svg",{ref:m,...Ud,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Ta("lucide",r),...!o&&!$d(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...Array.isArray(o)?o:[o]]));/**
18
18
  * @license lucide-react v0.555.0 - ISC
19
19
  *
20
20
  * This source code is licensed under the ISC license.
21
21
  * See the LICENSE file in the root directory of this source tree.
22
- */const le=(e,t)=>{const n=p.forwardRef(({className:r,...s},o)=>p.createElement(zd,{ref:o,iconNode:t,className:Ta(`lucide-${Ld(ao(e))}`,`lucide-${e}`,r),...s}));return n.displayName=ao(e),n};/**
22
+ */const le=(e,t)=>{const n=p.forwardRef(({className:s,...r},o)=>p.createElement(zd,{ref:o,iconNode:t,className:Ta(`lucide-${Ld(ao(e))}`,`lucide-${e}`,s),...r}));return n.displayName=ao(e),n};/**
23
23
  * @license lucide-react v0.555.0 - ISC
24
24
  *
25
25
  * This source code is licensed under the ISC license.
@@ -209,13 +209,13 @@ var Fc=Object.defineProperty;var $c=(e,t,n)=>t in e?Fc(e,t,{enumerable:!0,config
209
209
  *
210
210
  * This source code is licensed under the ISC license.
211
211
  * See the LICENSE file in the root directory of this source tree.
212
- */const Ku=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],bn=le("x",Ku),La=p.createContext(void 0),Fa="theme";function io(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function lo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(Fa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function co(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function Yu(){const e=p.useContext(La);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Xu({children:e,defaultTheme:t="system"}){const[n,r]=p.useState(()=>lo()||t),[s,o]=p.useState(()=>{const m=lo()||t;return m==="system"?io():m}),a=p.useCallback(m=>{r(m);try{localStorage.setItem(Fa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?io():n;o(m),co(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";o(c),co(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:s,setTheme:a};return mt.createElement(La.Provider,{value:i},e)}function uo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ze(...e){return t=>{let n=!1;const r=e.map(s=>{const o=uo(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():uo(e[s],null)}}}}function Ae(...e){return p.useCallback(Ze(...e),e)}var Qu=Symbol.for("react.lazy"),Hn=us[" use ".trim().toString()];function Ju(e){return typeof e=="object"&&e!==null&&"then"in e}function $a(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Qu&&"_payload"in e&&Ju(e._payload)}function Ua(e){const t=ef(e),n=p.forwardRef((r,s)=>{let{children:o,...a}=r;$a(o)&&typeof Hn=="function"&&(o=Hn(o._payload));const i=p.Children.toArray(o),m=i.find(nf);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:s,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var Zu=Ua("Slot");function ef(e){const t=p.forwardRef((n,r)=>{let{children:s,...o}=n;if($a(s)&&typeof Hn=="function"&&(s=Hn(s._payload)),p.isValidElement(s)){const a=sf(s),i=rf(o,s.props);return s.type!==p.Fragment&&(i.ref=r?Ze(r,a):a),p.cloneElement(s,i)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tf=Symbol("radix.slottable");function nf(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tf}function rf(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...i)=>{const m=o(...i);return s(...i),m}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function sf(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const fo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mo=fa,of=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return mo(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,a=Object.keys(s).map(f=>{const l=n==null?void 0:n[f],c=o==null?void 0:o[f];if(l===null)return null;const u=fo(l)||fo(c);return s[f][u]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,u]=l;return u===void 0||(f[c]=u),f},{}),m=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,l)=>{let{class:c,className:u,...h}=l;return Object.entries(h).every(b=>{let[v,w]=b;return Array.isArray(w)?w.includes({...o,...i}[v]):{...o,...i}[v]===w})?[...f,c,u]:f},[]);return mo(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},af=of("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Dt({className:e,variant:t,size:n,asChild:r=!1,...s}){const o=r?Zu:"button";return d.jsx(o,{"data-slot":"button",className:Z(af({variant:t,size:n,className:e})),...s})}function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function lf(e,t){const n=p.createContext(t),r=o=>{const{children:a,...i}=o,m=p.useMemo(()=>i,Object.values(i));return d.jsx(n.Provider,{value:m,children:a})};r.displayName=e+"Provider";function s(o){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function it(e,t=[]){let n=[];function r(o,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var y;const{scope:u,children:h,...b}=c,v=((y=u==null?void 0:u[e])==null?void 0:y[m])||i,w=p.useMemo(()=>b,Object.values(b));return d.jsx(v.Provider,{value:w,children:h})};f.displayName=o+"Provider";function l(c,u){var v;const h=((v=u==null?void 0:u[e])==null?void 0:v[m])||i,b=p.useContext(h);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${o}\``)}return[f,l]}const s=()=>{const o=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return s.scopeName=e,[r,cf(s,...t)]}function cf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=r.reduce((i,{useScope:m,scopeName:f})=>{const c=m(o)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var rt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},df=us[" useInsertionEffect ".trim().toString()]||rt;function gt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,a]=uf({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:s;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${r} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,r])}const f=p.useCallback(l=>{var c;if(i){const u=ff(l)?l(e):l;u!==e&&((c=a.current)==null||c.call(a,u))}else o(l)},[i,e,o,a]);return[m,f]}function uf({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return df(()=>{o.current=t},[t]),p.useEffect(()=>{var a;s.current!==n&&((a=o.current)==null||a.call(o,n),s.current=n)},[n,s]),[n,r,o]}function ff(e){return typeof e=="function"}function Yt(e){const t=mf(e),n=p.forwardRef((r,s)=>{const{children:o,...a}=r,i=p.Children.toArray(o),m=i.find(hf);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:s,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function mf(e){const t=p.forwardRef((n,r)=>{const{children:s,...o}=n;if(p.isValidElement(s)){const a=bf(s),i=gf(o,s.props);return s.type!==p.Fragment&&(i.ref=r?Ze(r,a):a),p.cloneElement(s,i)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var za=Symbol("radix.slottable");function pf(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=za,t}function hf(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===za}function gf(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...i)=>{const m=o(...i);return s(...i),m}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function bf(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],be=xf.reduce((e,t)=>{const n=Yt(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:a,...i}=s,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ha(e,t){e&&da.flushSync(()=>e.dispatchEvent(t))}function Ba(e){const t=e+"CollectionProvider",[n,r]=it(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:w,children:y}=v,T=mt.useRef(null),A=mt.useRef(new Map).current;return d.jsx(s,{scope:w,itemMap:A,collectionRef:T,children:y})};a.displayName=t;const i=e+"CollectionSlot",m=Yt(i),f=mt.forwardRef((v,w)=>{const{scope:y,children:T}=v,A=o(i,y),k=Ae(w,A.collectionRef);return d.jsx(m,{ref:k,children:T})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",u=Yt(l),h=mt.forwardRef((v,w)=>{const{scope:y,children:T,...A}=v,k=mt.useRef(null),O=Ae(w,k),E=o(l,y);return mt.useEffect(()=>(E.itemMap.set(k,{ref:k,...A}),()=>void E.itemMap.delete(k))),d.jsx(u,{[c]:"",ref:O,children:T})});h.displayName=l;function b(v){const w=o(e+"CollectionConsumer",v);return mt.useCallback(()=>{const T=w.collectionRef.current;if(!T)return[];const A=Array.from(T.querySelectorAll(`[${c}]`));return Array.from(w.itemMap.values()).sort((E,_)=>A.indexOf(E.ref.current)-A.indexOf(_.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},b,r]}var yf=p.createContext(void 0);function Wa(e){const t=p.useContext(yf);return e||t||"ltr"}function st(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function vf(e,t=globalThis==null?void 0:globalThis.document){const n=st(e);p.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var wf="DismissableLayer",Br="dismissableLayer.update",Sf="dismissableLayer.pointerDownOutside",Cf="dismissableLayer.focusOutside",po,Ga=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(Ga),[l,c]=p.useState(null),u=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),b=Ae(t,_=>c(_)),v=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(w),T=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,k=T>=y,O=Af(_=>{const g=_.target,x=[...f.branches].some(M=>M.contains(g));!k||x||(s==null||s(_),a==null||a(_),_.defaultPrevented||i==null||i())},u),E=Tf(_=>{const g=_.target;[...f.branches].some(M=>M.contains(g))||(o==null||o(_),a==null||a(_),_.defaultPrevented||i==null||i())},u);return vf(_=>{T===f.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&i&&(_.preventDefault(),i()))},u),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(po=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ho(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=po)}},[l,u,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ho())},[l,f]),p.useEffect(()=>{const _=()=>h({});return document.addEventListener(Br,_),()=>document.removeEventListener(Br,_)},[]),d.jsx(be.div,{...m,ref:b,style:{pointerEvents:A?k?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,E.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,O.onPointerDownCapture)})});xn.displayName=wf;var kf="DismissableLayerBranch",Ef=p.forwardRef((e,t)=>{const n=p.useContext(Ga),r=p.useRef(null),s=Ae(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),d.jsx(be.div,{...e,ref:s})});Ef.displayName=kf;function Af(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),r=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const o=i=>{if(i.target&&!r.current){let m=function(){Va(Sf,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Tf(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),r=p.useRef(!1);return p.useEffect(()=>{const s=o=>{o.target&&!r.current&&Va(Cf,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ho(){const e=new CustomEvent(Br);document.dispatchEvent(e)}function Va(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Ha(s,o):s.dispatchEvent(o)}var vr=0;function bs(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??go()),document.body.insertAdjacentElement("beforeend",e[1]??go()),vr++,()=>{vr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vr--}},[])}function go(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var wr="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",bo={bubbles:!1,cancelable:!0},_f="FocusScope",nr=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=e,[i,m]=p.useState(null),f=st(s),l=st(o),c=p.useRef(null),u=Ae(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let v=function(A){if(h.paused||!i)return;const k=A.target;i.contains(k)?c.current=k:pt(c.current,{select:!0})},w=function(A){if(h.paused||!i)return;const k=A.relatedTarget;k!==null&&(i.contains(k)||pt(c.current,{select:!0}))},y=function(A){if(document.activeElement===document.body)for(const O of A)O.removedNodes.length>0&&pt(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const T=new MutationObserver(y);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),T.disconnect()}}},[r,i,h.paused]),p.useEffect(()=>{if(i){yo.add(h);const v=document.activeElement;if(!i.contains(v)){const y=new CustomEvent(wr,bo);i.addEventListener(wr,f),i.dispatchEvent(y),y.defaultPrevented||(Rf(If(qa(i)),{select:!0}),document.activeElement===v&&pt(i))}return()=>{i.removeEventListener(wr,f),setTimeout(()=>{const y=new CustomEvent(Sr,bo);i.addEventListener(Sr,l),i.dispatchEvent(y),y.defaultPrevented||pt(v??document.body,{select:!0}),i.removeEventListener(Sr,l),yo.remove(h)},0)}}},[i,f,l,h]);const b=p.useCallback(v=>{if(!n&&!r||h.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,y=document.activeElement;if(w&&y){const T=v.currentTarget,[A,k]=Mf(T);A&&k?!v.shiftKey&&y===k?(v.preventDefault(),n&&pt(A,{select:!0})):v.shiftKey&&y===A&&(v.preventDefault(),n&&pt(k,{select:!0})):y===T&&v.preventDefault()}},[n,r,h.paused]);return d.jsx(be.div,{tabIndex:-1,...a,ref:u,onKeyDown:b})});nr.displayName=_f;function Rf(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(pt(r,{select:t}),document.activeElement!==n)return}function Mf(e){const t=qa(e),n=xo(t,e),r=xo(t.reverse(),e);return[n,r]}function qa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function xo(e,t){for(const n of e)if(!Nf(n,{upTo:t}))return n}function Nf(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function jf(e){return e instanceof HTMLInputElement&&"select"in e}function pt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&jf(e)&&t&&e.select()}}var yo=Pf();function Pf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=vo(e,t),e.unshift(t)},remove(t){var n;e=vo(e,t),(n=e[0])==null||n.resume()}}}function vo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function If(e){return e.filter(t=>t.tagName!=="A")}var Df=us[" useId ".trim().toString()]||(()=>{}),Of=0;function De(e){const[t,n]=p.useState(Df());return rt(()=>{n(r=>r??String(Of++))},[e]),e||(t?`radix-${t}`:"")}const Lf=["top","right","bottom","left"],bt=Math.min,$e=Math.max,Bn=Math.round,Mn=Math.floor,Je=e=>({x:e,y:e}),Ff={left:"right",right:"left",bottom:"top",top:"bottom"};function Wr(e,t,n){return $e(e,bt(t,n))}function ot(e,t){return typeof e=="function"?e(t):e}function at(e){return e.split("-")[0]}function Zt(e){return e.split("-")[1]}function xs(e){return e==="x"?"y":"x"}function ys(e){return e==="y"?"height":"width"}function Qe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function vs(e){return xs(Qe(e))}function $f(e,t,n){n===void 0&&(n=!1);const r=Zt(e),s=vs(e),o=ys(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=Wn(a)),[a,Wn(a)]}function Uf(e){const t=Wn(e);return[Gr(e),t,Gr(t)]}function Gr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wo=["left","right"],So=["right","left"],zf=["top","bottom"],Hf=["bottom","top"];function Bf(e,t,n){switch(e){case"top":case"bottom":return n?t?So:wo:t?wo:So;case"left":case"right":return t?zf:Hf;default:return[]}}function Wf(e,t,n,r){const s=Zt(e);let o=Bf(at(e),n==="start",r);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map(Gr)))),o}function Wn(e){const t=at(e);return Ff[t]+e.slice(t.length)}function Gf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ka(e){return typeof e!="number"?Gf(e):{top:e,right:e,bottom:e,left:e}}function Gn(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Co(e,t,n){let{reference:r,floating:s}=e;const o=Qe(t),a=vs(t),i=ys(a),m=at(t),f=o==="y",l=r.x+r.width/2-s.width/2,c=r.y+r.height/2-s.height/2,u=r[i]/2-s[i]/2;let h;switch(m){case"top":h={x:l,y:r.y-s.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-s.width,y:c};break;default:h={x:r.x,y:r.y}}switch(Zt(t)){case"start":h[a]-=u*(n&&f?-1:1);break;case"end":h[a]+=u*(n&&f?-1:1);break}return h}async function Vf(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:u=!1,padding:h=0}=ot(t,e),b=Ka(h),w=i[u?c==="floating"?"reference":"floating":c],y=Gn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),T=c==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(i.floating)),k=await(o.isElement==null?void 0:o.isElement(A))?await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1}:{x:1,y:1},O=Gn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:T,offsetParent:A,strategy:m}):T);return{top:(y.top-O.top+b.top)/k.y,bottom:(O.bottom-y.bottom+b.bottom)/k.y,left:(y.left-O.left+b.left)/k.x,right:(O.right-y.right+b.right)/k.x}}const qf=50,Kf=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:Vf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:l,y:c}=Co(f,r,m),u=r,h=0;const b={};for(let v=0;v<o.length;v++){const w=o[v];if(!w)continue;const{name:y,fn:T}=w,{x:A,y:k,data:O,reset:E}=await T({x:l,y:c,initialPlacement:r,placement:u,strategy:s,middlewareData:b,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=k??c,b[y]={...b[y],...O},E&&h<qf&&(h++,typeof E=="object"&&(E.placement&&(u=E.placement),E.rects&&(f=E.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x:l,y:c}=Co(f,u,m)),v=-1)}return{x:l,y:c,placement:u,strategy:s,middlewareData:b}},Yf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=ot(e,t)||{};if(f==null)return{};const c=Ka(l),u={x:n,y:r},h=vs(s),b=ys(h),v=await a.getDimensions(f),w=h==="y",y=w?"top":"left",T=w?"bottom":"right",A=w?"clientHeight":"clientWidth",k=o.reference[b]+o.reference[h]-u[h]-o.floating[b],O=u[h]-o.reference[h],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let _=E?E[A]:0;(!_||!await(a.isElement==null?void 0:a.isElement(E)))&&(_=i.floating[A]||o.floating[b]);const g=k/2-O/2,x=_/2-v[b]/2-1,M=bt(c[y],x),I=bt(c[T],x),D=M,F=_-v[b]-I,j=_/2-v[b]/2+g,z=Wr(D,j,F),C=!m.arrow&&Zt(s)!=null&&j!==z&&o.reference[b]/2-(j<D?M:I)-v[b]/2<0,S=C?j<D?j-D:j-F:0;return{[h]:u[h]+S,data:{[h]:z,centerOffset:j-z-S,...C&&{alignmentOffset:S}},reset:C}}}),Xf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...w}=ot(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=at(s),T=Qe(i),A=at(i)===i,k=await(m.isRTL==null?void 0:m.isRTL(f.floating)),O=u||(A||!v?[Wn(i)]:Uf(i)),E=b!=="none";!u&&E&&O.push(...Wf(i,v,b,k));const _=[i,...O],g=await m.detectOverflow(t,w),x=[];let M=((r=o.flip)==null?void 0:r.overflows)||[];if(l&&x.push(g[y]),c){const j=$f(s,a,k);x.push(g[j[0]],g[j[1]])}if(M=[...M,{placement:s,overflows:x}],!x.every(j=>j<=0)){var I,D;const j=(((I=o.flip)==null?void 0:I.index)||0)+1,z=_[j];if(z&&(!(c==="alignment"?T!==Qe(z):!1)||M.every(H=>Qe(H.placement)===T?H.overflows[0]>0:!0)))return{data:{index:j,overflows:M},reset:{placement:z}};let C=(D=M.filter(S=>S.overflows[0]<=0).sort((S,H)=>S.overflows[1]-H.overflows[1])[0])==null?void 0:D.placement;if(!C)switch(h){case"bestFit":{var F;const S=(F=M.filter(H=>{if(E){const P=Qe(H.placement);return P===T||P==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((H,P)=>H[1]-P[1])[0])==null?void 0:F[0];S&&(C=S);break}case"initialPlacement":C=i;break}if(s!==C)return{reset:{placement:C}}}return{}}}};function ko(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Eo(e){return Lf.some(t=>e[t]>=0)}const Qf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=ot(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...o,elementContext:"reference"}),i=ko(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Eo(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...o,altBoundary:!0}),i=ko(a,n.floating);return{data:{escapedOffsets:i,escaped:Eo(i)}}}default:return{}}}}},Ya=new Set(["left","top"]);async function Jf(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=at(n),i=Zt(n),m=Qe(n)==="y",f=Ya.has(a)?-1:1,l=o&&m?-1:1,c=ot(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:b}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof b=="number"&&(h=i==="end"?b*-1:b),m?{x:h*l,y:u*f}:{x:u*f,y:h*l}}const Zf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:a,middlewareData:i}=t,m=await Jf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:a}}}}},em=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:y=>{let{x:T,y:A}=y;return{x:T,y:A}}},...f}=ot(e,t),l={x:n,y:r},c=await o.detectOverflow(t,f),u=Qe(at(s)),h=xs(u);let b=l[h],v=l[u];if(a){const y=h==="y"?"top":"left",T=h==="y"?"bottom":"right",A=b+c[y],k=b-c[T];b=Wr(A,b,k)}if(i){const y=u==="y"?"top":"left",T=u==="y"?"bottom":"right",A=v+c[y],k=v-c[T];v=Wr(A,v,k)}const w=m.fn({...t,[h]:b,[u]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:a,[u]:i}}}}}},tm=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=ot(e,t),l={x:n,y:r},c=Qe(s),u=xs(c);let h=l[u],b=l[c];const v=ot(i,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=u==="y"?"height":"width",k=o.reference[u]-o.floating[A]+w.mainAxis,O=o.reference[u]+o.reference[A]-w.mainAxis;h<k?h=k:h>O&&(h=O)}if(f){var y,T;const A=u==="y"?"width":"height",k=Ya.has(at(s)),O=o.reference[c]-o.floating[A]+(k&&((y=a.offset)==null?void 0:y[c])||0)+(k?0:w.crossAxis),E=o.reference[c]+o.reference[A]+(k?0:((T=a.offset)==null?void 0:T[c])||0)-(k?w.crossAxis:0);b<O?b=O:b>E&&(b=E)}return{[u]:h,[c]:b}}}},nm=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:a,elements:i}=t,{apply:m=()=>{},...f}=ot(e,t),l=await a.detectOverflow(t,f),c=at(s),u=Zt(s),h=Qe(s)==="y",{width:b,height:v}=o.floating;let w,y;c==="top"||c==="bottom"?(w=c,y=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(y=c,w=u==="end"?"top":"bottom");const T=v-l.top-l.bottom,A=b-l.left-l.right,k=bt(v-l[w],T),O=bt(b-l[y],A),E=!t.middlewareData.shift;let _=k,g=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=A),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=T),E&&!u){const M=$e(l.left,0),I=$e(l.right,0),D=$e(l.top,0),F=$e(l.bottom,0);h?g=b-2*(M!==0||I!==0?M+I:$e(l.left,l.right)):_=v-2*(D!==0||F!==0?D+F:$e(l.top,l.bottom))}await m({...t,availableWidth:g,availableHeight:_});const x=await a.getDimensions(i.floating);return b!==x.width||v!==x.height?{reset:{rects:!0}}:{}}}};function rr(){return typeof window<"u"}function en(e){return Xa(e)?(e.nodeName||"").toLowerCase():"#document"}function Ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function et(e){var t;return(t=(Xa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xa(e){return rr()?e instanceof Node||e instanceof Ue(e).Node:!1}function We(e){return rr()?e instanceof Element||e instanceof Ue(e).Element:!1}function lt(e){return rr()?e instanceof HTMLElement||e instanceof Ue(e).HTMLElement:!1}function Ao(e){return!rr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ue(e).ShadowRoot}function yn(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function rm(e){return/^(table|td|th)$/.test(en(e))}function sr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sm=/transform|translate|scale|rotate|perspective|filter/,om=/paint|layout|strict|content/,At=e=>!!e&&e!=="none";let Cr;function ws(e){const t=We(e)?Ge(e):e;return At(t.transform)||At(t.translate)||At(t.scale)||At(t.rotate)||At(t.perspective)||!Ss()&&(At(t.backdropFilter)||At(t.filter))||sm.test(t.willChange||"")||om.test(t.contain||"")}function am(e){let t=xt(e);for(;lt(t)&&!Xt(t);){if(ws(t))return t;if(sr(t))return null;t=xt(t)}return null}function Ss(){return Cr==null&&(Cr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cr}function Xt(e){return/^(html|body|#document)$/.test(en(e))}function Ge(e){return Ue(e).getComputedStyle(e)}function or(e){return We(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xt(e){if(en(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ao(e)&&e.host||et(e);return Ao(t)?t.host:t}function Qa(e){const t=xt(e);return Xt(t)?e.ownerDocument?e.ownerDocument.body:e.body:lt(t)&&yn(t)?t:Qa(t)}function dn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Qa(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),a=Ue(s);if(o){const i=Vr(a);return t.concat(a,a.visualViewport||[],yn(s)?s:[],i&&n?dn(i):[])}else return t.concat(s,dn(s,[],n))}function Vr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ja(e){const t=Ge(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=lt(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:r,i=Bn(n)!==o||Bn(r)!==a;return i&&(n=o,r=a),{width:n,height:r,$:i}}function Cs(e){return We(e)?e:e.contextElement}function Vt(e){const t=Cs(e);if(!lt(t))return Je(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Ja(t);let a=(o?Bn(n.width):n.width)/r,i=(o?Bn(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const im=Je(0);function Za(e){const t=Ue(e);return!Ss()||!t.visualViewport?im:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ue(e)?!1:t}function Nt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=Cs(e);let a=Je(1);t&&(r?We(r)&&(a=Vt(r)):a=Vt(e));const i=lm(o,n,r)?Za(o):Je(0);let m=(s.left+i.x)/a.x,f=(s.top+i.y)/a.y,l=s.width/a.x,c=s.height/a.y;if(o){const u=Ue(o),h=r&&We(r)?Ue(r):r;let b=u,v=Vr(b);for(;v&&r&&h!==b;){const w=Vt(v),y=v.getBoundingClientRect(),T=Ge(v),A=y.left+(v.clientLeft+parseFloat(T.paddingLeft))*w.x,k=y.top+(v.clientTop+parseFloat(T.paddingTop))*w.y;m*=w.x,f*=w.y,l*=w.x,c*=w.y,m+=A,f+=k,b=Ue(v),v=Vr(b)}}return Gn({width:l,height:c,x:m,y:f})}function ar(e,t){const n=or(e).scrollLeft;return t?t.left+n:Nt(et(e)).left+n}function ei(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ar(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function cm(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",a=et(r),i=t?sr(t.floating):!1;if(r===a||i&&o)return n;let m={scrollLeft:0,scrollTop:0},f=Je(1);const l=Je(0),c=lt(r);if((c||!c&&!o)&&((en(r)!=="body"||yn(a))&&(m=or(r)),c)){const h=Nt(r);f=Vt(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const u=a&&!c&&!o?ei(a,m):Je(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+u.x,y:n.y*f.y-m.scrollTop*f.y+l.y+u.y}}function dm(e){return Array.from(e.getClientRects())}function um(e){const t=et(e),n=or(e),r=e.ownerDocument.body,s=$e(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=$e(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ar(e);const i=-n.scrollTop;return Ge(r).direction==="rtl"&&(a+=$e(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:i}}const To=25;function fm(e,t){const n=Ue(e),r=et(e),s=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,i=0,m=0;if(s){o=s.width,a=s.height;const l=Ss();(!l||l&&t==="fixed")&&(i=s.offsetLeft,m=s.offsetTop)}const f=ar(r);if(f<=0){const l=r.ownerDocument,c=l.body,u=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,b=Math.abs(r.clientWidth-c.clientWidth-h);b<=To&&(o-=b)}else f<=To&&(o+=f);return{width:o,height:a,x:i,y:m}}function mm(e,t){const n=Nt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=lt(e)?Vt(e):Je(1),a=e.clientWidth*o.x,i=e.clientHeight*o.y,m=s*o.x,f=r*o.y;return{width:a,height:i,x:m,y:f}}function _o(e,t,n){let r;if(t==="viewport")r=fm(e,n);else if(t==="document")r=um(et(e));else if(We(t))r=mm(t,n);else{const s=Za(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Gn(r)}function ti(e,t){const n=xt(e);return n===t||!We(n)||Xt(n)?!1:Ge(n).position==="fixed"||ti(n,t)}function pm(e,t){const n=t.get(e);if(n)return n;let r=dn(e,[],!1).filter(i=>We(i)&&en(i)!=="body"),s=null;const o=Ge(e).position==="fixed";let a=o?xt(e):e;for(;We(a)&&!Xt(a);){const i=Ge(a),m=ws(a);!m&&i.position==="fixed"&&(s=null),(o?!m&&!s:!m&&i.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||yn(a)&&!m&&ti(e,a))?r=r.filter(l=>l!==a):s=i,a=xt(a)}return t.set(e,r),r}function hm(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?sr(t)?[]:pm(t,this._c):[].concat(n),r],i=_o(t,a[0],s);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let u=1;u<a.length;u++){const h=_o(t,a[u],s);m=$e(h.top,m),f=bt(h.right,f),l=bt(h.bottom,l),c=$e(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function gm(e){const{width:t,height:n}=Ja(e);return{width:t,height:n}}function bm(e,t,n){const r=lt(t),s=et(t),o=n==="fixed",a=Nt(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const m=Je(0);function f(){m.x=ar(s)}if(r||!r&&!o)if((en(t)!=="body"||yn(s))&&(i=or(t)),r){const h=Nt(t,!0,o,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else s&&f();o&&!r&&s&&f();const l=s&&!r&&!o?ei(s,i):Je(0),c=a.left+i.scrollLeft-m.x-l.x,u=a.top+i.scrollTop-m.y-l.y;return{x:c,y:u,width:a.width,height:a.height}}function kr(e){return Ge(e).position==="static"}function Ro(e,t){if(!lt(e)||Ge(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function ni(e,t){const n=Ue(e);if(sr(e))return n;if(!lt(e)){let s=xt(e);for(;s&&!Xt(s);){if(We(s)&&!kr(s))return s;s=xt(s)}return n}let r=Ro(e,t);for(;r&&rm(r)&&kr(r);)r=Ro(r,t);return r&&Xt(r)&&kr(r)&&!ws(r)?n:r||am(e)||n}const xm=async function(e){const t=this.getOffsetParent||ni,n=this.getDimensions,r=await n(e.floating);return{reference:bm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ym(e){return Ge(e).direction==="rtl"}const vm={convertOffsetParentRelativeRectToViewportRelativeRect:cm,getDocumentElement:et,getClippingRect:hm,getOffsetParent:ni,getElementRects:xm,getClientRects:dm,getDimensions:gm,getScale:Vt,isElement:We,isRTL:ym};function ri(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wm(e,t){let n=null,r;const s=et(e);function o(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),o();const f=e.getBoundingClientRect(),{left:l,top:c,width:u,height:h}=f;if(i||t(),!u||!h)return;const b=Mn(c),v=Mn(s.clientWidth-(l+u)),w=Mn(s.clientHeight-(c+h)),y=Mn(l),A={rootMargin:-b+"px "+-v+"px "+-w+"px "+-y+"px",threshold:$e(0,bt(1,m))||1};let k=!0;function O(E){const _=E[0].intersectionRatio;if(_!==m){if(!k)return a();_?a(!1,_):r=setTimeout(()=>{a(!1,1e-7)},1e3)}_===1&&!ri(f,e.getBoundingClientRect())&&a(),k=!1}try{n=new IntersectionObserver(O,{...A,root:s.ownerDocument})}catch{n=new IntersectionObserver(O,A)}n.observe(e)}return a(!0),o}function Sm(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,f=Cs(e),l=s||o?[...f?dn(f):[],...t?dn(t):[]]:[];l.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const c=f&&i?wm(f,n):null;let u=-1,h=null;a&&(h=new ResizeObserver(y=>{let[T]=y;T&&T.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let b,v=m?Nt(e):null;m&&w();function w(){const y=Nt(e);v&&!ri(v,y)&&n(),v=y,b=requestAnimationFrame(w)}return n(),()=>{var y;l.forEach(T=>{s&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),c==null||c(),(y=h)==null||y.disconnect(),h=null,m&&cancelAnimationFrame(b)}}const Cm=Zf,km=em,Em=Xf,Am=nm,Tm=Qf,Mo=Yf,_m=tm,Rm=(e,t,n)=>{const r=new Map,s={platform:vm,...n},o={...s.platform,_c:r};return Kf(e,t,{...s,platform:o})};var Mm=typeof document<"u",Nm=function(){},On=Mm?p.useLayoutEffect:Nm;function Vn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Vn(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Vn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function si(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function No(e,t){const n=si(e);return Math.round(t*n)/n}function Er(e){const t=p.useRef(e);return On(()=>{t.current=e}),t}function jm(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,h]=p.useState(r);Vn(u,r)||h(r);const[b,v]=p.useState(null),[w,y]=p.useState(null),T=p.useCallback(H=>{H!==E.current&&(E.current=H,v(H))},[]),A=p.useCallback(H=>{H!==_.current&&(_.current=H,y(H))},[]),k=o||b,O=a||w,E=p.useRef(null),_=p.useRef(null),g=p.useRef(l),x=m!=null,M=Er(m),I=Er(s),D=Er(f),F=p.useCallback(()=>{if(!E.current||!_.current)return;const H={placement:t,strategy:n,middleware:u};I.current&&(H.platform=I.current),Rm(E.current,_.current,H).then(P=>{const U={...P,isPositioned:D.current!==!1};j.current&&!Vn(g.current,U)&&(g.current=U,da.flushSync(()=>{c(U)}))})},[u,t,n,I,D]);On(()=>{f===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,c(H=>({...H,isPositioned:!1})))},[f]);const j=p.useRef(!1);On(()=>(j.current=!0,()=>{j.current=!1}),[]),On(()=>{if(k&&(E.current=k),O&&(_.current=O),k&&O){if(M.current)return M.current(k,O,F);F()}},[k,O,F,M,x]);const z=p.useMemo(()=>({reference:E,floating:_,setReference:T,setFloating:A}),[T,A]),C=p.useMemo(()=>({reference:k,floating:O}),[k,O]),S=p.useMemo(()=>{const H={position:n,left:0,top:0};if(!C.floating)return H;const P=No(C.floating,l.x),U=No(C.floating,l.y);return i?{...H,transform:"translate("+P+"px, "+U+"px)",...si(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:U}},[n,i,C.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:C,floatingStyles:S}),[l,F,z,C,S])}const Pm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Mo({element:r.current,padding:s}).fn(n):{}:r?Mo({element:r,padding:s}).fn(n):{}}}},Im=(e,t)=>{const n=Cm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dm=(e,t)=>{const n=km(e);return{name:n.name,fn:n.fn,options:[e,t]}},Om=(e,t)=>({fn:_m(e).fn,options:[e,t]}),Lm=(e,t)=>{const n=Em(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fm=(e,t)=>{const n=Am(e);return{name:n.name,fn:n.fn,options:[e,t]}},$m=(e,t)=>{const n=Tm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Um=(e,t)=>{const n=Pm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var zm="Arrow",oi=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return d.jsx(be.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});oi.displayName=zm;var Hm=oi;function Bm(e){const[t,n]=p.useState(void 0);return rt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let a,i;if("borderBoxSize"in o){const m=o.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ks="Popper",[ai,tn]=it(ks),[Wm,ii]=ai(ks),li=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return d.jsx(Wm,{scope:t,anchor:r,onAnchorChange:s,children:n})};li.displayName=ks;var ci="PopperAnchor",di=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=ii(ci,n),a=p.useRef(null),i=Ae(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(r==null?void 0:r.current)||a.current,f!==m.current&&o.onAnchorChange(m.current)}),r?null:d.jsx(be.div,{...s,ref:i})});di.displayName=ci;var Es="PopperContent",[Gm,Vm]=ai(Es),ui=p.forwardRef((e,t)=>{var V,q,K,oe,ee,re;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:u=!1,updatePositionStrategy:h="optimized",onPlaced:b,...v}=e,w=ii(Es,n),[y,T]=p.useState(null),A=Ae(t,ce=>T(ce)),[k,O]=p.useState(null),E=Bm(k),_=(E==null?void 0:E.width)??0,g=(E==null?void 0:E.height)??0,x=r+(o!=="center"?"-"+o:""),M=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},I=Array.isArray(f)?f:[f],D=I.length>0,F={padding:M,boundary:I.filter(Km),altBoundary:D},{refs:j,floatingStyles:z,placement:C,isPositioned:S,middlewareData:H}=jm({strategy:"fixed",placement:x,whileElementsMounted:(...ce)=>Sm(...ce,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[Im({mainAxis:s+g,alignmentAxis:a}),m&&Dm({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?Om():void 0,...F}),m&&Lm({...F}),Fm({...F,apply:({elements:ce,rects:ve,availableWidth:fe,availableHeight:we})=>{const{width:me,height:de}=ve.reference,xe=ce.floating.style;xe.setProperty("--radix-popper-available-width",`${fe}px`),xe.setProperty("--radix-popper-available-height",`${we}px`),xe.setProperty("--radix-popper-anchor-width",`${me}px`),xe.setProperty("--radix-popper-anchor-height",`${de}px`)}}),k&&Um({element:k,padding:i}),Ym({arrowWidth:_,arrowHeight:g}),u&&$m({strategy:"referenceHidden",...F})]}),[P,U]=pi(C),Y=st(b);rt(()=>{S&&(Y==null||Y())},[S,Y]);const N=(V=H.arrow)==null?void 0:V.x,L=(q=H.arrow)==null?void 0:q.y,$=((K=H.arrow)==null?void 0:K.centerOffset)!==0,[R,B]=p.useState();return rt(()=>{y&&B(window.getComputedStyle(y).zIndex)},[y]),d.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:S?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(oe=H.transformOrigin)==null?void 0:oe.x,(ee=H.transformOrigin)==null?void 0:ee.y].join(" "),...((re=H.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(Gm,{scope:n,placedSide:P,onArrowChange:O,arrowX:N,arrowY:L,shouldHideArrow:$,children:d.jsx(be.div,{"data-side":P,"data-align":U,...v,ref:A,style:{...v.style,animation:S?void 0:"none"}})})})});ui.displayName=Es;var fi="PopperArrow",qm={top:"bottom",right:"left",bottom:"top",left:"right"},mi=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=Vm(fi,r),a=qm[o.placedSide];return d.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:d.jsx(Hm,{...s,ref:n,style:{...s.style,display:"block"}})})});mi.displayName=fi;function Km(e){return e!==null}var Ym=e=>({name:"transformOrigin",options:e,fn(t){var w,y,T;const{placement:n,rects:r,middlewareData:s}=t,a=((w=s.arrow)==null?void 0:w.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=pi(n),c={start:"0%",center:"50%",end:"100%"}[l],u=(((y=s.arrow)==null?void 0:y.x)??0)+i/2,h=(((T=s.arrow)==null?void 0:T.y)??0)+m/2;let b="",v="";return f==="bottom"?(b=a?c:`${u}px`,v=`${-m}px`):f==="top"?(b=a?c:`${u}px`,v=`${r.floating.height+m}px`):f==="right"?(b=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(b=`${r.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:b,y:v}}}});function pi(e){const[t,n="center"]=e.split("-");return[t,n]}var As=li,ir=di,Ts=ui,_s=mi,Xm="Portal",vn=p.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[s,o]=p.useState(!1);rt(()=>o(!0),[]);const a=n||s&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?Uc.createPortal(d.jsx(be.div,{...r,ref:t}),a):null});vn.displayName=Xm;function Qm(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var ze=e=>{const{present:t,children:n}=e,r=Jm(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=Ae(r.ref,Zm(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};ze.displayName="Presence";function Jm(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Qm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=Nn(r.current);o.current=i==="mounted"?f:"none"},[i]),rt(()=>{const f=r.current,l=s.current;if(l!==e){const u=o.current,h=Nn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&u!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),rt(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=Nn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},u=h=>{h.target===t&&(o.current=Nn(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Nn(e){return(e==null?void 0:e.animationName)||"none"}function Zm(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ar="rovingFocusGroup.onEntryFocus",ep={bubbles:!1,cancelable:!0},wn="RovingFocusGroup",[qr,hi,tp]=Ba(wn),[np,gi]=it(wn,[tp]),[rp,sp]=np(wn),bi=p.forwardRef((e,t)=>d.jsx(qr.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(qr.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(op,{...e,ref:t})})}));bi.displayName=wn;var op=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,u=p.useRef(null),h=Ae(t,u),b=Wa(o),[v,w]=gt({prop:a,defaultProp:i??null,onChange:m,caller:wn}),[y,T]=p.useState(!1),A=st(f),k=hi(n),O=p.useRef(!1),[E,_]=p.useState(0);return p.useEffect(()=>{const g=u.current;if(g)return g.addEventListener(Ar,A),()=>g.removeEventListener(Ar,A)},[A]),d.jsx(rp,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:v,onItemFocus:p.useCallback(g=>w(g),[w]),onItemShiftTab:p.useCallback(()=>T(!0),[]),onFocusableItemAdd:p.useCallback(()=>_(g=>g+1),[]),onFocusableItemRemove:p.useCallback(()=>_(g=>g-1),[]),children:d.jsx(be.div,{tabIndex:y||E===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{O.current=!0}),onFocus:ne(e.onFocus,g=>{const x=!O.current;if(g.target===g.currentTarget&&x&&!y){const M=new CustomEvent(Ar,ep);if(g.currentTarget.dispatchEvent(M),!M.defaultPrevented){const I=k().filter(C=>C.focusable),D=I.find(C=>C.active),F=I.find(C=>C.id===v),z=[D,F,...I].filter(Boolean).map(C=>C.ref.current);vi(z,l)}}O.current=!1}),onBlur:ne(e.onBlur,()=>T(!1))})})}),xi="RovingFocusGroupItem",yi=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:a,...i}=e,m=De(),f=o||m,l=sp(xi,n),c=l.currentTabStopId===f,u=hi(n),{onFocusableItemAdd:h,onFocusableItemRemove:b,currentTabStopId:v}=l;return p.useEffect(()=>{if(r)return h(),()=>b()},[r,h,b]),d.jsx(qr.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:d.jsx(be.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:ne(e.onMouseDown,w=>{r?l.onItemFocus(f):w.preventDefault()}),onFocus:ne(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:ne(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){l.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const y=lp(w,l.orientation,l.dir);if(y!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let A=u().filter(k=>k.focusable).map(k=>k.ref.current);if(y==="last")A.reverse();else if(y==="prev"||y==="next"){y==="prev"&&A.reverse();const k=A.indexOf(w.currentTarget);A=l.loop?cp(A,k+1):A.slice(k+1)}setTimeout(()=>vi(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});yi.displayName=xi;var ap={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ip(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function lp(e,t,n){const r=ip(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ap[r]}function vi(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function cp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var dp=bi,up=yi,fp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ut=new WeakMap,jn=new WeakMap,Pn={},Tr=0,wi=function(e){return e&&(e.host||wi(e.parentNode))},mp=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=wi(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},pp=function(e,t,n,r){var s=mp(t,Array.isArray(e)?e:[e]);Pn[n]||(Pn[n]=new WeakMap);var o=Pn[n],a=[],i=new Set,m=new Set(s),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};s.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(u){if(i.has(u))l(u);else try{var h=u.getAttribute(r),b=h!==null&&h!=="false",v=(Ut.get(u)||0)+1,w=(o.get(u)||0)+1;Ut.set(u,v),o.set(u,w),a.push(u),v===1&&b&&jn.set(u,!0),w===1&&u.setAttribute(n,"true"),b||u.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",u,y)}})};return l(t),i.clear(),Tr++,function(){a.forEach(function(c){var u=Ut.get(c)-1,h=o.get(c)-1;Ut.set(c,u),o.set(c,h),u||(jn.has(c)||c.removeAttribute(r),jn.delete(c)),h||c.removeAttribute(n)}),Tr--,Tr||(Ut=new WeakMap,Ut=new WeakMap,jn=new WeakMap,Pn={})}},Rs=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=fp(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),pp(r,s,n,"aria-hidden")):function(){return null}},Kr=["Enter"," "],hp=["ArrowDown","PageUp","Home"],Si=["ArrowUp","PageDown","End"],gp=[...hp,...Si],bp={ltr:[...Kr,"ArrowRight"],rtl:[...Kr,"ArrowLeft"]},xp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sn="Menu",[un,yp,vp]=Ba(Sn),[Ot,Ci]=it(Sn,[vp,tn,gi]),lr=tn(),ki=gi(),[wp,Lt]=Ot(Sn),[Sp,Cn]=Ot(Sn),Ei=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:a=!0}=e,i=lr(t),[m,f]=p.useState(null),l=p.useRef(!1),c=st(o),u=Wa(s);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),d.jsx(As,{...i,children:d.jsx(wp,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:d.jsx(Sp,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:u,modal:a,children:r})})})};Ei.displayName=Sn;var Cp="MenuAnchor",Ms=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=lr(n);return d.jsx(ir,{...s,...r,ref:t})});Ms.displayName=Cp;var Ns="MenuPortal",[kp,Ai]=Ot(Ns,{forceMount:void 0}),Ti=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Lt(Ns,t);return d.jsx(kp,{scope:t,forceMount:n,children:d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};Ti.displayName=Ns;var He="MenuContent",[Ep,js]=Ot(He),_i=p.forwardRef((e,t)=>{const n=Ai(He,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Lt(He,e.__scopeMenu),a=Cn(He,e.__scopeMenu);return d.jsx(un.Provider,{scope:e.__scopeMenu,children:d.jsx(ze,{present:r||o.open,children:d.jsx(un.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(Ap,{...s,ref:t}):d.jsx(Tp,{...s,ref:t})})})})}),Ap=p.forwardRef((e,t)=>{const n=Lt(He,e.__scopeMenu),r=p.useRef(null),s=Ae(t,r);return p.useEffect(()=>{const o=r.current;if(o)return Rs(o)},[]),d.jsx(Ps,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tp=p.forwardRef((e,t)=>{const n=Lt(He,e.__scopeMenu);return d.jsx(Ps,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),_p=Yt("MenuContent.ScrollLock"),Ps=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,disableOutsideScroll:b,...v}=e,w=Lt(He,n),y=Cn(He,n),T=lr(n),A=ki(n),k=yp(n),[O,E]=p.useState(null),_=p.useRef(null),g=Ae(t,_,w.onContentChange),x=p.useRef(0),M=p.useRef(""),I=p.useRef(0),D=p.useRef(null),F=p.useRef("right"),j=p.useRef(0),z=b?fs:p.Fragment,C=b?{as:_p,allowPinchZoom:!0}:void 0,S=P=>{var V,q;const U=M.current+P,Y=k().filter(K=>!K.disabled),N=document.activeElement,L=(V=Y.find(K=>K.ref.current===N))==null?void 0:V.textValue,$=Y.map(K=>K.textValue),R=Up($,U,L),B=(q=Y.find(K=>K.textValue===R))==null?void 0:q.ref.current;(function K(oe){M.current=oe,window.clearTimeout(x.current),oe!==""&&(x.current=window.setTimeout(()=>K(""),1e3))})(U),B&&setTimeout(()=>B.focus())};p.useEffect(()=>()=>window.clearTimeout(x.current),[]),bs();const H=p.useCallback(P=>{var Y,N;return F.current===((Y=D.current)==null?void 0:Y.side)&&Hp(P,(N=D.current)==null?void 0:N.area)},[]);return d.jsx(Ep,{scope:n,searchRef:M,onItemEnter:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),onItemLeave:p.useCallback(P=>{var U;H(P)||((U=_.current)==null||U.focus(),E(null))},[H]),onTriggerLeave:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),pointerGraceTimerRef:I,onPointerGraceIntentChange:p.useCallback(P=>{D.current=P},[]),children:d.jsx(z,{...C,children:d.jsx(nr,{asChild:!0,trapped:s,onMountAutoFocus:ne(o,P=>{var U;P.preventDefault(),(U=_.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(xn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,children:d.jsx(dp,{asChild:!0,...A,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:E,onEntryFocus:ne(m,P=>{y.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(Ts,{role:"menu","aria-orientation":"vertical","data-state":Wi(w.open),"data-radix-menu-content":"",dir:y.dir,...T,...v,ref:g,style:{outline:"none",...v.style},onKeyDown:ne(v.onKeyDown,P=>{const Y=P.target.closest("[data-radix-menu-content]")===P.currentTarget,N=P.ctrlKey||P.altKey||P.metaKey,L=P.key.length===1;Y&&(P.key==="Tab"&&P.preventDefault(),!N&&L&&S(P.key));const $=_.current;if(P.target!==$||!gp.includes(P.key))return;P.preventDefault();const B=k().filter(V=>!V.disabled).map(V=>V.ref.current);Si.includes(P.key)&&B.reverse(),Fp(B)}),onBlur:ne(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(x.current),M.current="")}),onPointerMove:ne(e.onPointerMove,fn(P=>{const U=P.target,Y=j.current!==P.clientX;if(P.currentTarget.contains(U)&&Y){const N=P.clientX>j.current?"right":"left";F.current=N,j.current=P.clientX}}))})})})})})})});_i.displayName=He;var Rp="MenuGroup",Is=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(be.div,{role:"group",...r,ref:t})});Is.displayName=Rp;var Mp="MenuLabel",Ri=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(be.div,{...r,ref:t})});Ri.displayName=Mp;var qn="MenuItem",jo="menu.itemSelect",cr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),a=Cn(qn,e.__scopeMenu),i=js(qn,e.__scopeMenu),m=Ae(t,o),f=p.useRef(!1),l=()=>{const c=o.current;if(!n&&c){const u=new CustomEvent(jo,{bubbles:!0,cancelable:!0});c.addEventListener(jo,h=>r==null?void 0:r(h),{once:!0}),Ha(c,u),u.defaultPrevented?f.current=!1:a.onClose()}};return d.jsx(Mi,{...s,ref:m,disabled:n,onClick:ne(e.onClick,l),onPointerDown:c=>{var u;(u=e.onPointerDown)==null||u.call(e,c),f.current=!0},onPointerUp:ne(e.onPointerUp,c=>{var u;f.current||(u=c.currentTarget)==null||u.click()}),onKeyDown:ne(e.onKeyDown,c=>{const u=i.searchRef.current!=="";n||u&&c.key===" "||Kr.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});cr.displayName=qn;var Mi=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,a=js(qn,n),i=ki(n),m=p.useRef(null),f=Ae(t,m),[l,c]=p.useState(!1),[u,h]=p.useState("");return p.useEffect(()=>{const b=m.current;b&&h((b.textContent??"").trim())},[o.children]),d.jsx(un.ItemSlot,{scope:n,disabled:r,textValue:s??u,children:d.jsx(up,{asChild:!0,...i,focusable:!r,children:d.jsx(be.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:ne(e.onPointerMove,fn(b=>{r?a.onItemLeave(b):(a.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,fn(b=>a.onItemLeave(b))),onFocus:ne(e.onFocus,()=>c(!0)),onBlur:ne(e.onBlur,()=>c(!1))})})})}),Np="MenuCheckboxItem",Ni=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return d.jsx(Oi,{scope:e.__scopeMenu,checked:n,children:d.jsx(cr,{role:"menuitemcheckbox","aria-checked":Kn(n)?"mixed":n,...s,ref:t,"data-state":Os(n),onSelect:ne(s.onSelect,()=>r==null?void 0:r(Kn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ni.displayName=Np;var ji="MenuRadioGroup",[jp,Pp]=Ot(ji,{value:void 0,onValueChange:()=>{}}),Pi=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=st(r);return d.jsx(jp,{scope:e.__scopeMenu,value:n,onValueChange:o,children:d.jsx(Is,{...s,ref:t})})});Pi.displayName=ji;var Ii="MenuRadioItem",Di=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=Pp(Ii,e.__scopeMenu),o=n===s.value;return d.jsx(Oi,{scope:e.__scopeMenu,checked:o,children:d.jsx(cr,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Os(o),onSelect:ne(r.onSelect,()=>{var a;return(a=s.onValueChange)==null?void 0:a.call(s,n)},{checkForDefaultPrevented:!1})})})});Di.displayName=Ii;var Ds="MenuItemIndicator",[Oi,Ip]=Ot(Ds,{checked:!1}),Li=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Ip(Ds,n);return d.jsx(ze,{present:r||Kn(o.checked)||o.checked===!0,children:d.jsx(be.span,{...s,ref:t,"data-state":Os(o.checked)})})});Li.displayName=Ds;var Dp="MenuSeparator",Fi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(be.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Fi.displayName=Dp;var Op="MenuArrow",$i=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=lr(n);return d.jsx(_s,{...s,...r,ref:t})});$i.displayName=Op;var Lp="MenuSub",[uv,Ui]=Ot(Lp),cn="MenuSubTrigger",zi=p.forwardRef((e,t)=>{const n=Lt(cn,e.__scopeMenu),r=Cn(cn,e.__scopeMenu),s=Ui(cn,e.__scopeMenu),o=js(cn,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),d.jsx(Ms,{asChild:!0,...f,children:d.jsx(Mi,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":Wi(n.open),...e,ref:Ze(t,s.onTriggerChange),onClick:c=>{var u;(u=e.onClick)==null||u.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,fn(c=>{o.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:ne(e.onPointerLeave,fn(c=>{var h,b;l();const u=(h=n.content)==null?void 0:h.getBoundingClientRect();if(u){const v=(b=n.content)==null?void 0:b.dataset.side,w=v==="right",y=w?-5:5,T=u[w?"left":"right"],A=u[w?"right":"left"];o.onPointerGraceIntentChange({area:[{x:c.clientX+y,y:c.clientY},{x:T,y:u.top},{x:A,y:u.top},{x:A,y:u.bottom},{x:T,y:u.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(c),c.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,c=>{var h;const u=o.searchRef.current!=="";e.disabled||u&&c.key===" "||bp[r.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});zi.displayName=cn;var Hi="MenuSubContent",Bi=p.forwardRef((e,t)=>{const n=Ai(He,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Lt(He,e.__scopeMenu),a=Cn(He,e.__scopeMenu),i=Ui(Hi,e.__scopeMenu),m=p.useRef(null),f=Ae(t,m);return d.jsx(un.Provider,{scope:e.__scopeMenu,children:d.jsx(ze,{present:r||o.open,children:d.jsx(un.Slot,{scope:e.__scopeMenu,children:d.jsx(Ps,{id:i.contentId,"aria-labelledby":i.triggerId,...s,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:ne(e.onFocusOutside,l=>{l.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:ne(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),u=xp[a.dir].includes(l.key);c&&u&&(o.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Bi.displayName=Hi;function Wi(e){return e?"open":"closed"}function Kn(e){return e==="indeterminate"}function Os(e){return Kn(e)?"indeterminate":e?"checked":"unchecked"}function Fp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $p(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Up(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=$p(e,Math.max(o,0));s.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return m!==n?m:void 0}function zp(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>r!=u>r&&n<(c-f)*(r-l)/(u-l)+f&&(s=!s)}return s}function Hp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return zp(n,t)}function fn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Bp=Ei,Wp=Ms,Gp=Ti,Vp=_i,qp=Is,Kp=Ri,Yp=cr,Xp=Ni,Qp=Pi,Jp=Di,Zp=Li,eh=Fi,th=$i,nh=zi,rh=Bi,dr="DropdownMenu",[sh]=it(dr,[Ci]),Oe=Ci(),[oh,Gi]=sh(dr),Vi=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,m=Oe(t),f=p.useRef(null),[l,c]=gt({prop:s,defaultProp:o??!1,onChange:a,caller:dr});return d.jsx(oh,{scope:t,triggerId:De(),triggerRef:f,contentId:De(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(u=>!u),[c]),modal:i,children:d.jsx(Bp,{...m,open:l,onOpenChange:c,dir:r,modal:i,children:n})})};Vi.displayName=dr;var qi="DropdownMenuTrigger",Ki=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=Gi(qi,n),a=Oe(n);return d.jsx(Wp,{asChild:!0,...a,children:d.jsx(be.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Ze(t,o.triggerRef),onPointerDown:ne(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:ne(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ki.displayName=qi;var ah="DropdownMenuPortal",Yi=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Oe(t);return d.jsx(Gp,{...r,...n})};Yi.displayName=ah;var Xi="DropdownMenuContent",Qi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gi(Xi,n),o=Oe(n),a=p.useRef(!1);return d.jsx(Vp,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var m;a.current||(m=s.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!s.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qi.displayName=Xi;var ih="DropdownMenuGroup",lh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(qp,{...s,...r,ref:t})});lh.displayName=ih;var ch="DropdownMenuLabel",Ji=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(Kp,{...s,...r,ref:t})});Ji.displayName=ch;var dh="DropdownMenuItem",Zi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(Yp,{...s,...r,ref:t})});Zi.displayName=dh;var uh="DropdownMenuCheckboxItem",fh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(Xp,{...s,...r,ref:t})});fh.displayName=uh;var mh="DropdownMenuRadioGroup",ph=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(Qp,{...s,...r,ref:t})});ph.displayName=mh;var hh="DropdownMenuRadioItem",gh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(Jp,{...s,...r,ref:t})});gh.displayName=hh;var bh="DropdownMenuItemIndicator",xh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(Zp,{...s,...r,ref:t})});xh.displayName=bh;var yh="DropdownMenuSeparator",el=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(eh,{...s,...r,ref:t})});el.displayName=yh;var vh="DropdownMenuArrow",wh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(th,{...s,...r,ref:t})});wh.displayName=vh;var Sh="DropdownMenuSubTrigger",Ch=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(nh,{...s,...r,ref:t})});Ch.displayName=Sh;var kh="DropdownMenuSubContent",Eh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Oe(n);return d.jsx(rh,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Eh.displayName=kh;var Ah=Vi,Th=Ki,_h=Yi,Rh=Qi,Mh=Ji,Nh=Zi,jh=el;function tl({...e}){return d.jsx(Ah,{"data-slot":"dropdown-menu",...e})}function nl({...e}){return d.jsx(Th,{"data-slot":"dropdown-menu-trigger",...e})}function rl({className:e,sideOffset:t=4,...n}){return d.jsx(_h,{children:d.jsx(Rh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Ln({className:e,inset:t,variant:n="default",...r}){return d.jsx(Nh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Z("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function Ph({className:e,inset:t,...n}){return d.jsx(Mh,{"data-slot":"dropdown-menu-label","data-inset":t,className:Z("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Po({className:e,...t}){return d.jsx(jh,{"data-slot":"dropdown-menu-separator",className:Z("bg-border -mx-1 my-1 h-px",e),...t})}const Ih=[{value:"light",label:"Light",icon:d.jsx(Da,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:d.jsx(Na,{className:"h-4 w-4"})},{value:"system",label:"System",icon:d.jsx(xu,{className:"h-4 w-4"})}];function Dh(){const{theme:e,setTheme:t,resolvedTheme:n}=Yu();return d.jsxs(tl,{children:[d.jsx(nl,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?d.jsx(Na,{className:"h-4 w-4"}):d.jsx(Da,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),d.jsx(rl,{align:"end",children:Ih.map(r=>d.jsxs(Ln,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,d.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}const Io={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.unreachable":"无法连接服务器——请确认服务正在运行,且界面与 API 同源访问。","auth.login.rateLimited":"登录尝试过于频繁,请稍后再试。","auth.login.csrfBlocked":"请求来源校验失败(CSRF)——请从服务本身提供的地址打开界面。","auth.login.failedWithReason":"登录失败:{message}","auth.login.description":"输入你的用户名和密码以继续。","auth.login.singleUserHint":"单用户模式:首次部署已自动创建管理员账号","auth.login.singleUserHintFooter":"本地便捷默认密码,登录后建议尽快修改","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.all":"全部","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.list.empty":"创建你的第一个团队,开始协作。","team.list.count":"{n} 个团队","team.list.noDescription":"暂无描述","team.list.kicker":"协作名册","team.list.lede":"把机台、会话与工件收进同一个协作域。","team.list.founded":"创立于","team.list.delete":"删除团队","team.list.deleteConfirm":"确定删除团队「{name}」?团队环境需先转移,此操作不可撤销。","team.list.deleteFailed":"删除团队失败","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.create.failed":"创建团队失败","team.detail.back":"返回团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.detail.memberCount":"{n} 名成员","team.detail.notFound":"团队不存在。","team.detail.copyId":"复制团队 ID","team.detail.membersEmptyTitle":"暂无成员","team.detail.membersEmptyHint":"邀请同事加入后,他们会出现在这份名册上。","team.detail.envsEmptyTitle":"暂无环境","team.detail.envsEmptyHint":"用下面的命令把一台机器登记到本团队。","team.detail.copyCommand":"复制命令","team.detail.unlink":"解除关联","team.detail.unlinkConfirm":"将这台环境从团队解绑?它会回到个人空间。","team.detail.unlinkFailed":"解绑环境失败","team.detail.loadEnvsFailed":"加载环境失败","team.detail.registerHint":"把一台机器登记到本团队","team.detail.linkHint":"关联一台已有的个人环境","team.detail.linkSelect":"选择环境…","team.detail.link":"关联","team.detail.linkFailed":"关联环境失败","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","invitation.expires":"到期 {date}","invitation.emptyTitle":"暂无邀请","invitation.emptyHint":"创建一条邀请链接,把它发给同事。","invitation.addFailed":"添加用户失败","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dashboard.emptySessionsTitle":"暂无会话","dashboard.emptySessionsHint":"点右上角「+ 新会话」开一条,或等 worker 上报会话。","dashboard.emptyEnvironmentsTitle":"暂无环境","dashboard.emptyEnvironmentsHint":"worker 经 RCS 注册后,环境会落到这条线上。","dashboard.emptyMarker":"无记录","dashboard.envOwner":"创建者","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.metaStatus":"状态","session.metaWorker":"Worker","session.metaCreated":"创建时间","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.closedSendBlocked":"会话已归档,消息未发送","session.sendFailed":"消息发送失败","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","session.sseReconnecting":"与服务器的实时连接中断,正在自动重连…(期间消息可能延迟显示)","session.sseFailed":"实时连接重连失败,请刷新页面恢复","user.settings.language":"语言","dashboard.searchAction":"搜索会话","dashboard.searchPlaceholder":"搜索所有会话内容…","dashboard.searchNoResults":"没有匹配的会话","dashboard.closeSearch":"收起搜索","user.settings.notifications":"浏览器通知","user.settings.notificationsDesc":"会话需要审批或回合完成时通知(仅页面处于后台时)","user.settings.notificationsDenied":"通知权限已被拒绝 — 请在浏览器设置中允许","user.settings.notificationsUnsupported":"当前环境不支持通知(需要 HTTPS 或 localhost)","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"工件","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建工件","artifacts.empty":'还没有工件。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载工件失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","memories.title":"记忆","memories.subtitle":"团队共享与个人专属的长期记忆,自动注入 agent 会话","memories.new":"新建记忆","memories.empty":'还没有记忆。点击"新建"手动添加,或由 agent 会话自动沉淀。',"memories.loadFailed":"加载记忆失败","memories.delete":"删除","memories.deleteFailed":"删除失败","memories.edit":"编辑","memories.update":"保存更新","memories.updateFailed":"更新失败","memories.create.title":"新建记忆","memories.editMemory":"编辑记忆","memories.create.name":"名称","memories.create.namePlaceholder":'简短标题,如"发布流程约定"',"memories.create.description":"一句话描述","memories.create.descriptionPlaceholder":"用于注入索引的摘要行","memories.create.type":"类型","memories.create.content":"内容","memories.create.contentPlaceholder":"记忆正文(Markdown)…","memories.create.scope":"归属","memories.create.scope.personal":"个人","memories.create.scope.team":"团队","memories.create.teamRequired":"请选择团队","memories.create.failed":"创建失败","memories.type.user":"用户","memories.type.feedback":"反馈","memories.type.project":"项目","memories.type.reference":"参考","memories.scope.personal":"个人","memories.scope.team":"团队","memories.session":"来源会话","memories.updatedAt":"更新于","memories.promote":"晋升为团队记忆","memories.promoteFailed":"晋升失败","memories.promoteTeamRequired":"请选择目标团队","memorySidebar.title":"记忆","memorySidebar.memoriesTab":"记忆","memorySidebar.governanceTab":"治理","memorySidebar.loadFailed":"加载失败","memorySidebar.empty":"还没有记忆。agent 会话中自动沉淀,或在此手动编辑。","memorySidebar.updateFailed":"保存失败","memorySidebar.deleteFailed":"删除失败","memorySidebar.promoteFailed":"晋升失败","memorySidebar.edit":"编辑","memorySidebar.save":"保存","memorySidebar.cancel":"取消","memorySidebar.delete":"删除","memorySidebar.promote":"晋升为团队记忆","memorySidebar.personal":"个人","memorySidebar.team":"团队","memorySidebar.searchPlaceholder":"正则搜索…","memorySidebar.searchHint":"按正则表达式匹配记忆文件名与内容(非法正则按普通文本匹配)","memorySidebar.noResults":"没有匹配的记忆","memorySidebar.recallTitle":"agent 本回合召回","memorySidebar.recallQuery":"检索词","memorySidebar.recallTest.title":"召回测试","memorySidebar.recallTest.hint":"输入一句话,用与 agent 每回合相同的检索引擎(多路融合评分)预览哪些记忆会被召回","memorySidebar.recallTest.placeholder":"模拟一条用户消息…","memorySidebar.recallTest.run":"测试","memorySidebar.recallTest.running":"测试中…","memorySidebar.recallTest.noResults":"无召回命中","memorySidebar.saModeBanner":"SA 模式:记忆自动化已停用(主 agent 不感知记忆系统)","memorySidebar.poorModeBanner":"poor 模式:检索预取与自动整理已停用","memorySidebar.dream":"整理记忆(dream)","memorySidebar.dreaming":"整理中…","memorySidebar.dreamDisabled":"当前模式下 dream 不可用","memorySidebar.layers":"分层","memorySidebar.health":"健康","memorySidebar.total":"总数","memorySidebar.capacity":"容量","memorySidebar.avgConfidence":"平均置信度","memorySidebar.alerts":"提醒","memorySidebar.conflicts":"待处理冲突","memorySidebar.new":"新建记忆","memorySidebar.create.name":"名称","memorySidebar.create.namePlaceholder":"例如 deploy-workflow","memorySidebar.create.description":"描述","memorySidebar.create.descriptionPlaceholder":"一句话摘要(用于召回相关性判断)","memorySidebar.create.type":"类型","memorySidebar.create.content":"内容","memorySidebar.create.contentPlaceholder":"记忆正文。feedback/project 类型建议包含 **Why:** 与 **How to apply:** 行","memorySidebar.createFailed":"创建失败","memorySidebar.teamHint":"团队记忆对本项目目录下的所有会话共享","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"工件不存在或已过期","artifacts.backToGallery":"← 返回工件","artifacts.create.title":"新建工件","artifacts.editArtifact":"编辑工件","artifacts.edit":"编辑","artifacts.update":"保存更新","artifacts.updateFailed":"更新失败","artifacts.linkNotice":"任何持有链接的人均可访问","artifacts.create.contentRequired":"内容不能为空","artifacts.create.ttl":"有效期","artifacts.create.ttlResetNote":"保存后过期时间将按所选有效期重置","artifacts.create.preview":"实时预览","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.aiUpdate":"AI 更新","artifacts.edit.mode.html":"编辑 HTML","artifacts.edit.mode.ai":"AI 更新","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此工件","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的工件提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","artifacts.create.ai.model":"模型槽位","artifacts.create.ai.modelCurrent":"当前","artifacts.create.ai.modelHint":"选择非当前模型时,会先切换目标会话的模型再发送需求","artifacts.update.ai.briefPlaceholder":"例如:把本周的数据加进去,趋势图延长到最新一周…","artifacts.update.ai.briefRequired":"请描述需要的更新","artifacts.update.ai.sent":"更新需求已发送。新版本上传后会原位替换此工件,链接保持不变。","artifacts.update.ai.inPlace":"原位更新:链接不变,版本自增","artifacts.update.ai.sessionHint":"默认发送到该工件关联的会话,也可以选择其它会话","artifacts.ai.archify":"Archify 图表模板","artifacts.ai.archifyDesc":"架构 / 流程 / 时序 / 数据流 / 状态图 — 由 archify 技能生成并校验,再上传为工件","artifacts.ai.archifyHint":"开启后,目标会话的 agent 将运行 archify 技能:编写 JSON 规格并校验(showcase 质量零告警),渲染为自包含交互页面后上传。若会话缺少 archify 运行时,agent 会明确说明并退回手写页面。","artifacts.ai.archifyBriefPlaceholder":"例如:一张架构图 — 请求经网关 → 认证服务 → 业务服务 → 缓存 / 数据库 的调用链…","artifacts.view.liveUpdated":"已自动更新","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话","permission.title":"权限请求","permission.required":"需要权限","permission.approve":"允许","permission.alwaysAllow":"始终允许","permission.alwaysAllowHint":"允许并记住规则:{rule}","permission.reject":"拒绝","dashboard.searching":"搜索中…","dashboard.nMatches":"{n} 处匹配","dashboard.nameMatch":"标题/ID 匹配","session.mode.title":"权限模式(Shift+Tab 循环)","session.mode.default":"默认","session.mode.defaultDesc":"手动审批权限请求","session.mode.acceptEdits":"自动接受编辑","session.mode.acceptEditsDesc":"自动允许文件编辑操作","session.mode.plan":"规划模式","session.mode.planDesc":"仅规划,不执行工具","session.mode.bypass":"跳过权限","session.mode.bypassDesc":"跳过所有权限检查","session.mode.switchFailedRequest":"模式切换请求发送失败: {message}","session.mode.switchFailed":"模式切换失败","session.thinking.title":"思考预算","session.thinking.off":"关闭思考","session.thinking.offDesc":"不使用扩展思考","session.thinking.on":"默认思考","session.thinking.onDesc":"开启,使用默认预算","session.thinking.fallback":"思考","session.thinking.failedRequest":"思考预算请求发送失败: {message}","session.thinking.failed":"思考预算切换失败","session.effort.title":"Effort 档位","session.effort.auto":"自动","session.effort.autoDesc":"使用模型默认 effort","session.effort.lowDesc":"低推理力度","session.effort.mediumDesc":"中推理力度","session.effort.highDesc":"高推理力度","session.effort.xhighDesc":"超高推理力度","session.effort.maxDesc":"最大推理力度","session.effort.fallback":"自动","session.effort.failedRequest":"Effort 切换请求发送失败: {message}","session.effort.failed":"Effort 切换失败","session.tokenMode.title":"Token 省用模式","session.tokenMode.normal":"标准","session.tokenMode.normalDesc":"完整工具集与后台服务","session.tokenMode.poor":"poor","session.tokenMode.poorDesc":"关闭记忆抽取、prompt 建议等后台开销","session.tokenMode.sa":"sa","session.tokenMode.saDesc":"极简 harness:精简系统提示与小工具集(poor 超集)","session.tokenMode.fallback":"标准","session.tokenMode.failedRequest":"Token 模式切换请求发送失败: {message}","session.tokenMode.failed":"Token 模式切换失败","session.model.title":"选择模型","session.context.tooltip":"上下文用量:{used} / {max} tokens","session.context.deferredSuffix":"(延迟加载)","session.usage.total":"会话累计用量(input 含缓存读写)","session.resume.title":"恢复历史对话","session.resume.currentBlocked":"不能恢复当前会话自身","session.resume.restoring":"正在恢复「{title}」…","session.resume.restored":"已恢复 {count} 条消息","session.resume.restoredWithTitle":"已恢复 {count} 条消息:{title}","session.resume.failed":"恢复失败:{message}","session.resume.unsupported":"当前 worker 不支持 /resume(需要 spawn 模式 worker:slz rc)","session.resumeInNew":"在新会话中继续此对话(/resume)","session.createFailedWithReason":"创建会话失败:{message}","session.rewind.confirmEdit":"回退到这条消息并编辑?","session.rewind.confirm":"回退到这条消息?","session.rewind.confirmBody":"之后的对话将移除,已修改的文件将恢复到当时的状态(若有快照)。","session.rewind.failed":"回退失败: {message}","session.rename.title":"重命名会话","session.rename.failed":"重命名失败","session.sideQuestion.title":"旁路提问 — 针对会话上下文提问,不进入主对话","session.search.title":"搜索会话内容","session.mcp.title":"MCP 服务器","session.settings.title":"会话设置","session.search.placeholder":"搜索会话内容…","session.search.noResults":"无结果","session.stopTask.failed":"停止任务失败","settings.unset":"(未设置)","settings.loadFailed":"获取设置失败 — worker 可能不支持","settings.writeFailed":"写入失败","settings.loading":"加载设置…","settings.model":"模型","settings.defaultModel":"(默认)","settings.hint":"布尔开关写入会话级 flag 层(apply_flag_settings);只读项点击查看详情。","settings.back":"返回设置列表","settings.copied":"已复制","settings.copyValue":"复制值","settings.searchPlaceholder":"搜索设置项…","settings.noMatch":"没有匹配的设置项","settings.togglable":"可设置({n})","settings.readOnly":"只读({n})","settings.turnOff":"关闭(写入 false)","settings.turnOn":"开启(写入 true)","settings.viewDetail":"查看详情","settings.memorySection":"记忆","settings.autoMemory":"自动记忆","settings.teamMemory":"团队记忆","settings.memoryHint":"开启团队记忆后,会话记忆侧栏将出现「团队」页签(team/ 共享子树)。开关会话级生效,持久启用请写入 settings.json 的 teamMemoryEnabled。","mcp.status.connected":"已连接","mcp.status.failed":"失败","mcp.status.needsAuth":"待认证","mcp.status.pending":"连接中","mcp.status.disabled":"已禁用","mcp.loadFailed":"获取 MCP 状态失败 — worker 可能不支持","mcp.toggleFailed":"切换失败","mcp.reconnectFailed":"重连失败","mcp.loading":"加载 MCP 状态…","mcp.empty":"没有配置 MCP 服务器","mcp.toolCount":"{n} 工具","mcp.reconnect":"重连","mcp.enable":"启用","mcp.disable":"禁用","resume.loading":"正在加载本地会话列表…","resume.empty":"没有可恢复的历史对话","resume.today":"今天","resume.yesterday":"昨天","resume.earlier":"更早","sideQuestion.title":"旁路提问","sideQuestion.desc":"针对当前会话上下文提问,不进入主对话、不消耗会话历史 — 适合「这个会话干了什么」式的快速核对。","sideQuestion.empty":"还没有提问。在下方输入你的问题。","sideQuestion.noAnswer":"没有获得回答(超时或 worker 不支持)","sideQuestion.placeholder":"问点什么…","sideQuestion.send":"提问(Enter)","elicitation.title":"MCP 请求输入","elicitation.required":"必填","elicitation.submit":"提交","elicitation.decline":"拒绝","elicitation.done":"完成","subagent.stop":"停止此任务","task.endConfirm":"结束 worker 会话?正在进行的回合将被中止,会话随后归档。","task.endHint":"通知 worker 中止在途回合并退出,随后归档会话","task.backgroundTasks":"后台任务","task.noBackgroundTasks":"暂无后台任务","task.runningCount":"{count} 个运行中","task.recentCount":"{count} 个近期","task.mixedCount":"{running} 个运行中 · {recent} 个近期","task.type.teammates":"队友","task.type.shells":"Shell","task.type.monitors":"监视器","task.type.remoteAgents":"远程代理","task.type.localAgents":"本地代理","task.type.tasks":"任务","permission.writeUnknown":"待写入","permission.requestAria":"权限请求:{tool}","user.settings.notificationsOn":"已开启","user.settings.notificationsOff":"已关闭","artifacts.create.markdownPlaceholder":`# 周报
212
+ */const Ku=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],bn=le("x",Ku),La=p.createContext(void 0),Fa="theme";function io(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function lo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(Fa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function co(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function Yu(){const e=p.useContext(La);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Xu({children:e,defaultTheme:t="system"}){const[n,s]=p.useState(()=>lo()||t),[r,o]=p.useState(()=>{const m=lo()||t;return m==="system"?io():m}),a=p.useCallback(m=>{s(m);try{localStorage.setItem(Fa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?io():n;o(m),co(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";o(c),co(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return mt.createElement(La.Provider,{value:i},e)}function uo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ze(...e){return t=>{let n=!1;const s=e.map(r=>{const o=uo(r,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():uo(e[r],null)}}}}function Ae(...e){return p.useCallback(Ze(...e),e)}var Qu=Symbol.for("react.lazy"),Hn=us[" use ".trim().toString()];function Ju(e){return typeof e=="object"&&e!==null&&"then"in e}function $a(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Qu&&"_payload"in e&&Ju(e._payload)}function Ua(e){const t=ef(e),n=p.forwardRef((s,r)=>{let{children:o,...a}=s;$a(o)&&typeof Hn=="function"&&(o=Hn(o._payload));const i=p.Children.toArray(o),m=i.find(nf);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:r,children:o})});return n.displayName=`${e}.Slot`,n}var Zu=Ua("Slot");function ef(e){const t=p.forwardRef((n,s)=>{let{children:r,...o}=n;if($a(r)&&typeof Hn=="function"&&(r=Hn(r._payload)),p.isValidElement(r)){const a=sf(r),i=rf(o,r.props);return r.type!==p.Fragment&&(i.ref=s?Ze(s,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tf=Symbol("radix.slottable");function nf(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tf}function rf(e,t){const n={...t};for(const s in t){const r=e[s],o=t[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...i)=>{const m=o(...i);return r(...i),m}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...e,...n}}function sf(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const fo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mo=fa,of=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return mo(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:o}=t,a=Object.keys(r).map(f=>{const l=n==null?void 0:n[f],c=o==null?void 0:o[f];if(l===null)return null;const u=fo(l)||fo(c);return r[f][u]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,u]=l;return u===void 0||(f[c]=u),f},{}),m=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((f,l)=>{let{class:c,className:u,...h}=l;return Object.entries(h).every(b=>{let[v,w]=b;return Array.isArray(w)?w.includes({...o,...i}[v]):{...o,...i}[v]===w})?[...f,c,u]:f},[]);return mo(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},af=of("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Dt({className:e,variant:t,size:n,asChild:s=!1,...r}){const o=s?Zu:"button";return d.jsx(o,{"data-slot":"button",className:Q(af({variant:t,size:n,className:e})),...r})}function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function lf(e,t){const n=p.createContext(t),s=o=>{const{children:a,...i}=o,m=p.useMemo(()=>i,Object.values(i));return d.jsx(n.Provider,{value:m,children:a})};s.displayName=e+"Provider";function r(o){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[s,r]}function it(e,t=[]){let n=[];function s(o,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var y;const{scope:u,children:h,...b}=c,v=((y=u==null?void 0:u[e])==null?void 0:y[m])||i,w=p.useMemo(()=>b,Object.values(b));return d.jsx(v.Provider,{value:w,children:h})};f.displayName=o+"Provider";function l(c,u){var v;const h=((v=u==null?void 0:u[e])==null?void 0:v[m])||i,b=p.useContext(h);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${o}\``)}return[f,l]}const r=()=>{const o=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return r.scopeName=e,[s,cf(r,...t)]}function cf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(o){const a=s.reduce((i,{useScope:m,scopeName:f})=>{const c=m(o)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var rt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},df=us[" useInsertionEffect ".trim().toString()]||rt;function gt({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,o,a]=uf({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${s} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,s])}const f=p.useCallback(l=>{var c;if(i){const u=ff(l)?l(e):l;u!==e&&((c=a.current)==null||c.call(a,u))}else o(l)},[i,e,o,a]);return[m,f]}function uf({defaultProp:e,onChange:t}){const[n,s]=p.useState(e),r=p.useRef(n),o=p.useRef(t);return df(()=>{o.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=o.current)==null||a.call(o,n),r.current=n)},[n,r]),[n,s,o]}function ff(e){return typeof e=="function"}function Yt(e){const t=mf(e),n=p.forwardRef((s,r)=>{const{children:o,...a}=s,i=p.Children.toArray(o),m=i.find(hf);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:r,children:o})});return n.displayName=`${e}.Slot`,n}function mf(e){const t=p.forwardRef((n,s)=>{const{children:r,...o}=n;if(p.isValidElement(r)){const a=bf(r),i=gf(o,r.props);return r.type!==p.Fragment&&(i.ref=s?Ze(s,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var za=Symbol("radix.slottable");function pf(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=za,t}function hf(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===za}function gf(e,t){const n={...t};for(const s in t){const r=e[s],o=t[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...i)=>{const m=o(...i);return r(...i),m}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...e,...n}}function bf(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],be=xf.reduce((e,t)=>{const n=Yt(`Primitive.${t}`),s=p.forwardRef((r,o)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Ha(e,t){e&&da.flushSync(()=>e.dispatchEvent(t))}function Ba(e){const t=e+"CollectionProvider",[n,s]=it(t),[r,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:w,children:y}=v,T=mt.useRef(null),A=mt.useRef(new Map).current;return d.jsx(r,{scope:w,itemMap:A,collectionRef:T,children:y})};a.displayName=t;const i=e+"CollectionSlot",m=Yt(i),f=mt.forwardRef((v,w)=>{const{scope:y,children:T}=v,A=o(i,y),k=Ae(w,A.collectionRef);return d.jsx(m,{ref:k,children:T})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",u=Yt(l),h=mt.forwardRef((v,w)=>{const{scope:y,children:T,...A}=v,k=mt.useRef(null),O=Ae(w,k),E=o(l,y);return mt.useEffect(()=>(E.itemMap.set(k,{ref:k,...A}),()=>void E.itemMap.delete(k))),d.jsx(u,{[c]:"",ref:O,children:T})});h.displayName=l;function b(v){const w=o(e+"CollectionConsumer",v);return mt.useCallback(()=>{const T=w.collectionRef.current;if(!T)return[];const A=Array.from(T.querySelectorAll(`[${c}]`));return Array.from(w.itemMap.values()).sort((E,_)=>A.indexOf(E.ref.current)-A.indexOf(_.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},b,s]}var yf=p.createContext(void 0);function Wa(e){const t=p.useContext(yf);return e||t||"ltr"}function st(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function vf(e,t=globalThis==null?void 0:globalThis.document){const n=st(e);p.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var wf="DismissableLayer",Br="dismissableLayer.update",Sf="dismissableLayer.pointerDownOutside",Cf="dismissableLayer.focusOutside",po,Ga=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),xn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:o,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(Ga),[l,c]=p.useState(null),u=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),b=Ae(t,_=>c(_)),v=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(w),T=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,k=T>=y,O=Af(_=>{const g=_.target,x=[...f.branches].some(M=>M.contains(g));!k||x||(r==null||r(_),a==null||a(_),_.defaultPrevented||i==null||i())},u),E=Tf(_=>{const g=_.target;[...f.branches].some(M=>M.contains(g))||(o==null||o(_),a==null||a(_),_.defaultPrevented||i==null||i())},u);return vf(_=>{T===f.layers.size-1&&(s==null||s(_),!_.defaultPrevented&&i&&(_.preventDefault(),i()))},u),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(po=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ho(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=po)}},[l,u,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ho())},[l,f]),p.useEffect(()=>{const _=()=>h({});return document.addEventListener(Br,_),()=>document.removeEventListener(Br,_)},[]),d.jsx(be.div,{...m,ref:b,style:{pointerEvents:A?k?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,E.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,O.onPointerDownCapture)})});xn.displayName=wf;var kf="DismissableLayerBranch",Ef=p.forwardRef((e,t)=>{const n=p.useContext(Ga),s=p.useRef(null),r=Ae(t,s);return p.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),d.jsx(be.div,{...e,ref:r})});Ef.displayName=kf;function Af(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),s=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const o=i=>{if(i.target&&!s.current){let m=function(){Va(Sf,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=m,t.addEventListener("click",r.current,{once:!0})):m()}else t.removeEventListener("click",r.current);s.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function Tf(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),s=p.useRef(!1);return p.useEffect(()=>{const r=o=>{o.target&&!s.current&&Va(Cf,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function ho(){const e=new CustomEvent(Br);document.dispatchEvent(e)}function Va(e,t,n,{discrete:s}){const r=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?Ha(r,o):r.dispatchEvent(o)}var vr=0;function bs(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??go()),document.body.insertAdjacentElement("beforeend",e[1]??go()),vr++,()=>{vr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vr--}},[])}function go(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var wr="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",bo={bubbles:!1,cancelable:!0},_f="FocusScope",nr=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:o,...a}=e,[i,m]=p.useState(null),f=st(r),l=st(o),c=p.useRef(null),u=Ae(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let v=function(A){if(h.paused||!i)return;const k=A.target;i.contains(k)?c.current=k:pt(c.current,{select:!0})},w=function(A){if(h.paused||!i)return;const k=A.relatedTarget;k!==null&&(i.contains(k)||pt(c.current,{select:!0}))},y=function(A){if(document.activeElement===document.body)for(const O of A)O.removedNodes.length>0&&pt(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const T=new MutationObserver(y);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),T.disconnect()}}},[s,i,h.paused]),p.useEffect(()=>{if(i){yo.add(h);const v=document.activeElement;if(!i.contains(v)){const y=new CustomEvent(wr,bo);i.addEventListener(wr,f),i.dispatchEvent(y),y.defaultPrevented||(Rf(If(qa(i)),{select:!0}),document.activeElement===v&&pt(i))}return()=>{i.removeEventListener(wr,f),setTimeout(()=>{const y=new CustomEvent(Sr,bo);i.addEventListener(Sr,l),i.dispatchEvent(y),y.defaultPrevented||pt(v??document.body,{select:!0}),i.removeEventListener(Sr,l),yo.remove(h)},0)}}},[i,f,l,h]);const b=p.useCallback(v=>{if(!n&&!s||h.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,y=document.activeElement;if(w&&y){const T=v.currentTarget,[A,k]=Mf(T);A&&k?!v.shiftKey&&y===k?(v.preventDefault(),n&&pt(A,{select:!0})):v.shiftKey&&y===A&&(v.preventDefault(),n&&pt(k,{select:!0})):y===T&&v.preventDefault()}},[n,s,h.paused]);return d.jsx(be.div,{tabIndex:-1,...a,ref:u,onKeyDown:b})});nr.displayName=_f;function Rf(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(pt(s,{select:t}),document.activeElement!==n)return}function Mf(e){const t=qa(e),n=xo(t,e),s=xo(t.reverse(),e);return[n,s]}function qa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function xo(e,t){for(const n of e)if(!Nf(n,{upTo:t}))return n}function Nf(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function jf(e){return e instanceof HTMLInputElement&&"select"in e}function pt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&jf(e)&&t&&e.select()}}var yo=Pf();function Pf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=vo(e,t),e.unshift(t)},remove(t){var n;e=vo(e,t),(n=e[0])==null||n.resume()}}}function vo(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function If(e){return e.filter(t=>t.tagName!=="A")}var Df=us[" useId ".trim().toString()]||(()=>{}),Of=0;function De(e){const[t,n]=p.useState(Df());return rt(()=>{n(s=>s??String(Of++))},[e]),e||(t?`radix-${t}`:"")}const Lf=["top","right","bottom","left"],bt=Math.min,$e=Math.max,Bn=Math.round,Mn=Math.floor,Je=e=>({x:e,y:e}),Ff={left:"right",right:"left",bottom:"top",top:"bottom"};function Wr(e,t,n){return $e(e,bt(t,n))}function ot(e,t){return typeof e=="function"?e(t):e}function at(e){return e.split("-")[0]}function Zt(e){return e.split("-")[1]}function xs(e){return e==="x"?"y":"x"}function ys(e){return e==="y"?"height":"width"}function Qe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function vs(e){return xs(Qe(e))}function $f(e,t,n){n===void 0&&(n=!1);const s=Zt(e),r=vs(e),o=ys(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=Wn(a)),[a,Wn(a)]}function Uf(e){const t=Wn(e);return[Gr(e),t,Gr(t)]}function Gr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wo=["left","right"],So=["right","left"],zf=["top","bottom"],Hf=["bottom","top"];function Bf(e,t,n){switch(e){case"top":case"bottom":return n?t?So:wo:t?wo:So;case"left":case"right":return t?zf:Hf;default:return[]}}function Wf(e,t,n,s){const r=Zt(e);let o=Bf(at(e),n==="start",s);return r&&(o=o.map(a=>a+"-"+r),t&&(o=o.concat(o.map(Gr)))),o}function Wn(e){const t=at(e);return Ff[t]+e.slice(t.length)}function Gf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ka(e){return typeof e!="number"?Gf(e):{top:e,right:e,bottom:e,left:e}}function Gn(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function Co(e,t,n){let{reference:s,floating:r}=e;const o=Qe(t),a=vs(t),i=ys(a),m=at(t),f=o==="y",l=s.x+s.width/2-r.width/2,c=s.y+s.height/2-r.height/2,u=s[i]/2-r[i]/2;let h;switch(m){case"top":h={x:l,y:s.y-r.height};break;case"bottom":h={x:l,y:s.y+s.height};break;case"right":h={x:s.x+s.width,y:c};break;case"left":h={x:s.x-r.width,y:c};break;default:h={x:s.x,y:s.y}}switch(Zt(t)){case"start":h[a]-=u*(n&&f?-1:1);break;case"end":h[a]+=u*(n&&f?-1:1);break}return h}async function Vf(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:u=!1,padding:h=0}=ot(t,e),b=Ka(h),w=i[u?c==="floating"?"reference":"floating":c],y=Gn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),T=c==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(i.floating)),k=await(o.isElement==null?void 0:o.isElement(A))?await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1}:{x:1,y:1},O=Gn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:T,offsetParent:A,strategy:m}):T);return{top:(y.top-O.top+b.top)/k.y,bottom:(O.bottom-y.bottom+b.bottom)/k.y,left:(y.left-O.left+b.left)/k.x,right:(O.right-y.right+b.right)/k.x}}const qf=50,Kf=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:Vf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:l,y:c}=Co(f,s,m),u=s,h=0;const b={};for(let v=0;v<o.length;v++){const w=o[v];if(!w)continue;const{name:y,fn:T}=w,{x:A,y:k,data:O,reset:E}=await T({x:l,y:c,initialPlacement:s,placement:u,strategy:r,middlewareData:b,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=k??c,b[y]={...b[y],...O},E&&h<qf&&(h++,typeof E=="object"&&(E.placement&&(u=E.placement),E.rects&&(f=E.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):E.rects),{x:l,y:c}=Co(f,u,m)),v=-1)}return{x:l,y:c,placement:u,strategy:r,middlewareData:b}},Yf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=ot(e,t)||{};if(f==null)return{};const c=Ka(l),u={x:n,y:s},h=vs(r),b=ys(h),v=await a.getDimensions(f),w=h==="y",y=w?"top":"left",T=w?"bottom":"right",A=w?"clientHeight":"clientWidth",k=o.reference[b]+o.reference[h]-u[h]-o.floating[b],O=u[h]-o.reference[h],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let _=E?E[A]:0;(!_||!await(a.isElement==null?void 0:a.isElement(E)))&&(_=i.floating[A]||o.floating[b]);const g=k/2-O/2,x=_/2-v[b]/2-1,M=bt(c[y],x),I=bt(c[T],x),D=M,F=_-v[b]-I,j=_/2-v[b]/2+g,z=Wr(D,j,F),C=!m.arrow&&Zt(r)!=null&&j!==z&&o.reference[b]/2-(j<D?M:I)-v[b]/2<0,S=C?j<D?j-D:j-F:0;return{[h]:u[h]+S,data:{[h]:z,centerOffset:j-z-S,...C&&{alignmentOffset:S}},reset:C}}}),Xf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:o,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...w}=ot(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=at(r),T=Qe(i),A=at(i)===i,k=await(m.isRTL==null?void 0:m.isRTL(f.floating)),O=u||(A||!v?[Wn(i)]:Uf(i)),E=b!=="none";!u&&E&&O.push(...Wf(i,v,b,k));const _=[i,...O],g=await m.detectOverflow(t,w),x=[];let M=((s=o.flip)==null?void 0:s.overflows)||[];if(l&&x.push(g[y]),c){const j=$f(r,a,k);x.push(g[j[0]],g[j[1]])}if(M=[...M,{placement:r,overflows:x}],!x.every(j=>j<=0)){var I,D;const j=(((I=o.flip)==null?void 0:I.index)||0)+1,z=_[j];if(z&&(!(c==="alignment"?T!==Qe(z):!1)||M.every(H=>Qe(H.placement)===T?H.overflows[0]>0:!0)))return{data:{index:j,overflows:M},reset:{placement:z}};let C=(D=M.filter(S=>S.overflows[0]<=0).sort((S,H)=>S.overflows[1]-H.overflows[1])[0])==null?void 0:D.placement;if(!C)switch(h){case"bestFit":{var F;const S=(F=M.filter(H=>{if(E){const P=Qe(H.placement);return P===T||P==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((H,P)=>H[1]-P[1])[0])==null?void 0:F[0];S&&(C=S);break}case"initialPlacement":C=i;break}if(r!==C)return{reset:{placement:C}}}return{}}}};function ko(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Eo(e){return Lf.some(t=>e[t]>=0)}const Qf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=ot(e,t);switch(r){case"referenceHidden":{const a=await s.detectOverflow(t,{...o,elementContext:"reference"}),i=ko(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Eo(i)}}}case"escaped":{const a=await s.detectOverflow(t,{...o,altBoundary:!0}),i=ko(a,n.floating);return{data:{escapedOffsets:i,escaped:Eo(i)}}}default:return{}}}}},Ya=new Set(["left","top"]);async function Jf(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),a=at(n),i=Zt(n),m=Qe(n)==="y",f=Ya.has(a)?-1:1,l=o&&m?-1:1,c=ot(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:b}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof b=="number"&&(h=i==="end"?b*-1:b),m?{x:h*l,y:u*f}:{x:u*f,y:h*l}}const Zf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:o,placement:a,middlewareData:i}=t,m=await Jf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:r+m.x,y:o+m.y,data:{...m,placement:a}}}}},em=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:y=>{let{x:T,y:A}=y;return{x:T,y:A}}},...f}=ot(e,t),l={x:n,y:s},c=await o.detectOverflow(t,f),u=Qe(at(r)),h=xs(u);let b=l[h],v=l[u];if(a){const y=h==="y"?"top":"left",T=h==="y"?"bottom":"right",A=b+c[y],k=b-c[T];b=Wr(A,b,k)}if(i){const y=u==="y"?"top":"left",T=u==="y"?"bottom":"right",A=v+c[y],k=v-c[T];v=Wr(A,v,k)}const w=m.fn({...t,[h]:b,[u]:v});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[h]:a,[u]:i}}}}}},tm=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:o,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=ot(e,t),l={x:n,y:s},c=Qe(r),u=xs(c);let h=l[u],b=l[c];const v=ot(i,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=u==="y"?"height":"width",k=o.reference[u]-o.floating[A]+w.mainAxis,O=o.reference[u]+o.reference[A]-w.mainAxis;h<k?h=k:h>O&&(h=O)}if(f){var y,T;const A=u==="y"?"width":"height",k=Ya.has(at(r)),O=o.reference[c]-o.floating[A]+(k&&((y=a.offset)==null?void 0:y[c])||0)+(k?0:w.crossAxis),E=o.reference[c]+o.reference[A]+(k?0:((T=a.offset)==null?void 0:T[c])||0)-(k?w.crossAxis:0);b<O?b=O:b>E&&(b=E)}return{[u]:h,[c]:b}}}},nm=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:r,rects:o,platform:a,elements:i}=t,{apply:m=()=>{},...f}=ot(e,t),l=await a.detectOverflow(t,f),c=at(r),u=Zt(r),h=Qe(r)==="y",{width:b,height:v}=o.floating;let w,y;c==="top"||c==="bottom"?(w=c,y=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(y=c,w=u==="end"?"top":"bottom");const T=v-l.top-l.bottom,A=b-l.left-l.right,k=bt(v-l[w],T),O=bt(b-l[y],A),E=!t.middlewareData.shift;let _=k,g=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=A),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(_=T),E&&!u){const M=$e(l.left,0),I=$e(l.right,0),D=$e(l.top,0),F=$e(l.bottom,0);h?g=b-2*(M!==0||I!==0?M+I:$e(l.left,l.right)):_=v-2*(D!==0||F!==0?D+F:$e(l.top,l.bottom))}await m({...t,availableWidth:g,availableHeight:_});const x=await a.getDimensions(i.floating);return b!==x.width||v!==x.height?{reset:{rects:!0}}:{}}}};function rr(){return typeof window<"u"}function en(e){return Xa(e)?(e.nodeName||"").toLowerCase():"#document"}function Ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function et(e){var t;return(t=(Xa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xa(e){return rr()?e instanceof Node||e instanceof Ue(e).Node:!1}function We(e){return rr()?e instanceof Element||e instanceof Ue(e).Element:!1}function lt(e){return rr()?e instanceof HTMLElement||e instanceof Ue(e).HTMLElement:!1}function Ao(e){return!rr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ue(e).ShadowRoot}function yn(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function rm(e){return/^(table|td|th)$/.test(en(e))}function sr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sm=/transform|translate|scale|rotate|perspective|filter/,om=/paint|layout|strict|content/,At=e=>!!e&&e!=="none";let Cr;function ws(e){const t=We(e)?Ge(e):e;return At(t.transform)||At(t.translate)||At(t.scale)||At(t.rotate)||At(t.perspective)||!Ss()&&(At(t.backdropFilter)||At(t.filter))||sm.test(t.willChange||"")||om.test(t.contain||"")}function am(e){let t=xt(e);for(;lt(t)&&!Xt(t);){if(ws(t))return t;if(sr(t))return null;t=xt(t)}return null}function Ss(){return Cr==null&&(Cr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cr}function Xt(e){return/^(html|body|#document)$/.test(en(e))}function Ge(e){return Ue(e).getComputedStyle(e)}function or(e){return We(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xt(e){if(en(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ao(e)&&e.host||et(e);return Ao(t)?t.host:t}function Qa(e){const t=xt(e);return Xt(t)?e.ownerDocument?e.ownerDocument.body:e.body:lt(t)&&yn(t)?t:Qa(t)}function dn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Qa(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),a=Ue(r);if(o){const i=Vr(a);return t.concat(a,a.visualViewport||[],yn(r)?r:[],i&&n?dn(i):[])}else return t.concat(r,dn(r,[],n))}function Vr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ja(e){const t=Ge(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=lt(e),o=r?e.offsetWidth:n,a=r?e.offsetHeight:s,i=Bn(n)!==o||Bn(s)!==a;return i&&(n=o,s=a),{width:n,height:s,$:i}}function Cs(e){return We(e)?e:e.contextElement}function Vt(e){const t=Cs(e);if(!lt(t))return Je(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Ja(t);let a=(o?Bn(n.width):n.width)/s,i=(o?Bn(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const im=Je(0);function Za(e){const t=Ue(e);return!Ss()||!t.visualViewport?im:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ue(e)?!1:t}function Nt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=Cs(e);let a=Je(1);t&&(s?We(s)&&(a=Vt(s)):a=Vt(e));const i=lm(o,n,s)?Za(o):Je(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,l=r.width/a.x,c=r.height/a.y;if(o){const u=Ue(o),h=s&&We(s)?Ue(s):s;let b=u,v=Vr(b);for(;v&&s&&h!==b;){const w=Vt(v),y=v.getBoundingClientRect(),T=Ge(v),A=y.left+(v.clientLeft+parseFloat(T.paddingLeft))*w.x,k=y.top+(v.clientTop+parseFloat(T.paddingTop))*w.y;m*=w.x,f*=w.y,l*=w.x,c*=w.y,m+=A,f+=k,b=Ue(v),v=Vr(b)}}return Gn({width:l,height:c,x:m,y:f})}function ar(e,t){const n=or(e).scrollLeft;return t?t.left+n:Nt(et(e)).left+n}function ei(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-ar(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function cm(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",a=et(s),i=t?sr(t.floating):!1;if(s===a||i&&o)return n;let m={scrollLeft:0,scrollTop:0},f=Je(1);const l=Je(0),c=lt(s);if((c||!c&&!o)&&((en(s)!=="body"||yn(a))&&(m=or(s)),c)){const h=Nt(s);f=Vt(s),l.x=h.x+s.clientLeft,l.y=h.y+s.clientTop}const u=a&&!c&&!o?ei(a,m):Je(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+u.x,y:n.y*f.y-m.scrollTop*f.y+l.y+u.y}}function dm(e){return Array.from(e.getClientRects())}function um(e){const t=et(e),n=or(e),s=e.ownerDocument.body,r=$e(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=$e(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+ar(e);const i=-n.scrollTop;return Ge(s).direction==="rtl"&&(a+=$e(t.clientWidth,s.clientWidth)-r),{width:r,height:o,x:a,y:i}}const To=25;function fm(e,t){const n=Ue(e),s=et(e),r=n.visualViewport;let o=s.clientWidth,a=s.clientHeight,i=0,m=0;if(r){o=r.width,a=r.height;const l=Ss();(!l||l&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=ar(s);if(f<=0){const l=s.ownerDocument,c=l.body,u=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,b=Math.abs(s.clientWidth-c.clientWidth-h);b<=To&&(o-=b)}else f<=To&&(o+=f);return{width:o,height:a,x:i,y:m}}function mm(e,t){const n=Nt(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=lt(e)?Vt(e):Je(1),a=e.clientWidth*o.x,i=e.clientHeight*o.y,m=r*o.x,f=s*o.y;return{width:a,height:i,x:m,y:f}}function _o(e,t,n){let s;if(t==="viewport")s=fm(e,n);else if(t==="document")s=um(et(e));else if(We(t))s=mm(t,n);else{const r=Za(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Gn(s)}function ti(e,t){const n=xt(e);return n===t||!We(n)||Xt(n)?!1:Ge(n).position==="fixed"||ti(n,t)}function pm(e,t){const n=t.get(e);if(n)return n;let s=dn(e,[],!1).filter(i=>We(i)&&en(i)!=="body"),r=null;const o=Ge(e).position==="fixed";let a=o?xt(e):e;for(;We(a)&&!Xt(a);){const i=Ge(a),m=ws(a);!m&&i.position==="fixed"&&(r=null),(o?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||yn(a)&&!m&&ti(e,a))?s=s.filter(l=>l!==a):r=i,a=xt(a)}return t.set(e,s),s}function hm(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const a=[...n==="clippingAncestors"?sr(t)?[]:pm(t,this._c):[].concat(n),s],i=_o(t,a[0],r);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let u=1;u<a.length;u++){const h=_o(t,a[u],r);m=$e(h.top,m),f=bt(h.right,f),l=bt(h.bottom,l),c=$e(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function gm(e){const{width:t,height:n}=Ja(e);return{width:t,height:n}}function bm(e,t,n){const s=lt(t),r=et(t),o=n==="fixed",a=Nt(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const m=Je(0);function f(){m.x=ar(r)}if(s||!s&&!o)if((en(t)!=="body"||yn(r))&&(i=or(t)),s){const h=Nt(t,!0,o,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();o&&!s&&r&&f();const l=r&&!s&&!o?ei(r,i):Je(0),c=a.left+i.scrollLeft-m.x-l.x,u=a.top+i.scrollTop-m.y-l.y;return{x:c,y:u,width:a.width,height:a.height}}function kr(e){return Ge(e).position==="static"}function Ro(e,t){if(!lt(e)||Ge(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function ni(e,t){const n=Ue(e);if(sr(e))return n;if(!lt(e)){let r=xt(e);for(;r&&!Xt(r);){if(We(r)&&!kr(r))return r;r=xt(r)}return n}let s=Ro(e,t);for(;s&&rm(s)&&kr(s);)s=Ro(s,t);return s&&Xt(s)&&kr(s)&&!ws(s)?n:s||am(e)||n}const xm=async function(e){const t=this.getOffsetParent||ni,n=this.getDimensions,s=await n(e.floating);return{reference:bm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function ym(e){return Ge(e).direction==="rtl"}const vm={convertOffsetParentRelativeRectToViewportRelativeRect:cm,getDocumentElement:et,getClippingRect:hm,getOffsetParent:ni,getElementRects:xm,getClientRects:dm,getDimensions:gm,getScale:Vt,isElement:We,isRTL:ym};function ri(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wm(e,t){let n=null,s;const r=et(e);function o(){var i;clearTimeout(s),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),o();const f=e.getBoundingClientRect(),{left:l,top:c,width:u,height:h}=f;if(i||t(),!u||!h)return;const b=Mn(c),v=Mn(r.clientWidth-(l+u)),w=Mn(r.clientHeight-(c+h)),y=Mn(l),A={rootMargin:-b+"px "+-v+"px "+-w+"px "+-y+"px",threshold:$e(0,bt(1,m))||1};let k=!0;function O(E){const _=E[0].intersectionRatio;if(_!==m){if(!k)return a();_?a(!1,_):s=setTimeout(()=>{a(!1,1e-7)},1e3)}_===1&&!ri(f,e.getBoundingClientRect())&&a(),k=!1}try{n=new IntersectionObserver(O,{...A,root:r.ownerDocument})}catch{n=new IntersectionObserver(O,A)}n.observe(e)}return a(!0),o}function Sm(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=s,f=Cs(e),l=r||o?[...f?dn(f):[],...t?dn(t):[]]:[];l.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const c=f&&i?wm(f,n):null;let u=-1,h=null;a&&(h=new ResizeObserver(y=>{let[T]=y;T&&T.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let b,v=m?Nt(e):null;m&&w();function w(){const y=Nt(e);v&&!ri(v,y)&&n(),v=y,b=requestAnimationFrame(w)}return n(),()=>{var y;l.forEach(T=>{r&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),c==null||c(),(y=h)==null||y.disconnect(),h=null,m&&cancelAnimationFrame(b)}}const Cm=Zf,km=em,Em=Xf,Am=nm,Tm=Qf,Mo=Yf,_m=tm,Rm=(e,t,n)=>{const s=new Map,r={platform:vm,...n},o={...r.platform,_c:s};return Kf(e,t,{...r,platform:o})};var Mm=typeof document<"u",Nm=function(){},On=Mm?p.useLayoutEffect:Nm;function Vn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Vn(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const o=r[s];if(!(o==="_owner"&&e.$$typeof)&&!Vn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function si(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function No(e,t){const n=si(e);return Math.round(t*n)/n}function Er(e){const t=p.useRef(e);return On(()=>{t.current=e}),t}function jm(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:o,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,h]=p.useState(s);Vn(u,s)||h(s);const[b,v]=p.useState(null),[w,y]=p.useState(null),T=p.useCallback(H=>{H!==E.current&&(E.current=H,v(H))},[]),A=p.useCallback(H=>{H!==_.current&&(_.current=H,y(H))},[]),k=o||b,O=a||w,E=p.useRef(null),_=p.useRef(null),g=p.useRef(l),x=m!=null,M=Er(m),I=Er(r),D=Er(f),F=p.useCallback(()=>{if(!E.current||!_.current)return;const H={placement:t,strategy:n,middleware:u};I.current&&(H.platform=I.current),Rm(E.current,_.current,H).then(P=>{const U={...P,isPositioned:D.current!==!1};j.current&&!Vn(g.current,U)&&(g.current=U,da.flushSync(()=>{c(U)}))})},[u,t,n,I,D]);On(()=>{f===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,c(H=>({...H,isPositioned:!1})))},[f]);const j=p.useRef(!1);On(()=>(j.current=!0,()=>{j.current=!1}),[]),On(()=>{if(k&&(E.current=k),O&&(_.current=O),k&&O){if(M.current)return M.current(k,O,F);F()}},[k,O,F,M,x]);const z=p.useMemo(()=>({reference:E,floating:_,setReference:T,setFloating:A}),[T,A]),C=p.useMemo(()=>({reference:k,floating:O}),[k,O]),S=p.useMemo(()=>{const H={position:n,left:0,top:0};if(!C.floating)return H;const P=No(C.floating,l.x),U=No(C.floating,l.y);return i?{...H,transform:"translate("+P+"px, "+U+"px)",...si(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:U}},[n,i,C.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:C,floatingStyles:S}),[l,F,z,C,S])}const Pm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:r}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Mo({element:s.current,padding:r}).fn(n):{}:s?Mo({element:s,padding:r}).fn(n):{}}}},Im=(e,t)=>{const n=Cm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dm=(e,t)=>{const n=km(e);return{name:n.name,fn:n.fn,options:[e,t]}},Om=(e,t)=>({fn:_m(e).fn,options:[e,t]}),Lm=(e,t)=>{const n=Em(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fm=(e,t)=>{const n=Am(e);return{name:n.name,fn:n.fn,options:[e,t]}},$m=(e,t)=>{const n=Tm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Um=(e,t)=>{const n=Pm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var zm="Arrow",oi=p.forwardRef((e,t)=>{const{children:n,width:s=10,height:r=5,...o}=e;return d.jsx(be.svg,{...o,ref:t,width:s,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});oi.displayName=zm;var Hm=oi;function Bm(e){const[t,n]=p.useState(void 0);return rt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const o=r[0];let a,i;if("borderBoxSize"in o){const m=o.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var ks="Popper",[ai,tn]=it(ks),[Wm,ii]=ai(ks),li=e=>{const{__scopePopper:t,children:n}=e,[s,r]=p.useState(null);return d.jsx(Wm,{scope:t,anchor:s,onAnchorChange:r,children:n})};li.displayName=ks;var ci="PopperAnchor",di=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...r}=e,o=ii(ci,n),a=p.useRef(null),i=Ae(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(s==null?void 0:s.current)||a.current,f!==m.current&&o.onAnchorChange(m.current)}),s?null:d.jsx(be.div,{...r,ref:i})});di.displayName=ci;var Es="PopperContent",[Gm,Vm]=ai(Es),ui=p.forwardRef((e,t)=>{var V,q,K,oe,ee,re;const{__scopePopper:n,side:s="bottom",sideOffset:r=0,align:o="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:u=!1,updatePositionStrategy:h="optimized",onPlaced:b,...v}=e,w=ii(Es,n),[y,T]=p.useState(null),A=Ae(t,ce=>T(ce)),[k,O]=p.useState(null),E=Bm(k),_=(E==null?void 0:E.width)??0,g=(E==null?void 0:E.height)??0,x=s+(o!=="center"?"-"+o:""),M=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},I=Array.isArray(f)?f:[f],D=I.length>0,F={padding:M,boundary:I.filter(Km),altBoundary:D},{refs:j,floatingStyles:z,placement:C,isPositioned:S,middlewareData:H}=jm({strategy:"fixed",placement:x,whileElementsMounted:(...ce)=>Sm(...ce,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[Im({mainAxis:r+g,alignmentAxis:a}),m&&Dm({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?Om():void 0,...F}),m&&Lm({...F}),Fm({...F,apply:({elements:ce,rects:ve,availableWidth:fe,availableHeight:we})=>{const{width:me,height:de}=ve.reference,xe=ce.floating.style;xe.setProperty("--radix-popper-available-width",`${fe}px`),xe.setProperty("--radix-popper-available-height",`${we}px`),xe.setProperty("--radix-popper-anchor-width",`${me}px`),xe.setProperty("--radix-popper-anchor-height",`${de}px`)}}),k&&Um({element:k,padding:i}),Ym({arrowWidth:_,arrowHeight:g}),u&&$m({strategy:"referenceHidden",...F})]}),[P,U]=pi(C),Y=st(b);rt(()=>{S&&(Y==null||Y())},[S,Y]);const N=(V=H.arrow)==null?void 0:V.x,L=(q=H.arrow)==null?void 0:q.y,$=((K=H.arrow)==null?void 0:K.centerOffset)!==0,[R,B]=p.useState();return rt(()=>{y&&B(window.getComputedStyle(y).zIndex)},[y]),d.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:S?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(oe=H.transformOrigin)==null?void 0:oe.x,(ee=H.transformOrigin)==null?void 0:ee.y].join(" "),...((re=H.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(Gm,{scope:n,placedSide:P,onArrowChange:O,arrowX:N,arrowY:L,shouldHideArrow:$,children:d.jsx(be.div,{"data-side":P,"data-align":U,...v,ref:A,style:{...v.style,animation:S?void 0:"none"}})})})});ui.displayName=Es;var fi="PopperArrow",qm={top:"bottom",right:"left",bottom:"top",left:"right"},mi=p.forwardRef(function(t,n){const{__scopePopper:s,...r}=t,o=Vm(fi,s),a=qm[o.placedSide];return d.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:d.jsx(Hm,{...r,ref:n,style:{...r.style,display:"block"}})})});mi.displayName=fi;function Km(e){return e!==null}var Ym=e=>({name:"transformOrigin",options:e,fn(t){var w,y,T;const{placement:n,rects:s,middlewareData:r}=t,a=((w=r.arrow)==null?void 0:w.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=pi(n),c={start:"0%",center:"50%",end:"100%"}[l],u=(((y=r.arrow)==null?void 0:y.x)??0)+i/2,h=(((T=r.arrow)==null?void 0:T.y)??0)+m/2;let b="",v="";return f==="bottom"?(b=a?c:`${u}px`,v=`${-m}px`):f==="top"?(b=a?c:`${u}px`,v=`${s.floating.height+m}px`):f==="right"?(b=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(b=`${s.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:b,y:v}}}});function pi(e){const[t,n="center"]=e.split("-");return[t,n]}var As=li,ir=di,Ts=ui,_s=mi,Xm="Portal",vn=p.forwardRef((e,t)=>{var i;const{container:n,...s}=e,[r,o]=p.useState(!1);rt(()=>o(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?Uc.createPortal(d.jsx(be.div,{...s,ref:t}),a):null});vn.displayName=Xm;function Qm(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var ze=e=>{const{present:t,children:n}=e,s=Jm(t),r=typeof n=="function"?n({present:s.isPresent}):p.Children.only(n),o=Ae(s.ref,Zm(r));return typeof n=="function"||s.isPresent?p.cloneElement(r,{ref:o}):null};ze.displayName="Presence";function Jm(e){const[t,n]=p.useState(),s=p.useRef(null),r=p.useRef(e),o=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Qm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=Nn(s.current);o.current=i==="mounted"?f:"none"},[i]),rt(()=>{const f=s.current,l=r.current;if(l!==e){const u=o.current,h=Nn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&u!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),rt(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=Nn(s.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!r.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},u=h=>{h.target===t&&(o.current=Nn(s.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{s.current=f?getComputedStyle(f):null,n(f)},[])}}function Nn(e){return(e==null?void 0:e.animationName)||"none"}function Zm(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ar="rovingFocusGroup.onEntryFocus",ep={bubbles:!1,cancelable:!0},wn="RovingFocusGroup",[qr,hi,tp]=Ba(wn),[np,gi]=it(wn,[tp]),[rp,sp]=np(wn),bi=p.forwardRef((e,t)=>d.jsx(qr.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(qr.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(op,{...e,ref:t})})}));bi.displayName=wn;var op=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:r=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,u=p.useRef(null),h=Ae(t,u),b=Wa(o),[v,w]=gt({prop:a,defaultProp:i??null,onChange:m,caller:wn}),[y,T]=p.useState(!1),A=st(f),k=hi(n),O=p.useRef(!1),[E,_]=p.useState(0);return p.useEffect(()=>{const g=u.current;if(g)return g.addEventListener(Ar,A),()=>g.removeEventListener(Ar,A)},[A]),d.jsx(rp,{scope:n,orientation:s,dir:b,loop:r,currentTabStopId:v,onItemFocus:p.useCallback(g=>w(g),[w]),onItemShiftTab:p.useCallback(()=>T(!0),[]),onFocusableItemAdd:p.useCallback(()=>_(g=>g+1),[]),onFocusableItemRemove:p.useCallback(()=>_(g=>g-1),[]),children:d.jsx(be.div,{tabIndex:y||E===0?-1:0,"data-orientation":s,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{O.current=!0}),onFocus:ne(e.onFocus,g=>{const x=!O.current;if(g.target===g.currentTarget&&x&&!y){const M=new CustomEvent(Ar,ep);if(g.currentTarget.dispatchEvent(M),!M.defaultPrevented){const I=k().filter(C=>C.focusable),D=I.find(C=>C.active),F=I.find(C=>C.id===v),z=[D,F,...I].filter(Boolean).map(C=>C.ref.current);vi(z,l)}}O.current=!1}),onBlur:ne(e.onBlur,()=>T(!1))})})}),xi="RovingFocusGroupItem",yi=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:r=!1,tabStopId:o,children:a,...i}=e,m=De(),f=o||m,l=sp(xi,n),c=l.currentTabStopId===f,u=hi(n),{onFocusableItemAdd:h,onFocusableItemRemove:b,currentTabStopId:v}=l;return p.useEffect(()=>{if(s)return h(),()=>b()},[s,h,b]),d.jsx(qr.ItemSlot,{scope:n,id:f,focusable:s,active:r,children:d.jsx(be.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:ne(e.onMouseDown,w=>{s?l.onItemFocus(f):w.preventDefault()}),onFocus:ne(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:ne(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){l.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const y=lp(w,l.orientation,l.dir);if(y!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let A=u().filter(k=>k.focusable).map(k=>k.ref.current);if(y==="last")A.reverse();else if(y==="prev"||y==="next"){y==="prev"&&A.reverse();const k=A.indexOf(w.currentTarget);A=l.loop?cp(A,k+1):A.slice(k+1)}setTimeout(()=>vi(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});yi.displayName=xi;var ap={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ip(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function lp(e,t,n){const s=ip(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return ap[s]}function vi(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function cp(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var dp=bi,up=yi,fp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ut=new WeakMap,jn=new WeakMap,Pn={},Tr=0,wi=function(e){return e&&(e.host||wi(e.parentNode))},mp=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=wi(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},pp=function(e,t,n,s){var r=mp(t,Array.isArray(e)?e:[e]);Pn[n]||(Pn[n]=new WeakMap);var o=Pn[n],a=[],i=new Set,m=new Set(r),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};r.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(u){if(i.has(u))l(u);else try{var h=u.getAttribute(s),b=h!==null&&h!=="false",v=(Ut.get(u)||0)+1,w=(o.get(u)||0)+1;Ut.set(u,v),o.set(u,w),a.push(u),v===1&&b&&jn.set(u,!0),w===1&&u.setAttribute(n,"true"),b||u.setAttribute(s,"true")}catch(y){console.error("aria-hidden: cannot operate on ",u,y)}})};return l(t),i.clear(),Tr++,function(){a.forEach(function(c){var u=Ut.get(c)-1,h=o.get(c)-1;Ut.set(c,u),o.set(c,h),u||(jn.has(c)||c.removeAttribute(s),jn.delete(c)),h||c.removeAttribute(n)}),Tr--,Tr||(Ut=new WeakMap,Ut=new WeakMap,jn=new WeakMap,Pn={})}},Rs=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=fp(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),pp(s,r,n,"aria-hidden")):function(){return null}},Kr=["Enter"," "],hp=["ArrowDown","PageUp","Home"],Si=["ArrowUp","PageDown","End"],gp=[...hp,...Si],bp={ltr:[...Kr,"ArrowRight"],rtl:[...Kr,"ArrowLeft"]},xp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sn="Menu",[un,yp,vp]=Ba(Sn),[Ot,Ci]=it(Sn,[vp,tn,gi]),lr=tn(),ki=gi(),[wp,Lt]=Ot(Sn),[Sp,Cn]=Ot(Sn),Ei=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:r,onOpenChange:o,modal:a=!0}=e,i=lr(t),[m,f]=p.useState(null),l=p.useRef(!1),c=st(o),u=Wa(r);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),d.jsx(As,{...i,children:d.jsx(wp,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:d.jsx(Sp,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:u,modal:a,children:s})})})};Ei.displayName=Sn;var Cp="MenuAnchor",Ms=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=lr(n);return d.jsx(ir,{...r,...s,ref:t})});Ms.displayName=Cp;var Ns="MenuPortal",[kp,Ai]=Ot(Ns,{forceMount:void 0}),Ti=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:r}=e,o=Lt(Ns,t);return d.jsx(kp,{scope:t,forceMount:n,children:d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:r,children:s})})})};Ti.displayName=Ns;var He="MenuContent",[Ep,js]=Ot(He),_i=p.forwardRef((e,t)=>{const n=Ai(He,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,o=Lt(He,e.__scopeMenu),a=Cn(He,e.__scopeMenu);return d.jsx(un.Provider,{scope:e.__scopeMenu,children:d.jsx(ze,{present:s||o.open,children:d.jsx(un.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(Ap,{...r,ref:t}):d.jsx(Tp,{...r,ref:t})})})})}),Ap=p.forwardRef((e,t)=>{const n=Lt(He,e.__scopeMenu),s=p.useRef(null),r=Ae(t,s);return p.useEffect(()=>{const o=s.current;if(o)return Rs(o)},[]),d.jsx(Ps,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tp=p.forwardRef((e,t)=>{const n=Lt(He,e.__scopeMenu);return d.jsx(Ps,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),_p=Yt("MenuContent.ScrollLock"),Ps=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,disableOutsideScroll:b,...v}=e,w=Lt(He,n),y=Cn(He,n),T=lr(n),A=ki(n),k=yp(n),[O,E]=p.useState(null),_=p.useRef(null),g=Ae(t,_,w.onContentChange),x=p.useRef(0),M=p.useRef(""),I=p.useRef(0),D=p.useRef(null),F=p.useRef("right"),j=p.useRef(0),z=b?fs:p.Fragment,C=b?{as:_p,allowPinchZoom:!0}:void 0,S=P=>{var V,q;const U=M.current+P,Y=k().filter(K=>!K.disabled),N=document.activeElement,L=(V=Y.find(K=>K.ref.current===N))==null?void 0:V.textValue,$=Y.map(K=>K.textValue),R=Up($,U,L),B=(q=Y.find(K=>K.textValue===R))==null?void 0:q.ref.current;(function K(oe){M.current=oe,window.clearTimeout(x.current),oe!==""&&(x.current=window.setTimeout(()=>K(""),1e3))})(U),B&&setTimeout(()=>B.focus())};p.useEffect(()=>()=>window.clearTimeout(x.current),[]),bs();const H=p.useCallback(P=>{var Y,N;return F.current===((Y=D.current)==null?void 0:Y.side)&&Hp(P,(N=D.current)==null?void 0:N.area)},[]);return d.jsx(Ep,{scope:n,searchRef:M,onItemEnter:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),onItemLeave:p.useCallback(P=>{var U;H(P)||((U=_.current)==null||U.focus(),E(null))},[H]),onTriggerLeave:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),pointerGraceTimerRef:I,onPointerGraceIntentChange:p.useCallback(P=>{D.current=P},[]),children:d.jsx(z,{...C,children:d.jsx(nr,{asChild:!0,trapped:r,onMountAutoFocus:ne(o,P=>{var U;P.preventDefault(),(U=_.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(xn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,children:d.jsx(dp,{asChild:!0,...A,dir:y.dir,orientation:"vertical",loop:s,currentTabStopId:O,onCurrentTabStopIdChange:E,onEntryFocus:ne(m,P=>{y.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(Ts,{role:"menu","aria-orientation":"vertical","data-state":Wi(w.open),"data-radix-menu-content":"",dir:y.dir,...T,...v,ref:g,style:{outline:"none",...v.style},onKeyDown:ne(v.onKeyDown,P=>{const Y=P.target.closest("[data-radix-menu-content]")===P.currentTarget,N=P.ctrlKey||P.altKey||P.metaKey,L=P.key.length===1;Y&&(P.key==="Tab"&&P.preventDefault(),!N&&L&&S(P.key));const $=_.current;if(P.target!==$||!gp.includes(P.key))return;P.preventDefault();const B=k().filter(V=>!V.disabled).map(V=>V.ref.current);Si.includes(P.key)&&B.reverse(),Fp(B)}),onBlur:ne(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(x.current),M.current="")}),onPointerMove:ne(e.onPointerMove,fn(P=>{const U=P.target,Y=j.current!==P.clientX;if(P.currentTarget.contains(U)&&Y){const N=P.clientX>j.current?"right":"left";F.current=N,j.current=P.clientX}}))})})})})})})});_i.displayName=He;var Rp="MenuGroup",Is=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return d.jsx(be.div,{role:"group",...s,ref:t})});Is.displayName=Rp;var Mp="MenuLabel",Ri=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return d.jsx(be.div,{...s,ref:t})});Ri.displayName=Mp;var qn="MenuItem",jo="menu.itemSelect",cr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...r}=e,o=p.useRef(null),a=Cn(qn,e.__scopeMenu),i=js(qn,e.__scopeMenu),m=Ae(t,o),f=p.useRef(!1),l=()=>{const c=o.current;if(!n&&c){const u=new CustomEvent(jo,{bubbles:!0,cancelable:!0});c.addEventListener(jo,h=>s==null?void 0:s(h),{once:!0}),Ha(c,u),u.defaultPrevented?f.current=!1:a.onClose()}};return d.jsx(Mi,{...r,ref:m,disabled:n,onClick:ne(e.onClick,l),onPointerDown:c=>{var u;(u=e.onPointerDown)==null||u.call(e,c),f.current=!0},onPointerUp:ne(e.onPointerUp,c=>{var u;f.current||(u=c.currentTarget)==null||u.click()}),onKeyDown:ne(e.onKeyDown,c=>{const u=i.searchRef.current!=="";n||u&&c.key===" "||Kr.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});cr.displayName=qn;var Mi=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:r,...o}=e,a=js(qn,n),i=ki(n),m=p.useRef(null),f=Ae(t,m),[l,c]=p.useState(!1),[u,h]=p.useState("");return p.useEffect(()=>{const b=m.current;b&&h((b.textContent??"").trim())},[o.children]),d.jsx(un.ItemSlot,{scope:n,disabled:s,textValue:r??u,children:d.jsx(up,{asChild:!0,...i,focusable:!s,children:d.jsx(be.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:f,onPointerMove:ne(e.onPointerMove,fn(b=>{s?a.onItemLeave(b):(a.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,fn(b=>a.onItemLeave(b))),onFocus:ne(e.onFocus,()=>c(!0)),onBlur:ne(e.onBlur,()=>c(!1))})})})}),Np="MenuCheckboxItem",Ni=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...r}=e;return d.jsx(Oi,{scope:e.__scopeMenu,checked:n,children:d.jsx(cr,{role:"menuitemcheckbox","aria-checked":Kn(n)?"mixed":n,...r,ref:t,"data-state":Os(n),onSelect:ne(r.onSelect,()=>s==null?void 0:s(Kn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ni.displayName=Np;var ji="MenuRadioGroup",[jp,Pp]=Ot(ji,{value:void 0,onValueChange:()=>{}}),Pi=p.forwardRef((e,t)=>{const{value:n,onValueChange:s,...r}=e,o=st(s);return d.jsx(jp,{scope:e.__scopeMenu,value:n,onValueChange:o,children:d.jsx(Is,{...r,ref:t})})});Pi.displayName=ji;var Ii="MenuRadioItem",Di=p.forwardRef((e,t)=>{const{value:n,...s}=e,r=Pp(Ii,e.__scopeMenu),o=n===r.value;return d.jsx(Oi,{scope:e.__scopeMenu,checked:o,children:d.jsx(cr,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Os(o),onSelect:ne(s.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});Di.displayName=Ii;var Ds="MenuItemIndicator",[Oi,Ip]=Ot(Ds,{checked:!1}),Li=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...r}=e,o=Ip(Ds,n);return d.jsx(ze,{present:s||Kn(o.checked)||o.checked===!0,children:d.jsx(be.span,{...r,ref:t,"data-state":Os(o.checked)})})});Li.displayName=Ds;var Dp="MenuSeparator",Fi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return d.jsx(be.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Fi.displayName=Dp;var Op="MenuArrow",$i=p.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,r=lr(n);return d.jsx(_s,{...r,...s,ref:t})});$i.displayName=Op;var Lp="MenuSub",[uv,Ui]=Ot(Lp),cn="MenuSubTrigger",zi=p.forwardRef((e,t)=>{const n=Lt(cn,e.__scopeMenu),s=Cn(cn,e.__scopeMenu),r=Ui(cn,e.__scopeMenu),o=js(cn,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),d.jsx(Ms,{asChild:!0,...f,children:d.jsx(Mi,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Wi(n.open),...e,ref:Ze(t,r.onTriggerChange),onClick:c=>{var u;(u=e.onClick)==null||u.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,fn(c=>{o.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:ne(e.onPointerLeave,fn(c=>{var h,b;l();const u=(h=n.content)==null?void 0:h.getBoundingClientRect();if(u){const v=(b=n.content)==null?void 0:b.dataset.side,w=v==="right",y=w?-5:5,T=u[w?"left":"right"],A=u[w?"right":"left"];o.onPointerGraceIntentChange({area:[{x:c.clientX+y,y:c.clientY},{x:T,y:u.top},{x:A,y:u.top},{x:A,y:u.bottom},{x:T,y:u.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(c),c.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,c=>{var h;const u=o.searchRef.current!=="";e.disabled||u&&c.key===" "||bp[s.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});zi.displayName=cn;var Hi="MenuSubContent",Bi=p.forwardRef((e,t)=>{const n=Ai(He,e.__scopeMenu),{forceMount:s=n.forceMount,...r}=e,o=Lt(He,e.__scopeMenu),a=Cn(He,e.__scopeMenu),i=Ui(Hi,e.__scopeMenu),m=p.useRef(null),f=Ae(t,m);return d.jsx(un.Provider,{scope:e.__scopeMenu,children:d.jsx(ze,{present:s||o.open,children:d.jsx(un.Slot,{scope:e.__scopeMenu,children:d.jsx(Ps,{id:i.contentId,"aria-labelledby":i.triggerId,...r,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:ne(e.onFocusOutside,l=>{l.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:ne(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),u=xp[a.dir].includes(l.key);c&&u&&(o.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Bi.displayName=Hi;function Wi(e){return e?"open":"closed"}function Kn(e){return e==="indeterminate"}function Os(e){return Kn(e)?"indeterminate":e?"checked":"unchecked"}function Fp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $p(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function Up(e,t,n){const r=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=$p(e,Math.max(o,0));r.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return m!==n?m:void 0}function zp(e,t){const{x:n,y:s}=e;let r=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>s!=u>s&&n<(c-f)*(s-l)/(u-l)+f&&(r=!r)}return r}function Hp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return zp(n,t)}function fn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Bp=Ei,Wp=Ms,Gp=Ti,Vp=_i,qp=Is,Kp=Ri,Yp=cr,Xp=Ni,Qp=Pi,Jp=Di,Zp=Li,eh=Fi,th=$i,nh=zi,rh=Bi,dr="DropdownMenu",[sh]=it(dr,[Ci]),Oe=Ci(),[oh,Gi]=sh(dr),Vi=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,m=Oe(t),f=p.useRef(null),[l,c]=gt({prop:r,defaultProp:o??!1,onChange:a,caller:dr});return d.jsx(oh,{scope:t,triggerId:De(),triggerRef:f,contentId:De(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(u=>!u),[c]),modal:i,children:d.jsx(Bp,{...m,open:l,onOpenChange:c,dir:s,modal:i,children:n})})};Vi.displayName=dr;var qi="DropdownMenuTrigger",Ki=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...r}=e,o=Gi(qi,n),a=Oe(n);return d.jsx(Wp,{asChild:!0,...a,children:d.jsx(be.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...r,ref:Ze(t,o.triggerRef),onPointerDown:ne(e.onPointerDown,i=>{!s&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:ne(e.onKeyDown,i=>{s||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ki.displayName=qi;var ah="DropdownMenuPortal",Yi=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Oe(t);return d.jsx(Gp,{...s,...n})};Yi.displayName=ah;var Xi="DropdownMenuContent",Qi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Gi(Xi,n),o=Oe(n),a=p.useRef(!1);return d.jsx(Vp,{id:r.contentId,"aria-labelledby":r.triggerId,...o,...s,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!r.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qi.displayName=Xi;var ih="DropdownMenuGroup",lh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(qp,{...r,...s,ref:t})});lh.displayName=ih;var ch="DropdownMenuLabel",Ji=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(Kp,{...r,...s,ref:t})});Ji.displayName=ch;var dh="DropdownMenuItem",Zi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(Yp,{...r,...s,ref:t})});Zi.displayName=dh;var uh="DropdownMenuCheckboxItem",fh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(Xp,{...r,...s,ref:t})});fh.displayName=uh;var mh="DropdownMenuRadioGroup",ph=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(Qp,{...r,...s,ref:t})});ph.displayName=mh;var hh="DropdownMenuRadioItem",gh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(Jp,{...r,...s,ref:t})});gh.displayName=hh;var bh="DropdownMenuItemIndicator",xh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(Zp,{...r,...s,ref:t})});xh.displayName=bh;var yh="DropdownMenuSeparator",el=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(eh,{...r,...s,ref:t})});el.displayName=yh;var vh="DropdownMenuArrow",wh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(th,{...r,...s,ref:t})});wh.displayName=vh;var Sh="DropdownMenuSubTrigger",Ch=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(nh,{...r,...s,ref:t})});Ch.displayName=Sh;var kh="DropdownMenuSubContent",Eh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,r=Oe(n);return d.jsx(rh,{...r,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Eh.displayName=kh;var Ah=Vi,Th=Ki,_h=Yi,Rh=Qi,Mh=Ji,Nh=Zi,jh=el;function tl({...e}){return d.jsx(Ah,{"data-slot":"dropdown-menu",...e})}function nl({...e}){return d.jsx(Th,{"data-slot":"dropdown-menu-trigger",...e})}function rl({className:e,sideOffset:t=4,...n}){return d.jsx(_h,{children:d.jsx(Rh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Ln({className:e,inset:t,variant:n="default",...s}){return d.jsx(Nh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Q("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s})}function Ph({className:e,inset:t,...n}){return d.jsx(Mh,{"data-slot":"dropdown-menu-label","data-inset":t,className:Q("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Po({className:e,...t}){return d.jsx(jh,{"data-slot":"dropdown-menu-separator",className:Q("bg-border -mx-1 my-1 h-px",e),...t})}const Ih=[{value:"light",label:"Light",icon:d.jsx(Da,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:d.jsx(Na,{className:"h-4 w-4"})},{value:"system",label:"System",icon:d.jsx(xu,{className:"h-4 w-4"})}];function Dh({className:e}){const{theme:t,setTheme:n,resolvedTheme:s}=Yu();return d.jsxs(tl,{children:[d.jsx(nl,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"icon",className:e??"h-8 w-8",children:[s==="dark"?d.jsx(Na,{className:"h-4 w-4"}):d.jsx(Da,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),d.jsx(rl,{align:"end",children:Ih.map(r=>d.jsxs(Ln,{onClick:()=>n(r.value),className:t===r.value?"bg-accent":"",children:[r.icon,d.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}const Io={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.unreachable":"无法连接服务器——请确认服务正在运行,且界面与 API 同源访问。","auth.login.rateLimited":"登录尝试过于频繁,请稍后再试。","auth.login.csrfBlocked":"请求来源校验失败(CSRF)——请从服务本身提供的地址打开界面。","auth.login.failedWithReason":"登录失败:{message}","auth.login.description":"输入你的用户名和密码以继续。","auth.login.singleUserHint":"单用户模式:首次部署已自动创建管理员账号","auth.login.singleUserHintFooter":"本地便捷默认密码,登录后建议尽快修改","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.all":"全部","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.list.empty":"创建你的第一个团队,开始协作。","team.list.count":"{n} 个团队","team.list.noDescription":"暂无描述","team.list.kicker":"协作名册","team.list.lede":"把机台、会话与工件收进同一个协作域。","team.list.founded":"创立于","team.list.delete":"删除团队","team.list.deleteConfirm":"确定删除团队「{name}」?团队环境需先转移,此操作不可撤销。","team.list.deleteFailed":"删除团队失败","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.create.failed":"创建团队失败","team.detail.back":"返回团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.detail.memberCount":"{n} 名成员","team.detail.notFound":"团队不存在。","team.detail.copyId":"复制团队 ID","team.detail.membersEmptyTitle":"暂无成员","team.detail.membersEmptyHint":"邀请同事加入后,他们会出现在这份名册上。","team.detail.envsEmptyTitle":"暂无环境","team.detail.envsEmptyHint":"用下面的命令把一台机器登记到本团队。","team.detail.copyCommand":"复制命令","team.detail.unlink":"解除关联","team.detail.unlinkConfirm":"将这台环境从团队解绑?它会回到个人空间。","team.detail.unlinkFailed":"解绑环境失败","team.detail.loadEnvsFailed":"加载环境失败","team.detail.registerHint":"把一台机器登记到本团队","team.detail.linkHint":"关联一台已有的个人环境","team.detail.linkSelect":"选择环境…","team.detail.link":"关联","team.detail.linkFailed":"关联环境失败","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","invitation.expires":"到期 {date}","invitation.emptyTitle":"暂无邀请","invitation.emptyHint":"创建一条邀请链接,把它发给同事。","invitation.addFailed":"添加用户失败","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dashboard.emptySessionsTitle":"暂无会话","dashboard.emptySessionsHint":"点右上角「+ 新会话」开一条,或等 worker 上报会话。","dashboard.emptyEnvironmentsTitle":"暂无环境","dashboard.emptyEnvironmentsHint":"worker 经 RCS 注册后,环境会落到这条线上。","dashboard.emptyMarker":"无记录","dashboard.envOwner":"创建者","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.closedSendBlocked":"会话已归档,消息未发送","session.sendFailed":"消息发送失败","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","session.sseReconnecting":"与服务器的实时连接中断,正在自动重连…(期间消息可能延迟显示)","session.sseFailed":"实时连接重连失败,请刷新页面恢复","user.settings.language":"语言","dashboard.searchAction":"搜索会话","dashboard.searchPlaceholder":"搜索所有会话内容…","dashboard.searchNoResults":"没有匹配的会话","dashboard.closeSearch":"收起搜索","user.settings.notifications":"浏览器通知","user.settings.notificationsDesc":"会话需要审批或回合完成时通知(仅页面处于后台时)","user.settings.notificationsDenied":"通知权限已被拒绝 — 请在浏览器设置中允许","user.settings.notificationsUnsupported":"当前环境不支持通知(需要 HTTPS 或 localhost)","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"工件","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建工件","artifacts.empty":'还没有工件。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载工件失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","memories.title":"记忆","memories.subtitle":"团队共享与个人专属的长期记忆,自动注入 agent 会话","memories.new":"新建记忆","memories.empty":'还没有记忆。点击"新建"手动添加,或由 agent 会话自动沉淀。',"memories.loadFailed":"加载记忆失败","memories.delete":"删除","memories.deleteFailed":"删除失败","memories.edit":"编辑","memories.update":"保存更新","memories.updateFailed":"更新失败","memories.create.title":"新建记忆","memories.editMemory":"编辑记忆","memories.create.name":"名称","memories.create.namePlaceholder":'简短标题,如"发布流程约定"',"memories.create.description":"一句话描述","memories.create.descriptionPlaceholder":"用于注入索引的摘要行","memories.create.type":"类型","memories.create.content":"内容","memories.create.contentPlaceholder":"记忆正文(Markdown)…","memories.create.scope":"归属","memories.create.scope.personal":"个人","memories.create.scope.team":"团队","memories.create.teamRequired":"请选择团队","memories.create.failed":"创建失败","memories.type.user":"用户","memories.type.feedback":"反馈","memories.type.project":"项目","memories.type.reference":"参考","memories.scope.personal":"个人","memories.scope.team":"团队","memories.session":"来源会话","memories.updatedAt":"更新于","memories.promote":"晋升为团队记忆","memories.promoteFailed":"晋升失败","memories.promoteTeamRequired":"请选择目标团队","memorySidebar.title":"记忆","memorySidebar.memoriesTab":"记忆","memorySidebar.governanceTab":"治理","memorySidebar.loadFailed":"加载失败","memorySidebar.empty":"还没有记忆。agent 会话中自动沉淀,或在此手动编辑。","memorySidebar.updateFailed":"保存失败","memorySidebar.deleteFailed":"删除失败","memorySidebar.promoteFailed":"晋升失败","memorySidebar.edit":"编辑","memorySidebar.save":"保存","memorySidebar.cancel":"取消","memorySidebar.delete":"删除","memorySidebar.promote":"晋升为团队记忆","memorySidebar.personal":"个人","memorySidebar.team":"团队","memorySidebar.searchPlaceholder":"正则搜索…","memorySidebar.searchHint":"按正则表达式匹配记忆文件名与内容(非法正则按普通文本匹配)","memorySidebar.noResults":"没有匹配的记忆","memorySidebar.recallTitle":"agent 本回合召回","memorySidebar.recallQuery":"检索词","memorySidebar.recallTest.title":"召回测试","memorySidebar.recallTest.hint":"输入一句话,用与 agent 每回合相同的检索引擎(多路融合评分)预览哪些记忆会被召回","memorySidebar.recallTest.placeholder":"模拟一条用户消息…","memorySidebar.recallTest.run":"测试","memorySidebar.recallTest.running":"测试中…","memorySidebar.recallTest.noResults":"无召回命中","memorySidebar.saModeBanner":"SA 模式:记忆自动化已停用(主 agent 不感知记忆系统)","memorySidebar.poorModeBanner":"poor 模式:检索预取与自动整理已停用","memorySidebar.dream":"整理记忆(dream)","memorySidebar.dreaming":"整理中…","memorySidebar.dreamDisabled":"当前模式下 dream 不可用","memorySidebar.layers":"分层","memorySidebar.health":"健康","memorySidebar.total":"总数","memorySidebar.capacity":"容量","memorySidebar.avgConfidence":"平均置信度","memorySidebar.alerts":"提醒","memorySidebar.conflicts":"待处理冲突","memorySidebar.new":"新建记忆","memorySidebar.create.name":"名称","memorySidebar.create.namePlaceholder":"例如 deploy-workflow","memorySidebar.create.description":"描述","memorySidebar.create.descriptionPlaceholder":"一句话摘要(用于召回相关性判断)","memorySidebar.create.type":"类型","memorySidebar.create.content":"内容","memorySidebar.create.contentPlaceholder":"记忆正文。feedback/project 类型建议包含 **Why:** 与 **How to apply:** 行","memorySidebar.createFailed":"创建失败","memorySidebar.teamHint":"团队记忆对本项目目录下的所有会话共享","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"工件不存在或已过期","artifacts.backToGallery":"← 返回工件","artifacts.create.title":"新建工件","artifacts.editArtifact":"编辑工件","artifacts.edit":"编辑","artifacts.update":"保存更新","artifacts.updateFailed":"更新失败","artifacts.linkNotice":"任何持有链接的人均可访问","artifacts.create.contentRequired":"内容不能为空","artifacts.create.ttl":"有效期","artifacts.create.ttlResetNote":"保存后过期时间将按所选有效期重置","artifacts.create.preview":"实时预览","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.aiUpdate":"AI 更新","artifacts.edit.mode.html":"编辑 HTML","artifacts.edit.mode.ai":"AI 更新","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此工件","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的工件提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","artifacts.create.ai.model":"模型槽位","artifacts.create.ai.modelCurrent":"当前","artifacts.create.ai.modelHint":"选择非当前模型时,会先切换目标会话的模型再发送需求","artifacts.update.ai.briefPlaceholder":"例如:把本周的数据加进去,趋势图延长到最新一周…","artifacts.update.ai.briefRequired":"请描述需要的更新","artifacts.update.ai.sent":"更新需求已发送。新版本上传后会原位替换此工件,链接保持不变。","artifacts.update.ai.inPlace":"原位更新:链接不变,版本自增","artifacts.update.ai.sessionHint":"默认发送到该工件关联的会话,也可以选择其它会话","artifacts.ai.archify":"Archify 图表模板","artifacts.ai.archifyDesc":"架构 / 流程 / 时序 / 数据流 / 状态图 — 由 archify 技能生成并校验,再上传为工件","artifacts.ai.archifyHint":"开启后,目标会话的 agent 将运行 archify 技能:编写 JSON 规格并校验(showcase 质量零告警),渲染为自包含交互页面后上传。若会话缺少 archify 运行时,agent 会明确说明并退回手写页面。","artifacts.ai.archifyBriefPlaceholder":"例如:一张架构图 — 请求经网关 → 认证服务 → 业务服务 → 缓存 / 数据库 的调用链…","artifacts.view.liveUpdated":"已自动更新","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话","permission.title":"权限请求","permission.required":"需要权限","permission.approve":"允许","permission.alwaysAllow":"始终允许","permission.alwaysAllowHint":"允许并记住规则:{rule}","permission.reject":"拒绝","dashboard.searching":"搜索中…","dashboard.nMatches":"{n} 处匹配","dashboard.nameMatch":"标题/ID 匹配","session.mode.title":"权限模式(Shift+Tab 循环)","session.mode.default":"默认","session.mode.defaultDesc":"手动审批权限请求","session.mode.acceptEdits":"自动接受编辑","session.mode.acceptEditsDesc":"自动允许文件编辑操作","session.mode.plan":"规划模式","session.mode.planDesc":"仅规划,不执行工具","session.mode.bypass":"跳过权限","session.mode.bypassDesc":"跳过所有权限检查","session.mode.switchFailedRequest":"模式切换请求发送失败: {message}","session.mode.switchFailed":"模式切换失败","session.thinking.title":"思考预算","session.thinking.off":"关闭思考","session.thinking.offDesc":"不使用扩展思考","session.thinking.on":"默认思考","session.thinking.onDesc":"开启,使用默认预算","session.thinking.fallback":"思考","session.thinking.failedRequest":"思考预算请求发送失败: {message}","session.thinking.failed":"思考预算切换失败","session.effort.title":"Effort 档位","session.effort.auto":"自动","session.effort.autoDesc":"使用模型默认 effort","session.effort.lowDesc":"低推理力度","session.effort.mediumDesc":"中推理力度","session.effort.highDesc":"高推理力度","session.effort.xhighDesc":"超高推理力度","session.effort.maxDesc":"最大推理力度","session.effort.fallback":"自动","session.effort.failedRequest":"Effort 切换请求发送失败: {message}","session.effort.failed":"Effort 切换失败","session.tokenMode.title":"Token 省用模式","session.tokenMode.normal":"标准","session.tokenMode.normalDesc":"完整工具集与后台服务","session.tokenMode.poor":"poor","session.tokenMode.poorDesc":"关闭记忆抽取、prompt 建议等后台开销","session.tokenMode.sa":"sa","session.tokenMode.saDesc":"极简 harness:精简系统提示与小工具集(poor 超集)","session.tokenMode.fallback":"标准","session.tokenMode.failedRequest":"Token 模式切换请求发送失败: {message}","session.tokenMode.failed":"Token 模式切换失败","session.model.title":"选择模型","session.context.tooltip":"上下文用量:{used} / {max} tokens","session.context.deferredSuffix":"(延迟加载)","session.resume.title":"恢复历史对话","session.resume.currentBlocked":"不能恢复当前会话自身","session.resume.restoring":"正在恢复「{title}」…","session.resume.restored":"已恢复 {count} 条消息","session.resume.restoredWithTitle":"已恢复 {count} 条消息:{title}","session.resume.failed":"恢复失败:{message}","session.resume.unsupported":"当前 worker 不支持 /resume(需要 spawn 模式 worker:slz rc)","session.resumeInNew":"在新会话中继续此对话(/resume)","session.createFailedWithReason":"创建会话失败:{message}","session.rewind.confirmEdit":"回退到这条消息并编辑?","session.rewind.confirm":"回退到这条消息?","session.rewind.confirmBody":"之后的对话将移除,已修改的文件将恢复到当时的状态(若有快照)。","session.rewind.failed":"回退失败: {message}","session.rename.title":"重命名会话","session.rename.failed":"重命名失败","session.sideQuestion.title":"旁路提问 — 针对会话上下文提问,不进入主对话","session.search.title":"搜索会话内容","session.mcp.title":"MCP 服务器","session.settings.title":"会话设置","session.search.placeholder":"搜索会话内容…","session.search.noResults":"无结果","session.stopTask.failed":"停止任务失败","settings.unset":"(未设置)","settings.loadFailed":"获取设置失败 — worker 可能不支持","settings.writeFailed":"写入失败","settings.loading":"加载设置…","settings.model":"模型","settings.defaultModel":"(默认)","settings.hint":"布尔开关写入会话级 flag 层(apply_flag_settings);只读项点击查看详情。","settings.back":"返回设置列表","settings.copied":"已复制","settings.copyValue":"复制值","settings.searchPlaceholder":"搜索设置项…","settings.noMatch":"没有匹配的设置项","settings.togglable":"可设置({n})","settings.readOnly":"只读({n})","settings.turnOff":"关闭(写入 false)","settings.turnOn":"开启(写入 true)","settings.viewDetail":"查看详情","settings.memorySection":"记忆","settings.autoMemory":"自动记忆","settings.teamMemory":"团队记忆","settings.memoryHint":"开启团队记忆后,会话记忆侧栏将出现「团队」页签(team/ 共享子树)。开关会话级生效,持久启用请写入 settings.json 的 teamMemoryEnabled。","mcp.status.connected":"已连接","mcp.status.failed":"失败","mcp.status.needsAuth":"待认证","mcp.status.pending":"连接中","mcp.status.disabled":"已禁用","mcp.loadFailed":"获取 MCP 状态失败 — worker 可能不支持","mcp.toggleFailed":"切换失败","mcp.reconnectFailed":"重连失败","mcp.loading":"加载 MCP 状态…","mcp.empty":"没有配置 MCP 服务器","mcp.toolCount":"{n} 工具","mcp.reconnect":"重连","mcp.enable":"启用","mcp.disable":"禁用","resume.loading":"正在加载本地会话列表…","resume.empty":"没有可恢复的历史对话","resume.today":"今天","resume.yesterday":"昨天","resume.earlier":"更早","sideQuestion.title":"旁路提问","sideQuestion.desc":"针对当前会话上下文提问,不进入主对话、不消耗会话历史 — 适合「这个会话干了什么」式的快速核对。","sideQuestion.empty":"还没有提问。在下方输入你的问题。","sideQuestion.noAnswer":"没有获得回答(超时或 worker 不支持)","sideQuestion.placeholder":"问点什么…","sideQuestion.send":"提问(Enter)","elicitation.title":"MCP 请求输入","elicitation.required":"必填","elicitation.submit":"提交","elicitation.decline":"拒绝","elicitation.done":"完成","subagent.stop":"停止此任务","task.endConfirm":"结束 worker 会话?正在进行的回合将被中止,会话随后归档。","task.endHint":"通知 worker 中止在途回合并退出,随后归档会话","task.backgroundTasks":"后台任务","task.noBackgroundTasks":"暂无后台任务","task.runningCount":"{count} 个运行中","task.recentCount":"{count} 个近期","task.mixedCount":"{running} 个运行中 · {recent} 个近期","task.type.teammates":"队友","task.type.shells":"Shell","task.type.monitors":"监视器","task.type.remoteAgents":"远程代理","task.type.localAgents":"本地代理","task.type.tasks":"任务","permission.writeUnknown":"待写入","permission.requestAria":"权限请求:{tool}","user.settings.notificationsOn":"已开启","user.settings.notificationsOff":"已关闭","artifacts.create.markdownPlaceholder":`# 周报
213
213
 
214
214
  - 进度…
215
- - 风险…`,"cmd.desc.compact":"压缩上下文","cmd.desc.cost":"查看会话费用","cmd.desc.summary":"生成会话摘要","cmd.desc.files":"列出会话追踪的文件","cmd.desc.clear":"清空当前对话","cmd.desc.new":"新建会话","cmd.desc.help":"显示此帮助信息","cmd.desc.status":"显示会话状态","cmd.desc.model":"查看或切换模型","cmd.desc.copy":"复制最后一条助手消息","cmd.desc.resume":"恢复一个历史对话到当前会话","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[会话id]","cmd.desc.agentFallback":"agent 命令","cmd.subtitle.help":"可用命令列表","cmd.subtitle.status":"会话状态信息","cmd.subtitle.model":"查看或切换模型","cmd.subtitle.copy":"复制助手消息到剪贴板","cmd.subtitle.resume":"选择并恢复一个历史对话","cmd.help.localHeader":"**本地命令**(Web UI 直接执行)","cmd.help.agentHeader":"**Agent 命令**(发给 Saluzi agent 执行)","cmd.status.header":"**会话状态**","cmd.status.sessionId":"会话 ID","cmd.status.none":"无","cmd.status.currentModel":"当前模型","cmd.status.unset":"未设置","cmd.status.modelCount":"可用模型数","cmd.status.imageSupport":"图片支持","cmd.status.yes":"是","cmd.status.no":"否","cmd.status.messageCount":"消息条数","cmd.model.none":"当前 agent 未提供模型选择能力。","cmd.model.available":"**可用模型**","cmd.model.hint":"使用 `/model <id>` 切换模型。","cmd.model.switched":"已请求切换到模型: `{id}`","cmd.model.switchFailed":"切换模型失败: {message}","cmd.copy.failed":"复制失败:剪贴板不可用","cmd.copy.copied":"已复制 {n} 字符到剪贴板","cmd.copy.nothing":"没有可复制的助手消息","notify.permission.title":"需要审批","notify.permission.body":"{session} — agent 正在等待权限批准","notify.turnComplete.title":"回合完成","notify.turnComplete.body":"{session} — agent 已完成当前回合","adapter.workerCrashed":"Worker 进程异常退出","adapter.stopTimeout":"停止请求超时","adapter.stopFailed":"停止请求失败","adapter.requestTimeout":"请求超时","attach.emptyFile":"(空文件)","attach.emptyDirectory":"(空目录)","attach.directoryHeader":"📁 目录: {name}","attach.fileCount":"({n} 个文件)","attach.readFailed":"(读取失败)","attach.tooLarge":"(文件过大,已跳过)","attach.imageFile":"(图片文件,{size})","attach.binaryFile":"(二进制文件,{size})","attach.dumpHeader":"# 目录: {name}","attach.dumpCount":"共 {n} 个文件","attach.structure":"## 文件结构","attach.contents":"## 文件内容","acp.sessions":"会话","acp.newSession":"新会话","acp.confirmDelete":'删除会话 "{label}"?此操作不可恢复。',"acp.emptySessions":"暂无会话","acp.historyNav":"历史会话","acp.confirm":"确认","acp.noSessionManagement":"该 agent 不支持会话管理(重命名/删除)","acp.rename":"重命名","acp.renameUnsupported":"该 agent 不支持会话重命名","acp.delete":"删除","acp.deleteUnsupported":"该 agent 不支持会话删除","acp.mode.default":"默认","acp.mode.defaultDesc":"手动审批权限请求","acp.mode.acceptEdits":"自动接受编辑","acp.mode.acceptEditsDesc":"自动允许文件编辑操作","acp.mode.bypass":"跳过权限","acp.mode.bypassDesc":"跳过所有权限检查","acp.mode.plan":"规划模式","acp.mode.planDesc":"仅规划,不执行工具","acp.mode.dontAsk":"不询问","acp.mode.dontAskDesc":"不弹出询问,自动拒绝","acp.mode.auto":"自动判断","acp.mode.autoDesc":"AI 自动判断是否批准","acp.emptyDescription":"输入消息开始与 ACP agent 聊天","acp.inputPlaceholder":"给 Saluzi 发送消息…","acp.waitingPlaceholder":"等待会话...","chat.fileMatchHint":"文件匹配 {query} — ↑↓ 选择,Enter 插入","chat.picker.image":"图片","chat.picker.textFile":"文本文件","chat.picker.sheet":"表格文件","chat.picker.directory":"目录","chat.commandList":"命令列表","chat.processingFile":"处理文件中…","chat.queued":"{n} 条消息排队中,完成后自动发送","chat.queuedCancel":"(点击取消全部)","chat.inputHint":"Enter 发送,Shift+Enter 换行","chat.inputHintSuffix":",/ 唤出命令,@ 补全文件","chat.fileCount":"{n} 个文件","chat.directory":"目录","chat.noCommands":"没有匹配的命令","chat.cmdDone":"命令已执行 · 输入消息继续","chat.live.working":"处理中","chat.live.running":"运行中","plan.title":"执行计划","plan.priority.high":"高","plan.priority.medium":"中","plan.priority.low":"低","tool.newFile":"新文件","tool.callTimes":"{n} 次{name}","tool.summaryCalls":"{n} 个工具调用","tool.summaryTools":"{n} 个工具: {names}","usage.context":"上下文: {used} / {size} tokens","usage.totalCost":"累计成本: {cost}","diff.aria":"{path} 的改动预览,{added} 行新增,{removed} 行删除","diff.hidden":"… 还有 {n} 行未显示","diff.addedLine":"新增行: {text}","diff.removedLine":"删除行: {text}","common.emptyTitle":"暂无消息","common.emptyDescription":"开始对话后消息会显示在这里","message.rewindHere":"回退到这里(对话与文件)","message.rewindEdit":"回退并编辑这条消息","message.expand":"展开"},Oh={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.unreachable":"Cannot reach the server — make sure it is running and that the UI and API share one origin.","auth.login.rateLimited":"Too many login attempts. Try again later.","auth.login.csrfBlocked":"Request origin check failed (CSRF) — open the UI from the address the server itself serves.","auth.login.failedWithReason":"Login failed: {message}","auth.login.description":"Enter your username and password to continue.","auth.login.singleUserHint":"Single-user mode: an admin account was auto-created on first deployment","auth.login.singleUserHintFooter":"Local convenience default — change the password after first login","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.all":"All","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.list.empty":"Create your first team to start collaborating.","team.list.count":"{n} teams","team.list.noDescription":"No description","team.list.kicker":"Roster","team.list.lede":"Gather machines, sessions, and artifacts under one shared domain.","team.list.founded":"Founded","team.list.delete":"Delete team","team.list.deleteConfirm":'Delete team "{name}"? Environments must be transferred first. This cannot be undone.',"team.list.deleteFailed":"Failed to delete team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.create.failed":"Failed to create team","team.detail.back":"Back to teams","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.detail.memberCount":"{n} members","team.detail.notFound":"Team not found.","team.detail.copyId":"Copy team ID","team.detail.membersEmptyTitle":"No members yet","team.detail.membersEmptyHint":"Invite a teammate and they will appear on this roster.","team.detail.envsEmptyTitle":"No environments yet","team.detail.envsEmptyHint":"Register a machine to this team with the command below.","team.detail.copyCommand":"Copy command","team.detail.unlink":"Unlink","team.detail.unlinkConfirm":"Unlink this environment from the team? It will revert to personal scope.","team.detail.unlinkFailed":"Failed to unlink environment","team.detail.loadEnvsFailed":"Failed to load environments","team.detail.registerHint":"Register a machine to this team","team.detail.linkHint":"Link an existing personal environment","team.detail.linkSelect":"Select environment...","team.detail.link":"Link","team.detail.linkFailed":"Failed to link environment","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","invitation.expires":"expires {date}","invitation.emptyTitle":"No invitations yet","invitation.emptyHint":"Create an invite link and send it to a teammate.","invitation.addFailed":"Failed to add user","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dashboard.emptySessionsTitle":"No sessions yet","dashboard.emptySessionsHint":"Start one from “+ New Session”, or wait for a worker to report in.","dashboard.emptyEnvironmentsTitle":"No environments yet","dashboard.emptyEnvironmentsHint":"An environment lands on this wire once a worker registers over RCS.","dashboard.emptyMarker":"No records","dashboard.envOwner":"Created by","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.metaStatus":"Status","session.metaWorker":"Worker","session.metaCreated":"Created","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.closedSendBlocked":"Session is archived — message was not sent","session.sendFailed":"Failed to send message","session.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","session.sseReconnecting":"Live connection lost — reconnecting… (messages may be delayed)","session.sseFailed":"Live connection failed — refresh the page to recover","user.settings.language":"Language","dashboard.searchAction":"Search sessions","dashboard.searchPlaceholder":"Search across all sessions…","dashboard.searchNoResults":"No matching sessions","dashboard.closeSearch":"Close search","user.settings.notifications":"Browser notifications","user.settings.notificationsDesc":"Notify when a session needs approval or completes a turn (only while the page is in the background)","user.settings.notificationsDenied":"Notification permission denied — allow it in your browser settings","user.settings.notificationsUnsupported":"Notifications unavailable in this context (HTTPS or localhost required)","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","memories.title":"Memories","memories.subtitle":"Team-shared and personal long-term memories, injected into agent sessions","memories.new":"New Memory","memories.empty":"No memories yet. Create one manually, or let agent sessions distill them.","memories.loadFailed":"Failed to load memories","memories.delete":"Delete","memories.deleteFailed":"Delete failed","memories.edit":"Edit","memories.update":"Save update","memories.updateFailed":"Update failed","memories.create.title":"New Memory","memories.editMemory":"Edit Memory","memories.create.name":"Name","memories.create.namePlaceholder":'Short title, e.g. "Release process"',"memories.create.description":"One-line description","memories.create.descriptionPlaceholder":"Summary line used in the injection index","memories.create.type":"Type","memories.create.content":"Content","memories.create.contentPlaceholder":"Memory body (Markdown)…","memories.create.scope":"Scope","memories.create.scope.personal":"Personal","memories.create.scope.team":"Team","memories.create.teamRequired":"Pick a team","memories.create.failed":"Create failed","memories.type.user":"User","memories.type.feedback":"Feedback","memories.type.project":"Project","memories.type.reference":"Reference","memories.scope.personal":"Personal","memories.scope.team":"Team","memories.session":"Source session","memories.updatedAt":"Updated","memories.promote":"Promote to team","memories.promoteFailed":"Promote failed","memories.promoteTeamRequired":"Pick a target team","memorySidebar.title":"Memory","memorySidebar.memoriesTab":"Memories","memorySidebar.governanceTab":"Governance","memorySidebar.loadFailed":"Failed to load","memorySidebar.empty":"No memories yet. They accumulate from agent sessions, or edit here manually.","memorySidebar.updateFailed":"Save failed","memorySidebar.deleteFailed":"Delete failed","memorySidebar.promoteFailed":"Promote failed","memorySidebar.edit":"Edit","memorySidebar.save":"Save","memorySidebar.cancel":"Cancel","memorySidebar.delete":"Delete","memorySidebar.promote":"Promote to team","memorySidebar.personal":"Personal","memorySidebar.team":"Team","memorySidebar.searchPlaceholder":"Regex search…","memorySidebar.searchHint":"Match memory file names and content by regex (invalid regex falls back to plain text)","memorySidebar.noResults":"No matching memories","memorySidebar.recallTitle":"Agent's recall this turn","memorySidebar.recallQuery":"Query","memorySidebar.recallTest.title":"Recall test","memorySidebar.recallTest.hint":"Type a sentence to preview which memories the agent would recall, using the same multi-path engine as its per-turn retrieval","memorySidebar.recallTest.placeholder":"Simulate a user message…","memorySidebar.recallTest.run":"Test","memorySidebar.recallTest.running":"Testing…","memorySidebar.recallTest.noResults":"No recall hits","memorySidebar.saModeBanner":"SA mode: memory automation is off (the agent has no memory prompt)","memorySidebar.poorModeBanner":"Poor mode: recall prefetch and auto-consolidation are off","memorySidebar.dream":"Consolidate (dream)","memorySidebar.dreaming":"Consolidating…","memorySidebar.dreamDisabled":"Dream is unavailable in this mode","memorySidebar.layers":"Layers","memorySidebar.health":"Health","memorySidebar.total":"Total","memorySidebar.capacity":"Capacity","memorySidebar.avgConfidence":"Avg confidence","memorySidebar.alerts":"Alerts","memorySidebar.conflicts":"Pending conflicts","memorySidebar.new":"New memory","memorySidebar.create.name":"Name","memorySidebar.create.namePlaceholder":"e.g. deploy-workflow","memorySidebar.create.description":"Description","memorySidebar.create.descriptionPlaceholder":"One-line summary (drives recall relevance)","memorySidebar.create.type":"Type","memorySidebar.create.content":"Content","memorySidebar.create.contentPlaceholder":"Memory body. For feedback/project types, structure as: rule, then **Why:** and **How to apply:** lines","memorySidebar.createFailed":"Create failed","memorySidebar.teamHint":"Team memories are shared across every session in this project directory","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.editArtifact":"Edit Artifact","artifacts.edit":"Edit","artifacts.update":"Save update","artifacts.updateFailed":"Update failed","artifacts.linkNotice":"Anyone with the link can view","artifacts.create.contentRequired":"Content is required","artifacts.create.ttl":"Lifetime","artifacts.create.ttlResetNote":"Saving resets the expiry from the chosen lifetime","artifacts.create.preview":"Live preview","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.aiUpdate":"AI update","artifacts.edit.mode.html":"Edit HTML","artifacts.edit.mode.ai":"AI update","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","artifacts.create.ai.model":"Model slot","artifacts.create.ai.modelCurrent":"current","artifacts.create.ai.modelHint":"Picking a non-current model switches the target session before dispatching the brief","artifacts.update.ai.briefPlaceholder":"e.g. append this week’s data and extend the trend chart to the latest week…","artifacts.update.ai.briefRequired":"Describe the update you need","artifacts.update.ai.sent":"Update request sent. The new version will replace this artifact in place — the link stays the same.","artifacts.update.ai.inPlace":"In-place update: link stays stable, version bumps","artifacts.update.ai.sessionHint":"Defaults to the session this artifact belongs to; you can pick another one","artifacts.ai.archify":"Archify diagram template","artifacts.ai.archifyDesc":"Architecture / workflow / sequence / dataflow / lifecycle — authored and validated by the archify skill, then uploaded as an artifact","artifacts.ai.archifyHint":"When on, the agent in the target session runs the archify skill: it authors a JSON spec, validates it (showcase quality, zero warnings), renders a self-contained interactive page, and uploads it. If the archify runtime is missing, the agent reports that and falls back to a hand-authored page.","artifacts.ai.archifyBriefPlaceholder":"e.g. an architecture diagram — the request path through gateway → auth → service → cache / database…","artifacts.view.liveUpdated":"Auto-updated","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions","permission.title":"Permission Request","permission.required":"Permission Required","permission.approve":"Approve","permission.alwaysAllow":"Always allow","permission.alwaysAllowHint":"Allow and remember rule: {rule}","permission.reject":"Reject","dashboard.searching":"Searching…","dashboard.nMatches":"{n} matches","dashboard.nameMatch":"Title/ID match","session.mode.title":"Permission mode (Shift+Tab to cycle)","session.mode.default":"Default","session.mode.defaultDesc":"Approve permission requests manually","session.mode.acceptEdits":"Auto-accept edits","session.mode.acceptEditsDesc":"Automatically allow file edits","session.mode.plan":"Plan mode","session.mode.planDesc":"Plan only — no tool execution","session.mode.bypass":"Bypass permissions","session.mode.bypassDesc":"Skip all permission checks","session.mode.switchFailedRequest":"Failed to send mode switch request: {message}","session.mode.switchFailed":"Failed to switch mode","session.thinking.title":"Thinking budget","session.thinking.off":"Thinking off","session.thinking.offDesc":"No extended thinking","session.thinking.on":"Default thinking","session.thinking.onDesc":"On with the default budget","session.thinking.fallback":"Thinking","session.thinking.failedRequest":"Failed to send thinking budget request: {message}","session.thinking.failed":"Failed to switch thinking budget","session.effort.title":"Effort level","session.effort.auto":"Auto","session.effort.autoDesc":"Use the model default effort","session.effort.lowDesc":"Low reasoning effort","session.effort.mediumDesc":"Medium reasoning effort","session.effort.highDesc":"High reasoning effort","session.effort.xhighDesc":"Very high reasoning effort","session.effort.maxDesc":"Maximum reasoning effort","session.effort.fallback":"Auto","session.effort.failedRequest":"Failed to send effort request: {message}","session.effort.failed":"Failed to switch effort","session.tokenMode.title":"Token saving mode","session.tokenMode.normal":"Normal","session.tokenMode.normalDesc":"Full tool set and background services","session.tokenMode.poor":"poor","session.tokenMode.poorDesc":"Disables extract_memories, prompt suggestions, and other background spend","session.tokenMode.sa":"sa","session.tokenMode.saDesc":"Minimal harness: trimmed system prompt and small tool set (superset of poor)","session.tokenMode.fallback":"Normal","session.tokenMode.failedRequest":"Failed to send token mode request: {message}","session.tokenMode.failed":"Failed to switch token mode","session.model.title":"Select model","session.context.tooltip":"Context usage: {used} / {max} tokens","session.context.deferredSuffix":" (deferred)","session.usage.total":"Session totals (input includes cache reads/writes)","session.resume.title":"Resume conversation","session.resume.currentBlocked":"Cannot resume the current session itself","session.resume.restoring":'Restoring "{title}"…',"session.resume.restored":"Restored {count} messages","session.resume.restoredWithTitle":"Restored {count} messages: {title}","session.resume.failed":"Resume failed: {message}","session.resume.unsupported":"This worker does not support /resume (requires a spawn-mode worker: slz rc)","session.resumeInNew":"Continue this conversation in a new session (/resume)","session.createFailedWithReason":"Failed to create session: {message}","session.rewind.confirmEdit":"Rewind to this message and edit?","session.rewind.confirm":"Rewind to this message?","session.rewind.confirmBody":"The later conversation will be removed; modified files will be restored to their state at that point (if a snapshot exists).","session.rewind.failed":"Rewind failed: {message}","session.rename.title":"Rename session","session.rename.failed":"Rename failed","session.sideQuestion.title":"Side question — ask about the session context without entering the main conversation","session.search.title":"Search conversation","session.mcp.title":"MCP servers","session.settings.title":"Session settings","session.search.placeholder":"Search conversation…","session.search.noResults":"No results","session.stopTask.failed":"Failed to stop task","settings.unset":"(not set)","settings.loadFailed":"Failed to load settings — worker may not support it","settings.writeFailed":"Write failed","settings.loading":"Loading settings…","settings.model":"Model","settings.defaultModel":"(default)","settings.hint":"Boolean toggles write to the session flag layer (apply_flag_settings); click read-only items for details.","settings.back":"Back to settings","settings.copied":"Copied","settings.copyValue":"Copy value","settings.searchPlaceholder":"Search settings…","settings.noMatch":"No matching settings","settings.togglable":"Editable ({n})","settings.readOnly":"Read-only ({n})","settings.turnOff":"Turn off (writes false)","settings.turnOn":"Turn on (writes true)","settings.viewDetail":"View details","settings.memorySection":"Memory","settings.autoMemory":"Auto-memory","settings.teamMemory":"Team memory","settings.memoryHint":"Team memory adds a Team tab to the session memory sidebar (shared team/ subtree). Toggles apply to this session; persist by setting teamMemoryEnabled in settings.json.","mcp.status.connected":"Connected","mcp.status.failed":"Failed","mcp.status.needsAuth":"Needs auth","mcp.status.pending":"Connecting","mcp.status.disabled":"Disabled","mcp.loadFailed":"Failed to load MCP status — worker may not support it","mcp.toggleFailed":"Toggle failed","mcp.reconnectFailed":"Reconnect failed","mcp.loading":"Loading MCP status…","mcp.empty":"No MCP servers configured","mcp.toolCount":"{n} tools","mcp.reconnect":"Reconnect","mcp.enable":"Enable","mcp.disable":"Disable","resume.loading":"Loading local sessions…","resume.empty":"No resumable conversations","resume.today":"Today","resume.yesterday":"Yesterday","resume.earlier":"Earlier","sideQuestion.title":"Side question","sideQuestion.desc":'Ask about the current session context without entering the main conversation or consuming session history — good for a quick "what did this session do" check.',"sideQuestion.empty":"No questions yet. Type your question below.","sideQuestion.noAnswer":"No answer received (timeout or worker unsupported)","sideQuestion.placeholder":"Ask something…","sideQuestion.send":"Ask (Enter)","elicitation.title":"MCP input request","elicitation.required":"Required","elicitation.submit":"Submit","elicitation.decline":"Decline","elicitation.done":"Done","subagent.stop":"Stop this task","task.endConfirm":"End the worker session? The in-flight turn will be aborted and the session archived.","task.endHint":"Tells the worker to abort the in-flight turn, exit, and archive the session","task.backgroundTasks":"Background tasks","task.noBackgroundTasks":"No background tasks","task.runningCount":"{count} running","task.recentCount":"{count} recent","task.mixedCount":"{running} running · {recent} recent","task.type.teammates":"Agents","task.type.shells":"Shells","task.type.monitors":"Monitors","task.type.remoteAgents":"Remote agents","task.type.localAgents":"Local agents","task.type.tasks":"Tasks","permission.writeUnknown":"Pending write","permission.requestAria":"Permission request: {tool}","user.settings.notificationsOn":"On","user.settings.notificationsOff":"Off","artifacts.create.markdownPlaceholder":`# Weekly report
215
+ - 风险…`,"cmd.desc.compact":"压缩上下文","cmd.desc.cost":"查看会话费用","cmd.desc.summary":"生成会话摘要","cmd.desc.files":"列出会话追踪的文件","cmd.desc.clear":"清空当前对话","cmd.desc.new":"新建会话","cmd.desc.help":"显示此帮助信息","cmd.desc.status":"显示会话状态","cmd.desc.model":"查看或切换模型","cmd.desc.copy":"复制最后一条助手消息","cmd.desc.resume":"恢复一个历史对话到当前会话","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[会话id]","cmd.desc.agentFallback":"agent 命令","cmd.subtitle.help":"可用命令列表","cmd.subtitle.status":"会话状态信息","cmd.subtitle.model":"查看或切换模型","cmd.subtitle.copy":"复制助手消息到剪贴板","cmd.subtitle.resume":"选择并恢复一个历史对话","cmd.help.localHeader":"**本地命令**(Web UI 直接执行)","cmd.help.agentHeader":"**Agent 命令**(发给 Saluzi agent 执行)","cmd.status.header":"**会话状态**","cmd.status.sessionId":"会话 ID","cmd.status.none":"无","cmd.status.currentModel":"当前模型","cmd.status.unset":"未设置","cmd.status.modelCount":"可用模型数","cmd.status.imageSupport":"图片支持","cmd.status.yes":"是","cmd.status.no":"否","cmd.status.messageCount":"消息条数","cmd.model.none":"当前 agent 未提供模型选择能力。","cmd.model.available":"**可用模型**","cmd.model.hint":"使用 `/model <id>` 切换模型。","cmd.model.switched":"已请求切换到模型: `{id}`","cmd.model.switchFailed":"切换模型失败: {message}","cmd.copy.failed":"复制失败:剪贴板不可用","cmd.copy.copied":"已复制 {n} 字符到剪贴板","cmd.copy.nothing":"没有可复制的助手消息","notify.permission.title":"需要审批","notify.permission.body":"{session} — agent 正在等待权限批准","notify.turnComplete.title":"回合完成","notify.turnComplete.body":"{session} — agent 已完成当前回合","adapter.workerCrashed":"Worker 进程异常退出","adapter.stopTimeout":"停止请求超时","adapter.stopFailed":"停止请求失败","adapter.requestTimeout":"请求超时","attach.emptyFile":"(空文件)","attach.emptyDirectory":"(空目录)","attach.directoryHeader":"📁 目录: {name}","attach.fileCount":"({n} 个文件)","attach.readFailed":"(读取失败)","attach.tooLarge":"(文件过大,已跳过)","attach.imageFile":"(图片文件,{size})","attach.binaryFile":"(二进制文件,{size})","attach.dumpHeader":"# 目录: {name}","attach.dumpCount":"共 {n} 个文件","attach.structure":"## 文件结构","attach.contents":"## 文件内容","acp.sessions":"会话","acp.newSession":"新会话","acp.confirmDelete":'删除会话 "{label}"?此操作不可恢复。',"acp.emptySessions":"暂无会话","acp.historyNav":"历史会话","acp.confirm":"确认","acp.noSessionManagement":"该 agent 不支持会话管理(重命名/删除)","acp.rename":"重命名","acp.renameUnsupported":"该 agent 不支持会话重命名","acp.delete":"删除","acp.deleteUnsupported":"该 agent 不支持会话删除","acp.mode.default":"默认","acp.mode.defaultDesc":"手动审批权限请求","acp.mode.acceptEdits":"自动接受编辑","acp.mode.acceptEditsDesc":"自动允许文件编辑操作","acp.mode.bypass":"跳过权限","acp.mode.bypassDesc":"跳过所有权限检查","acp.mode.plan":"规划模式","acp.mode.planDesc":"仅规划,不执行工具","acp.mode.dontAsk":"不询问","acp.mode.dontAskDesc":"不弹出询问,自动拒绝","acp.mode.auto":"自动判断","acp.mode.autoDesc":"AI 自动判断是否批准","acp.emptyDescription":"输入消息开始与 ACP agent 聊天","acp.inputPlaceholder":"给 Saluzi 发送消息…","acp.waitingPlaceholder":"等待会话...","chat.fileMatchHint":"文件匹配 {query} — ↑↓ 选择,Enter 插入","chat.picker.image":"图片","chat.picker.textFile":"文本文件","chat.picker.sheet":"表格文件","chat.picker.directory":"目录","chat.commandList":"命令列表","chat.processingFile":"处理文件中…","chat.queued":"{n} 条消息排队中,完成后自动发送","chat.queuedCancel":"(点击取消全部)","chat.inputHint":"Enter 发送,Shift+Enter 换行","chat.inputHintSuffix":",/ 唤出命令,@ 补全文件","chat.fileCount":"{n} 个文件","chat.directory":"目录","chat.noCommands":"没有匹配的命令","chat.cmdDone":"命令已执行 · 输入消息继续","chat.live.working":"处理中","chat.live.running":"运行中","plan.title":"执行计划","plan.priority.high":"高","plan.priority.medium":"中","plan.priority.low":"低","tool.newFile":"新文件","tool.callTimes":"{n} 次{name}","tool.summaryCalls":"{n} 个工具调用","tool.summaryTools":"{n} 个工具: {names}","usage.context":"上下文: {used} / {size} tokens","usage.totalCost":"累计成本: {cost}","diff.aria":"{path} 的改动预览,{added} 行新增,{removed} 行删除","diff.hidden":"… 还有 {n} 行未显示","diff.addedLine":"新增行: {text}","diff.removedLine":"删除行: {text}","common.emptyTitle":"暂无消息","common.emptyDescription":"开始对话后消息会显示在这里","message.rewindHere":"回退到这里(对话与文件)","message.rewindEdit":"回退并编辑这条消息","message.expand":"展开"},Oh={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.unreachable":"Cannot reach the server — make sure it is running and that the UI and API share one origin.","auth.login.rateLimited":"Too many login attempts. Try again later.","auth.login.csrfBlocked":"Request origin check failed (CSRF) — open the UI from the address the server itself serves.","auth.login.failedWithReason":"Login failed: {message}","auth.login.description":"Enter your username and password to continue.","auth.login.singleUserHint":"Single-user mode: an admin account was auto-created on first deployment","auth.login.singleUserHintFooter":"Local convenience default — change the password after first login","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.all":"All","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.list.empty":"Create your first team to start collaborating.","team.list.count":"{n} teams","team.list.noDescription":"No description","team.list.kicker":"Roster","team.list.lede":"Gather machines, sessions, and artifacts under one shared domain.","team.list.founded":"Founded","team.list.delete":"Delete team","team.list.deleteConfirm":'Delete team "{name}"? Environments must be transferred first. This cannot be undone.',"team.list.deleteFailed":"Failed to delete team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.create.failed":"Failed to create team","team.detail.back":"Back to teams","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.detail.memberCount":"{n} members","team.detail.notFound":"Team not found.","team.detail.copyId":"Copy team ID","team.detail.membersEmptyTitle":"No members yet","team.detail.membersEmptyHint":"Invite a teammate and they will appear on this roster.","team.detail.envsEmptyTitle":"No environments yet","team.detail.envsEmptyHint":"Register a machine to this team with the command below.","team.detail.copyCommand":"Copy command","team.detail.unlink":"Unlink","team.detail.unlinkConfirm":"Unlink this environment from the team? It will revert to personal scope.","team.detail.unlinkFailed":"Failed to unlink environment","team.detail.loadEnvsFailed":"Failed to load environments","team.detail.registerHint":"Register a machine to this team","team.detail.linkHint":"Link an existing personal environment","team.detail.linkSelect":"Select environment...","team.detail.link":"Link","team.detail.linkFailed":"Failed to link environment","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","invitation.expires":"expires {date}","invitation.emptyTitle":"No invitations yet","invitation.emptyHint":"Create an invite link and send it to a teammate.","invitation.addFailed":"Failed to add user","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dashboard.emptySessionsTitle":"No sessions yet","dashboard.emptySessionsHint":"Start one from “+ New Session”, or wait for a worker to report in.","dashboard.emptyEnvironmentsTitle":"No environments yet","dashboard.emptyEnvironmentsHint":"An environment lands on this wire once a worker registers over RCS.","dashboard.emptyMarker":"No records","dashboard.envOwner":"Created by","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.closedSendBlocked":"Session is archived — message was not sent","session.sendFailed":"Failed to send message","session.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","session.sseReconnecting":"Live connection lost — reconnecting… (messages may be delayed)","session.sseFailed":"Live connection failed — refresh the page to recover","user.settings.language":"Language","dashboard.searchAction":"Search sessions","dashboard.searchPlaceholder":"Search across all sessions…","dashboard.searchNoResults":"No matching sessions","dashboard.closeSearch":"Close search","user.settings.notifications":"Browser notifications","user.settings.notificationsDesc":"Notify when a session needs approval or completes a turn (only while the page is in the background)","user.settings.notificationsDenied":"Notification permission denied — allow it in your browser settings","user.settings.notificationsUnsupported":"Notifications unavailable in this context (HTTPS or localhost required)","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","memories.title":"Memories","memories.subtitle":"Team-shared and personal long-term memories, injected into agent sessions","memories.new":"New Memory","memories.empty":"No memories yet. Create one manually, or let agent sessions distill them.","memories.loadFailed":"Failed to load memories","memories.delete":"Delete","memories.deleteFailed":"Delete failed","memories.edit":"Edit","memories.update":"Save update","memories.updateFailed":"Update failed","memories.create.title":"New Memory","memories.editMemory":"Edit Memory","memories.create.name":"Name","memories.create.namePlaceholder":'Short title, e.g. "Release process"',"memories.create.description":"One-line description","memories.create.descriptionPlaceholder":"Summary line used in the injection index","memories.create.type":"Type","memories.create.content":"Content","memories.create.contentPlaceholder":"Memory body (Markdown)…","memories.create.scope":"Scope","memories.create.scope.personal":"Personal","memories.create.scope.team":"Team","memories.create.teamRequired":"Pick a team","memories.create.failed":"Create failed","memories.type.user":"User","memories.type.feedback":"Feedback","memories.type.project":"Project","memories.type.reference":"Reference","memories.scope.personal":"Personal","memories.scope.team":"Team","memories.session":"Source session","memories.updatedAt":"Updated","memories.promote":"Promote to team","memories.promoteFailed":"Promote failed","memories.promoteTeamRequired":"Pick a target team","memorySidebar.title":"Memory","memorySidebar.memoriesTab":"Memories","memorySidebar.governanceTab":"Governance","memorySidebar.loadFailed":"Failed to load","memorySidebar.empty":"No memories yet. They accumulate from agent sessions, or edit here manually.","memorySidebar.updateFailed":"Save failed","memorySidebar.deleteFailed":"Delete failed","memorySidebar.promoteFailed":"Promote failed","memorySidebar.edit":"Edit","memorySidebar.save":"Save","memorySidebar.cancel":"Cancel","memorySidebar.delete":"Delete","memorySidebar.promote":"Promote to team","memorySidebar.personal":"Personal","memorySidebar.team":"Team","memorySidebar.searchPlaceholder":"Regex search…","memorySidebar.searchHint":"Match memory file names and content by regex (invalid regex falls back to plain text)","memorySidebar.noResults":"No matching memories","memorySidebar.recallTitle":"Agent's recall this turn","memorySidebar.recallQuery":"Query","memorySidebar.recallTest.title":"Recall test","memorySidebar.recallTest.hint":"Type a sentence to preview which memories the agent would recall, using the same multi-path engine as its per-turn retrieval","memorySidebar.recallTest.placeholder":"Simulate a user message…","memorySidebar.recallTest.run":"Test","memorySidebar.recallTest.running":"Testing…","memorySidebar.recallTest.noResults":"No recall hits","memorySidebar.saModeBanner":"SA mode: memory automation is off (the agent has no memory prompt)","memorySidebar.poorModeBanner":"Poor mode: recall prefetch and auto-consolidation are off","memorySidebar.dream":"Consolidate (dream)","memorySidebar.dreaming":"Consolidating…","memorySidebar.dreamDisabled":"Dream is unavailable in this mode","memorySidebar.layers":"Layers","memorySidebar.health":"Health","memorySidebar.total":"Total","memorySidebar.capacity":"Capacity","memorySidebar.avgConfidence":"Avg confidence","memorySidebar.alerts":"Alerts","memorySidebar.conflicts":"Pending conflicts","memorySidebar.new":"New memory","memorySidebar.create.name":"Name","memorySidebar.create.namePlaceholder":"e.g. deploy-workflow","memorySidebar.create.description":"Description","memorySidebar.create.descriptionPlaceholder":"One-line summary (drives recall relevance)","memorySidebar.create.type":"Type","memorySidebar.create.content":"Content","memorySidebar.create.contentPlaceholder":"Memory body. For feedback/project types, structure as: rule, then **Why:** and **How to apply:** lines","memorySidebar.createFailed":"Create failed","memorySidebar.teamHint":"Team memories are shared across every session in this project directory","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.editArtifact":"Edit Artifact","artifacts.edit":"Edit","artifacts.update":"Save update","artifacts.updateFailed":"Update failed","artifacts.linkNotice":"Anyone with the link can view","artifacts.create.contentRequired":"Content is required","artifacts.create.ttl":"Lifetime","artifacts.create.ttlResetNote":"Saving resets the expiry from the chosen lifetime","artifacts.create.preview":"Live preview","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.aiUpdate":"AI update","artifacts.edit.mode.html":"Edit HTML","artifacts.edit.mode.ai":"AI update","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","artifacts.create.ai.model":"Model slot","artifacts.create.ai.modelCurrent":"current","artifacts.create.ai.modelHint":"Picking a non-current model switches the target session before dispatching the brief","artifacts.update.ai.briefPlaceholder":"e.g. append this week’s data and extend the trend chart to the latest week…","artifacts.update.ai.briefRequired":"Describe the update you need","artifacts.update.ai.sent":"Update request sent. The new version will replace this artifact in place — the link stays the same.","artifacts.update.ai.inPlace":"In-place update: link stays stable, version bumps","artifacts.update.ai.sessionHint":"Defaults to the session this artifact belongs to; you can pick another one","artifacts.ai.archify":"Archify diagram template","artifacts.ai.archifyDesc":"Architecture / workflow / sequence / dataflow / lifecycle — authored and validated by the archify skill, then uploaded as an artifact","artifacts.ai.archifyHint":"When on, the agent in the target session runs the archify skill: it authors a JSON spec, validates it (showcase quality, zero warnings), renders a self-contained interactive page, and uploads it. If the archify runtime is missing, the agent reports that and falls back to a hand-authored page.","artifacts.ai.archifyBriefPlaceholder":"e.g. an architecture diagram — the request path through gateway → auth → service → cache / database…","artifacts.view.liveUpdated":"Auto-updated","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions","permission.title":"Permission Request","permission.required":"Permission Required","permission.approve":"Approve","permission.alwaysAllow":"Always allow","permission.alwaysAllowHint":"Allow and remember rule: {rule}","permission.reject":"Reject","dashboard.searching":"Searching…","dashboard.nMatches":"{n} matches","dashboard.nameMatch":"Title/ID match","session.mode.title":"Permission mode (Shift+Tab to cycle)","session.mode.default":"Default","session.mode.defaultDesc":"Approve permission requests manually","session.mode.acceptEdits":"Auto-accept edits","session.mode.acceptEditsDesc":"Automatically allow file edits","session.mode.plan":"Plan mode","session.mode.planDesc":"Plan only — no tool execution","session.mode.bypass":"Bypass permissions","session.mode.bypassDesc":"Skip all permission checks","session.mode.switchFailedRequest":"Failed to send mode switch request: {message}","session.mode.switchFailed":"Failed to switch mode","session.thinking.title":"Thinking budget","session.thinking.off":"Thinking off","session.thinking.offDesc":"No extended thinking","session.thinking.on":"Default thinking","session.thinking.onDesc":"On with the default budget","session.thinking.fallback":"Thinking","session.thinking.failedRequest":"Failed to send thinking budget request: {message}","session.thinking.failed":"Failed to switch thinking budget","session.effort.title":"Effort level","session.effort.auto":"Auto","session.effort.autoDesc":"Use the model default effort","session.effort.lowDesc":"Low reasoning effort","session.effort.mediumDesc":"Medium reasoning effort","session.effort.highDesc":"High reasoning effort","session.effort.xhighDesc":"Very high reasoning effort","session.effort.maxDesc":"Maximum reasoning effort","session.effort.fallback":"Auto","session.effort.failedRequest":"Failed to send effort request: {message}","session.effort.failed":"Failed to switch effort","session.tokenMode.title":"Token saving mode","session.tokenMode.normal":"Normal","session.tokenMode.normalDesc":"Full tool set and background services","session.tokenMode.poor":"poor","session.tokenMode.poorDesc":"Disables extract_memories, prompt suggestions, and other background spend","session.tokenMode.sa":"sa","session.tokenMode.saDesc":"Minimal harness: trimmed system prompt and small tool set (superset of poor)","session.tokenMode.fallback":"Normal","session.tokenMode.failedRequest":"Failed to send token mode request: {message}","session.tokenMode.failed":"Failed to switch token mode","session.model.title":"Select model","session.context.tooltip":"Context usage: {used} / {max} tokens","session.context.deferredSuffix":" (deferred)","session.resume.title":"Resume conversation","session.resume.currentBlocked":"Cannot resume the current session itself","session.resume.restoring":'Restoring "{title}"…',"session.resume.restored":"Restored {count} messages","session.resume.restoredWithTitle":"Restored {count} messages: {title}","session.resume.failed":"Resume failed: {message}","session.resume.unsupported":"This worker does not support /resume (requires a spawn-mode worker: slz rc)","session.resumeInNew":"Continue this conversation in a new session (/resume)","session.createFailedWithReason":"Failed to create session: {message}","session.rewind.confirmEdit":"Rewind to this message and edit?","session.rewind.confirm":"Rewind to this message?","session.rewind.confirmBody":"The later conversation will be removed; modified files will be restored to their state at that point (if a snapshot exists).","session.rewind.failed":"Rewind failed: {message}","session.rename.title":"Rename session","session.rename.failed":"Rename failed","session.sideQuestion.title":"Side question — ask about the session context without entering the main conversation","session.search.title":"Search conversation","session.mcp.title":"MCP servers","session.settings.title":"Session settings","session.search.placeholder":"Search conversation…","session.search.noResults":"No results","session.stopTask.failed":"Failed to stop task","settings.unset":"(not set)","settings.loadFailed":"Failed to load settings — worker may not support it","settings.writeFailed":"Write failed","settings.loading":"Loading settings…","settings.model":"Model","settings.defaultModel":"(default)","settings.hint":"Boolean toggles write to the session flag layer (apply_flag_settings); click read-only items for details.","settings.back":"Back to settings","settings.copied":"Copied","settings.copyValue":"Copy value","settings.searchPlaceholder":"Search settings…","settings.noMatch":"No matching settings","settings.togglable":"Editable ({n})","settings.readOnly":"Read-only ({n})","settings.turnOff":"Turn off (writes false)","settings.turnOn":"Turn on (writes true)","settings.viewDetail":"View details","settings.memorySection":"Memory","settings.autoMemory":"Auto-memory","settings.teamMemory":"Team memory","settings.memoryHint":"Team memory adds a Team tab to the session memory sidebar (shared team/ subtree). Toggles apply to this session; persist by setting teamMemoryEnabled in settings.json.","mcp.status.connected":"Connected","mcp.status.failed":"Failed","mcp.status.needsAuth":"Needs auth","mcp.status.pending":"Connecting","mcp.status.disabled":"Disabled","mcp.loadFailed":"Failed to load MCP status — worker may not support it","mcp.toggleFailed":"Toggle failed","mcp.reconnectFailed":"Reconnect failed","mcp.loading":"Loading MCP status…","mcp.empty":"No MCP servers configured","mcp.toolCount":"{n} tools","mcp.reconnect":"Reconnect","mcp.enable":"Enable","mcp.disable":"Disable","resume.loading":"Loading local sessions…","resume.empty":"No resumable conversations","resume.today":"Today","resume.yesterday":"Yesterday","resume.earlier":"Earlier","sideQuestion.title":"Side question","sideQuestion.desc":'Ask about the current session context without entering the main conversation or consuming session history — good for a quick "what did this session do" check.',"sideQuestion.empty":"No questions yet. Type your question below.","sideQuestion.noAnswer":"No answer received (timeout or worker unsupported)","sideQuestion.placeholder":"Ask something…","sideQuestion.send":"Ask (Enter)","elicitation.title":"MCP input request","elicitation.required":"Required","elicitation.submit":"Submit","elicitation.decline":"Decline","elicitation.done":"Done","subagent.stop":"Stop this task","task.endConfirm":"End the worker session? The in-flight turn will be aborted and the session archived.","task.endHint":"Tells the worker to abort the in-flight turn, exit, and archive the session","task.backgroundTasks":"Background tasks","task.noBackgroundTasks":"No background tasks","task.runningCount":"{count} running","task.recentCount":"{count} recent","task.mixedCount":"{running} running · {recent} recent","task.type.teammates":"Agents","task.type.shells":"Shells","task.type.monitors":"Monitors","task.type.remoteAgents":"Remote agents","task.type.localAgents":"Local agents","task.type.tasks":"Tasks","permission.writeUnknown":"Pending write","permission.requestAria":"Permission request: {tool}","user.settings.notificationsOn":"On","user.settings.notificationsOff":"Off","artifacts.create.markdownPlaceholder":`# Weekly report
216
216
 
217
217
  - Progress…
218
- - Risks…`,"cmd.desc.compact":"Compact the context","cmd.desc.cost":"View session cost","cmd.desc.summary":"Generate a session summary","cmd.desc.files":"List files tracked by the session","cmd.desc.clear":"Clear the conversation","cmd.desc.new":"Start a new session","cmd.desc.help":"Show this help","cmd.desc.status":"Show session status","cmd.desc.model":"View or switch models","cmd.desc.copy":"Copy the last assistant message","cmd.desc.resume":"Resume a past conversation into this session","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[session id]","cmd.desc.agentFallback":"agent command","cmd.subtitle.help":"Available commands","cmd.subtitle.status":"Session status","cmd.subtitle.model":"View or switch models","cmd.subtitle.copy":"Copy the assistant message to the clipboard","cmd.subtitle.resume":"Pick and resume a past conversation","cmd.help.localHeader":"**Local commands** (executed by the Web UI)","cmd.help.agentHeader":"**Agent commands** (sent to the Saluzi agent)","cmd.status.header":"**Session status**","cmd.status.sessionId":"Session ID","cmd.status.none":"none","cmd.status.currentModel":"Current model","cmd.status.unset":"not set","cmd.status.modelCount":"Available models","cmd.status.imageSupport":"Image support","cmd.status.yes":"yes","cmd.status.no":"no","cmd.status.messageCount":"Messages","cmd.model.none":"The agent does not expose model selection.","cmd.model.available":"**Available models**","cmd.model.hint":"Use `/model <id>` to switch models.","cmd.model.switched":"Requested switch to model: `{id}`","cmd.model.switchFailed":"Failed to switch model: {message}","cmd.copy.failed":"Copy failed: clipboard unavailable","cmd.copy.copied":"Copied {n} characters to the clipboard","cmd.copy.nothing":"No assistant message to copy","notify.permission.title":"Approval needed","notify.permission.body":"{session} — the agent is waiting for approval","notify.turnComplete.title":"Turn complete","notify.turnComplete.body":"{session} — the agent finished the current turn","adapter.workerCrashed":"Worker process exited unexpectedly","adapter.stopTimeout":"Stop request timed out","adapter.stopFailed":"Stop request failed","adapter.requestTimeout":"Request timed out","attach.emptyFile":"(empty file)","attach.emptyDirectory":"(empty directory)","attach.directoryHeader":"📁 Directory: {name}","attach.fileCount":"({n} files)","attach.readFailed":"(failed to read)","attach.tooLarge":"(file too large, skipped)","attach.imageFile":"(image file, {size})","attach.binaryFile":"(binary file, {size})","attach.dumpHeader":"# Directory: {name}","attach.dumpCount":"{n} files total","attach.structure":"## File structure","attach.contents":"## File contents","acp.sessions":"Sessions","acp.newSession":"New session","acp.confirmDelete":'Delete session "{label}"? This cannot be undone.',"acp.emptySessions":"No sessions","acp.historyNav":"Session history","acp.confirm":"Confirm","acp.noSessionManagement":"This agent does not support session management (rename/delete)","acp.rename":"Rename","acp.renameUnsupported":"This agent does not support session rename","acp.delete":"Delete","acp.deleteUnsupported":"This agent does not support session deletion","acp.mode.default":"Default","acp.mode.defaultDesc":"Approve permission requests manually","acp.mode.acceptEdits":"Auto-accept edits","acp.mode.acceptEditsDesc":"Automatically allow file edits","acp.mode.bypass":"Bypass permissions","acp.mode.bypassDesc":"Skip all permission checks","acp.mode.plan":"Plan mode","acp.mode.planDesc":"Plan only — no tool execution","acp.mode.dontAsk":"Don’t ask","acp.mode.dontAskDesc":"No prompts — reject automatically","acp.mode.auto":"Auto decide","acp.mode.autoDesc":"The AI decides whether to approve","acp.emptyDescription":"Type a message to start chatting with the ACP agent","acp.inputPlaceholder":"Message Saluzi…","acp.waitingPlaceholder":"Waiting for session...","chat.fileMatchHint":"File matches {query} — ↑↓ to select, Enter to insert","chat.picker.image":"Images","chat.picker.textFile":"Text files","chat.picker.sheet":"Spreadsheets","chat.picker.directory":"Directories","chat.commandList":"Command list","chat.processingFile":"Processing files…","chat.queued":"{n} messages queued — sent automatically when the turn completes","chat.queuedCancel":" (click to cancel all)","chat.inputHint":"Enter to send, Shift+Enter for a new line","chat.inputHintSuffix":", / for commands, @ completes file paths","chat.fileCount":"{n} files","chat.directory":"Directory","chat.noCommands":"No matching commands","chat.cmdDone":"Command executed · type a message to continue","chat.live.working":"Working","chat.live.running":"Running","plan.title":"Plan","plan.priority.high":"High","plan.priority.medium":"Medium","plan.priority.low":"Low","tool.newFile":"New file","tool.callTimes":"{name} ×{n}","tool.summaryCalls":"{n} tool calls","tool.summaryTools":"{n} tools: {names}","usage.context":"Context: {used} / {size} tokens","usage.totalCost":"Total cost: {cost}","diff.aria":"Diff preview for {path}, {added} additions, {removed} deletions","diff.hidden":"… {n} more lines hidden","diff.addedLine":"Added line: {text}","diff.removedLine":"Removed line: {text}","common.emptyTitle":"No messages yet","common.emptyDescription":"Start a conversation to see messages here","message.rewindHere":"Rewind here (conversation and files)","message.rewindEdit":"Rewind and edit this message","message.expand":"Expand"},sl="rcs_locale";function Lh(){try{const t=localStorage.getItem(sl);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Ls=Lh();const Yr=new Set;function fv(e){Ls=e;try{localStorage.setItem(sl,e)}catch{}Yr.forEach(t=>t())}function Fh(e){return Yr.add(e),()=>{Yr.delete(e)}}function nn(){return p.useSyncExternalStore(Fh,()=>Ls)}function G(e){return Ls==="en"?Oh[e]??Io[e]??e:Io[e]??e}function Se(e,t){let n=G(e);for(const[r,s]of Object.entries(t))n=n.split(`{${r}}`).join(String(s));return n}function $h({className:e}){return d.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:Z("text-brand-mark",e),children:d.jsx("path",{d:"M7.8 1.6H12.2L12.4 7.6L18.4 7.8V12.2L12.4 12.4L12.2 18.4H7.8L7.6 12.4L1.6 12.2V7.8L7.6 7.6ZM10 7.4L12.6 10L10 12.6L7.4 10Z",fill:"currentColor",fillRule:"evenodd"})})}const Uh="";let Yn=null;function zh(e){Yn=e}function mv(){return Yn}let Xr=null;function Do(e){Xr=e}let an=null;async function Hh(){return an||(an=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{an=null}})(),an)}class _r extends Error{constructor(n,r,s){super(n);se(this,"type");se(this,"status");this.name="ApiError",this.type=r,this.status=s}}async function ae(e,t,n,r){const s={"Content-Type":"application/json"};Yn&&(s.Authorization=`Bearer ${Yn}`);const o=`${Uh}${t}`,a={method:e,headers:s,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(o,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!r&&await Hh())return ae(e,t,n,!0);Xr&&Xr()}let m;try{m=await i.json()}catch{throw i.ok?new _r("Invalid JSON response","parse_error",i.status):new _r(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new _r(c,l,i.status)}return m}function pv(){return ae("GET","/web/sessions")}function hv(){return ae("GET","/web/sessions/all")}function gv(e){return ae("GET",`/web/sessions/${e}`)}function bv(e){return ae("GET",`/web/sessions/${e}/history`)}function xv(e){return ae("GET",`/web/sessions/${e}/models`)}function yv(){return ae("GET","/web/environments")}function vv(e,t=20){const n=encodeURIComponent(e);return ae("GET",`/web/search?q=${n}&limit=${t}`)}function wv(e,t){return ae("POST",`/web/sessions/${e}/events`,t)}function Sv(e,t){return ae("POST",`/web/sessions/${e}/rewind`,{target_event_id:t})}function Cv(e,t){return ae("POST",`/web/sessions/${e}/control`,t)}function kv(e){return ae("POST",`/web/sessions/${e}/interrupt`)}function Ev(e){return ae("DELETE",`/web/sessions/${e}`)}function Av(e){return ae("POST",`/web/sessions/${e}/clear`)}function Tv(e,t){return ae("PATCH",`/web/sessions/${e}`,{title:t})}function _v(e){return ae("POST","/web/sessions",e)}function Rv(e){return ae("GET",`/web/sessions/s/${e}`)}function Mv(e){return ae("GET",`/web/sessions/${e}/shares`)}function Nv(e,t){return ae("POST",`/web/sessions/${e}/shares`,t)}function jv(e,t){return ae("DELETE",`/web/sessions/${e}/shares/${t}`)}function Pv(e,t){return ae("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Iv(e,t){return ae("DELETE",`/web/teams/${e}/environments/${t}`)}function Dv(e){return ae("POST","/web/environments/claim",{claim_token:e})}function Ov(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),r=n?`?${n}`:"";return ae("GET",`/web/artifacts${r}`)}function Lv(e){return ae("GET",`/web/artifacts/${e}`)}function Fv(e){return ae("POST","/web/artifacts",e)}function $v(e){return ae("DELETE",`/web/artifacts/${e}`)}function Uv(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope),e!=null&&e.type&&t.set("type",e.type);const n=t.toString(),r=n?`?${n}`:"";return ae("GET",`/web/memories${r}`)}function zv(e){return ae("GET",`/web/memories/${e}`)}function Hv(e){return ae("POST","/web/memories",e)}function Bv(e,t){return ae("PATCH",`/web/memories/${e}`,t)}function Wv(e){return ae("DELETE",`/web/memories/${e}`)}function Gv(e,t){return ae("POST",`/web/memories/${e}/promote`,{team_id:t})}function Vv(){return ae("GET","/web/memory/status")}function qv(e){const t=e?`?scope=${e}`:"";return ae("GET",`/web/memory/list${t}`)}function Kv(e){return ae("GET",`/web/memory/file?path=${encodeURIComponent(e)}`)}function Yv(e,t){return ae("PUT","/web/memory/file",{path:e,content:t})}function Xv(e){return ae("DELETE",`/web/memory/file?path=${encodeURIComponent(e)}`)}function Qv(e){return ae("POST","/web/memory/promote",{path:e})}function Jv(e){return ae("POST","/web/memory/create",e)}function Zv(e){return ae("GET",`/web/memory/search?q=${encodeURIComponent(e)}`)}function ew(e,t){const n=new URLSearchParams;return n.set("q",e),n.set("top_k",String(t)),ae("GET",`/web/memory/recall-test?${n.toString()}`)}function tw(){return ae("GET","/web/memory/governance")}const Qr="rcs_active_team",Jr="__all_teams__";function Bh(e){return e===Jr}function Wh(){try{return localStorage.getItem(Qr)}catch{return null}}let ol=Wh();const Zr=new Set;function Gh(){for(const e of Zr)e()}function Vh(e){return Zr.add(e),()=>Zr.delete(e)}function qh(){return ol}function Tt(e){try{e?localStorage.setItem(Qr,e):localStorage.removeItem(Qr)}catch{}ol=e,Gh()}let In=null;function Kh(){return In||(In=ae("GET","/web/teams").finally(()=>{In=null})),In}function Yh(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),s=p.useSyncExternalStore(Vh,qh,()=>null),o=p.useCallback(async()=>{r(!0);try{const l=await Kh();t(l)}catch{t([])}finally{r(!1)}},[]);p.useEffect(()=>{o()},[o]);const a=e.find(l=>l.id===s)||null,i=Bh(s),m=p.useCallback(l=>{Tt(l)},[]),f=p.useCallback(async l=>{const c=await ae("POST","/web/teams",l);return await o(),c},[o]);return{myTeams:e,activeTeam:a,activeTeamId:s,isAllTeams:i,isLoading:n,switchTeam:m,createTeam:f,refetch:o}}function Xh({className:e}){nn();const{myTeams:t,activeTeam:n,isAllTeams:r,switchTeam:s,isLoading:o}=Yh();return o||t.length===0?null:d.jsxs("div",{className:Z("group relative min-w-0",e),children:[d.jsxs("select",{"aria-label":G("team.switcher.label"),className:"max-w-[7.5rem] cursor-pointer appearance-none truncate rounded-md bg-transparent py-1.5 pl-2 pr-6 text-sm text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1 sm:max-w-[11rem] sm:pl-3",value:r?Jr:(n==null?void 0:n.id)||"",onChange:a=>{const i=a.target.value;s(i||null)},children:[d.jsx("option",{value:Jr,children:G("team.switcher.all")}),d.jsx("option",{value:"",children:G("team.switcher.personal")}),t.map(a=>d.jsx("option",{value:a.id,children:a.name},a.id))]}),d.jsx(Qd,{className:"pointer-events-none absolute right-1.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-text-muted transition-colors group-hover:text-text-primary"})]})}const al=p.createContext(null);function il(){const e=p.useContext(al);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function zt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function Qh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function Jh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).singleUser===!0:!1}catch{return!1}}async function Dn(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function Zh({children:e}){const[t,n]=p.useState(null),[r,s]=p.useState(!0),[o,a]=p.useState(!0),[i,m]=p.useState(!1);p.useEffect(()=>{let w=!1;return zt().then(y=>{w||(n(y),s(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(y=>y.json()).then(y=>{w||a(y.allowed===!0)}).catch(()=>{}),Jh().then(y=>{w||m(y)}),Do(()=>{n(null),Tt(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{w=!0,Do(null)}},[]);const f=p.useCallback(async(w,y)=>{const T=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:y})});if(!T.ok){const k=await Dn(T);throw new Error(k.error||"Login failed")}const A=await zt();n(A),Tt(null)},[]),l=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Tt(null)},[]),c=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const y=await zt();return n(y),!0}catch{return!1}},[]),u=p.useCallback(async(w,y,T)=>{const A=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:w,username:y,password:T})});if(!A.ok){const O=await Dn(A);throw new Error(O.error||"Setup failed")}const k=await zt();n(k),Tt(null)},[]),h=p.useCallback(async(w,y,T)=>{const A=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:w,username:y,password:T})});if(!A.ok){const O=await Dn(A);throw new Error(O.error||"Join failed")}const k=await zt();n(k),Tt(null)},[]),b=p.useCallback(async(w,y)=>{const T=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:y})});if(!T.ok){const k=await Dn(T);throw new Error(k.error||"Registration failed")}const A=await zt();n(A),Tt(null)},[]),v=p.useCallback(async()=>Qh(),[]);return d.jsx(al.Provider,{value:{user:t,isLoading:r,login:f,logout:l,refresh:c,setup:u,join:h,register:b,checkSetupStatus:v,registrationAllowed:o,singleUserMode:i},children:e})}function eg({onSettingsClick:e}){const{user:t,logout:n}=il();if(!t)return null;const r=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return d.jsxs(tl,{children:[d.jsx(nl,{asChild:!0,children:d.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",title:t.username,children:[d.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand-text",children:d.jsx(Oa,{className:"h-3.5 w-3.5"})}),d.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),d.jsxs(rl,{align:"end",className:"w-48",children:[d.jsx(Ph,{children:d.jsxs("div",{className:"flex flex-col space-y-0.5",children:[d.jsx("span",{className:"text-sm font-medium",children:t.username}),d.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),d.jsx(Po,{}),d.jsxs(Ln,{onClick:e,children:[d.jsx(Pu,{className:"mr-2 h-4 w-4"}),G("user.menu.settings")]}),d.jsxs(Ln,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[d.jsx(qu,{className:"mr-2 h-4 w-4"}),G("team.menu.myTeams")]}),d.jsx(Po,{}),d.jsxs(Ln,{onClick:r,children:[d.jsx(pu,{className:"mr-2 h-4 w-4"}),G("user.menu.logout")]})]})]})}function tg({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:r,onNavigateArtifacts:s,onNavigateMemories:o}){return nn(),d.jsx("nav",{className:"sticky top-0 z-40 border-b border-nav-rule bg-surface-1/80 backdrop-blur-md",children:d.jsxs("div",{className:e?"mx-auto page-measure flex h-11 sm:h-12 items-center justify-between px-4 sm:px-8":"ds-nav-bleed flex h-11 sm:h-12 items-center justify-between",children:[d.jsx("div",{className:"ds-nav-brand flex items-center gap-2 min-w-0",children:e?d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[d.jsx(Kd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("nav.dashboard")})]}),d.jsx("span",{className:"text-text-muted/40",children:"/"}),d.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&d.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand-text flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[d.jsx($h,{className:"h-5 w-5 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:G("nav.remoteControl")})]}),d.jsx(Xh,{className:"ml-1 sm:ml-2"})]})}),d.jsxs("div",{className:"ds-nav-actions flex items-center gap-0.5 sm:gap-1",children:[!e&&d.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:G("nav.dashboard"),children:[d.jsx(uu,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("nav.dashboard")})]}),s&&d.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("artifacts.title"),children:[d.jsx(ou,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("artifacts.title")})]}),o&&d.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("memories.title"),children:[d.jsx(_a,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("memories.title")})]}),d.jsx(Dh,{}),d.jsx(eg,{onSettingsClick:r??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}const ng={running:{pill:"bg-status-running/15 text-status-running font-medium",dot:"bg-status-running pulse-dot"},active:{pill:"bg-status-active/15 text-status-active",dot:"bg-status-active"},idle:{pill:"bg-surface-2 text-text-muted"},requires_action:{pill:"bg-status-warning/15 text-status-warning",dot:"bg-status-warning"},error:{pill:"bg-status-error/15 text-status-error",dot:"bg-status-error"},inactive:{pill:"bg-surface-3 text-text-muted"},archived:{pill:"bg-surface-3 text-text-muted"}};function nw({status:e}){const t=ng[e];return d.jsxs("span",{className:Z("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs",t?t.pill:"bg-surface-3 text-text-secondary"),children:[(t==null?void 0:t.dot)&&d.jsx("span",{className:Z("h-1.5 w-1.5 rounded-full",t.dot)}),e]})}function rg(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class ll extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ht=class ht{constructor(t){se(this,"ws",null);se(this,"settings");se(this,"connectionState","disconnected");se(this,"sessionId",null);se(this,"_agentCapabilities",null);se(this,"_promptCapabilities",null);se(this,"_modelState",null);se(this,"_availableCommands",[]);se(this,"_usage",null);se(this,"_currentModeId",null);se(this,"_configOptions",[]);se(this,"onModelChanged",new Set);se(this,"onModelStateChanged",new Set);se(this,"onUsageChanged",new Set);se(this,"onCurrentModeChanged",new Set);se(this,"onConfigOptionsChanged",new Set);se(this,"onAvailableCommandsChanged",null);se(this,"onSessionLoaded",null);se(this,"onSessionSwitching",null);se(this,"onConnectionStateChange",new Set);se(this,"onSessionUpdate",null);se(this,"onSessionCreated",null);se(this,"onPromptComplete",null);se(this,"onPermissionRequest",null);se(this,"onBrowserToolCall",null);se(this,"onErrorMessage",null);se(this,"onSessionDeleted",null);se(this,"onSessionRenamed",null);se(this,"pendingSessionList",null);se(this,"pendingSessionLoad",null);se(this,"pendingSessionResume",null);se(this,"pendingSessionTarget",null);se(this,"connectResolve",null);se(this,"connectReject",null);se(this,"heartbeatInterval",null);se(this,"heartbeatTimeout",null);se(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,s;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((s=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:s.resume)!==null}get supportsSessionList(){var t,n,r,s;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((s=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:s.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const r=new WebSocket(this.settings.proxyUrl,this.settings.token?[rg(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=s=>{if(this.ws===r)try{const o=JSON.parse(s.data);this.handleResponse(o)}catch(o){console.error("[ACPClient] Failed to parse message:",o)}},r.onerror=()=>{var s;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(s=this.connectReject)==null||s.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=s=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",s.code,s.reason),this.connectReject){const o=s.reason||`Connection closed (code: ${s.code})`;this.setState("error",o),this.connectReject(new Error(o)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,s,o,a,i,m,f,l,c,u,h,b;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(s=this.onErrorMessage)==null||s.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(o=this.onSessionCreated)==null||o.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const w=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",w,"payload:",t.payload),w==="available_commands_update")this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(w==="usage_update"){this._usage=t.payload.update;for(const y of this.onUsageChanged)y(this._usage)}else if(w==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const y of this.onCurrentModeChanged)y(this._currentModeId)}else if(w==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const y of this.onConfigOptionsChanged)y(this._configOptions)}(u=this.onSessionUpdate)==null||u.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(b=this.onPermissionRequest)==null||b.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const y of this.onModelChanged)y(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=ht.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},ht.PONG_TIMEOUT_MS)},ht.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,r)=>{const s=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:s};try{this.send({type:"list_sessions",payload:t})}catch(o){clearTimeout(s),this.pendingSessionList=null,r(o)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const s=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:s};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(s),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const s=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:s};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(s),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new ll),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};se(ht,"HEARTBEAT_INTERVAL_MS",3e4),se(ht,"PONG_TIMEOUT_MS",1e4),se(ht,"MAX_MISSED_PONGS",2);let es=ht;function sg(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function cl(e,t){return new Promise((function(n,r){let s;return og(e).then((function(o){try{return s=o,n(new Blob([t.slice(0,2),s,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const og=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let a=0;if(o.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=o.getUint16(a);if(i===65498)break;const m=o.getUint16(a+2);if(i===65505&&o.getUint32(a+4)===1165519206){const f=a+10;let l;switch(o.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=o.getUint32(f+4,l),u=f+c+2+12*o.getUint16(f+c,l);for(let h=f+c+2;h<u;h+=12)if(o.getUint16(h,l)==274){if(o.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(o.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");o.setUint16(h+8,1,l);break}return t(s.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),r.readAsArrayBuffer(e)}));var Xn={},ag={get exports(){return Xn},set exports(e){Xn=e}};(function(e){var t,n,r={};ag.exports=r,r.parse=function(s,o){for(var a=r.bin.readUshort,i=r.bin.readUint,m=0,f={},l=new Uint8Array(s),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var u=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),b=i(l,m+=4);m+=4,m=b;for(var v=0;v<u;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var w=i(l,m+=4),y=a(l,m+=4),T=a(l,m+2),A=a(l,m+4);m+=6;var k=i(l,m+=8);m+=4,m+=y+T+A,r._readLocal(l,k,f,h,w,o)}return f},r._readLocal=function(s,o,a,i,m,f){var l=r.bin.readUshort,c=r.bin.readUint;c(s,o),l(s,o+=4),l(s,o+=2);var u=l(s,o+=2);c(s,o+=2),c(s,o+=4),o+=4;var h=l(s,o+=8),b=l(s,o+=2);o+=2;var v=r.bin.readUTF8(s,o,h);if(o+=h,o+=b,f)a[v]={size:m,csize:i};else{var w=new Uint8Array(s.buffer,o);if(u==0)a[v]=new Uint8Array(w.buffer.slice(o,o+i));else{if(u!=8)throw"unknown compression method: "+u;var y=new Uint8Array(m);r.inflateRaw(w,y),a[v]=y}}},r.inflateRaw=function(s,o){return r.F.inflate(s,o)},r.inflate=function(s,o){return s[0],s[1],r.inflateRaw(new Uint8Array(s.buffer,s.byteOffset+2,s.length-6),o)},r.deflate=function(s,o){o==null&&(o={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*s.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(s,i,a,o.level);var m=r.adler(s,0,s.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var a=new Uint8Array(50+Math.floor(1.1*s.length)),i=r.F.deflateRaw(s,a,i,o.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(s,o){o==null&&(o=!1);var a=0,i=r.bin.writeUint,m=r.bin.writeUshort,f={};for(var l in s){var c=!r._noNeed(l)&&!o,u=s[l],h=r.crc.crc(u,0,u.length);f[l]={cpr:c,usize:u.length,crc:h,file:c?r.deflateRaw(u):u}}for(var l in f)a+=f[l].file.length+30+46+2*r.bin.sizeUTF8(l);a+=22;var b=new Uint8Array(a),v=0,w=[];for(var l in f){var y=f[l];w.push(v),v=r._writeHeader(b,v,l,y,0)}var T=0,A=v;for(var l in f)y=f[l],w.push(v),v=r._writeHeader(b,v,l,y,1,w[T++]);var k=v-A;return i(b,v,101010256),v+=4,m(b,v+=4,T),m(b,v+=2,T),i(b,v+=2,k),i(b,v+=4,A),v+=4,v+=2,b.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,a,i,m,f){var l=r.bin.writeUint,c=r.bin.writeUshort,u=i.file;return l(s,o,m==0?67324752:33639248),o+=4,m==1&&(o+=2),c(s,o,20),c(s,o+=2,0),c(s,o+=2,i.cpr?8:0),l(s,o+=2,0),l(s,o+=4,i.crc),l(s,o+=4,u.length),l(s,o+=4,i.usize),c(s,o+=4,r.bin.sizeUTF8(a)),c(s,o+=2,0),o+=2,m==1&&(o+=2,o+=2,l(s,o+=6,f),o+=4),o+=r.bin.writeUTF8(s,o,a),m==0&&(s.set(u,o),o+=u.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var a=o,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;s[o]=a}return s})(),update:function(s,o,a,i){for(var m=0;m<i;m++)s=r.crc.table[255&(s^o[a+m])]^s>>>8;return s},crc:function(s,o,a){return 4294967295^r.crc.update(4294967295,s,o,a)}},r.adler=function(s,o,a){for(var i=1,m=0,f=o,l=o+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=s[f++];i%=65521,m%=65521}return m<<16|i},r.bin={readUshort:function(s,o){return s[o]|s[o+1]<<8},writeUshort:function(s,o,a){s[o]=255&a,s[o+1]=a>>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,a){s[o]=255&a,s[o+1]=a>>8&255,s[o+2]=a>>16&255,s[o+3]=a>>24&255},readASCII:function(s,o,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(s[o+m]);return i},writeASCII:function(s,o,a){for(var i=0;i<a.length;i++)s[o+i]=a.charCodeAt(i)},pad:function(s){return s.length<2?"0"+s:s},readUTF8:function(s,o,a){for(var i,m="",f=0;f<a;f++)m+="%"+r.bin.pad(s[o+f].toString(16));try{i=decodeURIComponent(m)}catch{return r.bin.readASCII(s,o,a)}return i},writeUTF8:function(s,o,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)s[o+m]=l,m++;else if((4294965248&l)==0)s[o+m]=192|l>>6,s[o+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)s[o+m]=224|l>>12,s[o+m+1]=128|l>>6&63,s[o+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";s[o+m]=240|l>>18,s[o+m+1]=128|l>>12&63,s[o+m+2]=128|l>>6&63,s[o+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(s){for(var o=s.length,a=0,i=0;i<o;i++){var m=s.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},r.F={},r.F.deflateRaw=function(s,o,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=r.F.U,l=r.F._goodIndex;r.F._hash;var c=r.F._putsE,u=0,h=a<<3,b=0,v=s.length;if(i==0){for(;u<v;)c(o,h,u+(I=Math.min(65535,v-u))==v?1:0),h=r.F._copyExact(s,u,I,o,h+8),u+=I;return h>>>3}var w=f.lits,y=f.strt,T=f.prev,A=0,k=0,O=0,E=0,_=0,g=0;for(v>2&&(y[g=r.F._hash(s,0)]=0),u=0;u<v;u++){if(_=g,u+1<v-2){g=r.F._hash(s,u+1);var x=u+1&32767;T[x]=y[g],y[g]=x}if(b<=u){(A>14e3||k>26697)&&v-u>100&&(b<u&&(w[A]=u-b,A+=2,b=u),h=r.F._writeBlock(u==v-1||b==v?1:0,w,A,E,s,O,u-O,o,h),A=k=E=0,O=u);var M=0;u<v-2&&(M=r.F._bestMatch(s,u,T,_,Math.min(m[2],v-u),m[3]));var I=M>>>16,D=65535&M;if(M!=0){D=65535&M;var F=l(I=M>>>16,f.of0);f.lhst[257+F]++;var j=l(D,f.df0);f.dhst[j]++,E+=f.exb[F]+f.dxb[j],w[A]=I<<23|u-b,w[A+1]=D<<16|F<<8|j,A+=2,b=u+I}else f.lhst[s[u]]++;k++}}for(O==u&&s.length!=0||(b<u&&(w[A]=u-b,A+=2,b=u),h=r.F._writeBlock(1,w,A,E,s,O,u-O,o,h),A=0,k=0,A=k=E=0,O=u);(7&h)!=0;)h++;return h>>>3},r.F._bestMatch=function(s,o,a,i,m,f){var l=32767&o,c=a[l],u=l-c+32768&32767;if(c==l||i!=r.F._hash(s,o-u))return 0;for(var h=0,b=0,v=Math.min(32767,o);u<=v&&--f!=0&&c!=l;){if(h==0||s[o+h]==s[o+h-u]){var w=r.F._howLong(s,o,u);if(w>h){if(b=u,(h=w)>=m)break;u+2<w&&(w=u+2);for(var y=0,T=0;T<w-2;T++){var A=o-u+T+32768&32767,k=A-a[A]+32768&32767;k>y&&(y=k,c=A)}}}u+=(l=c)-(c=a[l])+32768&32767}return h<<16|b},r.F._howLong=function(s,o,a){if(s[o]!=s[o-a]||s[o+1]!=s[o+1-a]||s[o+2]!=s[o+2-a])return 0;var i=o,m=Math.min(s.length,o+258);for(o+=3;o<m&&s[o]==s[o-a];)o++;return o-i},r.F._hash=function(s,o){return(s[o]<<8|s[o+1])+(s[o+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(s,o,a,i,m,f,l,c,u){var h,b,v,w,y,T,A,k,O,E=r.F.U,_=r.F._putsF,g=r.F._putsE;E.lhst[256]++,b=(h=r.F.getTrees())[0],v=h[1],w=h[2],y=h[3],T=h[4],A=h[5],k=h[6],O=h[7];var x=32+((u+3&7)==0?0:8-(u+3&7))+(l<<3),M=i+r.F.contSize(E.fltree,E.lhst)+r.F.contSize(E.fdtree,E.dhst),I=i+r.F.contSize(E.ltree,E.lhst)+r.F.contSize(E.dtree,E.dhst);I+=14+3*A+r.F.contSize(E.itree,E.ihst)+(2*E.ihst[16]+3*E.ihst[17]+7*E.ihst[18]);for(var D=0;D<286;D++)E.lhst[D]=0;for(D=0;D<30;D++)E.dhst[D]=0;for(D=0;D<19;D++)E.ihst[D]=0;var F=x<M&&x<I?0:M<I?1:2;if(_(c,u,s),_(c,u+1,F),u+=3,F==0){for(;(7&u)!=0;)u++;u=r.F._copyExact(m,f,l,c,u)}else{var j,z;if(F==1&&(j=E.fltree,z=E.fdtree),F==2){r.F.makeCodes(E.ltree,b),r.F.revCodes(E.ltree,b),r.F.makeCodes(E.dtree,v),r.F.revCodes(E.dtree,v),r.F.makeCodes(E.itree,w),r.F.revCodes(E.itree,w),j=E.ltree,z=E.dtree,g(c,u,y-257),g(c,u+=5,T-1),g(c,u+=5,A-4),u+=4;for(var C=0;C<A;C++)g(c,u+3*C,E.itree[1+(E.ordr[C]<<1)]);u+=3*A,u=r.F._codeTiny(k,E.itree,c,u),u=r.F._codeTiny(O,E.itree,c,u)}for(var S=f,H=0;H<a;H+=2){for(var P=o[H],U=P>>>23,Y=S+(8388607&P);S<Y;)u=r.F._writeLit(m[S++],j,c,u);if(U!=0){var N=o[H+1],L=N>>16,$=N>>8&255,R=255&N;g(c,u=r.F._writeLit(257+$,j,c,u),U-E.of0[$]),u+=E.exb[$],_(c,u=r.F._writeLit(R,z,c,u),L-E.df0[R]),u+=E.dxb[R],S+=U}}u=r.F._writeLit(256,j,c,u)}return u},r.F._copyExact=function(s,o,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(s.buffer,o,a),f),m+(a+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),a=r.F._hufTree(s.dhst,s.dtree,15),i=[],m=r.F._lenCodes(s.ltree,i),f=[],l=r.F._lenCodes(s.dtree,f),c=0;c<i.length;c+=2)s.ihst[i[c]]++;for(c=0;c<f.length;c+=2)s.ihst[f[c]]++;for(var u=r.F._hufTree(s.ihst,s.itree,7),h=19;h>4&&s.itree[1+(s.ordr[h-1]<<1)]==0;)h--;return[o,a,u,m,l,h,i,f]},r.F.getSecond=function(s){for(var o=[],a=0;a<s.length;a+=2)o.push(s[a+1]);return o},r.F.nonZero=function(s){for(var o="",a=0;a<s.length;a+=2)s[a+1]!=0&&(o+=(a>>1)+",");return o},r.F.contSize=function(s,o){for(var a=0,i=0;i<o.length;i++)a+=o[i]*s[1+(i<<1)];return a},r.F._codeTiny=function(s,o,a,i){for(var m=0;m<s.length;m+=2){var f=s[m],l=s[m+1];i=r.F._writeLit(f,o,a,i);var c=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,l,c),i+=c)}return i},r.F._lenCodes=function(s,o){for(var a=s.length;a!=2&&s[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=s[i+1],f=i+3<a?s[i+3]:-1,l=i+5<a?s[i+5]:-1,c=i==0?-1:s[i-1];if(m==0&&f==m&&l==m){for(var u=i+5;u+2<a&&s[u+2]==m;)u+=2;(h=Math.min(u+1-i>>>1,138))<11?o.push(17,h-3):o.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(u=i+5;u+2<a&&s[u+2]==m;)u+=2;var h=Math.min(u+1-i>>>1,6);o.push(16,h-3),i+=2*h-2}else o.push(m,0)}return a>>>1},r.F._hufTree=function(s,o,a){var i=[],m=s.length,f=o.length,l=0;for(l=0;l<f;l+=2)o[l]=0,o[l+1]=0;for(l=0;l<m;l++)s[l]!=0&&i.push({lit:l,f:s[l]});var c=i.length,u=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return u=h==0?1:0,o[1+(h<<1)]=1,o[1+(u<<1)]=1,1}i.sort((function(k,O){return k.f-O.f}));var b=i[0],v=i[1],w=0,y=1,T=2;for(i[0]={lit:-1,f:b.f+v.f,l:b,r:v,d:0};y!=c-1;)b=w!=y&&(T==c||i[w].f<i[T].f)?i[w++]:i[T++],v=w!=y&&(T==c||i[w].f<i[T].f)?i[w++]:i[T++],i[y++]={lit:-1,f:b.f+v.f,l:b,r:v};var A=r.F.setDepth(i[y-1],0);for(A>a&&(r.F.restrictDepth(u,a,A),A=a),l=0;l<c;l++)o[1+(u[l].lit<<1)]=u[l].d;return A},r.F.setDepth=function(s,o){return s.lit!=-1?(s.d=o,o):Math.max(r.F.setDepth(s.l,o+1),r.F.setDepth(s.r,o+1))},r.F.restrictDepth=function(s,o,a){var i=0,m=1<<a-o,f=0;for(s.sort((function(c,u){return u.d==c.d?c.f-u.f:u.d-c.d})),i=0;i<s.length&&s[i].d>o;i++){var l=s[i].d;s[i].d=o,f+=m-(1<<a-l)}for(f>>>=a-o;f>0;)(l=s[i].d)<o?(s[i].d++,f-=1<<o-l-1):i++;for(;i>=0;i--)s[i].d==o&&f<0&&(s[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var a=0;return o[16|a]<=s&&(a|=16),o[8|a]<=s&&(a|=8),o[4|a]<=s&&(a|=4),o[2|a]<=s&&(a|=2),o[1|a]<=s&&(a|=1),a},r.F._writeLit=function(s,o,a,i){return r.F._putsF(a,i,o[s<<1]),i+o[1+(s<<1)]},r.F.inflate=function(s,o){var a=Uint8Array;if(s[0]==3&&s[1]==0)return o||new a(0);var i=r.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,u=i.codes2map,h=i._get17,b=i.U,v=o==null;v&&(o=new a(s.length>>>2<<3));for(var w,y,T=0,A=0,k=0,O=0,E=0,_=0,g=0,x=0,M=0;T==0;)if(T=m(s,M,1),A=m(s,M+1,2),M+=3,A!=0){if(v&&(o=r.F._check(o,x+(1<<17))),A==1&&(w=b.flmap,y=b.fdmap,_=511,g=31),A==2){k=f(s,M,5)+257,O=f(s,M+5,5)+1,E=f(s,M+10,4)+4,M+=14;for(var I=0;I<38;I+=2)b.itree[I]=0,b.itree[I+1]=0;var D=1;for(I=0;I<E;I++){var F=f(s,M+3*I,3);b.itree[1+(b.ordr[I]<<1)]=F,F>D&&(D=F)}M+=3*E,c(b.itree,D),u(b.itree,D,b.imap),w=b.lmap,y=b.dmap,M=l(b.imap,(1<<D)-1,k+O,s,M,b.ttree);var j=i._copyOut(b.ttree,0,k,b.ltree);_=(1<<j)-1;var z=i._copyOut(b.ttree,k,O,b.dtree);g=(1<<z)-1,c(b.ltree,j),u(b.ltree,j,w),c(b.dtree,z),u(b.dtree,z,y)}for(;;){var C=w[h(s,M)&_];M+=15&C;var S=C>>>4;if(!(S>>>8))o[x++]=S;else{if(S==256)break;var H=x+S-254;if(S>264){var P=b.ldef[S-257];H=x+(P>>>3)+f(s,M,7&P),M+=7&P}var U=y[h(s,M)&g];M+=15&U;var Y=U>>>4,N=b.ddef[Y],L=(N>>>4)+m(s,M,15&N);for(M+=15&N,v&&(o=r.F._check(o,x+(1<<17)));x<H;)o[x]=o[x++-L],o[x]=o[x++-L],o[x]=o[x++-L],o[x]=o[x++-L];x=H}}}else{(7&M)!=0&&(M+=8-(7&M));var $=4+(M>>>3),R=s[$-4]|s[$-3]<<8;v&&(o=r.F._check(o,x+R)),o.set(new a(s.buffer,s.byteOffset+$,R),x),M=$+R<<3,x+=R}return o.length==x?o:o.slice(0,x)},r.F._check=function(s,o){var a=s.length;if(o<=a)return s;var i=new Uint8Array(Math.max(a<<1,o));return i.set(s,0),i},r.F._decodeTiny=function(s,o,a,i,m,f){for(var l=r.F._bitsE,c=r.F._get17,u=0;u<a;){var h=s[c(i,m)&o];m+=15&h;var b=h>>>4;if(b<=15)f[u]=b,u++;else{var v=0,w=0;b==16?(w=3+l(i,m,2),m+=2,v=f[u-1]):b==17?(w=3+l(i,m,3),m+=3):b==18&&(w=11+l(i,m,7),m+=7);for(var y=u+w;u<y;)f[u]=v,u++}}return m},r.F._copyOut=function(s,o,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=s[f+o];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},r.F.makeCodes=function(s,o){for(var a,i,m,f,l=r.F.U,c=s.length,u=l.bl_count,h=0;h<=o;h++)u[h]=0;for(h=1;h<c;h+=2)u[s[h]]++;var b=l.next_code;for(a=0,u[0]=0,i=1;i<=o;i++)a=a+u[i-1]<<1,b[i]=a;for(m=0;m<c;m+=2)(f=s[m+1])!=0&&(s[m]=b[f],b[f]++)},r.F.codes2map=function(s,o,a){for(var i=s.length,m=r.F.U.rev15,f=0;f<i;f+=2)if(s[f+1]!=0)for(var l=f>>1,c=s[f+1],u=l<<4|c,h=o-c,b=s[f]<<h,v=b+(1<<h);b!=v;)a[m[b]>>>15-o]=u,b++},r.F.revCodes=function(s,o){for(var a=r.F.U.rev15,i=15-o,m=0;m<s.length;m+=2){var f=s[m]<<o-s[m+1];s[m]=a[f]>>>i}},r.F._putsE=function(s,o,a){a<<=7&o;var i=o>>>3;s[i]|=a,s[i+1]|=a>>>8},r.F._putsF=function(s,o,a){a<<=7&o;var i=o>>>3;s[i]|=a,s[i+1]|=a>>>8,s[i+2]|=a>>>16},r.F._bitsE=function(s,o,a){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<<a)-1},r.F._bitsF=function(s,o,a){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<<a)-1},r.F._get17=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var a=o;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,s.rev15[o]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];i(s.fltree,144,8),i(s.fltree,112,9),i(s.fltree,24,7),i(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),i(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),i(s.itree,19,0),i(s.ltree,286,0),i(s.dtree,30,0),i(s.ttree,320,0)})()})();var ig=sg({__proto__:null,default:Xn},[Xn]);const Be=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,u){l[c]=u>>8&255,l[c+1]=255&u},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,u){l[c]=u>>24&255,l[c+1]=u>>16&255,l[c+2]=u>>8&255,l[c+3]=255&u},readASCII(l,c,u){let h="";for(let b=0;b<u;b++)h+=String.fromCharCode(l[c+b]);return h},writeASCII(l,c,u){for(let h=0;h<u.length;h++)l[c+h]=u.charCodeAt(h)},readBytes(l,c,u){const h=[];for(let b=0;b<u;b++)h.push(l[c+b]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,u){let h,b="";for(let v=0;v<u;v++)b+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(b)}catch{return e.readASCII(l,c,u)}return h}};function t(l,c,u,h){const b=c*u,v=o(h),w=Math.ceil(c*v/8),y=new Uint8Array(4*b),T=new Uint32Array(y.buffer),{ctype:A}=h,{depth:k}=h,O=e.readUshort;if(A==6){const P=b<<2;if(k==8)for(var E=0;E<P;E+=4)y[E]=l[E],y[E+1]=l[E+1],y[E+2]=l[E+2],y[E+3]=l[E+3];if(k==16)for(E=0;E<P;E++)y[E]=l[E<<1]}else if(A==2){const P=h.tabs.tRNS;if(P==null){if(k==8)for(E=0;E<b;E++){var _=3*E;T[E]=255<<24|l[_+2]<<16|l[_+1]<<8|l[_]}if(k==16)for(E=0;E<b;E++)_=6*E,T[E]=255<<24|l[_+4]<<16|l[_+2]<<8|l[_]}else{var g=P[0];const U=P[1],Y=P[2];if(k==8)for(E=0;E<b;E++){var x=E<<2;_=3*E,T[E]=255<<24|l[_+2]<<16|l[_+1]<<8|l[_],l[_]==g&&l[_+1]==U&&l[_+2]==Y&&(y[x+3]=0)}if(k==16)for(E=0;E<b;E++)x=E<<2,_=6*E,T[E]=255<<24|l[_+4]<<16|l[_+2]<<8|l[_],O(l,_)==g&&O(l,_+2)==U&&O(l,_+4)==Y&&(y[x+3]=0)}}else if(A==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,Y=U?U.length:0;if(k==1)for(var M=0;M<u;M++){var I=M*w,D=M*c;for(E=0;E<c;E++){x=D+E<<2;var F=3*(j=l[I+(E>>3)]>>7-((7&E)<<0)&1);y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255}}if(k==2)for(M=0;M<u;M++)for(I=M*w,D=M*c,E=0;E<c;E++)x=D+E<<2,F=3*(j=l[I+(E>>2)]>>6-((3&E)<<1)&3),y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255;if(k==4)for(M=0;M<u;M++)for(I=M*w,D=M*c,E=0;E<c;E++)x=D+E<<2,F=3*(j=l[I+(E>>1)]>>4-((1&E)<<2)&15),y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255;if(k==8)for(E=0;E<b;E++){var j;x=E<<2,F=3*(j=l[E]),y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255}}else if(A==4){if(k==8)for(E=0;E<b;E++){x=E<<2;var z=l[C=E<<1];y[x]=z,y[x+1]=z,y[x+2]=z,y[x+3]=l[C+1]}if(k==16)for(E=0;E<b;E++){var C;x=E<<2,z=l[C=E<<2],y[x]=z,y[x+1]=z,y[x+2]=z,y[x+3]=l[C+2]}}else if(A==0)for(g=h.tabs.tRNS?h.tabs.tRNS:-1,M=0;M<u;M++){const P=M*w,U=M*c;if(k==1)for(var S=0;S<c;S++){var H=(z=255*(l[P+(S>>>3)]>>>7-(7&S)&1))==255*g?0:255;T[U+S]=H<<24|z<<16|z<<8|z}else if(k==2)for(S=0;S<c;S++)H=(z=85*(l[P+(S>>>2)]>>>6-((3&S)<<1)&3))==85*g?0:255,T[U+S]=H<<24|z<<16|z<<8|z;else if(k==4)for(S=0;S<c;S++)H=(z=17*(l[P+(S>>>1)]>>>4-((1&S)<<2)&15))==17*g?0:255,T[U+S]=H<<24|z<<16|z<<8|z;else if(k==8)for(S=0;S<c;S++)H=(z=l[P+S])==g?0:255,T[U+S]=H<<24|z<<16|z<<8|z;else if(k==16)for(S=0;S<c;S++)z=l[P+(S<<1)],H=O(l,P+(S<<1))==g?0:255,T[U+S]=H<<24|z<<16|z<<8|z}return y}function n(l,c,u,h){const b=o(l),v=Math.ceil(u*b/8),w=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?s(c,w):r(c,w),l.interlace==0?c=a(c,l,0,u,h):l.interlace==1&&(c=(function(T,A){const k=A.width,O=A.height,E=o(A),_=E>>3,g=Math.ceil(k*E/8),x=new Uint8Array(O*g);let M=0;const I=[0,0,4,0,2,0,1],D=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],j=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const S=F[z],H=j[z];let P=0,U=0,Y=I[z];for(;Y<O;)Y+=S,U++;let N=D[z];for(;N<k;)N+=H,P++;const L=Math.ceil(P*E/8);a(T,A,M,P,U);let $=0,R=I[z];for(;R<O;){let B=D[z],V=M+$*L<<3;for(;B<k;){var C;if(E==1&&(C=(C=T[V>>3])>>7-(7&V)&1,x[R*g+(B>>3)]|=C<<7-((7&B)<<0)),E==2&&(C=(C=T[V>>3])>>6-(7&V)&3,x[R*g+(B>>2)]|=C<<6-((3&B)<<1)),E==4&&(C=(C=T[V>>3])>>4-(7&V)&15,x[R*g+(B>>1)]|=C<<4-((1&B)<<2)),E>=8){const q=R*g+B*_;for(let K=0;K<_;K++)x[q+K]=T[(V>>3)+K]}V+=E,B+=H}$++,R+=S}P*U!=0&&(M+=U*(1+L)),z+=1}return x})(c,l)),c}function r(l,c){return s(new Uint8Array(l.buffer,2,l.length-6),c)}var s=(function(){const l={H:{}};return l.H.N=function(c,u){const h=Uint8Array;let b,v,w=0,y=0,T=0,A=0,k=0,O=0,E=0,_=0,g=0;if(c[0]==3&&c[1]==0)return u||new h(0);const x=l.H,M=x.b,I=x.e,D=x.R,F=x.n,j=x.A,z=x.Z,C=x.m,S=u==null;for(S&&(u=new h(c.length>>>2<<5));w==0;)if(w=M(c,g,1),y=M(c,g+1,2),g+=3,y!=0){if(S&&(u=l.H.W(u,_+(1<<17))),y==1&&(b=C.J,v=C.h,O=511,E=31),y==2){T=I(c,g,5)+257,A=I(c,g+5,5)+1,k=I(c,g+10,4)+4,g+=14;let P=1;for(var H=0;H<38;H+=2)C.Q[H]=0,C.Q[H+1]=0;for(H=0;H<k;H++){const N=I(c,g+3*H,3);C.Q[1+(C.X[H]<<1)]=N,N>P&&(P=N)}g+=3*k,F(C.Q,P),j(C.Q,P,C.u),b=C.w,v=C.d,g=D(C.u,(1<<P)-1,T+A,c,g,C.v);const U=x.V(C.v,0,T,C.C);O=(1<<U)-1;const Y=x.V(C.v,T,A,C.D);E=(1<<Y)-1,F(C.C,U),j(C.C,U,b),F(C.D,Y),j(C.D,Y,v)}for(;;){const P=b[z(c,g)&O];g+=15&P;const U=P>>>4;if(!(U>>>8))u[_++]=U;else{if(U==256)break;{let Y=_+U-254;if(U>264){const B=C.q[U-257];Y=_+(B>>>3)+I(c,g,7&B),g+=7&B}const N=v[z(c,g)&E];g+=15&N;const L=N>>>4,$=C.c[L],R=($>>>4)+M(c,g,15&$);for(g+=15&$;_<Y;)u[_]=u[_++-R],u[_]=u[_++-R],u[_]=u[_++-R],u[_]=u[_++-R];_=Y}}}}else{(7&g)!=0&&(g+=8-(7&g));const P=4+(g>>>3),U=c[P-4]|c[P-3]<<8;S&&(u=l.H.W(u,_+U)),u.set(new h(c.buffer,c.byteOffset+P,U),_),g=P+U<<3,_+=U}return u.length==_?u:u.slice(0,_)},l.H.W=function(c,u){const h=c.length;if(u<=h)return c;const b=new Uint8Array(h<<1);return b.set(c,0),b},l.H.R=function(c,u,h,b,v,w){const y=l.H.e,T=l.H.Z;let A=0;for(;A<h;){const k=c[T(b,v)&u];v+=15&k;const O=k>>>4;if(O<=15)w[A]=O,A++;else{let E=0,_=0;O==16?(_=3+y(b,v,2),v+=2,E=w[A-1]):O==17?(_=3+y(b,v,3),v+=3):O==18&&(_=11+y(b,v,7),v+=7);const g=A+_;for(;A<g;)w[A]=E,A++}}return v},l.H.V=function(c,u,h,b){let v=0,w=0;const y=b.length>>>1;for(;w<h;){const T=c[w+u];b[w<<1]=0,b[1+(w<<1)]=T,T>v&&(v=T),w++}for(;w<y;)b[w<<1]=0,b[1+(w<<1)]=0,w++;return v},l.H.n=function(c,u){const h=l.H.m,b=c.length;let v,w,y,T;const A=h.j;for(var k=0;k<=u;k++)A[k]=0;for(k=1;k<b;k+=2)A[c[k]]++;const O=h.K;for(v=0,A[0]=0,w=1;w<=u;w++)v=v+A[w-1]<<1,O[w]=v;for(y=0;y<b;y+=2)T=c[y+1],T!=0&&(c[y]=O[T],O[T]++)},l.H.A=function(c,u,h){const b=c.length,v=l.H.m.r;for(let w=0;w<b;w+=2)if(c[w+1]!=0){const y=w>>1,T=c[w+1],A=y<<4|T,k=u-T;let O=c[w]<<k;const E=O+(1<<k);for(;O!=E;)h[v[O]>>>15-u]=A,O++}},l.H.l=function(c,u){const h=l.H.m.r,b=15-u;for(let v=0;v<c.length;v+=2){const w=c[v]<<u-c[v+1];c[v]=h[w]>>>b}},l.H.M=function(c,u,h){h<<=7&u;const b=u>>>3;c[b]|=h,c[b+1]|=h>>>8},l.H.I=function(c,u,h){h<<=7&u;const b=u>>>3;c[b]|=h,c[b+1]|=h>>>8,c[b+2]|=h>>>16},l.H.e=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8)>>>(7&u)&(1<<h)-1},l.H.b=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)&(1<<h)-1},l.H.Z=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)},l.H.i=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16|c[3+(u>>>3)]<<24)>>>(7&u)},l.H.m=(function(){const c=Uint16Array,u=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var u=0;u<32768;u++){let b=u;b=(2863311530&b)>>>1|(1431655765&b)<<1,b=(3435973836&b)>>>2|(858993459&b)<<2,b=(4042322160&b)>>>4|(252645135&b)<<4,b=(4278255360&b)>>>8|(16711935&b)<<8,c.r[u]=(b>>>16|b<<16)>>>17}function h(b,v,w){for(;v--!=0;)b.push(0,w)}for(u=0;u<32;u++)c.q[u]=c.S[u]<<3|c.T[u],c.c[u]=c.p[u]<<4|c.z[u];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function o(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,u,h,b){let v=o(c);const w=Math.ceil(h*v/8);let y,T;v=Math.ceil(v/8);let A=l[u],k=0;if(A>1&&(l[u]=[0,0,1][A-2]),A==3)for(k=v;k<w;k++)l[k+1]=l[k+1]+(l[k+1-v]>>>1)&255;for(let O=0;O<b;O++)if(y=u+O*w,T=y+O+1,A=l[T-1],k=0,A==0)for(;k<w;k++)l[y+k]=l[T+k];else if(A==1){for(;k<v;k++)l[y+k]=l[T+k];for(;k<w;k++)l[y+k]=l[T+k]+l[y+k-v]}else if(A==2)for(;k<w;k++)l[y+k]=l[T+k]+l[y+k-w];else if(A==3){for(;k<v;k++)l[y+k]=l[T+k]+(l[y+k-w]>>>1);for(;k<w;k++)l[y+k]=l[T+k]+(l[y+k-w]+l[y+k-v]>>>1)}else{for(;k<v;k++)l[y+k]=l[T+k]+i(0,l[y+k-w],0);for(;k<w;k++)l[y+k]=l[T+k]+i(l[y+k-v],l[y+k-w],l[y+k-v-w])}return l}function i(l,c,u){const h=l+c-u,b=h-l,v=h-c,w=h-u;return b*b<=v*v&&b*b<=w*w?l:v*v<=w*w?c:u}function m(l,c,u){u.width=e.readUint(l,c),c+=4,u.height=e.readUint(l,c),c+=4,u.depth=l[c],c++,u.ctype=l[c],c++,u.compress=l[c],c++,u.filter=l[c],c++,u.interlace=l[c],c++}function f(l,c,u,h,b,v,w,y,T){const A=Math.min(c,b),k=Math.min(u,v);let O=0,E=0;for(let z=0;z<k;z++)for(let C=0;C<A;C++)if(w>=0&&y>=0?(O=z*c+C<<2,E=(y+z)*b+w+C<<2):(O=(-y+z)*c-w+C<<2,E=z*b+C<<2),T==0)h[E]=l[O],h[E+1]=l[O+1],h[E+2]=l[O+2],h[E+3]=l[O+3];else if(T==1){var _=l[O+3]*.00392156862745098,g=l[O]*_,x=l[O+1]*_,M=l[O+2]*_,I=h[E+3]*(1/255),D=h[E]*I,F=h[E+1]*I,j=h[E+2]*I;const S=1-_,H=_+I*S,P=H==0?0:1/H;h[E+3]=255*H,h[E+0]=(g+D*S)*P,h[E+1]=(x+F*S)*P,h[E+2]=(M+j*S)*P}else if(T==2)_=l[O+3],g=l[O],x=l[O+1],M=l[O+2],I=h[E+3],D=h[E],F=h[E+1],j=h[E+2],_==I&&g==D&&x==F&&M==j?(h[E]=0,h[E+1]=0,h[E+2]=0,h[E+3]=0):(h[E]=g,h[E+1]=x,h[E+2]=M,h[E+3]=_);else if(T==3){if(_=l[O+3],g=l[O],x=l[O+1],M=l[O+2],I=h[E+3],D=h[E],F=h[E+1],j=h[E+2],_==I&&g==D&&x==F&&M==j)continue;if(_<220&&I>20)return!1}return!0}return{decode:function(c){const u=new Uint8Array(c);let h=8;const b=e,v=b.readUshort,w=b.readUint,y={tabs:{},frames:[]},T=new Uint8Array(u.length);let A,k=0,O=0;const E=[137,80,78,71,13,10,26,10];for(var _=0;_<8;_++)if(u[_]!=E[_])throw"The input is not a PNG file!";for(;h<u.length;){const z=b.readUint(u,h);h+=4;const C=b.readASCII(u,h,4);if(h+=4,C=="IHDR")m(u,h,y);else if(C=="iCCP"){for(var g=h;u[g]!=0;)g++;b.readASCII(u,h,g-h),u[g+1];const S=u.slice(g+2,h+z);let H=null;try{H=r(S)}catch{H=s(S)}y.tabs[C]=H}else if(C=="CgBI")y.tabs[C]=u.slice(h,h+4);else if(C=="IDAT"){for(_=0;_<z;_++)T[k+_]=u[h+_];k+=z}else if(C=="acTL")y.tabs[C]={num_frames:w(u,h),num_plays:w(u,h+4)},A=new Uint8Array(u.length);else if(C=="fcTL"){O!=0&&((j=y.frames[y.frames.length-1]).data=n(y,A.slice(0,O),j.rect.width,j.rect.height),O=0);const S={x:w(u,h+12),y:w(u,h+16),width:w(u,h+4),height:w(u,h+8)};let H=v(u,h+22);H=v(u,h+20)/(H==0?100:H);const P={rect:S,delay:Math.round(1e3*H),dispose:u[h+24],blend:u[h+25]};y.frames.push(P)}else if(C=="fdAT"){for(_=0;_<z-4;_++)A[O+_]=u[h+_+4];O+=z-4}else if(C=="pHYs")y.tabs[C]=[b.readUint(u,h),b.readUint(u,h+4),u[h+8]];else if(C=="cHRM")for(y.tabs[C]=[],_=0;_<8;_++)y.tabs[C].push(b.readUint(u,h+4*_));else if(C=="tEXt"||C=="zTXt"){y.tabs[C]==null&&(y.tabs[C]={});var x=b.nextZero(u,h),M=b.readASCII(u,h,x-h),I=h+z-x-1;if(C=="tEXt")F=b.readASCII(u,x+1,I);else{var D=r(u.slice(x+2,x+2+I));F=b.readUTF8(D,0,D.length)}y.tabs[C][M]=F}else if(C=="iTXt"){y.tabs[C]==null&&(y.tabs[C]={}),x=0,g=h,x=b.nextZero(u,g),M=b.readASCII(u,g,x-g);const S=u[g=x+1];var F;u[g+1],g+=2,x=b.nextZero(u,g),b.readASCII(u,g,x-g),g=x+1,x=b.nextZero(u,g),b.readUTF8(u,g,x-g),I=z-((g=x+1)-h),S==0?F=b.readUTF8(u,g,I):(D=r(u.slice(g,g+I)),F=b.readUTF8(D,0,D.length)),y.tabs[C][M]=F}else if(C=="PLTE")y.tabs[C]=b.readBytes(u,h,z);else if(C=="hIST"){const S=y.tabs.PLTE.length/3;for(y.tabs[C]=[],_=0;_<S;_++)y.tabs[C].push(v(u,h+2*_))}else if(C=="tRNS")y.ctype==3?y.tabs[C]=b.readBytes(u,h,z):y.ctype==0?y.tabs[C]=v(u,h):y.ctype==2&&(y.tabs[C]=[v(u,h),v(u,h+2),v(u,h+4)]);else if(C=="gAMA")y.tabs[C]=b.readUint(u,h)/1e5;else if(C=="sRGB")y.tabs[C]=u[h];else if(C=="bKGD")y.ctype==0||y.ctype==4?y.tabs[C]=[v(u,h)]:y.ctype==2||y.ctype==6?y.tabs[C]=[v(u,h),v(u,h+2),v(u,h+4)]:y.ctype==3&&(y.tabs[C]=u[h]);else if(C=="IEND")break;h+=z,b.readUint(u,h),h+=4}var j;return O!=0&&((j=y.frames[y.frames.length-1]).data=n(y,A.slice(0,O),j.rect.width,j.rect.height)),y.data=n(y,T,y.width,y.height),delete y.compress,delete y.interlace,delete y.filter,y},toRGBA8:function(c){const u=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,u,h,c).buffer];const b=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=u*h*4,w=new Uint8Array(v),y=new Uint8Array(v),T=new Uint8Array(v);for(let k=0;k<c.frames.length;k++){const O=c.frames[k],E=O.rect.x,_=O.rect.y,g=O.rect.width,x=O.rect.height,M=t(O.data,g,x,c);if(k!=0)for(var A=0;A<v;A++)T[A]=w[A];if(O.blend==0?f(M,g,x,w,u,h,E,_,0):O.blend==1&&f(M,g,x,w,u,h,E,_,1),b.push(w.buffer.slice(0)),O.dispose!=0){if(O.dispose==1)f(y,g,x,w,u,h,E,_,0);else if(O.dispose==2)for(A=0;A<v;A++)w[A]=T[A]}}return b},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Be,{_bin:t}=Be,n=Be._paeth;var r={table:(function(){const g=new Uint32Array(256);for(let x=0;x<256;x++){let M=x;for(let I=0;I<8;I++)1&M?M=3988292384^M>>>1:M>>>=1;g[x]=M}return g})(),update(g,x,M,I){for(let D=0;D<I;D++)g=r.table[255&(g^x[M+D])]^g>>>8;return g},crc:(g,x,M)=>4294967295^r.update(4294967295,g,x,M)};function s(g,x,M,I){x[M]+=g[0]*I>>4,x[M+1]+=g[1]*I>>4,x[M+2]+=g[2]*I>>4,x[M+3]+=g[3]*I>>4}function o(g){return Math.max(0,Math.min(255,g))}function a(g,x){const M=g[0]-x[0],I=g[1]-x[1],D=g[2]-x[2],F=g[3]-x[3];return M*M+I*I+D*D+F*F}function i(g,x,M,I,D,F,j){j==null&&(j=1);const z=I.length,C=[];for(var S=0;S<z;S++){const R=I[S];C.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(S=0;S<z;S++){let R=4294967295;for(var H=0,P=0;P<z;P++){var U=a(C[S],C[P]);P!=S&&U<R&&(R=U,H=P)}}const Y=new Uint32Array(D.buffer),N=new Int16Array(x*M*4),L=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(S=0;S<L.length;S++)L[S]=255*((L[S]+.5)/16-.5);for(let R=0;R<M;R++)for(let B=0;B<x;B++){var $;S=4*(R*x+B),j!=2?$=[o(g[S]+N[S]),o(g[S+1]+N[S+1]),o(g[S+2]+N[S+2]),o(g[S+3]+N[S+3])]:(U=L[4*(3&R)+(3&B)],$=[o(g[S]+U),o(g[S+1]+U),o(g[S+2]+U),o(g[S+3]+U)]),H=0;let V=16777215;for(P=0;P<z;P++){const oe=a($,C[P]);oe<V&&(V=oe,H=P)}const q=C[H],K=[$[0]-q[0],$[1]-q[1],$[2]-q[2],$[3]-q[3]];j==1&&(B!=x-1&&s(K,N,S+4,7),R!=M-1&&(B!=0&&s(K,N,S+4*x-4,3),s(K,N,S+4*x,5),B!=x-1&&s(K,N,S+4*x+4,1))),F[S>>2]=H,Y[S>>2]=I[H]}}function m(g,x,M,I,D){D==null&&(D={});const{crc:F}=r,j=t.writeUint,z=t.writeUshort,C=t.writeASCII;let S=8;const H=g.frames.length>1;let P,U=!1,Y=33+(H?20:0);if(D.sRGB!=null&&(Y+=13),D.pHYs!=null&&(Y+=21),D.iCCP!=null&&(P=pako.deflate(D.iCCP),Y+=21+P.length+4),g.ctype==3){for(var N=g.plte.length,L=0;L<N;L++)g.plte[L]>>>24!=255&&(U=!0);Y+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<g.frames.length;$++)H&&(Y+=38),Y+=(q=g.frames[$]).cimg.length+12,$!=0&&(Y+=4);Y+=12;const R=new Uint8Array(Y),B=[137,80,78,71,13,10,26,10];for(L=0;L<8;L++)R[L]=B[L];if(j(R,S,13),S+=4,C(R,S,"IHDR"),S+=4,j(R,S,x),S+=4,j(R,S,M),S+=4,R[S]=g.depth,S++,R[S]=g.ctype,S++,R[S]=0,S++,R[S]=0,S++,R[S]=0,S++,j(R,S,F(R,S-17,17)),S+=4,D.sRGB!=null&&(j(R,S,1),S+=4,C(R,S,"sRGB"),S+=4,R[S]=D.sRGB,S++,j(R,S,F(R,S-5,5)),S+=4),D.iCCP!=null){const K=13+P.length;j(R,S,K),S+=4,C(R,S,"iCCP"),S+=4,C(R,S,"ICC profile"),S+=11,S+=2,R.set(P,S),S+=P.length,j(R,S,F(R,S-(K+4),K+4)),S+=4}if(D.pHYs!=null&&(j(R,S,9),S+=4,C(R,S,"pHYs"),S+=4,j(R,S,D.pHYs[0]),S+=4,j(R,S,D.pHYs[1]),S+=4,R[S]=D.pHYs[2],S++,j(R,S,F(R,S-13,13)),S+=4),H&&(j(R,S,8),S+=4,C(R,S,"acTL"),S+=4,j(R,S,g.frames.length),S+=4,j(R,S,D.loop!=null?D.loop:0),S+=4,j(R,S,F(R,S-12,12)),S+=4),g.ctype==3){for(j(R,S,3*(N=g.plte.length)),S+=4,C(R,S,"PLTE"),S+=4,L=0;L<N;L++){const K=3*L,oe=g.plte[L],ee=255&oe,re=oe>>>8&255,ce=oe>>>16&255;R[S+K+0]=ee,R[S+K+1]=re,R[S+K+2]=ce}if(S+=3*N,j(R,S,F(R,S-3*N-4,3*N+4)),S+=4,U){for(j(R,S,N),S+=4,C(R,S,"tRNS"),S+=4,L=0;L<N;L++)R[S+L]=g.plte[L]>>>24&255;S+=N,j(R,S,F(R,S-N-4,N+4)),S+=4}}let V=0;for($=0;$<g.frames.length;$++){var q=g.frames[$];H&&(j(R,S,26),S+=4,C(R,S,"fcTL"),S+=4,j(R,S,V++),S+=4,j(R,S,q.rect.width),S+=4,j(R,S,q.rect.height),S+=4,j(R,S,q.rect.x),S+=4,j(R,S,q.rect.y),S+=4,z(R,S,I[$]),S+=2,z(R,S,1e3),S+=2,R[S]=q.dispose,S++,R[S]=q.blend,S++,j(R,S,F(R,S-30,30)),S+=4);const K=q.cimg;j(R,S,(N=K.length)+($==0?0:4)),S+=4;const oe=S;C(R,S,$==0?"IDAT":"fdAT"),S+=4,$!=0&&(j(R,S,V++),S+=4),R.set(K,S),S+=N,j(R,S,F(R,oe,S-oe)),S+=4}return j(R,S,0),S+=4,C(R,S,"IEND"),S+=4,j(R,S,F(R,S-4,4)),S+=4,R.buffer}function f(g,x,M){for(let I=0;I<g.frames.length;I++){const D=g.frames[I];D.rect.width;const F=D.rect.height,j=new Uint8Array(F*D.bpl+F);D.cimg=h(D.img,F,D.bpp,D.bpl,j,x,M)}}function l(g,x,M,I,D){const F=D[0],j=D[1],z=D[2],C=D[3],S=D[4],H=D[5];let P=6,U=8,Y=255;for(var N=0;N<g.length;N++){const we=new Uint8Array(g[N]);for(var L=we.length,$=0;$<L;$+=4)Y&=we[$+3]}const R=Y!=255,B=(function(me,de,xe,Ce,pe,_e){const ke=[];for(var ge=0;ge<me.length;ge++){const je=new Uint8Array(me[ge]),Le=new Uint32Array(je.buffer);var Ie;let W=0,X=0,te=de,ue=xe,Ee=Ce?1:0;if(ge!=0){const he=_e||Ce||ge==1||ke[ge-2].dispose!=0?1:2;let Me=0,Tn=1e9;for(let ct=0;ct<he;ct++){var qe=new Uint8Array(me[ge-1-ct]);const Lc=new Uint32Array(me[ge-1-ct]);let dt=de,ut=xe,$t=-1,sn=-1;for(let Ct=0;Ct<xe;Ct++)for(let kt=0;kt<de;kt++)Le[Re=Ct*de+kt]!=Lc[Re]&&(kt<dt&&(dt=kt),kt>$t&&($t=kt),Ct<ut&&(ut=Ct),Ct>sn&&(sn=Ct));$t==-1&&(dt=ut=$t=sn=0),pe&&((1&dt)==1&&dt--,(1&ut)==1&&ut--);const Zs=($t-dt+1)*(sn-ut+1);Zs<Tn&&(Tn=Zs,Me=ct,W=dt,X=ut,te=$t-dt+1,ue=sn-ut+1)}qe=new Uint8Array(me[ge-1-Me]),Me==1&&(ke[ge-1].dispose=2),Ie=new Uint8Array(te*ue*4),e(qe,de,xe,Ie,te,ue,-W,-X,0),Ee=e(je,de,xe,Ie,te,ue,-W,-X,3)?1:0,Ee==1?u(je,de,xe,Ie,{x:W,y:X,width:te,height:ue}):e(je,de,xe,Ie,te,ue,-W,-X,0)}else Ie=je.slice(0);ke.push({rect:{x:W,y:X,width:te,height:ue},img:Ie,blend:Ee,dispose:0})}if(Ce)for(ge=0;ge<ke.length;ge++){if((tt=ke[ge]).blend==1)continue;const je=tt.rect,Le=ke[ge-1].rect,W=Math.min(je.x,Le.x),X=Math.min(je.y,Le.y),te={x:W,y:X,width:Math.max(je.x+je.width,Le.x+Le.width)-W,height:Math.max(je.y+je.height,Le.y+Le.height)-X};ke[ge-1].dispose=1,ge-1!=0&&c(me,de,xe,ke,ge-1,te,pe),c(me,de,xe,ke,ge,te,pe)}let Ft=0;if(me.length!=1)for(var Re=0;Re<ke.length;Re++){var tt;Ft+=(tt=ke[Re]).rect.width*tt.rect.height}return ke})(g,x,M,F,j,z),V={},q=[],K=[];if(I!=0){const we=[];for($=0;$<B.length;$++)we.push(B[$].img.buffer);const me=(function(pe){let _e=0;for(var ke=0;ke<pe.length;ke++)_e+=pe[ke].byteLength;const ge=new Uint8Array(_e);let Ie=0;for(ke=0;ke<pe.length;ke++){const qe=new Uint8Array(pe[ke]),Ft=qe.length;for(let Re=0;Re<Ft;Re+=4){let tt=qe[Re],je=qe[Re+1],Le=qe[Re+2];const W=qe[Re+3];W==0&&(tt=je=Le=0),ge[Ie+Re]=tt,ge[Ie+Re+1]=je,ge[Ie+Re+2]=Le,ge[Ie+Re+3]=W}Ie+=Ft}return ge.buffer})(we),de=v(me,I);for($=0;$<de.plte.length;$++)q.push(de.plte[$].est.rgba);let xe=0;for($=0;$<B.length;$++){const Ce=(ee=B[$]).img.length;var oe=new Uint8Array(de.inds.buffer,xe>>2,Ce>>2);K.push(oe);const pe=new Uint8Array(de.abuf,xe,Ce);H&&i(ee.img,ee.rect.width,ee.rect.height,q,pe,oe),ee.img.set(pe),xe+=Ce}}else for(N=0;N<B.length;N++){var ee=B[N];const we=new Uint32Array(ee.img.buffer);var re=ee.rect.width;for(L=we.length,oe=new Uint8Array(L),K.push(oe),$=0;$<L;$++){const me=we[$];if($!=0&&me==we[$-1])oe[$]=oe[$-1];else if($>re&&me==we[$-re])oe[$]=oe[$-re];else{let de=V[me];if(de==null&&(V[me]=de=q.length,q.push(me),q.length>=300))break;oe[$]=de}}}const ce=q.length;for(ce<=256&&S==0&&(U=ce<=2?1:ce<=4?2:ce<=16?4:8,U=Math.max(U,C)),N=0;N<B.length;N++){(ee=B[N]).rect.x,ee.rect.y,re=ee.rect.width;const we=ee.rect.height;let me=ee.img;new Uint32Array(me.buffer);let de=4*re,xe=4;if(ce<=256&&S==0){de=Math.ceil(U*re/8);var ve=new Uint8Array(de*we);const Ce=K[N];for(let pe=0;pe<we;pe++){$=pe*de;const _e=pe*re;if(U==8)for(var fe=0;fe<re;fe++)ve[$+fe]=Ce[_e+fe];else if(U==4)for(fe=0;fe<re;fe++)ve[$+(fe>>1)]|=Ce[_e+fe]<<4-4*(1&fe);else if(U==2)for(fe=0;fe<re;fe++)ve[$+(fe>>2)]|=Ce[_e+fe]<<6-2*(3&fe);else if(U==1)for(fe=0;fe<re;fe++)ve[$+(fe>>3)]|=Ce[_e+fe]<<7-1*(7&fe)}me=ve,P=3,xe=1}else if(R==0&&B.length==1){ve=new Uint8Array(re*we*3);const Ce=re*we;for($=0;$<Ce;$++){const pe=3*$,_e=4*$;ve[pe]=me[_e],ve[pe+1]=me[_e+1],ve[pe+2]=me[_e+2]}me=ve,P=2,xe=3,de=3*re}ee.img=me,ee.bpl=de,ee.bpp=xe}return{ctype:P,depth:U,plte:q,frames:B}}function c(g,x,M,I,D,F,j){const z=Uint8Array,C=Uint32Array,S=new z(g[D-1]),H=new C(g[D-1]),P=D+1<g.length?new z(g[D+1]):null,U=new z(g[D]),Y=new C(U.buffer);let N=x,L=M,$=-1,R=-1;for(let V=0;V<F.height;V++)for(let q=0;q<F.width;q++){const K=F.x+q,oe=F.y+V,ee=oe*x+K,re=Y[ee];re==0||I[D-1].dispose==0&&H[ee]==re&&(P==null||P[4*ee+3]!=0)||(K<N&&(N=K),K>$&&($=K),oe<L&&(L=oe),oe>R&&(R=oe))}$==-1&&(N=L=$=R=0),j&&((1&N)==1&&N--,(1&L)==1&&L--),F={x:N,y:L,width:$-N+1,height:R-L+1};const B=I[D];B.rect=F,B.blend=1,B.img=new Uint8Array(F.width*F.height*4),I[D-1].dispose==0?(e(S,x,M,B.img,F.width,F.height,-F.x,-F.y,0),u(U,x,M,B.img,F)):e(U,x,M,B.img,F.width,F.height,-F.x,-F.y,0)}function u(g,x,M,I,D){e(g,x,M,I,D.width,D.height,-D.x,-D.y,2)}function h(g,x,M,I,D,F,j){const z=[];let C,S=[0,1,2,3,4];F!=-1?S=[F]:(x*I>5e5||M==1)&&(S=[0]),j&&(C={level:0});const H=ig;for(var P=0;P<S.length;P++){for(let N=0;N<x;N++)b(D,g,N,I,M,S[P]);z.push(H.deflate(D,C))}let U,Y=1e9;for(P=0;P<z.length;P++)z[P].length<Y&&(U=P,Y=z[P].length);return z[U]}function b(g,x,M,I,D,F){const j=M*I;let z=j+M;if(g[z]=F,z++,F==0)if(I<500)for(var C=0;C<I;C++)g[z+C]=x[j+C];else g.set(new Uint8Array(x.buffer,j,I),z);else if(F==1){for(C=0;C<D;C++)g[z+C]=x[j+C];for(C=D;C<I;C++)g[z+C]=x[j+C]-x[j+C-D]+256&255}else if(M==0){for(C=0;C<D;C++)g[z+C]=x[j+C];if(F==2)for(C=D;C<I;C++)g[z+C]=x[j+C];if(F==3)for(C=D;C<I;C++)g[z+C]=x[j+C]-(x[j+C-D]>>1)+256&255;if(F==4)for(C=D;C<I;C++)g[z+C]=x[j+C]-n(x[j+C-D],0,0)+256&255}else{if(F==2)for(C=0;C<I;C++)g[z+C]=x[j+C]+256-x[j+C-I]&255;if(F==3){for(C=0;C<D;C++)g[z+C]=x[j+C]+256-(x[j+C-I]>>1)&255;for(C=D;C<I;C++)g[z+C]=x[j+C]+256-(x[j+C-I]+x[j+C-D]>>1)&255}if(F==4){for(C=0;C<D;C++)g[z+C]=x[j+C]+256-n(0,x[j+C-I],0)&255;for(C=D;C<I;C++)g[z+C]=x[j+C]+256-n(x[j+C-D],x[j+C-I],x[j+C-D-I])&255}}}function v(g,x){const M=new Uint8Array(g),I=M.slice(0),D=new Uint32Array(I.buffer),F=w(I,x),j=F[0],z=F[1],C=M.length,S=new Uint8Array(C>>2);let H;if(M.length<2e7)for(var P=0;P<C;P+=4)H=y(j,U=M[P]*(1/255),Y=M[P+1]*(1/255),N=M[P+2]*(1/255),L=M[P+3]*(1/255)),S[P>>2]=H.ind,D[P>>2]=H.est.rgba;else for(P=0;P<C;P+=4){var U=M[P]*.00392156862745098,Y=M[P+1]*(1/255),N=M[P+2]*(1/255),L=M[P+3]*(1/255);for(H=j;H.left;)H=T(H.est,U,Y,N,L)<=0?H.left:H.right;S[P>>2]=H.ind,D[P>>2]=H.est.rgba}return{abuf:I.buffer,inds:S,plte:z}}function w(g,x,M){M==null&&(M=1e-4);const I=new Uint32Array(g.buffer),D={i0:0,i1:g.length,bst:null,est:null,tdst:0,left:null,right:null};D.bst=O(g,D.i0,D.i1),D.est=E(D.bst);const F=[D];for(;F.length<x;){let z=0,C=0;for(var j=0;j<F.length;j++)F[j].est.L>z&&(z=F[j].est.L,C=j);if(z<M)break;const S=F[C],H=A(g,I,S.i0,S.i1,S.est.e,S.est.eMq255);if(S.i0>=H||S.i1<=H){S.est.L=0;continue}const P={i0:S.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};P.bst=O(g,P.i0,P.i1),P.est=E(P.bst);const U={i0:H,i1:S.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:S.bst.N-P.bst.N},j=0;j<16;j++)U.bst.R[j]=S.bst.R[j]-P.bst.R[j];for(j=0;j<4;j++)U.bst.m[j]=S.bst.m[j]-P.bst.m[j];U.est=E(U.bst),S.left=P,S.right=U,F[C]=P,F.push(U)}for(F.sort(((z,C)=>C.bst.N-z.bst.N)),j=0;j<F.length;j++)F[j].ind=j;return[D,F]}function y(g,x,M,I,D){if(g.left==null)return g.tdst=(function(P,U,Y,N,L){const $=U-P[0],R=Y-P[1],B=N-P[2],V=L-P[3];return $*$+R*R+B*B+V*V})(g.est.q,x,M,I,D),g;const F=T(g.est,x,M,I,D);let j=g.left,z=g.right;F>0&&(j=g.right,z=g.left);const C=y(j,x,M,I,D);if(C.tdst<=F*F)return C;const S=y(z,x,M,I,D);return S.tdst<C.tdst?S:C}function T(g,x,M,I,D){const{e:F}=g;return F[0]*x+F[1]*M+F[2]*I+F[3]*D-g.eMq}function A(g,x,M,I,D,F){for(I-=4;M<I;){for(;k(g,M,D)<=F;)M+=4;for(;k(g,I,D)>F;)I-=4;if(M>=I)break;const j=x[M>>2];x[M>>2]=x[I>>2],x[I>>2]=j,M+=4,I-=4}for(;k(g,M,D)>F;)M-=4;return M+4}function k(g,x,M){return g[x]*M[0]+g[x+1]*M[1]+g[x+2]*M[2]+g[x+3]*M[3]}function O(g,x,M){const I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],D=[0,0,0,0],F=M-x>>2;for(let j=x;j<M;j+=4){const z=g[j]*.00392156862745098,C=g[j+1]*(1/255),S=g[j+2]*(1/255),H=g[j+3]*(1/255);D[0]+=z,D[1]+=C,D[2]+=S,D[3]+=H,I[0]+=z*z,I[1]+=z*C,I[2]+=z*S,I[3]+=z*H,I[5]+=C*C,I[6]+=C*S,I[7]+=C*H,I[10]+=S*S,I[11]+=S*H,I[15]+=H*H}return I[4]=I[1],I[8]=I[2],I[9]=I[6],I[12]=I[3],I[13]=I[7],I[14]=I[11],{R:I,m:D,N:F}}function E(g){const{R:x}=g,{m:M}=g,{N:I}=g,D=M[0],F=M[1],j=M[2],z=M[3],C=I==0?0:1/I,S=[x[0]-D*D*C,x[1]-D*F*C,x[2]-D*j*C,x[3]-D*z*C,x[4]-F*D*C,x[5]-F*F*C,x[6]-F*j*C,x[7]-F*z*C,x[8]-j*D*C,x[9]-j*F*C,x[10]-j*j*C,x[11]-j*z*C,x[12]-z*D*C,x[13]-z*F*C,x[14]-z*j*C,x[15]-z*z*C],H=S,P=_;let U=[Math.random(),Math.random(),Math.random(),Math.random()],Y=0,N=0;if(I!=0)for(let $=0;$<16&&(U=P.multVec(H,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-Y)<1e-9));$++)Y=N;const L=[D*C,F*C,j*C,z*C];return{Cov:S,q:L,e:U,L:Y,eMq255:P.dot(P.sml(255,L),U),eMq:P.dot(U,L),rgba:(Math.round(255*L[3])<<24|Math.round(255*L[2])<<16|Math.round(255*L[1])<<8|Math.round(255*L[0])<<0)>>>0}}var _={multVec:(g,x)=>[g[0]*x[0]+g[1]*x[1]+g[2]*x[2]+g[3]*x[3],g[4]*x[0]+g[5]*x[1]+g[6]*x[2]+g[7]*x[3],g[8]*x[0]+g[9]*x[1]+g[10]*x[2]+g[11]*x[3],g[12]*x[0]+g[13]*x[1]+g[14]*x[2]+g[15]*x[3]],dot:(g,x)=>g[0]*x[0]+g[1]*x[1]+g[2]*x[2]+g[3]*x[3],sml:(g,x)=>[g*x[0],g*x[1],g*x[2],g*x[3]]};Be.encode=function(x,M,I,D,F,j,z){D==null&&(D=0),z==null&&(z=!1);const C=l(x,M,I,D,[!1,!1,!1,0,z,!1]);return f(C,-1),m(C,M,I,F,j)},Be.encodeLL=function(x,M,I,D,F,j,z,C){const S={ctype:0+(D==1?0:2)+(F==0?0:4),depth:j,frames:[]},H=(D+F)*j,P=H*M;for(let U=0;U<x.length;U++)S.frames.push({rect:{x:0,y:0,width:M,height:I},img:new Uint8Array(x[U]),blend:0,dispose:1,bpp:Math.ceil(H/8),bpl:Math.ceil(P/8)});return f(S,0,!0),m(S,M,I,z,C)},Be.encode.compress=l,Be.encode.dither=i,Be.quantize=v,Be.quantize.getKDtree=w,Be.quantize.getNearest=y})();const dl={toArrayBuffer(e,t){const n=e.width,r=e.height,s=n<<2,o=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(o.data.buffer),i=(32*n+31)/32<<2,m=i*r,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),u=1<<20;let h,b,v,w,y=u,T=0,A=0,k=0;function O(g){c.setUint16(A,g,!0),A+=2}function E(g){c.setUint32(A,g,!0),A+=4}function _(g){A+=g}O(19778),E(f),_(4),E(122),E(108),E(n),E(-r>>>0),O(1),O(32),E(3),E(m),E(2835),E(2835),_(8),E(16711680),E(65280),E(255),E(4278190080),E(1466527264),(function g(){for(;T<r&&y>0;){for(w=122+T*i,h=0;h<s;)y--,b=a[k++],v=b>>>24,c.setUint32(w+h,b<<8|v),h+=4;T++}k<a.length?(y=u,setTimeout(g,dl._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Fe={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},lg={[Fe.CHROME]:16384,[Fe.FIREFOX]:11180,[Fe.DESKTOP_SAFARI]:16384,[Fe.IE]:8192,[Fe.IOS]:4096,[Fe.ETC]:8192};const Fs=typeof window<"u",ul=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Qn=Fs&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),cg=(Fs||ul)&&(Qn&&Qn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),fl=(Fs||ul)&&(Qn&&Qn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function $s(e,t,n=Date.now()){return new Promise((r=>{const s=e.split(","),o=s[0].match(/:(.*?);/)[1],a=globalThis.atob(s[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:o});f.name=t,f.lastModified=n,r(f)}))}function ml(e){return new Promise(((t,n)=>{const r=new fl;r.onload=()=>t(r.result),r.onerror=s=>n(s),r.readAsDataURL(e)}))}function pl(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=s=>n(s),r.src=e}))}function _t(){if(_t.cachedResult!==void 0)return _t.cachedResult;let e=Fe.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Fe.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Fe.IOS:/Safari/i.test(t)?e=Fe.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Fe.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Fe.IE),_t.cachedResult=e,_t.cachedResult}function hl(e,t){const n=_t(),r=lg[n];let s=e,o=t,a=s*o;const i=s>o?o/s:s/o;for(;a>r*r;){const m=(r+s)/2,f=(r+o)/2;m<f?(o=f,s=f*i):(o=m*i,s=m),a=s*o}return{width:s,height:o}}function ur(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function gl(e,t){const{width:n,height:r}=hl(e.width,e.height),[s,o]=ur(n,r);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,s.width,s.height)),o.drawImage(e,0,0,s.width,s.height),s}function Fn(){return Fn.cachedResult!==void 0||(Fn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Fn.cachedResult}function Jn(e,t={}){return new Promise((function(n,r){let s,o;var a=function(){try{return o=gl(s,t.fileType||e.type),n([s,o])}catch(m){return r(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return r(c)}};try{let l;return ml(e).then((function(c){try{return l=c,pl(l).then((function(u){try{return s=u,(function(){try{return a()}catch(h){return r(h)}})()}catch(h){return f(h)}}),f)}catch(u){return f(u)}}),f)}catch(l){f(l)}}catch(l){return r(l)}};try{if(Fn()||[Fe.DESKTOP_SAFARI,Fe.MOBILE_SAFARI].includes(_t()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return s=m,a()}catch{return i()}}),i)}catch{i()}}))}function Zn(e,t,n,r,s=1){return new Promise((function(o,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=Be.encode([l.buffer],e.width,e.height,4096*s),i=new Blob([c],{type:t}),i.name=n,i.lastModified=r,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>dl.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=r,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:s}).then((function(c){try{return i=c,i.name=n,i.lastModified=r,l.call(this)}catch(u){return a(u)}}).bind(this),a);{let c;return c=e.toDataURL(t,s),$s(c,n,r).then((function(u){try{return i=u,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return o(i)}}))}function Xe(e){e.width=0,e.height=0}function Gt(){return new Promise((function(e,t){let n,r,s,o;return Gt.cachedResult!==void 0?e(Gt.cachedResult):$s("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Jn(n).then((function(i){try{return r=i[1],Zn(r,n.type,n.name,n.lastModified).then((function(m){try{return s=m,Xe(r),Jn(s).then((function(f){try{return o=f[0],Gt.cachedResult=o.width===1&&o.height===2,e(Gt.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function bl(e){return new Promise(((t,n)=>{const r=new fl;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return t(-2);const a=o.byteLength;let i=2;for(;i<a;){if(o.getUint16(i+2,!1)<=8)return t(-1);const m=o.getUint16(i,!1);if(i+=2,m==65505){if(o.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=o.getUint16(i+=6,!1)==18761;i+=o.getUint32(i+4,f);const l=o.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(o.getUint16(i+12*c,f)==274)return t(o.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=o.getUint16(i,!1)}}return t(-1)},r.onerror=s=>n(s),r.readAsArrayBuffer(e)}))}function xl(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:s}=t;let o,a=e;return isFinite(s)&&(n>s||r>s)&&([a,o]=ur(n,r),n>r?(a.width=s,a.height=r/n*s):(a.width=n/r*s,a.height=s),o.drawImage(e,0,0,a.width,a.height),Xe(e)),a}function yl(e,t){const{width:n}=e,{height:r}=e,[s,o]=ur(n,r);switch(t>4&&t<9?(s.width=r,s.height=n):(s.width=n,s.height=r),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,r),Xe(e),s}function Oo(e,t,n=0){return new Promise((function(r,s){let o,a,i,m,f,l,c,u,h,b,v,w,y,T,A,k,O,E,_,g;function x(I=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=I,t.onProgress(Math.min(o,100))}function M(I){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(I,o),100),t.onProgress(o)}return o=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,x(),Jn(e,t).then((function(I){try{return[,m]=I,x(),f=xl(m,t),x(),new Promise((function(D,F){var j;if(!(j=t.exifOrientation))return bl(e).then((function(C){try{return j=C,z.call(this)}catch(S){return F(S)}}).bind(this),F);function z(){return D(j)}return z.call(this)})).then((function(D){try{return l=D,x(),Gt().then((function(F){try{return c=F?f:yl(f,l),x(),u=t.initialQuality||1,h=t.fileType||e.type,Zn(c,h,e.name,e.lastModified,u).then((function(j){try{{let C=function(){if(a--&&(A>i||A>y)){let H,P;return H=g?.95*_.width:_.width,P=g?.95*_.height:_.height,[O,E]=ur(H,P),E.drawImage(_,0,0,H,P),u*=h==="image/png"?.85:.95,Zn(O,h,e.name,e.lastModified,u).then((function(U){try{return k=U,Xe(_),_=O,A=k.size,M(Math.min(99,Math.floor((T-A)/(T-i)*100))),C}catch(Y){return s(Y)}}),s)}return[1]},S=function(){return Xe(_),Xe(O),Xe(f),Xe(c),Xe(m),M(100),r(k)};if(b=j,x(),v=b.size>i,w=b.size>e.size,!v&&!w)return M(100),r(b);var z;return y=e.size,T=b.size,A=T,_=c,g=!t.alwaysKeepResolution&&v,(z=(function(H){for(;H;){if(H.then)return void H.then(z,s);try{if(H.pop){if(H.length)return H.pop()?S.call(this):H;H=C}else H=H.call(this)}catch(P){return s(P)}}}).bind(this))(C)}}catch(C){return s(C)}}).bind(this),s)}catch(j){return s(j)}}).bind(this),s)}catch(F){return s(F)}}).bind(this),s)}catch(D){return s(D)}}).bind(this),s)}))}const dg=`
218
+ - Risks…`,"cmd.desc.compact":"Compact the context","cmd.desc.cost":"View session cost","cmd.desc.summary":"Generate a session summary","cmd.desc.files":"List files tracked by the session","cmd.desc.clear":"Clear the conversation","cmd.desc.new":"Start a new session","cmd.desc.help":"Show this help","cmd.desc.status":"Show session status","cmd.desc.model":"View or switch models","cmd.desc.copy":"Copy the last assistant message","cmd.desc.resume":"Resume a past conversation into this session","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[session id]","cmd.desc.agentFallback":"agent command","cmd.subtitle.help":"Available commands","cmd.subtitle.status":"Session status","cmd.subtitle.model":"View or switch models","cmd.subtitle.copy":"Copy the assistant message to the clipboard","cmd.subtitle.resume":"Pick and resume a past conversation","cmd.help.localHeader":"**Local commands** (executed by the Web UI)","cmd.help.agentHeader":"**Agent commands** (sent to the Saluzi agent)","cmd.status.header":"**Session status**","cmd.status.sessionId":"Session ID","cmd.status.none":"none","cmd.status.currentModel":"Current model","cmd.status.unset":"not set","cmd.status.modelCount":"Available models","cmd.status.imageSupport":"Image support","cmd.status.yes":"yes","cmd.status.no":"no","cmd.status.messageCount":"Messages","cmd.model.none":"The agent does not expose model selection.","cmd.model.available":"**Available models**","cmd.model.hint":"Use `/model <id>` to switch models.","cmd.model.switched":"Requested switch to model: `{id}`","cmd.model.switchFailed":"Failed to switch model: {message}","cmd.copy.failed":"Copy failed: clipboard unavailable","cmd.copy.copied":"Copied {n} characters to the clipboard","cmd.copy.nothing":"No assistant message to copy","notify.permission.title":"Approval needed","notify.permission.body":"{session} — the agent is waiting for approval","notify.turnComplete.title":"Turn complete","notify.turnComplete.body":"{session} — the agent finished the current turn","adapter.workerCrashed":"Worker process exited unexpectedly","adapter.stopTimeout":"Stop request timed out","adapter.stopFailed":"Stop request failed","adapter.requestTimeout":"Request timed out","attach.emptyFile":"(empty file)","attach.emptyDirectory":"(empty directory)","attach.directoryHeader":"📁 Directory: {name}","attach.fileCount":"({n} files)","attach.readFailed":"(failed to read)","attach.tooLarge":"(file too large, skipped)","attach.imageFile":"(image file, {size})","attach.binaryFile":"(binary file, {size})","attach.dumpHeader":"# Directory: {name}","attach.dumpCount":"{n} files total","attach.structure":"## File structure","attach.contents":"## File contents","acp.sessions":"Sessions","acp.newSession":"New session","acp.confirmDelete":'Delete session "{label}"? This cannot be undone.',"acp.emptySessions":"No sessions","acp.historyNav":"Session history","acp.confirm":"Confirm","acp.noSessionManagement":"This agent does not support session management (rename/delete)","acp.rename":"Rename","acp.renameUnsupported":"This agent does not support session rename","acp.delete":"Delete","acp.deleteUnsupported":"This agent does not support session deletion","acp.mode.default":"Default","acp.mode.defaultDesc":"Approve permission requests manually","acp.mode.acceptEdits":"Auto-accept edits","acp.mode.acceptEditsDesc":"Automatically allow file edits","acp.mode.bypass":"Bypass permissions","acp.mode.bypassDesc":"Skip all permission checks","acp.mode.plan":"Plan mode","acp.mode.planDesc":"Plan only — no tool execution","acp.mode.dontAsk":"Don’t ask","acp.mode.dontAskDesc":"No prompts — reject automatically","acp.mode.auto":"Auto decide","acp.mode.autoDesc":"The AI decides whether to approve","acp.emptyDescription":"Type a message to start chatting with the ACP agent","acp.inputPlaceholder":"Message Saluzi…","acp.waitingPlaceholder":"Waiting for session...","chat.fileMatchHint":"File matches {query} — ↑↓ to select, Enter to insert","chat.picker.image":"Images","chat.picker.textFile":"Text files","chat.picker.sheet":"Spreadsheets","chat.picker.directory":"Directories","chat.commandList":"Command list","chat.processingFile":"Processing files…","chat.queued":"{n} messages queued — sent automatically when the turn completes","chat.queuedCancel":" (click to cancel all)","chat.inputHint":"Enter to send, Shift+Enter for a new line","chat.inputHintSuffix":", / for commands, @ completes file paths","chat.fileCount":"{n} files","chat.directory":"Directory","chat.noCommands":"No matching commands","chat.cmdDone":"Command executed · type a message to continue","chat.live.working":"Working","chat.live.running":"Running","plan.title":"Plan","plan.priority.high":"High","plan.priority.medium":"Medium","plan.priority.low":"Low","tool.newFile":"New file","tool.callTimes":"{name} ×{n}","tool.summaryCalls":"{n} tool calls","tool.summaryTools":"{n} tools: {names}","usage.context":"Context: {used} / {size} tokens","usage.totalCost":"Total cost: {cost}","diff.aria":"Diff preview for {path}, {added} additions, {removed} deletions","diff.hidden":"… {n} more lines hidden","diff.addedLine":"Added line: {text}","diff.removedLine":"Removed line: {text}","common.emptyTitle":"No messages yet","common.emptyDescription":"Start a conversation to see messages here","message.rewindHere":"Rewind here (conversation and files)","message.rewindEdit":"Rewind and edit this message","message.expand":"Expand"},sl="rcs_locale";function Lh(){try{const t=localStorage.getItem(sl);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Ls=Lh();const Yr=new Set;function fv(e){Ls=e;try{localStorage.setItem(sl,e)}catch{}Yr.forEach(t=>t())}function Fh(e){return Yr.add(e),()=>{Yr.delete(e)}}function nn(){return p.useSyncExternalStore(Fh,()=>Ls)}function G(e){return Ls==="en"?Oh[e]??Io[e]??e:Io[e]??e}function Se(e,t){let n=G(e);for(const[s,r]of Object.entries(t))n=n.split(`{${s}}`).join(String(r));return n}function $h({className:e}){return d.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:Q("text-brand-mark",e),children:d.jsx("path",{d:"M7.8 1.6H12.2L12.4 7.6L18.4 7.8V12.2L12.4 12.4L12.2 18.4H7.8L7.6 12.4L1.6 12.2V7.8L7.6 7.6ZM10 7.4L12.6 10L10 12.6L7.4 10Z",fill:"currentColor",fillRule:"evenodd"})})}const Uh="";let Yn=null;function zh(e){Yn=e}function mv(){return Yn}let Xr=null;function Do(e){Xr=e}let an=null;async function Hh(){return an||(an=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{an=null}})(),an)}class _r extends Error{constructor(n,s,r){super(n);se(this,"type");se(this,"status");this.name="ApiError",this.type=s,this.status=r}}async function ae(e,t,n,s){const r={"Content-Type":"application/json"};Yn&&(r.Authorization=`Bearer ${Yn}`);const o=`${Uh}${t}`,a={method:e,headers:r,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(o,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!s&&await Hh())return ae(e,t,n,!0);Xr&&Xr()}let m;try{m=await i.json()}catch{throw i.ok?new _r("Invalid JSON response","parse_error",i.status):new _r(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new _r(c,l,i.status)}return m}function pv(){return ae("GET","/web/sessions")}function hv(){return ae("GET","/web/sessions/all")}function gv(e){return ae("GET",`/web/sessions/${e}`)}function bv(e){return ae("GET",`/web/sessions/${e}/history`)}function xv(e){return ae("GET",`/web/sessions/${e}/models`)}function yv(){return ae("GET","/web/environments")}function vv(e,t=20){const n=encodeURIComponent(e);return ae("GET",`/web/search?q=${n}&limit=${t}`)}function wv(e,t){return ae("POST",`/web/sessions/${e}/events`,t)}function Sv(e,t){return ae("POST",`/web/sessions/${e}/rewind`,{target_event_id:t})}function Cv(e,t){return ae("POST",`/web/sessions/${e}/control`,t)}function kv(e){return ae("POST",`/web/sessions/${e}/interrupt`)}function Ev(e){return ae("DELETE",`/web/sessions/${e}`)}function Av(e){return ae("POST",`/web/sessions/${e}/clear`)}function Tv(e,t){return ae("PATCH",`/web/sessions/${e}`,{title:t})}function _v(e){return ae("POST","/web/sessions",e)}function Rv(e){return ae("GET",`/web/sessions/s/${e}`)}function Mv(e){return ae("GET",`/web/sessions/${e}/shares`)}function Nv(e,t){return ae("POST",`/web/sessions/${e}/shares`,t)}function jv(e,t){return ae("DELETE",`/web/sessions/${e}/shares/${t}`)}function Pv(e,t){return ae("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Iv(e,t){return ae("DELETE",`/web/teams/${e}/environments/${t}`)}function Dv(e){return ae("POST","/web/environments/claim",{claim_token:e})}function Ov(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),s=n?`?${n}`:"";return ae("GET",`/web/artifacts${s}`)}function Lv(e){return ae("GET",`/web/artifacts/${e}`)}function Fv(e){return ae("POST","/web/artifacts",e)}function $v(e){return ae("DELETE",`/web/artifacts/${e}`)}function Uv(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope),e!=null&&e.type&&t.set("type",e.type);const n=t.toString(),s=n?`?${n}`:"";return ae("GET",`/web/memories${s}`)}function zv(e){return ae("GET",`/web/memories/${e}`)}function Hv(e){return ae("POST","/web/memories",e)}function Bv(e,t){return ae("PATCH",`/web/memories/${e}`,t)}function Wv(e){return ae("DELETE",`/web/memories/${e}`)}function Gv(e,t){return ae("POST",`/web/memories/${e}/promote`,{team_id:t})}function Vv(){return ae("GET","/web/memory/status")}function qv(e){const t=e?`?scope=${e}`:"";return ae("GET",`/web/memory/list${t}`)}function Kv(e){return ae("GET",`/web/memory/file?path=${encodeURIComponent(e)}`)}function Yv(e,t){return ae("PUT","/web/memory/file",{path:e,content:t})}function Xv(e){return ae("DELETE",`/web/memory/file?path=${encodeURIComponent(e)}`)}function Qv(e){return ae("POST","/web/memory/promote",{path:e})}function Jv(e){return ae("POST","/web/memory/create",e)}function Zv(e){return ae("GET",`/web/memory/search?q=${encodeURIComponent(e)}`)}function ew(e,t){const n=new URLSearchParams;return n.set("q",e),n.set("top_k",String(t)),ae("GET",`/web/memory/recall-test?${n.toString()}`)}function tw(){return ae("GET","/web/memory/governance")}const Qr="rcs_active_team",Jr="__all_teams__";function Bh(e){return e===Jr}function Wh(){try{return localStorage.getItem(Qr)}catch{return null}}let ol=Wh();const Zr=new Set;function Gh(){for(const e of Zr)e()}function Vh(e){return Zr.add(e),()=>Zr.delete(e)}function qh(){return ol}function Tt(e){try{e?localStorage.setItem(Qr,e):localStorage.removeItem(Qr)}catch{}ol=e,Gh()}let In=null;function Kh(){return In||(In=ae("GET","/web/teams").finally(()=>{In=null})),In}function Yh(){const[e,t]=p.useState([]),[n,s]=p.useState(!0),r=p.useSyncExternalStore(Vh,qh,()=>null),o=p.useCallback(async()=>{s(!0);try{const l=await Kh();t(l)}catch{t([])}finally{s(!1)}},[]);p.useEffect(()=>{o()},[o]);const a=e.find(l=>l.id===r)||null,i=Bh(r),m=p.useCallback(l=>{Tt(l)},[]),f=p.useCallback(async l=>{const c=await ae("POST","/web/teams",l);return await o(),c},[o]);return{myTeams:e,activeTeam:a,activeTeamId:r,isAllTeams:i,isLoading:n,switchTeam:m,createTeam:f,refetch:o}}function Xh({className:e}){nn();const{myTeams:t,activeTeam:n,isAllTeams:s,switchTeam:r,isLoading:o}=Yh();return o||t.length===0?null:d.jsxs("div",{className:Q("group relative min-w-0",e),children:[d.jsxs("select",{"aria-label":G("team.switcher.label"),className:"max-w-[7.5rem] cursor-pointer appearance-none truncate rounded-md bg-transparent py-1.5 pl-2 pr-6 text-sm text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1 sm:max-w-[11rem] sm:pl-3",value:s?Jr:(n==null?void 0:n.id)||"",onChange:a=>{const i=a.target.value;r(i||null)},children:[d.jsx("option",{value:Jr,children:G("team.switcher.all")}),d.jsx("option",{value:"",children:G("team.switcher.personal")}),t.map(a=>d.jsx("option",{value:a.id,children:a.name},a.id))]}),d.jsx(Qd,{className:"pointer-events-none absolute right-1.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-text-muted transition-colors group-hover:text-text-primary"})]})}const al=p.createContext(null);function il(){const e=p.useContext(al);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function zt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function Qh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function Jh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).singleUser===!0:!1}catch{return!1}}async function Dn(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function Zh({children:e}){const[t,n]=p.useState(null),[s,r]=p.useState(!0),[o,a]=p.useState(!0),[i,m]=p.useState(!1);p.useEffect(()=>{let w=!1;return zt().then(y=>{w||(n(y),r(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(y=>y.json()).then(y=>{w||a(y.allowed===!0)}).catch(()=>{}),Jh().then(y=>{w||m(y)}),Do(()=>{n(null),Tt(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{w=!0,Do(null)}},[]);const f=p.useCallback(async(w,y)=>{const T=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:y})});if(!T.ok){const k=await Dn(T);throw new Error(k.error||"Login failed")}const A=await zt();n(A),Tt(null)},[]),l=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Tt(null)},[]),c=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const y=await zt();return n(y),!0}catch{return!1}},[]),u=p.useCallback(async(w,y,T)=>{const A=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:w,username:y,password:T})});if(!A.ok){const O=await Dn(A);throw new Error(O.error||"Setup failed")}const k=await zt();n(k),Tt(null)},[]),h=p.useCallback(async(w,y,T)=>{const A=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:w,username:y,password:T})});if(!A.ok){const O=await Dn(A);throw new Error(O.error||"Join failed")}const k=await zt();n(k),Tt(null)},[]),b=p.useCallback(async(w,y)=>{const T=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:y})});if(!T.ok){const k=await Dn(T);throw new Error(k.error||"Registration failed")}const A=await zt();n(A),Tt(null)},[]),v=p.useCallback(async()=>Qh(),[]);return d.jsx(al.Provider,{value:{user:t,isLoading:s,login:f,logout:l,refresh:c,setup:u,join:h,register:b,checkSetupStatus:v,registrationAllowed:o,singleUserMode:i},children:e})}function eg({onSettingsClick:e,compact:t}){const{user:n,logout:s}=il();if(!n)return null;const r=async()=>{await s(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return d.jsxs(tl,{children:[d.jsx(nl,{asChild:!0,children:d.jsxs("button",{type:"button",className:Q("flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",t&&"py-1"),title:n.username,children:[d.jsx("div",{className:Q("flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand-text",t&&"h-5 w-5"),children:d.jsx(Oa,{className:"h-3.5 w-3.5"})}),d.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:n.username})]})}),d.jsxs(rl,{align:"end",className:"w-48",children:[d.jsx(Ph,{children:d.jsxs("div",{className:"flex flex-col space-y-0.5",children:[d.jsx("span",{className:"text-sm font-medium",children:n.username}),d.jsx("span",{className:"text-xs text-muted-foreground",children:n.role})]})}),d.jsx(Po,{}),d.jsxs(Ln,{onClick:e,children:[d.jsx(Pu,{className:"mr-2 h-4 w-4"}),G("user.menu.settings")]}),d.jsxs(Ln,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[d.jsx(qu,{className:"mr-2 h-4 w-4"}),G("team.menu.myTeams")]}),d.jsx(Po,{}),d.jsxs(Ln,{onClick:r,children:[d.jsx(pu,{className:"mr-2 h-4 w-4"}),G("user.menu.logout")]})]})]})}function tg({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:s,onNavigateArtifacts:r,onNavigateMemories:o}){return nn(),d.jsx("nav",{className:"sticky top-0 z-40 border-b border-nav-rule bg-surface-1/80 backdrop-blur-md",children:d.jsxs("div",{className:e?"mx-auto page-measure flex h-11 sm:h-12 items-center justify-between px-4 sm:px-8":"ds-nav-bleed flex h-11 sm:h-12 items-center justify-between",children:[d.jsx("div",{className:"ds-nav-brand flex items-center gap-2 min-w-0",children:e?d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[d.jsx(Kd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("nav.dashboard")})]}),d.jsx("span",{className:"text-text-muted/40",children:"/"}),d.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&d.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand-text flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[d.jsx($h,{className:"h-5 w-5 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:G("nav.remoteControl")})]}),d.jsx(Xh,{className:"ml-1 sm:ml-2"})]})}),d.jsxs("div",{className:"ds-nav-actions flex items-center gap-0.5 sm:gap-1",children:[!e&&d.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:G("nav.dashboard"),children:[d.jsx(uu,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("nav.dashboard")})]}),r&&d.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("artifacts.title"),children:[d.jsx(ou,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("artifacts.title")})]}),o&&d.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("memories.title"),children:[d.jsx(_a,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:G("memories.title")})]}),d.jsx(Dh,{}),d.jsx(eg,{onSettingsClick:s??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}const ng={running:{pill:"bg-status-running/15 text-status-running font-medium",dot:"bg-status-running pulse-dot"},active:{pill:"bg-status-active/15 text-status-active",dot:"bg-status-active"},idle:{pill:"bg-surface-2 text-text-muted"},requires_action:{pill:"bg-status-warning/15 text-status-warning",dot:"bg-status-warning"},error:{pill:"bg-status-error/15 text-status-error",dot:"bg-status-error"},inactive:{pill:"bg-surface-3 text-text-muted"},archived:{pill:"bg-surface-3 text-text-muted"}};function nw({status:e}){const t=ng[e];return d.jsxs("span",{className:Q("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs",t?t.pill:"bg-surface-3 text-text-secondary"),children:[(t==null?void 0:t.dot)&&d.jsx("span",{className:Q("h-1.5 w-1.5 rounded-full",t.dot)}),e]})}function rg(e){const t=new TextEncoder().encode(e);let n="";for(const r of t)n+=String.fromCharCode(r);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class ll extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ht=class ht{constructor(t){se(this,"ws",null);se(this,"settings");se(this,"connectionState","disconnected");se(this,"sessionId",null);se(this,"_agentCapabilities",null);se(this,"_promptCapabilities",null);se(this,"_modelState",null);se(this,"_availableCommands",[]);se(this,"_usage",null);se(this,"_currentModeId",null);se(this,"_configOptions",[]);se(this,"onModelChanged",new Set);se(this,"onModelStateChanged",new Set);se(this,"onUsageChanged",new Set);se(this,"onCurrentModeChanged",new Set);se(this,"onConfigOptionsChanged",new Set);se(this,"onAvailableCommandsChanged",null);se(this,"onSessionLoaded",null);se(this,"onSessionSwitching",null);se(this,"onConnectionStateChange",new Set);se(this,"onSessionUpdate",null);se(this,"onSessionCreated",null);se(this,"onPromptComplete",null);se(this,"onPermissionRequest",null);se(this,"onBrowserToolCall",null);se(this,"onErrorMessage",null);se(this,"onSessionDeleted",null);se(this,"onSessionRenamed",null);se(this,"pendingSessionList",null);se(this,"pendingSessionLoad",null);se(this,"pendingSessionResume",null);se(this,"pendingSessionTarget",null);se(this,"connectResolve",null);se(this,"connectReject",null);se(this,"heartbeatInterval",null);se(this,"heartbeatTimeout",null);se(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const s of this.onConnectionStateChange)s(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,s,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(s=this._agentCapabilities)==null?void 0:s.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,s,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(s=this._agentCapabilities)==null?void 0:s.sessionCapabilities)==null?void 0:r.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const s=new WebSocket(this.settings.proxyUrl,this.settings.token?[rg(this.settings.token)]:void 0);this.ws=s,s.onopen=()=>{if(this.ws!==s){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),s.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},s.onmessage=r=>{if(this.ws===s)try{const o=JSON.parse(r.data);this.handleResponse(o)}catch(o){console.error("[ACPClient] Failed to parse message:",o)}},s.onerror=()=>{var r;this.ws===s&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},s.onclose=r=>{if(this.ws===s){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const o=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",o),this.connectReject(new Error(o)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(s){this.setState("error",s.message),n(s)}})}handleResponse(t){var n,s,r,o,a,i,m,f,l,c,u,h,b;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((s=t.payload)==null?void 0:s.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(o=this.onSessionCreated)==null||o.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const w=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",w,"payload:",t.payload),w==="available_commands_update")this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(w==="usage_update"){this._usage=t.payload.update;for(const y of this.onUsageChanged)y(this._usage)}else if(w==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const y of this.onCurrentModeChanged)y(this._currentModeId)}else if(w==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const y of this.onConfigOptionsChanged)y(this._configOptions)}(u=this.onSessionUpdate)==null||u.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(b=this.onPermissionRequest)==null||b.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const y of this.onModelChanged)y(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const s=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:s})}catch(s){console.error("[ACPClient] Browser tool error:",s),this.send({type:"browser_tool_result",callId:t,result:{error:s.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=ht.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},ht.PONG_TIMEOUT_MS)},ht.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const s=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:s,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const s=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:s}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,s)=>{const r=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,s(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:s,timer:r};try{this.send({type:"list_sessions",payload:t})}catch(o){clearTimeout(r),this.pendingSessionList=null,s(o)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,s)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,s(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:s,timer:r};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionLoad=null,s(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,s)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,s(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:s,timer:r};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionResume=null,s(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new ll),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const s of this.onModelStateChanged)s(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};se(ht,"HEARTBEAT_INTERVAL_MS",3e4),se(ht,"PONG_TIMEOUT_MS",1e4),se(ht,"MAX_MISSED_PONGS",2);let es=ht;function sg(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(s){if(s!=="default"&&!(s in e)){var r=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:function(){return n[s]}})}}))})),Object.freeze(e)}function cl(e,t){return new Promise((function(n,s){let r;return og(e).then((function(o){try{return r=o,n(new Blob([t.slice(0,2),r,t.slice(2)],{type:"image/jpeg"}))}catch(a){return s(a)}}),s)}))}const og=e=>new Promise(((t,n)=>{const s=new FileReader;s.addEventListener("load",(({target:{result:r}})=>{const o=new DataView(r);let a=0;if(o.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=o.getUint16(a);if(i===65498)break;const m=o.getUint16(a+2);if(i===65505&&o.getUint32(a+4)===1165519206){const f=a+10;let l;switch(o.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=o.getUint32(f+4,l),u=f+c+2+12*o.getUint16(f+c,l);for(let h=f+c+2;h<u;h+=12)if(o.getUint16(h,l)==274){if(o.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(o.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");o.setUint16(h+8,1,l);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),s.readAsArrayBuffer(e)}));var Xn={},ag={get exports(){return Xn},set exports(e){Xn=e}};(function(e){var t,n,s={};ag.exports=s,s.parse=function(r,o){for(var a=s.bin.readUshort,i=s.bin.readUint,m=0,f={},l=new Uint8Array(r),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var u=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),b=i(l,m+=4);m+=4,m=b;for(var v=0;v<u;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var w=i(l,m+=4),y=a(l,m+=4),T=a(l,m+2),A=a(l,m+4);m+=6;var k=i(l,m+=8);m+=4,m+=y+T+A,s._readLocal(l,k,f,h,w,o)}return f},s._readLocal=function(r,o,a,i,m,f){var l=s.bin.readUshort,c=s.bin.readUint;c(r,o),l(r,o+=4),l(r,o+=2);var u=l(r,o+=2);c(r,o+=2),c(r,o+=4),o+=4;var h=l(r,o+=8),b=l(r,o+=2);o+=2;var v=s.bin.readUTF8(r,o,h);if(o+=h,o+=b,f)a[v]={size:m,csize:i};else{var w=new Uint8Array(r.buffer,o);if(u==0)a[v]=new Uint8Array(w.buffer.slice(o,o+i));else{if(u!=8)throw"unknown compression method: "+u;var y=new Uint8Array(m);s.inflateRaw(w,y),a[v]=y}}},s.inflateRaw=function(r,o){return s.F.inflate(r,o)},s.inflate=function(r,o){return r[0],r[1],s.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),o)},s.deflate=function(r,o){o==null&&(o={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=s.F.deflateRaw(r,i,a,o.level);var m=s.adler(r,0,r.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},s.deflateRaw=function(r,o){o==null&&(o={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=s.F.deflateRaw(r,a,i,o.level);return new Uint8Array(a.buffer,0,i)},s.encode=function(r,o){o==null&&(o=!1);var a=0,i=s.bin.writeUint,m=s.bin.writeUshort,f={};for(var l in r){var c=!s._noNeed(l)&&!o,u=r[l],h=s.crc.crc(u,0,u.length);f[l]={cpr:c,usize:u.length,crc:h,file:c?s.deflateRaw(u):u}}for(var l in f)a+=f[l].file.length+30+46+2*s.bin.sizeUTF8(l);a+=22;var b=new Uint8Array(a),v=0,w=[];for(var l in f){var y=f[l];w.push(v),v=s._writeHeader(b,v,l,y,0)}var T=0,A=v;for(var l in f)y=f[l],w.push(v),v=s._writeHeader(b,v,l,y,1,w[T++]);var k=v-A;return i(b,v,101010256),v+=4,m(b,v+=4,T),m(b,v+=2,T),i(b,v+=2,k),i(b,v+=4,A),v+=4,v+=2,b.buffer},s._noNeed=function(r){var o=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},s._writeHeader=function(r,o,a,i,m,f){var l=s.bin.writeUint,c=s.bin.writeUshort,u=i.file;return l(r,o,m==0?67324752:33639248),o+=4,m==1&&(o+=2),c(r,o,20),c(r,o+=2,0),c(r,o+=2,i.cpr?8:0),l(r,o+=2,0),l(r,o+=4,i.crc),l(r,o+=4,u.length),l(r,o+=4,i.usize),c(r,o+=4,s.bin.sizeUTF8(a)),c(r,o+=2,0),o+=2,m==1&&(o+=2,o+=2,l(r,o+=6,f),o+=4),o+=s.bin.writeUTF8(r,o,a),m==0&&(r.set(u,o),o+=u.length),o},s.crc={table:(function(){for(var r=new Uint32Array(256),o=0;o<256;o++){for(var a=o,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[o]=a}return r})(),update:function(r,o,a,i){for(var m=0;m<i;m++)r=s.crc.table[255&(r^o[a+m])]^r>>>8;return r},crc:function(r,o,a){return 4294967295^s.crc.update(4294967295,r,o,a)}},s.adler=function(r,o,a){for(var i=1,m=0,f=o,l=o+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=r[f++];i%=65521,m%=65521}return m<<16|i},s.bin={readUshort:function(r,o){return r[o]|r[o+1]<<8},writeUshort:function(r,o,a){r[o]=255&a,r[o+1]=a>>8&255},readUint:function(r,o){return 16777216*r[o+3]+(r[o+2]<<16|r[o+1]<<8|r[o])},writeUint:function(r,o,a){r[o]=255&a,r[o+1]=a>>8&255,r[o+2]=a>>16&255,r[o+3]=a>>24&255},readASCII:function(r,o,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(r[o+m]);return i},writeASCII:function(r,o,a){for(var i=0;i<a.length;i++)r[o+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,o,a){for(var i,m="",f=0;f<a;f++)m+="%"+s.bin.pad(r[o+f].toString(16));try{i=decodeURIComponent(m)}catch{return s.bin.readASCII(r,o,a)}return i},writeUTF8:function(r,o,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)r[o+m]=l,m++;else if((4294965248&l)==0)r[o+m]=192|l>>6,r[o+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)r[o+m]=224|l>>12,r[o+m+1]=128|l>>6&63,r[o+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";r[o+m]=240|l>>18,r[o+m+1]=128|l>>12&63,r[o+m+2]=128|l>>6&63,r[o+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(r){for(var o=r.length,a=0,i=0;i<o;i++){var m=r.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},s.F={},s.F.deflateRaw=function(r,o,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=s.F.U,l=s.F._goodIndex;s.F._hash;var c=s.F._putsE,u=0,h=a<<3,b=0,v=r.length;if(i==0){for(;u<v;)c(o,h,u+(I=Math.min(65535,v-u))==v?1:0),h=s.F._copyExact(r,u,I,o,h+8),u+=I;return h>>>3}var w=f.lits,y=f.strt,T=f.prev,A=0,k=0,O=0,E=0,_=0,g=0;for(v>2&&(y[g=s.F._hash(r,0)]=0),u=0;u<v;u++){if(_=g,u+1<v-2){g=s.F._hash(r,u+1);var x=u+1&32767;T[x]=y[g],y[g]=x}if(b<=u){(A>14e3||k>26697)&&v-u>100&&(b<u&&(w[A]=u-b,A+=2,b=u),h=s.F._writeBlock(u==v-1||b==v?1:0,w,A,E,r,O,u-O,o,h),A=k=E=0,O=u);var M=0;u<v-2&&(M=s.F._bestMatch(r,u,T,_,Math.min(m[2],v-u),m[3]));var I=M>>>16,D=65535&M;if(M!=0){D=65535&M;var F=l(I=M>>>16,f.of0);f.lhst[257+F]++;var j=l(D,f.df0);f.dhst[j]++,E+=f.exb[F]+f.dxb[j],w[A]=I<<23|u-b,w[A+1]=D<<16|F<<8|j,A+=2,b=u+I}else f.lhst[r[u]]++;k++}}for(O==u&&r.length!=0||(b<u&&(w[A]=u-b,A+=2,b=u),h=s.F._writeBlock(1,w,A,E,r,O,u-O,o,h),A=0,k=0,A=k=E=0,O=u);(7&h)!=0;)h++;return h>>>3},s.F._bestMatch=function(r,o,a,i,m,f){var l=32767&o,c=a[l],u=l-c+32768&32767;if(c==l||i!=s.F._hash(r,o-u))return 0;for(var h=0,b=0,v=Math.min(32767,o);u<=v&&--f!=0&&c!=l;){if(h==0||r[o+h]==r[o+h-u]){var w=s.F._howLong(r,o,u);if(w>h){if(b=u,(h=w)>=m)break;u+2<w&&(w=u+2);for(var y=0,T=0;T<w-2;T++){var A=o-u+T+32768&32767,k=A-a[A]+32768&32767;k>y&&(y=k,c=A)}}}u+=(l=c)-(c=a[l])+32768&32767}return h<<16|b},s.F._howLong=function(r,o,a){if(r[o]!=r[o-a]||r[o+1]!=r[o+1-a]||r[o+2]!=r[o+2-a])return 0;var i=o,m=Math.min(r.length,o+258);for(o+=3;o<m&&r[o]==r[o-a];)o++;return o-i},s.F._hash=function(r,o){return(r[o]<<8|r[o+1])+(r[o+2]<<4)&65535},s.saved=0,s.F._writeBlock=function(r,o,a,i,m,f,l,c,u){var h,b,v,w,y,T,A,k,O,E=s.F.U,_=s.F._putsF,g=s.F._putsE;E.lhst[256]++,b=(h=s.F.getTrees())[0],v=h[1],w=h[2],y=h[3],T=h[4],A=h[5],k=h[6],O=h[7];var x=32+((u+3&7)==0?0:8-(u+3&7))+(l<<3),M=i+s.F.contSize(E.fltree,E.lhst)+s.F.contSize(E.fdtree,E.dhst),I=i+s.F.contSize(E.ltree,E.lhst)+s.F.contSize(E.dtree,E.dhst);I+=14+3*A+s.F.contSize(E.itree,E.ihst)+(2*E.ihst[16]+3*E.ihst[17]+7*E.ihst[18]);for(var D=0;D<286;D++)E.lhst[D]=0;for(D=0;D<30;D++)E.dhst[D]=0;for(D=0;D<19;D++)E.ihst[D]=0;var F=x<M&&x<I?0:M<I?1:2;if(_(c,u,r),_(c,u+1,F),u+=3,F==0){for(;(7&u)!=0;)u++;u=s.F._copyExact(m,f,l,c,u)}else{var j,z;if(F==1&&(j=E.fltree,z=E.fdtree),F==2){s.F.makeCodes(E.ltree,b),s.F.revCodes(E.ltree,b),s.F.makeCodes(E.dtree,v),s.F.revCodes(E.dtree,v),s.F.makeCodes(E.itree,w),s.F.revCodes(E.itree,w),j=E.ltree,z=E.dtree,g(c,u,y-257),g(c,u+=5,T-1),g(c,u+=5,A-4),u+=4;for(var C=0;C<A;C++)g(c,u+3*C,E.itree[1+(E.ordr[C]<<1)]);u+=3*A,u=s.F._codeTiny(k,E.itree,c,u),u=s.F._codeTiny(O,E.itree,c,u)}for(var S=f,H=0;H<a;H+=2){for(var P=o[H],U=P>>>23,Y=S+(8388607&P);S<Y;)u=s.F._writeLit(m[S++],j,c,u);if(U!=0){var N=o[H+1],L=N>>16,$=N>>8&255,R=255&N;g(c,u=s.F._writeLit(257+$,j,c,u),U-E.of0[$]),u+=E.exb[$],_(c,u=s.F._writeLit(R,z,c,u),L-E.df0[R]),u+=E.dxb[R],S+=U}}u=s.F._writeLit(256,j,c,u)}return u},s.F._copyExact=function(r,o,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(r.buffer,o,a),f),m+(a+4<<3)},s.F.getTrees=function(){for(var r=s.F.U,o=s.F._hufTree(r.lhst,r.ltree,15),a=s.F._hufTree(r.dhst,r.dtree,15),i=[],m=s.F._lenCodes(r.ltree,i),f=[],l=s.F._lenCodes(r.dtree,f),c=0;c<i.length;c+=2)r.ihst[i[c]]++;for(c=0;c<f.length;c+=2)r.ihst[f[c]]++;for(var u=s.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[o,a,u,m,l,h,i,f]},s.F.getSecond=function(r){for(var o=[],a=0;a<r.length;a+=2)o.push(r[a+1]);return o},s.F.nonZero=function(r){for(var o="",a=0;a<r.length;a+=2)r[a+1]!=0&&(o+=(a>>1)+",");return o},s.F.contSize=function(r,o){for(var a=0,i=0;i<o.length;i++)a+=o[i]*r[1+(i<<1)];return a},s.F._codeTiny=function(r,o,a,i){for(var m=0;m<r.length;m+=2){var f=r[m],l=r[m+1];i=s.F._writeLit(f,o,a,i);var c=f==16?2:f==17?3:7;f>15&&(s.F._putsE(a,i,l,c),i+=c)}return i},s.F._lenCodes=function(r,o){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=r[i+1],f=i+3<a?r[i+3]:-1,l=i+5<a?r[i+5]:-1,c=i==0?-1:r[i-1];if(m==0&&f==m&&l==m){for(var u=i+5;u+2<a&&r[u+2]==m;)u+=2;(h=Math.min(u+1-i>>>1,138))<11?o.push(17,h-3):o.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(u=i+5;u+2<a&&r[u+2]==m;)u+=2;var h=Math.min(u+1-i>>>1,6);o.push(16,h-3),i+=2*h-2}else o.push(m,0)}return a>>>1},s.F._hufTree=function(r,o,a){var i=[],m=r.length,f=o.length,l=0;for(l=0;l<f;l+=2)o[l]=0,o[l+1]=0;for(l=0;l<m;l++)r[l]!=0&&i.push({lit:l,f:r[l]});var c=i.length,u=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return u=h==0?1:0,o[1+(h<<1)]=1,o[1+(u<<1)]=1,1}i.sort((function(k,O){return k.f-O.f}));var b=i[0],v=i[1],w=0,y=1,T=2;for(i[0]={lit:-1,f:b.f+v.f,l:b,r:v,d:0};y!=c-1;)b=w!=y&&(T==c||i[w].f<i[T].f)?i[w++]:i[T++],v=w!=y&&(T==c||i[w].f<i[T].f)?i[w++]:i[T++],i[y++]={lit:-1,f:b.f+v.f,l:b,r:v};var A=s.F.setDepth(i[y-1],0);for(A>a&&(s.F.restrictDepth(u,a,A),A=a),l=0;l<c;l++)o[1+(u[l].lit<<1)]=u[l].d;return A},s.F.setDepth=function(r,o){return r.lit!=-1?(r.d=o,o):Math.max(s.F.setDepth(r.l,o+1),s.F.setDepth(r.r,o+1))},s.F.restrictDepth=function(r,o,a){var i=0,m=1<<a-o,f=0;for(r.sort((function(c,u){return u.d==c.d?c.f-u.f:u.d-c.d})),i=0;i<r.length&&r[i].d>o;i++){var l=r[i].d;r[i].d=o,f+=m-(1<<a-l)}for(f>>>=a-o;f>0;)(l=r[i].d)<o?(r[i].d++,f-=1<<o-l-1):i++;for(;i>=0;i--)r[i].d==o&&f<0&&(r[i].d--,f++);f!=0&&console.log("debt left")},s.F._goodIndex=function(r,o){var a=0;return o[16|a]<=r&&(a|=16),o[8|a]<=r&&(a|=8),o[4|a]<=r&&(a|=4),o[2|a]<=r&&(a|=2),o[1|a]<=r&&(a|=1),a},s.F._writeLit=function(r,o,a,i){return s.F._putsF(a,i,o[r<<1]),i+o[1+(r<<1)]},s.F.inflate=function(r,o){var a=Uint8Array;if(r[0]==3&&r[1]==0)return o||new a(0);var i=s.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,u=i.codes2map,h=i._get17,b=i.U,v=o==null;v&&(o=new a(r.length>>>2<<3));for(var w,y,T=0,A=0,k=0,O=0,E=0,_=0,g=0,x=0,M=0;T==0;)if(T=m(r,M,1),A=m(r,M+1,2),M+=3,A!=0){if(v&&(o=s.F._check(o,x+(1<<17))),A==1&&(w=b.flmap,y=b.fdmap,_=511,g=31),A==2){k=f(r,M,5)+257,O=f(r,M+5,5)+1,E=f(r,M+10,4)+4,M+=14;for(var I=0;I<38;I+=2)b.itree[I]=0,b.itree[I+1]=0;var D=1;for(I=0;I<E;I++){var F=f(r,M+3*I,3);b.itree[1+(b.ordr[I]<<1)]=F,F>D&&(D=F)}M+=3*E,c(b.itree,D),u(b.itree,D,b.imap),w=b.lmap,y=b.dmap,M=l(b.imap,(1<<D)-1,k+O,r,M,b.ttree);var j=i._copyOut(b.ttree,0,k,b.ltree);_=(1<<j)-1;var z=i._copyOut(b.ttree,k,O,b.dtree);g=(1<<z)-1,c(b.ltree,j),u(b.ltree,j,w),c(b.dtree,z),u(b.dtree,z,y)}for(;;){var C=w[h(r,M)&_];M+=15&C;var S=C>>>4;if(!(S>>>8))o[x++]=S;else{if(S==256)break;var H=x+S-254;if(S>264){var P=b.ldef[S-257];H=x+(P>>>3)+f(r,M,7&P),M+=7&P}var U=y[h(r,M)&g];M+=15&U;var Y=U>>>4,N=b.ddef[Y],L=(N>>>4)+m(r,M,15&N);for(M+=15&N,v&&(o=s.F._check(o,x+(1<<17)));x<H;)o[x]=o[x++-L],o[x]=o[x++-L],o[x]=o[x++-L],o[x]=o[x++-L];x=H}}}else{(7&M)!=0&&(M+=8-(7&M));var $=4+(M>>>3),R=r[$-4]|r[$-3]<<8;v&&(o=s.F._check(o,x+R)),o.set(new a(r.buffer,r.byteOffset+$,R),x),M=$+R<<3,x+=R}return o.length==x?o:o.slice(0,x)},s.F._check=function(r,o){var a=r.length;if(o<=a)return r;var i=new Uint8Array(Math.max(a<<1,o));return i.set(r,0),i},s.F._decodeTiny=function(r,o,a,i,m,f){for(var l=s.F._bitsE,c=s.F._get17,u=0;u<a;){var h=r[c(i,m)&o];m+=15&h;var b=h>>>4;if(b<=15)f[u]=b,u++;else{var v=0,w=0;b==16?(w=3+l(i,m,2),m+=2,v=f[u-1]):b==17?(w=3+l(i,m,3),m+=3):b==18&&(w=11+l(i,m,7),m+=7);for(var y=u+w;u<y;)f[u]=v,u++}}return m},s.F._copyOut=function(r,o,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=r[f+o];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},s.F.makeCodes=function(r,o){for(var a,i,m,f,l=s.F.U,c=r.length,u=l.bl_count,h=0;h<=o;h++)u[h]=0;for(h=1;h<c;h+=2)u[r[h]]++;var b=l.next_code;for(a=0,u[0]=0,i=1;i<=o;i++)a=a+u[i-1]<<1,b[i]=a;for(m=0;m<c;m+=2)(f=r[m+1])!=0&&(r[m]=b[f],b[f]++)},s.F.codes2map=function(r,o,a){for(var i=r.length,m=s.F.U.rev15,f=0;f<i;f+=2)if(r[f+1]!=0)for(var l=f>>1,c=r[f+1],u=l<<4|c,h=o-c,b=r[f]<<h,v=b+(1<<h);b!=v;)a[m[b]>>>15-o]=u,b++},s.F.revCodes=function(r,o){for(var a=s.F.U.rev15,i=15-o,m=0;m<r.length;m+=2){var f=r[m]<<o-r[m+1];r[m]=a[f]>>>i}},s.F._putsE=function(r,o,a){a<<=7&o;var i=o>>>3;r[i]|=a,r[i+1]|=a>>>8},s.F._putsF=function(r,o,a){a<<=7&o;var i=o>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},s.F._bitsE=function(r,o,a){return(r[o>>>3]|r[1+(o>>>3)]<<8)>>>(7&o)&(1<<a)-1},s.F._bitsF=function(r,o,a){return(r[o>>>3]|r[1+(o>>>3)]<<8|r[2+(o>>>3)]<<16)>>>(7&o)&(1<<a)-1},s.F._get17=function(r,o){return(r[o>>>3]|r[1+(o>>>3)]<<8|r[2+(o>>>3)]<<16)>>>(7&o)},s.F._get25=function(r,o){return(r[o>>>3]|r[1+(o>>>3)]<<8|r[2+(o>>>3)]<<16|r[3+(o>>>3)]<<24)>>>(7&o)},s.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var r=s.F.U,o=0;o<32768;o++){var a=o;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,r.rev15[o]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(o=0;o<32;o++)r.ldef[o]=r.of0[o]<<3|r.exb[o],r.ddef[o]=r.df0[o]<<4|r.dxb[o];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),s.F.makeCodes(r.fltree,9),s.F.codes2map(r.fltree,9,r.flmap),s.F.revCodes(r.fltree,9),i(r.fdtree,32,5),s.F.makeCodes(r.fdtree,5),s.F.codes2map(r.fdtree,5,r.fdmap),s.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var ig=sg({__proto__:null,default:Xn},[Xn]);const Be=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,u){l[c]=u>>8&255,l[c+1]=255&u},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,u){l[c]=u>>24&255,l[c+1]=u>>16&255,l[c+2]=u>>8&255,l[c+3]=255&u},readASCII(l,c,u){let h="";for(let b=0;b<u;b++)h+=String.fromCharCode(l[c+b]);return h},writeASCII(l,c,u){for(let h=0;h<u.length;h++)l[c+h]=u.charCodeAt(h)},readBytes(l,c,u){const h=[];for(let b=0;b<u;b++)h.push(l[c+b]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,u){let h,b="";for(let v=0;v<u;v++)b+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(b)}catch{return e.readASCII(l,c,u)}return h}};function t(l,c,u,h){const b=c*u,v=o(h),w=Math.ceil(c*v/8),y=new Uint8Array(4*b),T=new Uint32Array(y.buffer),{ctype:A}=h,{depth:k}=h,O=e.readUshort;if(A==6){const P=b<<2;if(k==8)for(var E=0;E<P;E+=4)y[E]=l[E],y[E+1]=l[E+1],y[E+2]=l[E+2],y[E+3]=l[E+3];if(k==16)for(E=0;E<P;E++)y[E]=l[E<<1]}else if(A==2){const P=h.tabs.tRNS;if(P==null){if(k==8)for(E=0;E<b;E++){var _=3*E;T[E]=255<<24|l[_+2]<<16|l[_+1]<<8|l[_]}if(k==16)for(E=0;E<b;E++)_=6*E,T[E]=255<<24|l[_+4]<<16|l[_+2]<<8|l[_]}else{var g=P[0];const U=P[1],Y=P[2];if(k==8)for(E=0;E<b;E++){var x=E<<2;_=3*E,T[E]=255<<24|l[_+2]<<16|l[_+1]<<8|l[_],l[_]==g&&l[_+1]==U&&l[_+2]==Y&&(y[x+3]=0)}if(k==16)for(E=0;E<b;E++)x=E<<2,_=6*E,T[E]=255<<24|l[_+4]<<16|l[_+2]<<8|l[_],O(l,_)==g&&O(l,_+2)==U&&O(l,_+4)==Y&&(y[x+3]=0)}}else if(A==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,Y=U?U.length:0;if(k==1)for(var M=0;M<u;M++){var I=M*w,D=M*c;for(E=0;E<c;E++){x=D+E<<2;var F=3*(j=l[I+(E>>3)]>>7-((7&E)<<0)&1);y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255}}if(k==2)for(M=0;M<u;M++)for(I=M*w,D=M*c,E=0;E<c;E++)x=D+E<<2,F=3*(j=l[I+(E>>2)]>>6-((3&E)<<1)&3),y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255;if(k==4)for(M=0;M<u;M++)for(I=M*w,D=M*c,E=0;E<c;E++)x=D+E<<2,F=3*(j=l[I+(E>>1)]>>4-((1&E)<<2)&15),y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255;if(k==8)for(E=0;E<b;E++){var j;x=E<<2,F=3*(j=l[E]),y[x]=P[F],y[x+1]=P[F+1],y[x+2]=P[F+2],y[x+3]=j<Y?U[j]:255}}else if(A==4){if(k==8)for(E=0;E<b;E++){x=E<<2;var z=l[C=E<<1];y[x]=z,y[x+1]=z,y[x+2]=z,y[x+3]=l[C+1]}if(k==16)for(E=0;E<b;E++){var C;x=E<<2,z=l[C=E<<2],y[x]=z,y[x+1]=z,y[x+2]=z,y[x+3]=l[C+2]}}else if(A==0)for(g=h.tabs.tRNS?h.tabs.tRNS:-1,M=0;M<u;M++){const P=M*w,U=M*c;if(k==1)for(var S=0;S<c;S++){var H=(z=255*(l[P+(S>>>3)]>>>7-(7&S)&1))==255*g?0:255;T[U+S]=H<<24|z<<16|z<<8|z}else if(k==2)for(S=0;S<c;S++)H=(z=85*(l[P+(S>>>2)]>>>6-((3&S)<<1)&3))==85*g?0:255,T[U+S]=H<<24|z<<16|z<<8|z;else if(k==4)for(S=0;S<c;S++)H=(z=17*(l[P+(S>>>1)]>>>4-((1&S)<<2)&15))==17*g?0:255,T[U+S]=H<<24|z<<16|z<<8|z;else if(k==8)for(S=0;S<c;S++)H=(z=l[P+S])==g?0:255,T[U+S]=H<<24|z<<16|z<<8|z;else if(k==16)for(S=0;S<c;S++)z=l[P+(S<<1)],H=O(l,P+(S<<1))==g?0:255,T[U+S]=H<<24|z<<16|z<<8|z}return y}function n(l,c,u,h){const b=o(l),v=Math.ceil(u*b/8),w=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?r(c,w):s(c,w),l.interlace==0?c=a(c,l,0,u,h):l.interlace==1&&(c=(function(T,A){const k=A.width,O=A.height,E=o(A),_=E>>3,g=Math.ceil(k*E/8),x=new Uint8Array(O*g);let M=0;const I=[0,0,4,0,2,0,1],D=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],j=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const S=F[z],H=j[z];let P=0,U=0,Y=I[z];for(;Y<O;)Y+=S,U++;let N=D[z];for(;N<k;)N+=H,P++;const L=Math.ceil(P*E/8);a(T,A,M,P,U);let $=0,R=I[z];for(;R<O;){let B=D[z],V=M+$*L<<3;for(;B<k;){var C;if(E==1&&(C=(C=T[V>>3])>>7-(7&V)&1,x[R*g+(B>>3)]|=C<<7-((7&B)<<0)),E==2&&(C=(C=T[V>>3])>>6-(7&V)&3,x[R*g+(B>>2)]|=C<<6-((3&B)<<1)),E==4&&(C=(C=T[V>>3])>>4-(7&V)&15,x[R*g+(B>>1)]|=C<<4-((1&B)<<2)),E>=8){const q=R*g+B*_;for(let K=0;K<_;K++)x[q+K]=T[(V>>3)+K]}V+=E,B+=H}$++,R+=S}P*U!=0&&(M+=U*(1+L)),z+=1}return x})(c,l)),c}function s(l,c){return r(new Uint8Array(l.buffer,2,l.length-6),c)}var r=(function(){const l={H:{}};return l.H.N=function(c,u){const h=Uint8Array;let b,v,w=0,y=0,T=0,A=0,k=0,O=0,E=0,_=0,g=0;if(c[0]==3&&c[1]==0)return u||new h(0);const x=l.H,M=x.b,I=x.e,D=x.R,F=x.n,j=x.A,z=x.Z,C=x.m,S=u==null;for(S&&(u=new h(c.length>>>2<<5));w==0;)if(w=M(c,g,1),y=M(c,g+1,2),g+=3,y!=0){if(S&&(u=l.H.W(u,_+(1<<17))),y==1&&(b=C.J,v=C.h,O=511,E=31),y==2){T=I(c,g,5)+257,A=I(c,g+5,5)+1,k=I(c,g+10,4)+4,g+=14;let P=1;for(var H=0;H<38;H+=2)C.Q[H]=0,C.Q[H+1]=0;for(H=0;H<k;H++){const N=I(c,g+3*H,3);C.Q[1+(C.X[H]<<1)]=N,N>P&&(P=N)}g+=3*k,F(C.Q,P),j(C.Q,P,C.u),b=C.w,v=C.d,g=D(C.u,(1<<P)-1,T+A,c,g,C.v);const U=x.V(C.v,0,T,C.C);O=(1<<U)-1;const Y=x.V(C.v,T,A,C.D);E=(1<<Y)-1,F(C.C,U),j(C.C,U,b),F(C.D,Y),j(C.D,Y,v)}for(;;){const P=b[z(c,g)&O];g+=15&P;const U=P>>>4;if(!(U>>>8))u[_++]=U;else{if(U==256)break;{let Y=_+U-254;if(U>264){const B=C.q[U-257];Y=_+(B>>>3)+I(c,g,7&B),g+=7&B}const N=v[z(c,g)&E];g+=15&N;const L=N>>>4,$=C.c[L],R=($>>>4)+M(c,g,15&$);for(g+=15&$;_<Y;)u[_]=u[_++-R],u[_]=u[_++-R],u[_]=u[_++-R],u[_]=u[_++-R];_=Y}}}}else{(7&g)!=0&&(g+=8-(7&g));const P=4+(g>>>3),U=c[P-4]|c[P-3]<<8;S&&(u=l.H.W(u,_+U)),u.set(new h(c.buffer,c.byteOffset+P,U),_),g=P+U<<3,_+=U}return u.length==_?u:u.slice(0,_)},l.H.W=function(c,u){const h=c.length;if(u<=h)return c;const b=new Uint8Array(h<<1);return b.set(c,0),b},l.H.R=function(c,u,h,b,v,w){const y=l.H.e,T=l.H.Z;let A=0;for(;A<h;){const k=c[T(b,v)&u];v+=15&k;const O=k>>>4;if(O<=15)w[A]=O,A++;else{let E=0,_=0;O==16?(_=3+y(b,v,2),v+=2,E=w[A-1]):O==17?(_=3+y(b,v,3),v+=3):O==18&&(_=11+y(b,v,7),v+=7);const g=A+_;for(;A<g;)w[A]=E,A++}}return v},l.H.V=function(c,u,h,b){let v=0,w=0;const y=b.length>>>1;for(;w<h;){const T=c[w+u];b[w<<1]=0,b[1+(w<<1)]=T,T>v&&(v=T),w++}for(;w<y;)b[w<<1]=0,b[1+(w<<1)]=0,w++;return v},l.H.n=function(c,u){const h=l.H.m,b=c.length;let v,w,y,T;const A=h.j;for(var k=0;k<=u;k++)A[k]=0;for(k=1;k<b;k+=2)A[c[k]]++;const O=h.K;for(v=0,A[0]=0,w=1;w<=u;w++)v=v+A[w-1]<<1,O[w]=v;for(y=0;y<b;y+=2)T=c[y+1],T!=0&&(c[y]=O[T],O[T]++)},l.H.A=function(c,u,h){const b=c.length,v=l.H.m.r;for(let w=0;w<b;w+=2)if(c[w+1]!=0){const y=w>>1,T=c[w+1],A=y<<4|T,k=u-T;let O=c[w]<<k;const E=O+(1<<k);for(;O!=E;)h[v[O]>>>15-u]=A,O++}},l.H.l=function(c,u){const h=l.H.m.r,b=15-u;for(let v=0;v<c.length;v+=2){const w=c[v]<<u-c[v+1];c[v]=h[w]>>>b}},l.H.M=function(c,u,h){h<<=7&u;const b=u>>>3;c[b]|=h,c[b+1]|=h>>>8},l.H.I=function(c,u,h){h<<=7&u;const b=u>>>3;c[b]|=h,c[b+1]|=h>>>8,c[b+2]|=h>>>16},l.H.e=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8)>>>(7&u)&(1<<h)-1},l.H.b=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)&(1<<h)-1},l.H.Z=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)},l.H.i=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16|c[3+(u>>>3)]<<24)>>>(7&u)},l.H.m=(function(){const c=Uint16Array,u=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var u=0;u<32768;u++){let b=u;b=(2863311530&b)>>>1|(1431655765&b)<<1,b=(3435973836&b)>>>2|(858993459&b)<<2,b=(4042322160&b)>>>4|(252645135&b)<<4,b=(4278255360&b)>>>8|(16711935&b)<<8,c.r[u]=(b>>>16|b<<16)>>>17}function h(b,v,w){for(;v--!=0;)b.push(0,w)}for(u=0;u<32;u++)c.q[u]=c.S[u]<<3|c.T[u],c.c[u]=c.p[u]<<4|c.z[u];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function o(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,u,h,b){let v=o(c);const w=Math.ceil(h*v/8);let y,T;v=Math.ceil(v/8);let A=l[u],k=0;if(A>1&&(l[u]=[0,0,1][A-2]),A==3)for(k=v;k<w;k++)l[k+1]=l[k+1]+(l[k+1-v]>>>1)&255;for(let O=0;O<b;O++)if(y=u+O*w,T=y+O+1,A=l[T-1],k=0,A==0)for(;k<w;k++)l[y+k]=l[T+k];else if(A==1){for(;k<v;k++)l[y+k]=l[T+k];for(;k<w;k++)l[y+k]=l[T+k]+l[y+k-v]}else if(A==2)for(;k<w;k++)l[y+k]=l[T+k]+l[y+k-w];else if(A==3){for(;k<v;k++)l[y+k]=l[T+k]+(l[y+k-w]>>>1);for(;k<w;k++)l[y+k]=l[T+k]+(l[y+k-w]+l[y+k-v]>>>1)}else{for(;k<v;k++)l[y+k]=l[T+k]+i(0,l[y+k-w],0);for(;k<w;k++)l[y+k]=l[T+k]+i(l[y+k-v],l[y+k-w],l[y+k-v-w])}return l}function i(l,c,u){const h=l+c-u,b=h-l,v=h-c,w=h-u;return b*b<=v*v&&b*b<=w*w?l:v*v<=w*w?c:u}function m(l,c,u){u.width=e.readUint(l,c),c+=4,u.height=e.readUint(l,c),c+=4,u.depth=l[c],c++,u.ctype=l[c],c++,u.compress=l[c],c++,u.filter=l[c],c++,u.interlace=l[c],c++}function f(l,c,u,h,b,v,w,y,T){const A=Math.min(c,b),k=Math.min(u,v);let O=0,E=0;for(let z=0;z<k;z++)for(let C=0;C<A;C++)if(w>=0&&y>=0?(O=z*c+C<<2,E=(y+z)*b+w+C<<2):(O=(-y+z)*c-w+C<<2,E=z*b+C<<2),T==0)h[E]=l[O],h[E+1]=l[O+1],h[E+2]=l[O+2],h[E+3]=l[O+3];else if(T==1){var _=l[O+3]*.00392156862745098,g=l[O]*_,x=l[O+1]*_,M=l[O+2]*_,I=h[E+3]*(1/255),D=h[E]*I,F=h[E+1]*I,j=h[E+2]*I;const S=1-_,H=_+I*S,P=H==0?0:1/H;h[E+3]=255*H,h[E+0]=(g+D*S)*P,h[E+1]=(x+F*S)*P,h[E+2]=(M+j*S)*P}else if(T==2)_=l[O+3],g=l[O],x=l[O+1],M=l[O+2],I=h[E+3],D=h[E],F=h[E+1],j=h[E+2],_==I&&g==D&&x==F&&M==j?(h[E]=0,h[E+1]=0,h[E+2]=0,h[E+3]=0):(h[E]=g,h[E+1]=x,h[E+2]=M,h[E+3]=_);else if(T==3){if(_=l[O+3],g=l[O],x=l[O+1],M=l[O+2],I=h[E+3],D=h[E],F=h[E+1],j=h[E+2],_==I&&g==D&&x==F&&M==j)continue;if(_<220&&I>20)return!1}return!0}return{decode:function(c){const u=new Uint8Array(c);let h=8;const b=e,v=b.readUshort,w=b.readUint,y={tabs:{},frames:[]},T=new Uint8Array(u.length);let A,k=0,O=0;const E=[137,80,78,71,13,10,26,10];for(var _=0;_<8;_++)if(u[_]!=E[_])throw"The input is not a PNG file!";for(;h<u.length;){const z=b.readUint(u,h);h+=4;const C=b.readASCII(u,h,4);if(h+=4,C=="IHDR")m(u,h,y);else if(C=="iCCP"){for(var g=h;u[g]!=0;)g++;b.readASCII(u,h,g-h),u[g+1];const S=u.slice(g+2,h+z);let H=null;try{H=s(S)}catch{H=r(S)}y.tabs[C]=H}else if(C=="CgBI")y.tabs[C]=u.slice(h,h+4);else if(C=="IDAT"){for(_=0;_<z;_++)T[k+_]=u[h+_];k+=z}else if(C=="acTL")y.tabs[C]={num_frames:w(u,h),num_plays:w(u,h+4)},A=new Uint8Array(u.length);else if(C=="fcTL"){O!=0&&((j=y.frames[y.frames.length-1]).data=n(y,A.slice(0,O),j.rect.width,j.rect.height),O=0);const S={x:w(u,h+12),y:w(u,h+16),width:w(u,h+4),height:w(u,h+8)};let H=v(u,h+22);H=v(u,h+20)/(H==0?100:H);const P={rect:S,delay:Math.round(1e3*H),dispose:u[h+24],blend:u[h+25]};y.frames.push(P)}else if(C=="fdAT"){for(_=0;_<z-4;_++)A[O+_]=u[h+_+4];O+=z-4}else if(C=="pHYs")y.tabs[C]=[b.readUint(u,h),b.readUint(u,h+4),u[h+8]];else if(C=="cHRM")for(y.tabs[C]=[],_=0;_<8;_++)y.tabs[C].push(b.readUint(u,h+4*_));else if(C=="tEXt"||C=="zTXt"){y.tabs[C]==null&&(y.tabs[C]={});var x=b.nextZero(u,h),M=b.readASCII(u,h,x-h),I=h+z-x-1;if(C=="tEXt")F=b.readASCII(u,x+1,I);else{var D=s(u.slice(x+2,x+2+I));F=b.readUTF8(D,0,D.length)}y.tabs[C][M]=F}else if(C=="iTXt"){y.tabs[C]==null&&(y.tabs[C]={}),x=0,g=h,x=b.nextZero(u,g),M=b.readASCII(u,g,x-g);const S=u[g=x+1];var F;u[g+1],g+=2,x=b.nextZero(u,g),b.readASCII(u,g,x-g),g=x+1,x=b.nextZero(u,g),b.readUTF8(u,g,x-g),I=z-((g=x+1)-h),S==0?F=b.readUTF8(u,g,I):(D=s(u.slice(g,g+I)),F=b.readUTF8(D,0,D.length)),y.tabs[C][M]=F}else if(C=="PLTE")y.tabs[C]=b.readBytes(u,h,z);else if(C=="hIST"){const S=y.tabs.PLTE.length/3;for(y.tabs[C]=[],_=0;_<S;_++)y.tabs[C].push(v(u,h+2*_))}else if(C=="tRNS")y.ctype==3?y.tabs[C]=b.readBytes(u,h,z):y.ctype==0?y.tabs[C]=v(u,h):y.ctype==2&&(y.tabs[C]=[v(u,h),v(u,h+2),v(u,h+4)]);else if(C=="gAMA")y.tabs[C]=b.readUint(u,h)/1e5;else if(C=="sRGB")y.tabs[C]=u[h];else if(C=="bKGD")y.ctype==0||y.ctype==4?y.tabs[C]=[v(u,h)]:y.ctype==2||y.ctype==6?y.tabs[C]=[v(u,h),v(u,h+2),v(u,h+4)]:y.ctype==3&&(y.tabs[C]=u[h]);else if(C=="IEND")break;h+=z,b.readUint(u,h),h+=4}var j;return O!=0&&((j=y.frames[y.frames.length-1]).data=n(y,A.slice(0,O),j.rect.width,j.rect.height)),y.data=n(y,T,y.width,y.height),delete y.compress,delete y.interlace,delete y.filter,y},toRGBA8:function(c){const u=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,u,h,c).buffer];const b=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=u*h*4,w=new Uint8Array(v),y=new Uint8Array(v),T=new Uint8Array(v);for(let k=0;k<c.frames.length;k++){const O=c.frames[k],E=O.rect.x,_=O.rect.y,g=O.rect.width,x=O.rect.height,M=t(O.data,g,x,c);if(k!=0)for(var A=0;A<v;A++)T[A]=w[A];if(O.blend==0?f(M,g,x,w,u,h,E,_,0):O.blend==1&&f(M,g,x,w,u,h,E,_,1),b.push(w.buffer.slice(0)),O.dispose!=0){if(O.dispose==1)f(y,g,x,w,u,h,E,_,0);else if(O.dispose==2)for(A=0;A<v;A++)w[A]=T[A]}}return b},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Be,{_bin:t}=Be,n=Be._paeth;var s={table:(function(){const g=new Uint32Array(256);for(let x=0;x<256;x++){let M=x;for(let I=0;I<8;I++)1&M?M=3988292384^M>>>1:M>>>=1;g[x]=M}return g})(),update(g,x,M,I){for(let D=0;D<I;D++)g=s.table[255&(g^x[M+D])]^g>>>8;return g},crc:(g,x,M)=>4294967295^s.update(4294967295,g,x,M)};function r(g,x,M,I){x[M]+=g[0]*I>>4,x[M+1]+=g[1]*I>>4,x[M+2]+=g[2]*I>>4,x[M+3]+=g[3]*I>>4}function o(g){return Math.max(0,Math.min(255,g))}function a(g,x){const M=g[0]-x[0],I=g[1]-x[1],D=g[2]-x[2],F=g[3]-x[3];return M*M+I*I+D*D+F*F}function i(g,x,M,I,D,F,j){j==null&&(j=1);const z=I.length,C=[];for(var S=0;S<z;S++){const R=I[S];C.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(S=0;S<z;S++){let R=4294967295;for(var H=0,P=0;P<z;P++){var U=a(C[S],C[P]);P!=S&&U<R&&(R=U,H=P)}}const Y=new Uint32Array(D.buffer),N=new Int16Array(x*M*4),L=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(S=0;S<L.length;S++)L[S]=255*((L[S]+.5)/16-.5);for(let R=0;R<M;R++)for(let B=0;B<x;B++){var $;S=4*(R*x+B),j!=2?$=[o(g[S]+N[S]),o(g[S+1]+N[S+1]),o(g[S+2]+N[S+2]),o(g[S+3]+N[S+3])]:(U=L[4*(3&R)+(3&B)],$=[o(g[S]+U),o(g[S+1]+U),o(g[S+2]+U),o(g[S+3]+U)]),H=0;let V=16777215;for(P=0;P<z;P++){const oe=a($,C[P]);oe<V&&(V=oe,H=P)}const q=C[H],K=[$[0]-q[0],$[1]-q[1],$[2]-q[2],$[3]-q[3]];j==1&&(B!=x-1&&r(K,N,S+4,7),R!=M-1&&(B!=0&&r(K,N,S+4*x-4,3),r(K,N,S+4*x,5),B!=x-1&&r(K,N,S+4*x+4,1))),F[S>>2]=H,Y[S>>2]=I[H]}}function m(g,x,M,I,D){D==null&&(D={});const{crc:F}=s,j=t.writeUint,z=t.writeUshort,C=t.writeASCII;let S=8;const H=g.frames.length>1;let P,U=!1,Y=33+(H?20:0);if(D.sRGB!=null&&(Y+=13),D.pHYs!=null&&(Y+=21),D.iCCP!=null&&(P=pako.deflate(D.iCCP),Y+=21+P.length+4),g.ctype==3){for(var N=g.plte.length,L=0;L<N;L++)g.plte[L]>>>24!=255&&(U=!0);Y+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<g.frames.length;$++)H&&(Y+=38),Y+=(q=g.frames[$]).cimg.length+12,$!=0&&(Y+=4);Y+=12;const R=new Uint8Array(Y),B=[137,80,78,71,13,10,26,10];for(L=0;L<8;L++)R[L]=B[L];if(j(R,S,13),S+=4,C(R,S,"IHDR"),S+=4,j(R,S,x),S+=4,j(R,S,M),S+=4,R[S]=g.depth,S++,R[S]=g.ctype,S++,R[S]=0,S++,R[S]=0,S++,R[S]=0,S++,j(R,S,F(R,S-17,17)),S+=4,D.sRGB!=null&&(j(R,S,1),S+=4,C(R,S,"sRGB"),S+=4,R[S]=D.sRGB,S++,j(R,S,F(R,S-5,5)),S+=4),D.iCCP!=null){const K=13+P.length;j(R,S,K),S+=4,C(R,S,"iCCP"),S+=4,C(R,S,"ICC profile"),S+=11,S+=2,R.set(P,S),S+=P.length,j(R,S,F(R,S-(K+4),K+4)),S+=4}if(D.pHYs!=null&&(j(R,S,9),S+=4,C(R,S,"pHYs"),S+=4,j(R,S,D.pHYs[0]),S+=4,j(R,S,D.pHYs[1]),S+=4,R[S]=D.pHYs[2],S++,j(R,S,F(R,S-13,13)),S+=4),H&&(j(R,S,8),S+=4,C(R,S,"acTL"),S+=4,j(R,S,g.frames.length),S+=4,j(R,S,D.loop!=null?D.loop:0),S+=4,j(R,S,F(R,S-12,12)),S+=4),g.ctype==3){for(j(R,S,3*(N=g.plte.length)),S+=4,C(R,S,"PLTE"),S+=4,L=0;L<N;L++){const K=3*L,oe=g.plte[L],ee=255&oe,re=oe>>>8&255,ce=oe>>>16&255;R[S+K+0]=ee,R[S+K+1]=re,R[S+K+2]=ce}if(S+=3*N,j(R,S,F(R,S-3*N-4,3*N+4)),S+=4,U){for(j(R,S,N),S+=4,C(R,S,"tRNS"),S+=4,L=0;L<N;L++)R[S+L]=g.plte[L]>>>24&255;S+=N,j(R,S,F(R,S-N-4,N+4)),S+=4}}let V=0;for($=0;$<g.frames.length;$++){var q=g.frames[$];H&&(j(R,S,26),S+=4,C(R,S,"fcTL"),S+=4,j(R,S,V++),S+=4,j(R,S,q.rect.width),S+=4,j(R,S,q.rect.height),S+=4,j(R,S,q.rect.x),S+=4,j(R,S,q.rect.y),S+=4,z(R,S,I[$]),S+=2,z(R,S,1e3),S+=2,R[S]=q.dispose,S++,R[S]=q.blend,S++,j(R,S,F(R,S-30,30)),S+=4);const K=q.cimg;j(R,S,(N=K.length)+($==0?0:4)),S+=4;const oe=S;C(R,S,$==0?"IDAT":"fdAT"),S+=4,$!=0&&(j(R,S,V++),S+=4),R.set(K,S),S+=N,j(R,S,F(R,oe,S-oe)),S+=4}return j(R,S,0),S+=4,C(R,S,"IEND"),S+=4,j(R,S,F(R,S-4,4)),S+=4,R.buffer}function f(g,x,M){for(let I=0;I<g.frames.length;I++){const D=g.frames[I];D.rect.width;const F=D.rect.height,j=new Uint8Array(F*D.bpl+F);D.cimg=h(D.img,F,D.bpp,D.bpl,j,x,M)}}function l(g,x,M,I,D){const F=D[0],j=D[1],z=D[2],C=D[3],S=D[4],H=D[5];let P=6,U=8,Y=255;for(var N=0;N<g.length;N++){const we=new Uint8Array(g[N]);for(var L=we.length,$=0;$<L;$+=4)Y&=we[$+3]}const R=Y!=255,B=(function(me,de,xe,Ce,pe,_e){const ke=[];for(var ge=0;ge<me.length;ge++){const je=new Uint8Array(me[ge]),Le=new Uint32Array(je.buffer);var Ie;let W=0,X=0,te=de,ue=xe,Ee=Ce?1:0;if(ge!=0){const he=_e||Ce||ge==1||ke[ge-2].dispose!=0?1:2;let Me=0,Tn=1e9;for(let ct=0;ct<he;ct++){var qe=new Uint8Array(me[ge-1-ct]);const Lc=new Uint32Array(me[ge-1-ct]);let dt=de,ut=xe,$t=-1,sn=-1;for(let Ct=0;Ct<xe;Ct++)for(let kt=0;kt<de;kt++)Le[Re=Ct*de+kt]!=Lc[Re]&&(kt<dt&&(dt=kt),kt>$t&&($t=kt),Ct<ut&&(ut=Ct),Ct>sn&&(sn=Ct));$t==-1&&(dt=ut=$t=sn=0),pe&&((1&dt)==1&&dt--,(1&ut)==1&&ut--);const Zs=($t-dt+1)*(sn-ut+1);Zs<Tn&&(Tn=Zs,Me=ct,W=dt,X=ut,te=$t-dt+1,ue=sn-ut+1)}qe=new Uint8Array(me[ge-1-Me]),Me==1&&(ke[ge-1].dispose=2),Ie=new Uint8Array(te*ue*4),e(qe,de,xe,Ie,te,ue,-W,-X,0),Ee=e(je,de,xe,Ie,te,ue,-W,-X,3)?1:0,Ee==1?u(je,de,xe,Ie,{x:W,y:X,width:te,height:ue}):e(je,de,xe,Ie,te,ue,-W,-X,0)}else Ie=je.slice(0);ke.push({rect:{x:W,y:X,width:te,height:ue},img:Ie,blend:Ee,dispose:0})}if(Ce)for(ge=0;ge<ke.length;ge++){if((tt=ke[ge]).blend==1)continue;const je=tt.rect,Le=ke[ge-1].rect,W=Math.min(je.x,Le.x),X=Math.min(je.y,Le.y),te={x:W,y:X,width:Math.max(je.x+je.width,Le.x+Le.width)-W,height:Math.max(je.y+je.height,Le.y+Le.height)-X};ke[ge-1].dispose=1,ge-1!=0&&c(me,de,xe,ke,ge-1,te,pe),c(me,de,xe,ke,ge,te,pe)}let Ft=0;if(me.length!=1)for(var Re=0;Re<ke.length;Re++){var tt;Ft+=(tt=ke[Re]).rect.width*tt.rect.height}return ke})(g,x,M,F,j,z),V={},q=[],K=[];if(I!=0){const we=[];for($=0;$<B.length;$++)we.push(B[$].img.buffer);const me=(function(pe){let _e=0;for(var ke=0;ke<pe.length;ke++)_e+=pe[ke].byteLength;const ge=new Uint8Array(_e);let Ie=0;for(ke=0;ke<pe.length;ke++){const qe=new Uint8Array(pe[ke]),Ft=qe.length;for(let Re=0;Re<Ft;Re+=4){let tt=qe[Re],je=qe[Re+1],Le=qe[Re+2];const W=qe[Re+3];W==0&&(tt=je=Le=0),ge[Ie+Re]=tt,ge[Ie+Re+1]=je,ge[Ie+Re+2]=Le,ge[Ie+Re+3]=W}Ie+=Ft}return ge.buffer})(we),de=v(me,I);for($=0;$<de.plte.length;$++)q.push(de.plte[$].est.rgba);let xe=0;for($=0;$<B.length;$++){const Ce=(ee=B[$]).img.length;var oe=new Uint8Array(de.inds.buffer,xe>>2,Ce>>2);K.push(oe);const pe=new Uint8Array(de.abuf,xe,Ce);H&&i(ee.img,ee.rect.width,ee.rect.height,q,pe,oe),ee.img.set(pe),xe+=Ce}}else for(N=0;N<B.length;N++){var ee=B[N];const we=new Uint32Array(ee.img.buffer);var re=ee.rect.width;for(L=we.length,oe=new Uint8Array(L),K.push(oe),$=0;$<L;$++){const me=we[$];if($!=0&&me==we[$-1])oe[$]=oe[$-1];else if($>re&&me==we[$-re])oe[$]=oe[$-re];else{let de=V[me];if(de==null&&(V[me]=de=q.length,q.push(me),q.length>=300))break;oe[$]=de}}}const ce=q.length;for(ce<=256&&S==0&&(U=ce<=2?1:ce<=4?2:ce<=16?4:8,U=Math.max(U,C)),N=0;N<B.length;N++){(ee=B[N]).rect.x,ee.rect.y,re=ee.rect.width;const we=ee.rect.height;let me=ee.img;new Uint32Array(me.buffer);let de=4*re,xe=4;if(ce<=256&&S==0){de=Math.ceil(U*re/8);var ve=new Uint8Array(de*we);const Ce=K[N];for(let pe=0;pe<we;pe++){$=pe*de;const _e=pe*re;if(U==8)for(var fe=0;fe<re;fe++)ve[$+fe]=Ce[_e+fe];else if(U==4)for(fe=0;fe<re;fe++)ve[$+(fe>>1)]|=Ce[_e+fe]<<4-4*(1&fe);else if(U==2)for(fe=0;fe<re;fe++)ve[$+(fe>>2)]|=Ce[_e+fe]<<6-2*(3&fe);else if(U==1)for(fe=0;fe<re;fe++)ve[$+(fe>>3)]|=Ce[_e+fe]<<7-1*(7&fe)}me=ve,P=3,xe=1}else if(R==0&&B.length==1){ve=new Uint8Array(re*we*3);const Ce=re*we;for($=0;$<Ce;$++){const pe=3*$,_e=4*$;ve[pe]=me[_e],ve[pe+1]=me[_e+1],ve[pe+2]=me[_e+2]}me=ve,P=2,xe=3,de=3*re}ee.img=me,ee.bpl=de,ee.bpp=xe}return{ctype:P,depth:U,plte:q,frames:B}}function c(g,x,M,I,D,F,j){const z=Uint8Array,C=Uint32Array,S=new z(g[D-1]),H=new C(g[D-1]),P=D+1<g.length?new z(g[D+1]):null,U=new z(g[D]),Y=new C(U.buffer);let N=x,L=M,$=-1,R=-1;for(let V=0;V<F.height;V++)for(let q=0;q<F.width;q++){const K=F.x+q,oe=F.y+V,ee=oe*x+K,re=Y[ee];re==0||I[D-1].dispose==0&&H[ee]==re&&(P==null||P[4*ee+3]!=0)||(K<N&&(N=K),K>$&&($=K),oe<L&&(L=oe),oe>R&&(R=oe))}$==-1&&(N=L=$=R=0),j&&((1&N)==1&&N--,(1&L)==1&&L--),F={x:N,y:L,width:$-N+1,height:R-L+1};const B=I[D];B.rect=F,B.blend=1,B.img=new Uint8Array(F.width*F.height*4),I[D-1].dispose==0?(e(S,x,M,B.img,F.width,F.height,-F.x,-F.y,0),u(U,x,M,B.img,F)):e(U,x,M,B.img,F.width,F.height,-F.x,-F.y,0)}function u(g,x,M,I,D){e(g,x,M,I,D.width,D.height,-D.x,-D.y,2)}function h(g,x,M,I,D,F,j){const z=[];let C,S=[0,1,2,3,4];F!=-1?S=[F]:(x*I>5e5||M==1)&&(S=[0]),j&&(C={level:0});const H=ig;for(var P=0;P<S.length;P++){for(let N=0;N<x;N++)b(D,g,N,I,M,S[P]);z.push(H.deflate(D,C))}let U,Y=1e9;for(P=0;P<z.length;P++)z[P].length<Y&&(U=P,Y=z[P].length);return z[U]}function b(g,x,M,I,D,F){const j=M*I;let z=j+M;if(g[z]=F,z++,F==0)if(I<500)for(var C=0;C<I;C++)g[z+C]=x[j+C];else g.set(new Uint8Array(x.buffer,j,I),z);else if(F==1){for(C=0;C<D;C++)g[z+C]=x[j+C];for(C=D;C<I;C++)g[z+C]=x[j+C]-x[j+C-D]+256&255}else if(M==0){for(C=0;C<D;C++)g[z+C]=x[j+C];if(F==2)for(C=D;C<I;C++)g[z+C]=x[j+C];if(F==3)for(C=D;C<I;C++)g[z+C]=x[j+C]-(x[j+C-D]>>1)+256&255;if(F==4)for(C=D;C<I;C++)g[z+C]=x[j+C]-n(x[j+C-D],0,0)+256&255}else{if(F==2)for(C=0;C<I;C++)g[z+C]=x[j+C]+256-x[j+C-I]&255;if(F==3){for(C=0;C<D;C++)g[z+C]=x[j+C]+256-(x[j+C-I]>>1)&255;for(C=D;C<I;C++)g[z+C]=x[j+C]+256-(x[j+C-I]+x[j+C-D]>>1)&255}if(F==4){for(C=0;C<D;C++)g[z+C]=x[j+C]+256-n(0,x[j+C-I],0)&255;for(C=D;C<I;C++)g[z+C]=x[j+C]+256-n(x[j+C-D],x[j+C-I],x[j+C-D-I])&255}}}function v(g,x){const M=new Uint8Array(g),I=M.slice(0),D=new Uint32Array(I.buffer),F=w(I,x),j=F[0],z=F[1],C=M.length,S=new Uint8Array(C>>2);let H;if(M.length<2e7)for(var P=0;P<C;P+=4)H=y(j,U=M[P]*(1/255),Y=M[P+1]*(1/255),N=M[P+2]*(1/255),L=M[P+3]*(1/255)),S[P>>2]=H.ind,D[P>>2]=H.est.rgba;else for(P=0;P<C;P+=4){var U=M[P]*.00392156862745098,Y=M[P+1]*(1/255),N=M[P+2]*(1/255),L=M[P+3]*(1/255);for(H=j;H.left;)H=T(H.est,U,Y,N,L)<=0?H.left:H.right;S[P>>2]=H.ind,D[P>>2]=H.est.rgba}return{abuf:I.buffer,inds:S,plte:z}}function w(g,x,M){M==null&&(M=1e-4);const I=new Uint32Array(g.buffer),D={i0:0,i1:g.length,bst:null,est:null,tdst:0,left:null,right:null};D.bst=O(g,D.i0,D.i1),D.est=E(D.bst);const F=[D];for(;F.length<x;){let z=0,C=0;for(var j=0;j<F.length;j++)F[j].est.L>z&&(z=F[j].est.L,C=j);if(z<M)break;const S=F[C],H=A(g,I,S.i0,S.i1,S.est.e,S.est.eMq255);if(S.i0>=H||S.i1<=H){S.est.L=0;continue}const P={i0:S.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};P.bst=O(g,P.i0,P.i1),P.est=E(P.bst);const U={i0:H,i1:S.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:S.bst.N-P.bst.N},j=0;j<16;j++)U.bst.R[j]=S.bst.R[j]-P.bst.R[j];for(j=0;j<4;j++)U.bst.m[j]=S.bst.m[j]-P.bst.m[j];U.est=E(U.bst),S.left=P,S.right=U,F[C]=P,F.push(U)}for(F.sort(((z,C)=>C.bst.N-z.bst.N)),j=0;j<F.length;j++)F[j].ind=j;return[D,F]}function y(g,x,M,I,D){if(g.left==null)return g.tdst=(function(P,U,Y,N,L){const $=U-P[0],R=Y-P[1],B=N-P[2],V=L-P[3];return $*$+R*R+B*B+V*V})(g.est.q,x,M,I,D),g;const F=T(g.est,x,M,I,D);let j=g.left,z=g.right;F>0&&(j=g.right,z=g.left);const C=y(j,x,M,I,D);if(C.tdst<=F*F)return C;const S=y(z,x,M,I,D);return S.tdst<C.tdst?S:C}function T(g,x,M,I,D){const{e:F}=g;return F[0]*x+F[1]*M+F[2]*I+F[3]*D-g.eMq}function A(g,x,M,I,D,F){for(I-=4;M<I;){for(;k(g,M,D)<=F;)M+=4;for(;k(g,I,D)>F;)I-=4;if(M>=I)break;const j=x[M>>2];x[M>>2]=x[I>>2],x[I>>2]=j,M+=4,I-=4}for(;k(g,M,D)>F;)M-=4;return M+4}function k(g,x,M){return g[x]*M[0]+g[x+1]*M[1]+g[x+2]*M[2]+g[x+3]*M[3]}function O(g,x,M){const I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],D=[0,0,0,0],F=M-x>>2;for(let j=x;j<M;j+=4){const z=g[j]*.00392156862745098,C=g[j+1]*(1/255),S=g[j+2]*(1/255),H=g[j+3]*(1/255);D[0]+=z,D[1]+=C,D[2]+=S,D[3]+=H,I[0]+=z*z,I[1]+=z*C,I[2]+=z*S,I[3]+=z*H,I[5]+=C*C,I[6]+=C*S,I[7]+=C*H,I[10]+=S*S,I[11]+=S*H,I[15]+=H*H}return I[4]=I[1],I[8]=I[2],I[9]=I[6],I[12]=I[3],I[13]=I[7],I[14]=I[11],{R:I,m:D,N:F}}function E(g){const{R:x}=g,{m:M}=g,{N:I}=g,D=M[0],F=M[1],j=M[2],z=M[3],C=I==0?0:1/I,S=[x[0]-D*D*C,x[1]-D*F*C,x[2]-D*j*C,x[3]-D*z*C,x[4]-F*D*C,x[5]-F*F*C,x[6]-F*j*C,x[7]-F*z*C,x[8]-j*D*C,x[9]-j*F*C,x[10]-j*j*C,x[11]-j*z*C,x[12]-z*D*C,x[13]-z*F*C,x[14]-z*j*C,x[15]-z*z*C],H=S,P=_;let U=[Math.random(),Math.random(),Math.random(),Math.random()],Y=0,N=0;if(I!=0)for(let $=0;$<16&&(U=P.multVec(H,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-Y)<1e-9));$++)Y=N;const L=[D*C,F*C,j*C,z*C];return{Cov:S,q:L,e:U,L:Y,eMq255:P.dot(P.sml(255,L),U),eMq:P.dot(U,L),rgba:(Math.round(255*L[3])<<24|Math.round(255*L[2])<<16|Math.round(255*L[1])<<8|Math.round(255*L[0])<<0)>>>0}}var _={multVec:(g,x)=>[g[0]*x[0]+g[1]*x[1]+g[2]*x[2]+g[3]*x[3],g[4]*x[0]+g[5]*x[1]+g[6]*x[2]+g[7]*x[3],g[8]*x[0]+g[9]*x[1]+g[10]*x[2]+g[11]*x[3],g[12]*x[0]+g[13]*x[1]+g[14]*x[2]+g[15]*x[3]],dot:(g,x)=>g[0]*x[0]+g[1]*x[1]+g[2]*x[2]+g[3]*x[3],sml:(g,x)=>[g*x[0],g*x[1],g*x[2],g*x[3]]};Be.encode=function(x,M,I,D,F,j,z){D==null&&(D=0),z==null&&(z=!1);const C=l(x,M,I,D,[!1,!1,!1,0,z,!1]);return f(C,-1),m(C,M,I,F,j)},Be.encodeLL=function(x,M,I,D,F,j,z,C){const S={ctype:0+(D==1?0:2)+(F==0?0:4),depth:j,frames:[]},H=(D+F)*j,P=H*M;for(let U=0;U<x.length;U++)S.frames.push({rect:{x:0,y:0,width:M,height:I},img:new Uint8Array(x[U]),blend:0,dispose:1,bpp:Math.ceil(H/8),bpl:Math.ceil(P/8)});return f(S,0,!0),m(S,M,I,z,C)},Be.encode.compress=l,Be.encode.dither=i,Be.quantize=v,Be.quantize.getKDtree=w,Be.quantize.getNearest=y})();const dl={toArrayBuffer(e,t){const n=e.width,s=e.height,r=n<<2,o=e.getContext("2d").getImageData(0,0,n,s),a=new Uint32Array(o.data.buffer),i=(32*n+31)/32<<2,m=i*s,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),u=1<<20;let h,b,v,w,y=u,T=0,A=0,k=0;function O(g){c.setUint16(A,g,!0),A+=2}function E(g){c.setUint32(A,g,!0),A+=4}function _(g){A+=g}O(19778),E(f),_(4),E(122),E(108),E(n),E(-s>>>0),O(1),O(32),E(3),E(m),E(2835),E(2835),_(8),E(16711680),E(65280),E(255),E(4278190080),E(1466527264),(function g(){for(;T<s&&y>0;){for(w=122+T*i,h=0;h<r;)y--,b=a[k++],v=b>>>24,c.setUint32(w+h,b<<8|v),h+=4;T++}k<a.length?(y=u,setTimeout(g,dl._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Fe={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},lg={[Fe.CHROME]:16384,[Fe.FIREFOX]:11180,[Fe.DESKTOP_SAFARI]:16384,[Fe.IE]:8192,[Fe.IOS]:4096,[Fe.ETC]:8192};const Fs=typeof window<"u",ul=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Qn=Fs&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),cg=(Fs||ul)&&(Qn&&Qn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),fl=(Fs||ul)&&(Qn&&Qn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function $s(e,t,n=Date.now()){return new Promise((s=>{const r=e.split(","),o=r[0].match(/:(.*?);/)[1],a=globalThis.atob(r[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:o});f.name=t,f.lastModified=n,s(f)}))}function ml(e){return new Promise(((t,n)=>{const s=new fl;s.onload=()=>t(s.result),s.onerror=r=>n(r),s.readAsDataURL(e)}))}function pl(e){return new Promise(((t,n)=>{const s=new Image;s.onload=()=>t(s),s.onerror=r=>n(r),s.src=e}))}function _t(){if(_t.cachedResult!==void 0)return _t.cachedResult;let e=Fe.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Fe.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Fe.IOS:/Safari/i.test(t)?e=Fe.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Fe.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Fe.IE),_t.cachedResult=e,_t.cachedResult}function hl(e,t){const n=_t(),s=lg[n];let r=e,o=t,a=r*o;const i=r>o?o/r:r/o;for(;a>s*s;){const m=(s+r)/2,f=(s+o)/2;m<f?(o=f,r=f*i):(o=m*i,r=m),a=r*o}return{width:r,height:o}}function ur(e,t){let n,s;try{if(n=new OffscreenCanvas(e,t),s=n.getContext("2d"),s===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),s=n.getContext("2d")}return n.width=e,n.height=t,[n,s]}function gl(e,t){const{width:n,height:s}=hl(e.width,e.height),[r,o]=ur(n,s);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,r.width,r.height)),o.drawImage(e,0,0,r.width,r.height),r}function Fn(){return Fn.cachedResult!==void 0||(Fn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Fn.cachedResult}function Jn(e,t={}){return new Promise((function(n,s){let r,o;var a=function(){try{return o=gl(r,t.fileType||e.type),n([r,o])}catch(m){return s(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return s(c)}};try{let l;return ml(e).then((function(c){try{return l=c,pl(l).then((function(u){try{return r=u,(function(){try{return a()}catch(h){return s(h)}})()}catch(h){return f(h)}}),f)}catch(u){return f(u)}}),f)}catch(l){f(l)}}catch(l){return s(l)}};try{if(Fn()||[Fe.DESKTOP_SAFARI,Fe.MOBILE_SAFARI].includes(_t()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return r=m,a()}catch{return i()}}),i)}catch{i()}}))}function Zn(e,t,n,s,r=1){return new Promise((function(o,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=Be.encode([l.buffer],e.width,e.height,4096*r),i=new Blob([c],{type:t}),i.name=n,i.lastModified=s,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>dl.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=s,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:r}).then((function(c){try{return i=c,i.name=n,i.lastModified=s,l.call(this)}catch(u){return a(u)}}).bind(this),a);{let c;return c=e.toDataURL(t,r),$s(c,n,s).then((function(u){try{return i=u,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return o(i)}}))}function Xe(e){e.width=0,e.height=0}function Gt(){return new Promise((function(e,t){let n,s,r,o;return Gt.cachedResult!==void 0?e(Gt.cachedResult):$s("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Jn(n).then((function(i){try{return s=i[1],Zn(s,n.type,n.name,n.lastModified).then((function(m){try{return r=m,Xe(s),Jn(r).then((function(f){try{return o=f[0],Gt.cachedResult=o.width===1&&o.height===2,e(Gt.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function bl(e){return new Promise(((t,n)=>{const s=new fl;s.onload=r=>{const o=new DataView(r.target.result);if(o.getUint16(0,!1)!=65496)return t(-2);const a=o.byteLength;let i=2;for(;i<a;){if(o.getUint16(i+2,!1)<=8)return t(-1);const m=o.getUint16(i,!1);if(i+=2,m==65505){if(o.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=o.getUint16(i+=6,!1)==18761;i+=o.getUint32(i+4,f);const l=o.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(o.getUint16(i+12*c,f)==274)return t(o.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=o.getUint16(i,!1)}}return t(-1)},s.onerror=r=>n(r),s.readAsArrayBuffer(e)}))}function xl(e,t){const{width:n}=e,{height:s}=e,{maxWidthOrHeight:r}=t;let o,a=e;return isFinite(r)&&(n>r||s>r)&&([a,o]=ur(n,s),n>s?(a.width=r,a.height=s/n*r):(a.width=n/s*r,a.height=r),o.drawImage(e,0,0,a.width,a.height),Xe(e)),a}function yl(e,t){const{width:n}=e,{height:s}=e,[r,o]=ur(n,s);switch(t>4&&t<9?(r.width=s,r.height=n):(r.width=n,r.height=s),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,s);break;case 4:o.transform(1,0,0,-1,0,s);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,s,0);break;case 7:o.transform(0,-1,-1,0,s,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,s),Xe(e),r}function Oo(e,t,n=0){return new Promise((function(s,r){let o,a,i,m,f,l,c,u,h,b,v,w,y,T,A,k,O,E,_,g;function x(I=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=I,t.onProgress(Math.min(o,100))}function M(I){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(I,o),100),t.onProgress(o)}return o=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,x(),Jn(e,t).then((function(I){try{return[,m]=I,x(),f=xl(m,t),x(),new Promise((function(D,F){var j;if(!(j=t.exifOrientation))return bl(e).then((function(C){try{return j=C,z.call(this)}catch(S){return F(S)}}).bind(this),F);function z(){return D(j)}return z.call(this)})).then((function(D){try{return l=D,x(),Gt().then((function(F){try{return c=F?f:yl(f,l),x(),u=t.initialQuality||1,h=t.fileType||e.type,Zn(c,h,e.name,e.lastModified,u).then((function(j){try{{let C=function(){if(a--&&(A>i||A>y)){let H,P;return H=g?.95*_.width:_.width,P=g?.95*_.height:_.height,[O,E]=ur(H,P),E.drawImage(_,0,0,H,P),u*=h==="image/png"?.85:.95,Zn(O,h,e.name,e.lastModified,u).then((function(U){try{return k=U,Xe(_),_=O,A=k.size,M(Math.min(99,Math.floor((T-A)/(T-i)*100))),C}catch(Y){return r(Y)}}),r)}return[1]},S=function(){return Xe(_),Xe(O),Xe(f),Xe(c),Xe(m),M(100),s(k)};if(b=j,x(),v=b.size>i,w=b.size>e.size,!v&&!w)return M(100),s(b);var z;return y=e.size,T=b.size,A=T,_=c,g=!t.alwaysKeepResolution&&v,(z=(function(H){for(;H;){if(H.then)return void H.then(z,r);try{if(H.pop){if(H.length)return H.pop()?S.call(this):H;H=C}else H=H.call(this)}catch(P){return r(P)}}}).bind(this))(C)}}catch(C){return r(C)}}).bind(this),r)}catch(j){return r(j)}}).bind(this),r)}catch(F){return r(F)}}).bind(this),r)}catch(D){return r(D)}}).bind(this),r)}))}const dg=`
219
219
  let scriptImported = false
220
220
  self.addEventListener('message', async (e) => {
221
221
  const { file, id, imageCompressionLibUrl, options } = e.data
@@ -234,11 +234,11 @@ self.addEventListener('message', async (e) => {
234
234
  self.postMessage({ error: e.message + '\\n' + e.stack, id })
235
235
  }
236
236
  })
237
- `;let Rr;function ug(e,t){return new Promise(((n,r)=>{Rr||(Rr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(dg));const s=new Worker(Rr);s.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)s.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void s.terminate();n(a.data.file),s.terminate()}else t.onProgress(a.data.progress)})),s.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),s.terminate()})),s.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Pe(e,t){return new Promise((function(n,r){let s,o,a,i,m,f;if(s={...t},a=0,{onProgress:i}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof cg))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Oo(e,s).then((function(h){try{return o=h,u.call(this)}catch(b){return r(b)}}).bind(this),r);var l=(function(){try{return u.call(this)}catch(h){return r(h)}}).bind(this),c=function(h){try{return Oo(e,s).then((function(b){try{return o=b,l()}catch(v){return r(v)}}),r)}catch(b){return r(b)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",ug(e,s).then((function(h){try{return o=h,l()}catch{return c()}}),c)}catch{c()}function u(){try{o.name=e.name,o.lastModified=e.lastModified}catch{}try{s.preserveExif&&e.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===e.type)&&(o=cl(e,o))}catch{}return n(o)}}))}Pe.getDataUrlFromFile=ml,Pe.getFilefromDataUrl=$s,Pe.loadImage=pl,Pe.drawImageInCanvas=gl,Pe.drawFileInCanvas=Jn,Pe.canvasToFile=Zn,Pe.getExifOrientation=bl,Pe.handleMaxWidthOrHeight=xl,Pe.followExifOrientation=yl,Pe.cleanupCanvasMemory=Xe,Pe.isAutoOrientationInBrowser=Gt,Pe.approximateBelowMaximumCanvasSizeOfBrowser=hl,Pe.copyExifWithoutOrientation=cl,Pe.getBrowserName=_t,Pe.version="2.0.2";function $n(e){return e.type==="tool_call"?e.toolCall.id:e.id}function fg(e){switch(e.type){case"user_message":return e.content;case"assistant_message":return e.chunks.map(t=>"text"in t?t.text:"").join(`
237
+ `;let Rr;function ug(e,t){return new Promise(((n,s)=>{Rr||(Rr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(dg));const r=new Worker(Rr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return s(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",s),t.signal&&t.signal.addEventListener("abort",(()=>{s(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Pe(e,t){return new Promise((function(n,s){let r,o,a,i,m,f;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof cg))return s(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return s(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Oo(e,r).then((function(h){try{return o=h,u.call(this)}catch(b){return s(b)}}).bind(this),s);var l=(function(){try{return u.call(this)}catch(h){return s(h)}}).bind(this),c=function(h){try{return Oo(e,r).then((function(b){try{return o=b,l()}catch(v){return s(v)}}),s)}catch(b){return s(b)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",ug(e,r).then((function(h){try{return o=h,l()}catch{return c()}}),c)}catch{c()}function u(){try{o.name=e.name,o.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(o=cl(e,o))}catch{}return n(o)}}))}Pe.getDataUrlFromFile=ml,Pe.getFilefromDataUrl=$s,Pe.loadImage=pl,Pe.drawImageInCanvas=gl,Pe.drawFileInCanvas=Jn,Pe.canvasToFile=Zn,Pe.getExifOrientation=bl,Pe.handleMaxWidthOrHeight=xl,Pe.followExifOrientation=yl,Pe.cleanupCanvasMemory=Xe,Pe.isAutoOrientationInBrowser=Gt,Pe.approximateBelowMaximumCanvasSizeOfBrowser=hl,Pe.copyExifWithoutOrientation=cl,Pe.getBrowserName=_t,Pe.version="2.0.2";function $n(e){return e.type==="tool_call"?e.toolCall.id:e.id}function fg(e){switch(e.type){case"user_message":return e.content;case"assistant_message":return e.chunks.map(t=>"text"in t?t.text:"").join(`
238
238
  `);case"tool_call":{const t=[e.toolCall.title];try{e.toolCall.rawInput&&t.push(JSON.stringify(e.toolCall.rawInput)),e.toolCall.rawOutput&&t.push(JSON.stringify(e.toolCall.rawOutput))}catch{}return t.join(`
239
239
  `)}case"plan":return e.entries.map(t=>t.content).join(`
240
240
  `);case"command_output":return`${e.inputText}
241
- ${e.outputText}`;default:return""}}function rw(e,t){const n=t.trim();if(!n)return{matchIds:new Set,orderedMatchIds:[]};const r=n.toLowerCase(),s=[];for(const o of e)fg(o).toLowerCase().includes(r)&&s.push($n(o));return{matchIds:new Set(s),orderedMatchIds:s}}const Lo=6e3,mg=2e3;function pg(e,t=!1){return t||e<=Lo?0:Math.min((e-Lo)/mg,1)}const Un=new Set;let Ht=0,ts=0;const hg=50;function vl(e){if(e-ts>=hg){ts=e;for(const t of Un)t(e)}Ht=requestAnimationFrame(vl)}function gg(e){return Un.add(e),Ht===0&&(ts=0,Ht=requestAnimationFrame(vl)),()=>{Un.delete(e),Un.size===0&&Ht!==0&&(cancelAnimationFrame(Ht),Ht=0)}}function wl(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Sl(e=!0){const[t,n]=p.useState(0),[r]=p.useState(()=>wl());return p.useEffect(()=>{if(!(!e||r))return gg(n)},[e,r]),e&&!r?t:0}function bg(){const[e]=p.useState(()=>wl());return e}function xg(e,t){const[n,r]=p.useState(0),s=p.useRef(0);return p.useEffect(()=>{if(!e){r(0);return}s.current=t??Date.now(),r(Math.floor((Date.now()-s.current)/1e3));const o=setInterval(()=>{r(Math.floor((Date.now()-s.current)/1e3))},1e3);return()=>clearInterval(o)},[e,t]),n}function yg(e,t,n){const r=p.useRef({key:t,at:e});return r.current.key!==t&&(r.current={key:t,at:e}),pg(e-r.current.at,n)>0}const Fo=[" ","▁","▂","▃","▄","▅","▆","▇"],Mr=[{r:48,g:16,b:80},{r:64,g:24,b:104},{r:82,g:33,b:130},{r:101,g:44,b:156},{r:122,g:58,b:183},{r:145,g:80,b:205},{r:168,g:108,b:222},{r:191,g:140,b:236},{r:213,g:174,b:247}],$o=120,vg=120,wg=60,Uo=new WeakMap;function Sg(e){const t=Uo.get(e);if(t)return t;const n=[];let r=0;for(const o of e.notes){const a=r+o.beats;for(let i=Math.ceil(r-1e-9);i<a-1e-9;i++)n[i]={char:Fo[o.degree]??" ",color:Mr[o.octave-1]??Mr[4]};r=a}for(let o=0;o<n.length;o++)n[o]===void 0&&(n[o]={char:Fo[0],color:Mr[4]});const s=Object.freeze(n);return Uo.set(e,s),s}function Cg(e,t){const n=Sg(e),r=(t%n.length+n.length)%n.length;return n[r]}function kg(e){return!Number.isFinite(e)||e<=0?$o:Math.max(wg,Math.round($o*vg/e))}const Eg="♩";function Ag(e){return`${e.beatUnit??Eg} = ${e.bpm}`}const Tg={c:1,d:2,e:3,f:4,g:5,a:6,b:7},_g=4,Nr=.25;function zo(e,t){if(e===void 0)return 1;const n=Number(e);if(!Number.isFinite(n)||n<=0||n>_g)throw new Error(`Invalid beat count in token "${t}"`);if(Math.round(n/Nr)*Nr!==n)throw new Error(`Beats must be a multiple of ${Nr} in token "${t}"`);return n}function ye(e,t){const n=[],r=e.split(/\s+/).filter(s=>s.length>0&&s!=="|");if(r.length===0)throw new Error(`Score "${t.name}" has no notes`);for(const s of r){const o=/^r(?::([\d.]+))?$/.exec(s);if(o){n.push({degree:0,octave:5,beats:zo(o[1],s)});continue}const a=/^([1-9])([a-g])(?::([\d.]+)|([1-4]))?$/.exec(s);if(!a||a[1]===void 0||a[2]===void 0)throw new Error(`Malformed token "${s}" in score "${t.name}"`);const i=Tg[a[2]];if(i===void 0)throw new Error(`Unknown degree in token "${s}"`);n.push({degree:i,octave:Number(a[1]),beats:zo(a[3]??a[4],s)})}return{name:t.name,bpm:t.bpm,...t.key?{key:t.key}:{},...t.beatUnit?{beatUnit:t.beatUnit}:{},notes:n,...t.style?{style:t.style}:{}}}const Rg=ye(`5d:2 5e:0.5 5f:0.5 5g:1 | 5f:2 5e:2 |
241
+ ${e.outputText}`;default:return""}}function rw(e,t){const n=t.trim();if(!n)return{matchIds:new Set,orderedMatchIds:[]};const s=n.toLowerCase(),r=[];for(const o of e)fg(o).toLowerCase().includes(s)&&r.push($n(o));return{matchIds:new Set(r),orderedMatchIds:r}}const Lo=6e3,mg=2e3;function pg(e,t=!1){return t||e<=Lo?0:Math.min((e-Lo)/mg,1)}const Un=new Set;let Ht=0,ts=0;const hg=50;function vl(e){if(e-ts>=hg){ts=e;for(const t of Un)t(e)}Ht=requestAnimationFrame(vl)}function gg(e){return Un.add(e),Ht===0&&(ts=0,Ht=requestAnimationFrame(vl)),()=>{Un.delete(e),Un.size===0&&Ht!==0&&(cancelAnimationFrame(Ht),Ht=0)}}function wl(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Sl(e=!0){const[t,n]=p.useState(0),[s]=p.useState(()=>wl());return p.useEffect(()=>{if(!(!e||s))return gg(n)},[e,s]),e&&!s?t:0}function bg(){const[e]=p.useState(()=>wl());return e}function xg(e,t){const[n,s]=p.useState(0),r=p.useRef(0);return p.useEffect(()=>{if(!e){s(0);return}r.current=t??Date.now(),s(Math.floor((Date.now()-r.current)/1e3));const o=setInterval(()=>{s(Math.floor((Date.now()-r.current)/1e3))},1e3);return()=>clearInterval(o)},[e,t]),n}function yg(e,t,n){const s=p.useRef({key:t,at:e});return s.current.key!==t&&(s.current={key:t,at:e}),pg(e-s.current.at,n)>0}const Fo=[" ","▁","▂","▃","▄","▅","▆","▇"],Mr=[{r:48,g:16,b:80},{r:64,g:24,b:104},{r:82,g:33,b:130},{r:101,g:44,b:156},{r:122,g:58,b:183},{r:145,g:80,b:205},{r:168,g:108,b:222},{r:191,g:140,b:236},{r:213,g:174,b:247}],$o=120,vg=120,wg=60,Uo=new WeakMap;function Sg(e){const t=Uo.get(e);if(t)return t;const n=[];let s=0;for(const o of e.notes){const a=s+o.beats;for(let i=Math.ceil(s-1e-9);i<a-1e-9;i++)n[i]={char:Fo[o.degree]??" ",color:Mr[o.octave-1]??Mr[4]};s=a}for(let o=0;o<n.length;o++)n[o]===void 0&&(n[o]={char:Fo[0],color:Mr[4]});const r=Object.freeze(n);return Uo.set(e,r),r}function Cg(e,t){const n=Sg(e),s=(t%n.length+n.length)%n.length;return n[s]}function kg(e){return!Number.isFinite(e)||e<=0?$o:Math.max(wg,Math.round($o*vg/e))}const Eg="♩";function Ag(e){return`${e.beatUnit??Eg} = ${e.bpm}`}const Tg={c:1,d:2,e:3,f:4,g:5,a:6,b:7},_g=4,Nr=.25;function zo(e,t){if(e===void 0)return 1;const n=Number(e);if(!Number.isFinite(n)||n<=0||n>_g)throw new Error(`Invalid beat count in token "${t}"`);if(Math.round(n/Nr)*Nr!==n)throw new Error(`Beats must be a multiple of ${Nr} in token "${t}"`);return n}function ye(e,t){const n=[],s=e.split(/\s+/).filter(r=>r.length>0&&r!=="|");if(s.length===0)throw new Error(`Score "${t.name}" has no notes`);for(const r of s){const o=/^r(?::([\d.]+))?$/.exec(r);if(o){n.push({degree:0,octave:5,beats:zo(o[1],r)});continue}const a=/^([1-9])([a-g])(?::([\d.]+)|([1-4]))?$/.exec(r);if(!a||a[1]===void 0||a[2]===void 0)throw new Error(`Malformed token "${r}" in score "${t.name}"`);const i=Tg[a[2]];if(i===void 0)throw new Error(`Unknown degree in token "${r}"`);n.push({degree:i,octave:Number(a[1]),beats:zo(a[3]??a[4],r)})}return{name:t.name,bpm:t.bpm,...t.key?{key:t.key}:{},...t.beatUnit?{beatUnit:t.beatUnit}:{},notes:n,...t.style?{style:t.style}:{}}}const Rg=ye(`5d:2 5e:0.5 5f:0.5 5g:1 | 5f:2 5e:2 |
242
242
  5a:2 5b:0.5 5a:0.5 5g:1 | 5f:2 5e:2 |
243
243
  5d:0.5 5e:0.5 5f:0.5 5g:0.5 5e:0.5 5f:0.5 5d:0.5 5c:0.5 | 4b:2 5c:2 |
244
244
  5d:2 5e:0.5 5d:0.5 5c:1 | 4b:2 5d:2 |
@@ -351,20 +351,20 @@ ${e.outputText}`;default:return""}}function rw(e,t){const n=t.trim();if(!n)retur
351
351
  5e:0.5 5c:0.5 5e:0.5 5g:0.5 | 5e:2 r:1 |
352
352
  4a:0.5 4a:0.5 4a:0.5 5d:1 | 5f:0.5 5f:0.5 5f:0.5 5a:1 |
353
353
  5f:0.5 5d:0.5 5f:0.5 5a:0.5 | 6d:2 r:0.5 5a:0.5 |
354
- 5g:0.5 5e:0.5 5c:0.5 5e:0.5 | 5g:2 5e:0.5 5c:0.5 | 4g:2 r:2`,{name:"William Tell Overture",bpm:144,key:"E major"}),ns=[Jg,Lg,Vg,Hg,Dg,Qg,qg,Zg,Rg,Ug,Kg,Xg,Yg,$g,jg,Gg,zg,Og,Mg,Ng,Wg,Bg,Ig,Pg,Fg,e0];new Map(ns.map(e=>[e.name,e]));function t0(e=Math.random){const t=ns[Math.floor(e()*ns.length)];if(t===void 0)throw new Error("CLASSIC_SCORES is empty");return t}function n0(){return t0(Math.random)}function r0(e,t){return Cg(e,Math.floor(t/kg(e.bpm)))}function s0(e){return`${e.name}, ${Ag(e)}`}function o0(e){return`rgb(${e.r}, ${e.g}, ${e.b})`}function a0({score:e,stalled:t=!1,className:n}){const r=Sl(!0),s=bg(),o=Z("live-glyph inline-flex w-[0.6em] shrink-0 justify-center leading-none",t&&"live-glyph--stalled",n);if(s)return d.jsx("span",{"aria-hidden":"true",className:o,children:"●"});const a=r0(e,r);return d.jsx("span",{"aria-hidden":"true",className:o,children:d.jsx("span",{className:"live-note",style:t?void 0:{color:o0(a.color)},children:a.char})})}function i0({text:e,stalled:t=!1,className:n}){return d.jsx("span",{className:Z("live-word",t&&"live-word--stalled",n),children:e})}function Cl({active:e,since:t,className:n}){const r=xg(e,t);return!e||r<1?null:d.jsxs("span",{"aria-hidden":"true",className:Z("font-mono text-[10px] tabular-nums text-text-muted",n),children:[r,"s"]})}function l0({stalled:e=!1,since:t,className:n}){const[r]=p.useState(()=>n0());return d.jsxs("div",{className:Z("flex items-center gap-2 pt-1.5 font-display min-h-8",n),children:[d.jsx(a0,{score:r,stalled:e,className:"text-base text-brand"}),d.jsxs("span",{role:"status",className:"text-sm font-medium",children:[d.jsxs("span",{className:"sr-only",children:[G("chat.live.working")," · "]}),d.jsx(i0,{text:s0(r),stalled:e})]}),d.jsx(Cl,{active:!0,since:t,className:"self-center"})]})}var c0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wt=c0.reduce((e,t)=>{const n=Ua(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:a,...i}=s,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),d0=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),u0="VisuallyHidden",kl=p.forwardRef((e,t)=>d.jsx(be.span,{...e,ref:t,style:{...d0,...e.style}}));kl.displayName=u0;var f0=kl,[fr]=it("Tooltip",[tn]),mr=tn(),El="TooltipProvider",m0=700,rs="tooltip.open",[p0,Us]=fr(El),Al=e=>{const{__scopeTooltip:t,delayDuration:n=m0,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),d.jsx(p0,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:s,children:o})};Al.displayName=El;var mn="Tooltip",[h0,kn]=fr(mn),Tl=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:a,delayDuration:i}=e,m=Us(mn,e.__scopeTooltip),f=mr(t),[l,c]=p.useState(null),u=De(),h=p.useRef(0),b=a??m.disableHoverableContent,v=i??m.delayDuration,w=p.useRef(!1),[y,T]=gt({prop:r,defaultProp:s??!1,onChange:_=>{_?(m.onOpen(),document.dispatchEvent(new CustomEvent(rs))):m.onClose(),o==null||o(_)},caller:mn}),A=p.useMemo(()=>y?w.current?"delayed-open":"instant-open":"closed",[y]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w.current=!1,T(!0)},[T]),O=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,T(!1)},[T]),E=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{w.current=!0,T(!0),h.current=0},v)},[v,T]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(As,{...f,children:d.jsx(h0,{scope:t,contentId:u,open:y,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?E():k()},[m.isOpenDelayedRef,E,k]),onTriggerLeave:p.useCallback(()=>{b?O():(window.clearTimeout(h.current),h.current=0)},[O,b]),onOpen:k,onClose:O,disableHoverableContent:b,children:n})})};Tl.displayName=mn;var ss="TooltipTrigger",_l=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=kn(ss,n),o=Us(ss,n),a=mr(n),i=p.useRef(null),m=Ae(t,i,s.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),d.jsx(ir,{asChild:!0,...a,children:d.jsx(be.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:m,onPointerMove:ne(e.onPointerMove,u=>{u.pointerType!=="touch"&&!l.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),l.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{s.onTriggerLeave(),l.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:ne(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:ne(e.onBlur,s.onClose),onClick:ne(e.onClick,s.onClose)})})});_l.displayName=ss;var zs="TooltipPortal",[g0,b0]=fr(zs,{forceMount:void 0}),Rl=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=kn(zs,t);return d.jsx(g0,{scope:t,forceMount:n,children:d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};Rl.displayName=zs;var Qt="TooltipContent",Ml=p.forwardRef((e,t)=>{const n=b0(Qt,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,a=kn(Qt,e.__scopeTooltip);return d.jsx(ze,{present:r||a.open,children:a.disableHoverableContent?d.jsx(Nl,{side:s,...o,ref:t}):d.jsx(x0,{side:s,...o,ref:t})})}),x0=p.forwardRef((e,t)=>{const n=kn(Qt,e.__scopeTooltip),r=Us(Qt,e.__scopeTooltip),s=p.useRef(null),o=Ae(t,s),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=s.current,{onPointerInTransitChange:c}=r,u=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((b,v)=>{const w=b.currentTarget,y={x:b.clientX,y:b.clientY},T=S0(y,w.getBoundingClientRect()),A=C0(y,T),k=k0(v.getBoundingClientRect()),O=A0([...A,...k]);i(O),c(!0)},[c]);return p.useEffect(()=>()=>u(),[u]),p.useEffect(()=>{if(m&&l){const b=w=>h(w,l),v=w=>h(w,m);return m.addEventListener("pointerleave",b),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",v)}}},[m,l,h,u]),p.useEffect(()=>{if(a){const b=v=>{const w=v.target,y={x:v.clientX,y:v.clientY},T=(m==null?void 0:m.contains(w))||(l==null?void 0:l.contains(w)),A=!E0(y,a);T?u():A&&(u(),f())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[m,l,a,f,u]),d.jsx(Nl,{...e,ref:o})}),[y0,v0]=fr(mn,{isInside:!1}),w0=pf("TooltipContent"),Nl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:a,...i}=e,m=kn(Qt,n),f=mr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(rs,l),()=>document.removeEventListener(rs,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=u=>{const h=u.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),d.jsx(xn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:d.jsxs(Ts,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(w0,{children:r}),d.jsx(y0,{scope:n,isInside:!0,children:d.jsx(f0,{id:m.contentId,role:"tooltip",children:s||r})})]})})});Ml.displayName=Qt;var jl="TooltipArrow",Pl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=mr(n);return v0(jl,n).isInside?null:d.jsx(_s,{...s,...r,ref:t})});Pl.displayName=jl;function S0(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function C0(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function k0(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function E0(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>r!=u>r&&n<(c-f)*(r-l)/(u-l)+f&&(s=!s)}return s}function A0(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),T0(t)}function T0(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var _0=Al,R0=Tl,M0=_l,N0=Rl,j0=Ml,P0=Pl;function I0({delayDuration:e=0,...t}){return d.jsx(_0,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function D0({...e}){return d.jsx(I0,{children:d.jsx(R0,{"data-slot":"tooltip",...e})})}function O0({...e}){return d.jsx(M0,{"data-slot":"tooltip-trigger",...e})}function L0({className:e,sideOffset:t=0,children:n,...r}){return d.jsx(N0,{children:d.jsxs(j0,{"data-slot":"tooltip-content",sideOffset:t,className:Z("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,d.jsx(P0,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const F0=p.lazy(()=>Ne(()=>import("./mermaid-VLURNSYL-C1VVhmLq.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.Streamdown})));p.createContext(null);const Hs=p.memo(({className:e,children:t,...n})=>d.jsx(p.Suspense,{fallback:d.jsx("div",{className:Z("whitespace-pre-wrap break-words",e),children:t}),children:d.jsx(F0,{className:Z("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Hs.displayName="MessageResponse";var pr="Collapsible",[$0]=it(pr),[U0,Bs]=$0(pr),Il=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:a,...i}=e,[m,f]=gt({prop:r,defaultProp:s??!1,onChange:a,caller:pr});return d.jsx(U0,{scope:n,disabled:o,contentId:De(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:d.jsx(be.div,{"data-state":Gs(m),"data-disabled":o?"":void 0,...i,ref:t})})});Il.displayName=pr;var Dl="CollapsibleTrigger",Ol=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Bs(Dl,n);return d.jsx(be.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Gs(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:ne(e.onClick,s.onOpenToggle)})});Ol.displayName=Dl;var Ws="CollapsibleContent",Ll=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Bs(Ws,e.__scopeCollapsible);return d.jsx(ze,{present:n||s.open,children:({present:o})=>d.jsx(z0,{...r,ref:t,present:o})})});Ll.displayName=Ws;var z0=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,a=Bs(Ws,n),[i,m]=p.useState(r),f=p.useRef(null),l=Ae(t,f),c=p.useRef(0),u=c.current,h=p.useRef(0),b=h.current,v=a.open||i,w=p.useRef(v),y=p.useRef(void 0);return p.useEffect(()=>{const T=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(T)},[]),rt(()=>{const T=f.current;if(T){y.current=y.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const A=T.getBoundingClientRect();c.current=A.height,h.current=A.width,w.current||(T.style.transitionDuration=y.current.transitionDuration,T.style.animationName=y.current.animationName),m(r)}},[a.open,r]),d.jsx(be.div,{"data-state":Gs(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...o,ref:l,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:v&&s})});function Gs(e){return e?"open":"closed"}var H0=Il;function B0({...e}){return d.jsx(H0,{"data-slot":"collapsible",...e})}function W0({...e}){return d.jsx(Ol,{"data-slot":"collapsible-trigger",...e})}function G0({...e}){return d.jsx(Ll,{"data-slot":"collapsible-content",...e})}const V0=({children:e,as:t="p",className:n,duration:r=2})=>{const s=Hc.create(t);return d.jsx(s,{animate:{opacity:[.5,1,.5]},className:Z("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},q0=p.memo(V0),Fl=p.createContext(null),K0=()=>{const e=p.useContext(Fl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Y0=1e3,X0=1e3,$l=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:s,duration:o,children:a,...i})=>{const[m,f]=gt({prop:n,defaultProp:r,onChange:s}),[l,c]=gt({prop:o,defaultProp:void 0}),[u,h]=p.useState(!1),[b,v]=p.useState(null);p.useEffect(()=>{t?b===null&&v(Date.now()):b!==null&&(c(Math.ceil((Date.now()-b)/X0)),v(null))},[t,b,c]);const w=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!w&&r&&!t&&m&&!u){const T=setTimeout(()=>{f(!1),h(!0)},Y0);return()=>clearTimeout(T)}},[t,m,r,f,u,w]);const y=T=>{f(T)};return d.jsx(Fl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:d.jsx(B0,{className:Z("not-prose mb-4",e),onOpenChange:y,open:m,...i,children:a})})}),Q0=(e,t)=>e||t===0?d.jsx(q0,{duration:1,children:"Thinking..."}):t===void 0?d.jsx("p",{children:"Thought for a few seconds"}):d.jsxs("p",{children:["Thought for ",t," seconds"]}),Ul=p.memo(({className:e,children:t,getThinkingMessage:n=Q0,...r})=>{const{isStreaming:s,isOpen:o,duration:a}=K0();return d.jsx(W0,{className:Z("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??d.jsxs(d.Fragment,{children:[d.jsx(_a,{className:"size-4"}),n(s,a),d.jsx(gn,{className:Z("size-4 transition-transform",o?"rotate-180":"rotate-0")})]})})}),zl=p.memo(({className:e,children:t,...n})=>d.jsx(G0,{className:Z("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));$l.displayName="Reasoning";Ul.displayName="ReasoningTrigger";zl.displayName="ReasoningContent";const jr=200;function J0({entry:e,onRewind:t,onRewindAndEdit:n}){const[r,s]=p.useState(!1),[o,a]=p.useState(!1),i=p.useRef(null),m=p.useCallback(()=>{const f=i.current;f&&a(f.scrollHeight>jr+4)},[]);return p.useEffect(()=>{m()},[m,e.content]),d.jsxs("div",{className:"group/user flex justify-end items-start gap-2",children:[(t||n)&&d.jsxs("div",{className:"mt-1 flex items-center gap-0.5 opacity-0 transition-opacity group-hover/user:opacity-100",children:[t&&d.jsx("button",{type:"button",onClick:t,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("message.rewindHere"),children:d.jsx(Wu,{className:"h-3.5 w-3.5"})}),n&&d.jsx("button",{type:"button",onClick:n,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("message.rewindEdit"),children:d.jsx(ja,{className:"h-3.5 w-3.5"})})]}),d.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((f,l)=>d.jsx(eb,{image:f},l))}),e.attachments&&e.attachments.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((f,l)=>d.jsx(tb,{attachment:f},l))}),e.content&&d.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[d.jsx("div",{ref:i,className:Z("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!r&&o&&`max-h-[${jr}px]`),style:!r&&o?{maxHeight:`${jr}px`}:void 0,children:Id(e.content)}),!r&&o&&d.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:d.jsxs("button",{type:"button",onClick:()=>s(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[d.jsx("span",{children:G("message.expand")}),d.jsx(gn,{className:"h-3 w-3"})]})})]})]})]})}function Z0({entry:e,isStreaming:t}){return d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[d.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,r)=>{if(n.type==="thought"){const s=r===e.chunks.length-1,o=t&&s;return d.jsxs($l,{isStreaming:o,className:"mb-1",children:[d.jsx(Ul,{}),d.jsx(zl,{children:d.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},r)}return n.text.trim()?d.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:d.jsx(Hs,{children:n.text})},r):null})]})]})}function eb({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return d.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:d.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function tb({attachment:e}){const[t,n]=p.useState(!1),r=(()=>{switch(e.kind){case"text":return d.jsx(Kt,{className:"h-4 w-4"});case"table":return d.jsx(gs,{className:"h-4 w-4"});case"directory":return d.jsx(hs,{className:"h-4 w-4"});default:return d.jsx(Kt,{className:"h-4 w-4"})}})(),s=e.size!=null?nb(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return d.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[d.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:Z("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[r,d.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[d.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),d.jsxs("div",{className:"text-[10px] text-text-muted",children:[s&&d.jsx("span",{children:s}),s&&o!=null&&d.jsx("span",{children:" · "}),o!=null&&d.jsx("span",{children:Se("chat.fileCount",{n:o})})]})]}),a&&d.jsx(gn,{className:Z("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&d.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:d.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function nb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const rb=new Set(["FileEditTool","Edit","SedEdit"]),sb=new Set(["FileWriteTool","Write"]),ob=new Set(["MultiEdit"]),ab=new Set(["BashTool","Bash","PowerShellTool"]);function ib(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function Ye(e,t){for(const n of t){const r=e[n];if(typeof r=="string")return r}}function lb(e,t,n={}){if(rb.has(e)){const r=Ye(t,["old_string","oldString"]),s=Ye(t,["new_string","newString"]);return r===void 0||s===void 0?null:[{filePath:Ye(t,["file_path","filePath"])??e,oldString:r,newString:s}]}if(sb.has(e)){const r=Ye(t,["file_path","filePath"]),s=Ye(t,["content"]);if(r===void 0||s===void 0)return null;const o=n.writeOldContent;return[{filePath:r,oldString:o??"",newString:s,label:o===void 0?n.writeUnknownLabel:void 0}]}if(ob.has(e)){const r=t.edits;if(!Array.isArray(r)||r.length===0)return null;const s=Ye(t,["file_path","filePath"])??e,o=[];for(let a=0;a<r.length;a++){const i=r[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=Ye(m,["old_string","oldString"]),l=Ye(m,["new_string","newString"]);f===void 0||l===void 0||o.push({filePath:s,oldString:f,newString:l,label:`#${a+1}`})}return o.length>0?o:null}return null}function cb(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function db(e){switch(e){case"allow_once":case"allow_always":return"bg-approve text-white hover:bg-approve-hover";default:return""}}function ub(e){switch(e){case"allow_once":case"allow_always":return d.jsx(hn,{className:"size-4"});case"reject_once":case"reject_always":return d.jsx(bn,{className:"size-4"});default:return null}}function fb({requestId:e,options:t,onRespond:n,className:r}){nn();const s=o=>{n(e,o.optionId,o.kind)};return d.jsxs("div",{className:Z("p-3 border-t border-approve/30 bg-approve/5",r),children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(Ia,{className:"size-4 text-approve-text"}),d.jsx("span",{className:"text-xs font-medium font-display text-approve-text",children:G("permission.required")})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(o=>d.jsxs(Dt,{variant:cb(o.kind),size:"sm",onClick:()=>s(o),className:Z("gap-1.5 font-display",db(o.kind)),children:[ub(o.kind),o.name]},o.optionId))})]})}const Ho=1e3,mb=1e6;function pb({filePath:e,oldString:t,newString:n,label:r}){const s=gb(t,n),o=Wo(s,"add"),a=Wo(s,"remove"),i=s.length>Ho?s.slice(0,Ho):s,m=s.length-i.length;return d.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[d.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[d.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[10px] text-text-primary",title:e,children:e}),o>0&&d.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",o]}),a>0&&d.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),r&&d.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:r})]}),d.jsxs("div",{role:"list","aria-label":Se("diff.aria",{path:e,added:o,removed:a}),className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>d.jsx(hb,{line:f},l)),m>0&&d.jsx("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:Se("diff.hidden",{n:m})})]})]})}function hb({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return d.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?Se("diff.addedLine",{text:e.text}):e.type==="remove"?Se("diff.removedLine",{text:e.text}):void 0,className:Z("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[d.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),d.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Bo(e){return e.length===0?[]:e.split(`
355
- `)}function Wo(e,t){let n=0;for(const r of e)r.type===t&&n++;return n}function gb(e,t){const n=Bo(e),r=Bo(t);let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s++;let o=n.length,a=r.length;for(;o>s&&a>s&&n[o-1]===r[a-1];)o--,a--;const i=[];for(let m=0;m<s;m++)i.push({type:"context",text:n[m]});bb(n.slice(s,o),r.slice(s,a),i);for(let m=o;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function bb(e,t,n){const r=e.length,s=t.length;if(r===0&&s===0)return;if(r*s>mb){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const o=s+1,a=new Uint32Array((r+1)*o);for(let f=r-1;f>=0;f--)for(let l=s-1;l>=0;l--)a[f*o+l]=e[f]===t[l]?a[(f+1)*o+l+1]+1:Math.max(a[(f+1)*o+l],a[f*o+l+1]);let i=0,m=0;for(;i<r&&m<s;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*o+m]>=a[i*o+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<r;)n.push({type:"remove",text:e[i]}),i++;for(;m<s;)n.push({type:"add",text:t[m]}),m++}function Hl({entries:e,onPermissionRespond:t}){const[n,r]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return d.jsx("div",{className:"pl-10",children:d.jsx(Go,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const s=Sb(e),o=e.some(a=>a.toolCall.status==="running");return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand-text font-bold hover:bg-brand/10 transition-colors",onClick:()=>r(!n),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted",n&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-brand-text font-bold font-display",children:s}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"shrink-0 text-brand text-[10px]","aria-hidden":"true",children:"●"}),d.jsx("span",{className:"sr-only",children:G("chat.live.running")})]})]}),n&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((a,i)=>d.jsx(Go,{tool:a.toolCall,compact:!0,onPermissionRespond:t},a.toolCall.id||i))})]})})}function Go({tool:e,compact:t,onPermissionRespond:n}){const[r,s]=p.useState(!t),o=e.status==="running",a=(()=>{switch(e.status){case"running":return d.jsx("span",{className:"text-brand text-[10px]",children:"●"});case"complete":return d.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return d.jsx("span",{className:"text-brand-text text-[10px]",children:"⍻"});case"canceled":return d.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),i=Bl(e);return d.jsxs("div",{className:Z("px-3 py-2",t&&"py-1"),children:[d.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>s(!r),children:[a,d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-display font-bold text-brand-text transition-colors",children:e.title}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"sr-only",children:G("chat.live.running")}),d.jsx(Cl,{active:!0})]})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&d.jsx("div",{className:"mt-1.5 ml-4",children:d.jsx(fb,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),r&&d.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:vb(e)??d.jsxs(d.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&d.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Mt(JSON.stringify(e.rawInput,null,2),2e3)}),i&&d.jsx(Gl,{tool:e})]})})]})}const xb=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],yb=["output","stdout","stderr","result"];function vb(e){const t=ib(e.title),n=e.rawInput??{},r=lb(t,n,{writeOldContent:Ye(e.rawOutput??{},xb),writeUnknownLabel:G("tool.newFile")});if(r)return d.jsxs(d.Fragment,{children:[r.map((s,o)=>d.jsx(pb,{filePath:s.filePath,oldString:s.oldString,newString:s.newString,label:s.label},o)),Bl(e)&&d.jsx(Gl,{tool:e})]});if(ab.has(t)){const s=Ye(n,["command","cmd","script"]),o=kb(e);return s===void 0&&o.length===0?null:d.jsx(wb,{command:s!==void 0?Mt(s,500):void 0,output:o,isError:e.status==="error"})}return null}function wb({command:e,output:t,isError:n}){return d.jsx("div",{className:Z("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:d.jsxs("div",{className:"max-h-36 overflow-auto bg-zinc-900 px-2 py-1.5 font-mono text-xs text-zinc-300",children:[e&&d.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&d.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function Sb(e){const t=new Map;for(const r of e){const s=Cb(r.toolCall.title);t.set(s,(t.get(s)||0)+1)}const n=[];for(const[r,s]of t)n.push(s===1?r:Se("tool.callTimes",{n:s,name:r}));return n.length===0?Se("tool.summaryCalls",{n:e.length}):n.length===1?n[0]:Se("tool.summaryTools",{n:e.length,names:n.join("、")})}function Cb(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Bl(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function Wl(e){return!e.content||e.content.length===0?[]:e.content.filter(t=>t.type==="content").filter(t=>t.content.type==="text"&&"text"in t.content).map(t=>t.content.text)}function kb(e){const t=Wl(e);if(t.length>0)return Mt(t.join(`
356
- `),2e3);const n=e.rawOutput;if(n){for(const r of yb){const s=n[r];if(typeof s=="string"&&s.length>0)return Mt(s,2e3)}if(Object.keys(n).length>0)return Mt(JSON.stringify(n,null,2),2e3)}return""}function Gl({tool:e}){return d.jsx("pre",{className:Z("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:Eb(e)})}function Eb(e){const t=Wl(e);return t.length>0?Mt(t.join(`
357
- `),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?Mt(JSON.stringify(e.rawOutput,null,2),2e3):""}function Mt(e,t){return e.length>t?e.slice(0,t)+"...":e}function Ab({entry:e}){const[t,n]=p.useState(!1),{entries:r}=e;if(r.length===0)return null;const s=r.filter(i=>i.status==="completed").length,o=r.length,a=o>0?Math.round(s/o*100):0;return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:G("plan.title")}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[s,"/",o]}),d.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:d.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&d.jsx("div",{className:Z("border-t border-border px-3 py-1.5 space-y-0.5",o>5&&"max-h-64 overflow-y-auto"),children:r.map((i,m)=>d.jsx(Tb,{entry:i},m))})]})})}function Tb({entry:e}){return d.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[d.jsx("span",{className:"flex-shrink-0 mt-0.5",children:d.jsx(_b,{status:e.status})}),d.jsx("span",{className:Z("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),d.jsx(Rb,{priority:e.priority})]})}function _b({status:e}){switch(e){case"completed":return d.jsx(Zd,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return d.jsx(Ma,{className:"h-3.5 w-3.5 text-brand-text animate-spin",style:{animationDuration:"2s"}});case"pending":return d.jsx(tu,{className:"h-3.5 w-3.5 text-text-muted"})}}function Rb({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand-text dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:G("plan.priority.high"),medium:G("plan.priority.medium"),low:G("plan.priority.low")};return d.jsx("span",{className:Z("text-[10px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Mb({entry:e}){const t=e.variant==="error";return d.jsxs("div",{className:"w-full",children:[d.jsx("div",{className:Z("border-t-2",t?"border-status-error":"border-border")}),d.jsxs("div",{className:"pt-3",children:[d.jsx("h3",{className:Z("font-bold font-display text-base",t?"text-status-error":"text-brand-text"),children:e.title}),e.subtitle&&d.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),d.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:d.jsx(Hs,{children:e.outputText})}),d.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:G("chat.cmdDone")})]})}/*!---------------------------------------------------------------------------------------------
354
+ 5g:0.5 5e:0.5 5c:0.5 5e:0.5 | 5g:2 5e:0.5 5c:0.5 | 4g:2 r:2`,{name:"William Tell Overture",bpm:144,key:"E major"}),ns=[Jg,Lg,Vg,Hg,Dg,Qg,qg,Zg,Rg,Ug,Kg,Xg,Yg,$g,jg,Gg,zg,Og,Mg,Ng,Wg,Bg,Ig,Pg,Fg,e0];new Map(ns.map(e=>[e.name,e]));function t0(e=Math.random){const t=ns[Math.floor(e()*ns.length)];if(t===void 0)throw new Error("CLASSIC_SCORES is empty");return t}function n0(){return t0(Math.random)}function r0(e,t){return Cg(e,Math.floor(t/kg(e.bpm)))}function s0(e){return`${e.name}, ${Ag(e)}`}function o0(e){return`rgb(${e.r}, ${e.g}, ${e.b})`}function a0({score:e,stalled:t=!1,className:n}){const s=Sl(!0),r=bg(),o=Q("live-glyph inline-flex w-[0.6em] shrink-0 justify-center leading-none",t&&"live-glyph--stalled",n);if(r)return d.jsx("span",{"aria-hidden":"true",className:o,children:"●"});const a=r0(e,s);return d.jsx("span",{"aria-hidden":"true",className:o,children:d.jsx("span",{className:"live-note",style:t?void 0:{color:o0(a.color)},children:a.char})})}function i0({text:e,stalled:t=!1,className:n}){return d.jsx("span",{className:Q("live-word",t&&"live-word--stalled",n),children:e})}function Cl({active:e,since:t,className:n}){const s=xg(e,t);return!e||s<1?null:d.jsxs("span",{"aria-hidden":"true",className:Q("font-mono text-[10px] tabular-nums text-text-muted",n),children:[s,"s"]})}function l0({stalled:e=!1,since:t,className:n}){const[s]=p.useState(()=>n0());return d.jsxs("div",{className:Q("flex items-center gap-2 pt-1.5 font-display min-h-8",n),children:[d.jsx(a0,{score:s,stalled:e,className:"text-base text-brand"}),d.jsxs("span",{role:"status",className:"text-sm font-medium",children:[d.jsxs("span",{className:"sr-only",children:[G("chat.live.working")," · "]}),d.jsx(i0,{text:s0(s),stalled:e})]}),d.jsx(Cl,{active:!0,since:t,className:"self-center"})]})}var c0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wt=c0.reduce((e,t)=>{const n=Ua(`Primitive.${t}`),s=p.forwardRef((r,o)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),d0=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),u0="VisuallyHidden",kl=p.forwardRef((e,t)=>d.jsx(be.span,{...e,ref:t,style:{...d0,...e.style}}));kl.displayName=u0;var f0=kl,[fr]=it("Tooltip",[tn]),mr=tn(),El="TooltipProvider",m0=700,rs="tooltip.open",[p0,Us]=fr(El),Al=e=>{const{__scopeTooltip:t,delayDuration:n=m0,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:o}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),d.jsx(p0,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:r,children:o})};Al.displayName=El;var mn="Tooltip",[h0,kn]=fr(mn),Tl=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:o,disableHoverableContent:a,delayDuration:i}=e,m=Us(mn,e.__scopeTooltip),f=mr(t),[l,c]=p.useState(null),u=De(),h=p.useRef(0),b=a??m.disableHoverableContent,v=i??m.delayDuration,w=p.useRef(!1),[y,T]=gt({prop:s,defaultProp:r??!1,onChange:_=>{_?(m.onOpen(),document.dispatchEvent(new CustomEvent(rs))):m.onClose(),o==null||o(_)},caller:mn}),A=p.useMemo(()=>y?w.current?"delayed-open":"instant-open":"closed",[y]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w.current=!1,T(!0)},[T]),O=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,T(!1)},[T]),E=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{w.current=!0,T(!0),h.current=0},v)},[v,T]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(As,{...f,children:d.jsx(h0,{scope:t,contentId:u,open:y,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?E():k()},[m.isOpenDelayedRef,E,k]),onTriggerLeave:p.useCallback(()=>{b?O():(window.clearTimeout(h.current),h.current=0)},[O,b]),onOpen:k,onClose:O,disableHoverableContent:b,children:n})})};Tl.displayName=mn;var ss="TooltipTrigger",_l=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=kn(ss,n),o=Us(ss,n),a=mr(n),i=p.useRef(null),m=Ae(t,i,r.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),d.jsx(ir,{asChild:!0,...a,children:d.jsx(be.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:m,onPointerMove:ne(e.onPointerMove,u=>{u.pointerType!=="touch"&&!l.current&&!o.isPointerInTransitRef.current&&(r.onTriggerEnter(),l.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{r.onTriggerLeave(),l.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:ne(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:ne(e.onBlur,r.onClose),onClick:ne(e.onClick,r.onClose)})})});_l.displayName=ss;var zs="TooltipPortal",[g0,b0]=fr(zs,{forceMount:void 0}),Rl=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,o=kn(zs,t);return d.jsx(g0,{scope:t,forceMount:n,children:d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:r,children:s})})})};Rl.displayName=zs;var Qt="TooltipContent",Ml=p.forwardRef((e,t)=>{const n=b0(Qt,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...o}=e,a=kn(Qt,e.__scopeTooltip);return d.jsx(ze,{present:s||a.open,children:a.disableHoverableContent?d.jsx(Nl,{side:r,...o,ref:t}):d.jsx(x0,{side:r,...o,ref:t})})}),x0=p.forwardRef((e,t)=>{const n=kn(Qt,e.__scopeTooltip),s=Us(Qt,e.__scopeTooltip),r=p.useRef(null),o=Ae(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=r.current,{onPointerInTransitChange:c}=s,u=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((b,v)=>{const w=b.currentTarget,y={x:b.clientX,y:b.clientY},T=S0(y,w.getBoundingClientRect()),A=C0(y,T),k=k0(v.getBoundingClientRect()),O=A0([...A,...k]);i(O),c(!0)},[c]);return p.useEffect(()=>()=>u(),[u]),p.useEffect(()=>{if(m&&l){const b=w=>h(w,l),v=w=>h(w,m);return m.addEventListener("pointerleave",b),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",v)}}},[m,l,h,u]),p.useEffect(()=>{if(a){const b=v=>{const w=v.target,y={x:v.clientX,y:v.clientY},T=(m==null?void 0:m.contains(w))||(l==null?void 0:l.contains(w)),A=!E0(y,a);T?u():A&&(u(),f())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[m,l,a,f,u]),d.jsx(Nl,{...e,ref:o})}),[y0,v0]=fr(mn,{isInside:!1}),w0=pf("TooltipContent"),Nl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:o,onPointerDownOutside:a,...i}=e,m=kn(Qt,n),f=mr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(rs,l),()=>document.removeEventListener(rs,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=u=>{const h=u.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),d.jsx(xn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:d.jsxs(Ts,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(w0,{children:s}),d.jsx(y0,{scope:n,isInside:!0,children:d.jsx(f0,{id:m.contentId,role:"tooltip",children:r||s})})]})})});Ml.displayName=Qt;var jl="TooltipArrow",Pl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=mr(n);return v0(jl,n).isInside?null:d.jsx(_s,{...r,...s,ref:t})});Pl.displayName=jl;function S0(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,r,o)){case o:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function C0(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function k0(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function E0(e,t){const{x:n,y:s}=e;let r=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>s!=u>s&&n<(c-f)*(s-l)/(u-l)+f&&(r=!r)}return r}function A0(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),T0(t)}function T0(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(r.y-a.y)>=(o.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(r.y-a.y)>=(o.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var _0=Al,R0=Tl,M0=_l,N0=Rl,j0=Ml,P0=Pl;function I0({delayDuration:e=0,...t}){return d.jsx(_0,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function D0({...e}){return d.jsx(I0,{children:d.jsx(R0,{"data-slot":"tooltip",...e})})}function O0({...e}){return d.jsx(M0,{"data-slot":"tooltip-trigger",...e})}function L0({className:e,sideOffset:t=0,children:n,...s}){return d.jsx(N0,{children:d.jsxs(j0,{"data-slot":"tooltip-content",sideOffset:t,className:Q("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...s,children:[n,d.jsx(P0,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const F0=p.lazy(()=>Ne(()=>import("./mermaid-VLURNSYL-Bh10UEb0.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.Streamdown})));p.createContext(null);const Hs=p.memo(({className:e,children:t,...n})=>d.jsx(p.Suspense,{fallback:d.jsx("div",{className:Q("whitespace-pre-wrap break-words",e),children:t}),children:d.jsx(F0,{className:Q("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Hs.displayName="MessageResponse";var pr="Collapsible",[$0]=it(pr),[U0,Bs]=$0(pr),Il=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:r,disabled:o,onOpenChange:a,...i}=e,[m,f]=gt({prop:s,defaultProp:r??!1,onChange:a,caller:pr});return d.jsx(U0,{scope:n,disabled:o,contentId:De(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:d.jsx(be.div,{"data-state":Gs(m),"data-disabled":o?"":void 0,...i,ref:t})})});Il.displayName=pr;var Dl="CollapsibleTrigger",Ol=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,r=Bs(Dl,n);return d.jsx(be.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Gs(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:t,onClick:ne(e.onClick,r.onOpenToggle)})});Ol.displayName=Dl;var Ws="CollapsibleContent",Ll=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,r=Bs(Ws,e.__scopeCollapsible);return d.jsx(ze,{present:n||r.open,children:({present:o})=>d.jsx(z0,{...s,ref:t,present:o})})});Ll.displayName=Ws;var z0=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:r,...o}=e,a=Bs(Ws,n),[i,m]=p.useState(s),f=p.useRef(null),l=Ae(t,f),c=p.useRef(0),u=c.current,h=p.useRef(0),b=h.current,v=a.open||i,w=p.useRef(v),y=p.useRef(void 0);return p.useEffect(()=>{const T=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(T)},[]),rt(()=>{const T=f.current;if(T){y.current=y.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const A=T.getBoundingClientRect();c.current=A.height,h.current=A.width,w.current||(T.style.transitionDuration=y.current.transitionDuration,T.style.animationName=y.current.animationName),m(s)}},[a.open,s]),d.jsx(be.div,{"data-state":Gs(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...o,ref:l,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:v&&r})});function Gs(e){return e?"open":"closed"}var H0=Il;function B0({...e}){return d.jsx(H0,{"data-slot":"collapsible",...e})}function W0({...e}){return d.jsx(Ol,{"data-slot":"collapsible-trigger",...e})}function G0({...e}){return d.jsx(Ll,{"data-slot":"collapsible-content",...e})}const V0=({children:e,as:t="p",className:n,duration:s=2})=>{const r=Hc.create(t);return d.jsx(r,{animate:{opacity:[.5,1,.5]},className:Q("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:s,ease:"easeInOut"},children:e})},q0=p.memo(V0),Fl=p.createContext(null),K0=()=>{const e=p.useContext(Fl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Y0=1e3,X0=1e3,$l=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:s=!0,onOpenChange:r,duration:o,children:a,...i})=>{const[m,f]=gt({prop:n,defaultProp:s,onChange:r}),[l,c]=gt({prop:o,defaultProp:void 0}),[u,h]=p.useState(!1),[b,v]=p.useState(null);p.useEffect(()=>{t?b===null&&v(Date.now()):b!==null&&(c(Math.ceil((Date.now()-b)/X0)),v(null))},[t,b,c]);const w=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!w&&s&&!t&&m&&!u){const T=setTimeout(()=>{f(!1),h(!0)},Y0);return()=>clearTimeout(T)}},[t,m,s,f,u,w]);const y=T=>{f(T)};return d.jsx(Fl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:d.jsx(B0,{className:Q("not-prose mb-4",e),onOpenChange:y,open:m,...i,children:a})})}),Q0=(e,t)=>e||t===0?d.jsx(q0,{duration:1,children:"Thinking..."}):t===void 0?d.jsx("p",{children:"Thought for a few seconds"}):d.jsxs("p",{children:["Thought for ",t," seconds"]}),Ul=p.memo(({className:e,children:t,getThinkingMessage:n=Q0,...s})=>{const{isStreaming:r,isOpen:o,duration:a}=K0();return d.jsx(W0,{className:Q("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...s,children:t??d.jsxs(d.Fragment,{children:[d.jsx(_a,{className:"size-4"}),n(r,a),d.jsx(gn,{className:Q("size-4 transition-transform",o?"rotate-180":"rotate-0")})]})})}),zl=p.memo(({className:e,children:t,...n})=>d.jsx(G0,{className:Q("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));$l.displayName="Reasoning";Ul.displayName="ReasoningTrigger";zl.displayName="ReasoningContent";const jr=200;function J0({entry:e,onRewind:t,onRewindAndEdit:n}){const[s,r]=p.useState(!1),[o,a]=p.useState(!1),i=p.useRef(null),m=p.useCallback(()=>{const f=i.current;f&&a(f.scrollHeight>jr+4)},[]);return p.useEffect(()=>{m()},[m,e.content]),d.jsxs("div",{className:"group/user flex justify-end items-start gap-2",children:[(t||n)&&d.jsxs("div",{className:"mt-1 flex items-center gap-0.5 opacity-0 transition-opacity group-hover/user:opacity-100",children:[t&&d.jsx("button",{type:"button",onClick:t,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("message.rewindHere"),children:d.jsx(Wu,{className:"h-3.5 w-3.5"})}),n&&d.jsx("button",{type:"button",onClick:n,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:G("message.rewindEdit"),children:d.jsx(ja,{className:"h-3.5 w-3.5"})})]}),d.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((f,l)=>d.jsx(eb,{image:f},l))}),e.attachments&&e.attachments.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((f,l)=>d.jsx(tb,{attachment:f},l))}),e.content&&d.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[d.jsx("div",{ref:i,className:Q("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!s&&o&&`max-h-[${jr}px]`),style:!s&&o?{maxHeight:`${jr}px`}:void 0,children:Id(e.content)}),!s&&o&&d.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:d.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[d.jsx("span",{children:G("message.expand")}),d.jsx(gn,{className:"h-3 w-3"})]})})]})]})]})}function Z0({entry:e,isStreaming:t}){return d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[d.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,s)=>{if(n.type==="thought"){const r=s===e.chunks.length-1,o=t&&r;return d.jsxs($l,{isStreaming:o,className:"mb-1",children:[d.jsx(Ul,{}),d.jsx(zl,{children:d.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},s)}return n.text.trim()?d.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:d.jsx(Hs,{children:n.text})},s):null})]})]})}function eb({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return d.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:d.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function tb({attachment:e}){const[t,n]=p.useState(!1),s=(()=>{switch(e.kind){case"text":return d.jsx(Kt,{className:"h-4 w-4"});case"table":return d.jsx(gs,{className:"h-4 w-4"});case"directory":return d.jsx(hs,{className:"h-4 w-4"});default:return d.jsx(Kt,{className:"h-4 w-4"})}})(),r=e.size!=null?nb(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return d.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[d.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:Q("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[s,d.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[d.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),d.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&d.jsx("span",{children:r}),r&&o!=null&&d.jsx("span",{children:" · "}),o!=null&&d.jsx("span",{children:Se("chat.fileCount",{n:o})})]})]}),a&&d.jsx(gn,{className:Q("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&d.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:d.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function nb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const rb=new Set(["FileEditTool","Edit","SedEdit"]),sb=new Set(["FileWriteTool","Write"]),ob=new Set(["MultiEdit"]),ab=new Set(["BashTool","Bash","PowerShellTool"]);function ib(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function Ye(e,t){for(const n of t){const s=e[n];if(typeof s=="string")return s}}function lb(e,t,n={}){if(rb.has(e)){const s=Ye(t,["old_string","oldString"]),r=Ye(t,["new_string","newString"]);return s===void 0||r===void 0?null:[{filePath:Ye(t,["file_path","filePath"])??e,oldString:s,newString:r}]}if(sb.has(e)){const s=Ye(t,["file_path","filePath"]),r=Ye(t,["content"]);if(s===void 0||r===void 0)return null;const o=n.writeOldContent;return[{filePath:s,oldString:o??"",newString:r,label:o===void 0?n.writeUnknownLabel:void 0}]}if(ob.has(e)){const s=t.edits;if(!Array.isArray(s)||s.length===0)return null;const r=Ye(t,["file_path","filePath"])??e,o=[];for(let a=0;a<s.length;a++){const i=s[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=Ye(m,["old_string","oldString"]),l=Ye(m,["new_string","newString"]);f===void 0||l===void 0||o.push({filePath:r,oldString:f,newString:l,label:`#${a+1}`})}return o.length>0?o:null}return null}function cb(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function db(e){switch(e){case"allow_once":case"allow_always":return"bg-approve text-white hover:bg-approve-hover";default:return""}}function ub(e){switch(e){case"allow_once":case"allow_always":return d.jsx(hn,{className:"size-4"});case"reject_once":case"reject_always":return d.jsx(bn,{className:"size-4"});default:return null}}function fb({requestId:e,options:t,onRespond:n,className:s}){nn();const r=o=>{n(e,o.optionId,o.kind)};return d.jsxs("div",{className:Q("p-3 border-t border-approve/30 bg-approve/5",s),children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(Ia,{className:"size-4 text-approve-text"}),d.jsx("span",{className:"text-xs font-medium font-display text-approve-text",children:G("permission.required")})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(o=>d.jsxs(Dt,{variant:cb(o.kind),size:"sm",onClick:()=>r(o),className:Q("gap-1.5 font-display",db(o.kind)),children:[ub(o.kind),o.name]},o.optionId))})]})}const Ho=1e3,mb=1e6;function pb({filePath:e,oldString:t,newString:n,label:s}){const r=gb(t,n),o=Wo(r,"add"),a=Wo(r,"remove"),i=r.length>Ho?r.slice(0,Ho):r,m=r.length-i.length;return d.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[d.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[d.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[10px] text-text-primary",title:e,children:e}),o>0&&d.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",o]}),a>0&&d.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),s&&d.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:s})]}),d.jsxs("div",{role:"list","aria-label":Se("diff.aria",{path:e,added:o,removed:a}),className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>d.jsx(hb,{line:f},l)),m>0&&d.jsx("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:Se("diff.hidden",{n:m})})]})]})}function hb({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return d.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?Se("diff.addedLine",{text:e.text}):e.type==="remove"?Se("diff.removedLine",{text:e.text}):void 0,className:Q("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[d.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),d.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Bo(e){return e.length===0?[]:e.split(`
355
+ `)}function Wo(e,t){let n=0;for(const s of e)s.type===t&&n++;return n}function gb(e,t){const n=Bo(e),s=Bo(t);let r=0;for(;r<n.length&&r<s.length&&n[r]===s[r];)r++;let o=n.length,a=s.length;for(;o>r&&a>r&&n[o-1]===s[a-1];)o--,a--;const i=[];for(let m=0;m<r;m++)i.push({type:"context",text:n[m]});bb(n.slice(r,o),s.slice(r,a),i);for(let m=o;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function bb(e,t,n){const s=e.length,r=t.length;if(s===0&&r===0)return;if(s*r>mb){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const o=r+1,a=new Uint32Array((s+1)*o);for(let f=s-1;f>=0;f--)for(let l=r-1;l>=0;l--)a[f*o+l]=e[f]===t[l]?a[(f+1)*o+l+1]+1:Math.max(a[(f+1)*o+l],a[f*o+l+1]);let i=0,m=0;for(;i<s&&m<r;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*o+m]>=a[i*o+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<s;)n.push({type:"remove",text:e[i]}),i++;for(;m<r;)n.push({type:"add",text:t[m]}),m++}function Hl({entries:e,onPermissionRespond:t}){const[n,s]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return d.jsx("div",{className:"pl-10",children:d.jsx(Go,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=Sb(e),o=e.some(a=>a.toolCall.status==="running");return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand-text font-bold hover:bg-brand/10 transition-colors",onClick:()=>s(!n),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Q("transition-transform text-text-muted",n&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-brand-text font-bold font-display",children:r}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"shrink-0 text-brand text-[10px]","aria-hidden":"true",children:"●"}),d.jsx("span",{className:"sr-only",children:G("chat.live.running")})]})]}),n&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((a,i)=>d.jsx(Go,{tool:a.toolCall,compact:!0,onPermissionRespond:t},a.toolCall.id||i))})]})})}function Go({tool:e,compact:t,onPermissionRespond:n}){const[s,r]=p.useState(!t),o=e.status==="running",a=(()=>{switch(e.status){case"running":return d.jsx("span",{className:"text-brand text-[10px]",children:"●"});case"complete":return d.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return d.jsx("span",{className:"text-brand-text text-[10px]",children:"⍻"});case"canceled":return d.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),i=Bl(e);return d.jsxs("div",{className:Q("px-3 py-2",t&&"py-1"),children:[d.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!s),children:[a,d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-display font-bold text-brand-text transition-colors",children:e.title}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"sr-only",children:G("chat.live.running")}),d.jsx(Cl,{active:!0})]})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&d.jsx("div",{className:"mt-1.5 ml-4",children:d.jsx(fb,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),s&&d.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:vb(e)??d.jsxs(d.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&d.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Mt(JSON.stringify(e.rawInput,null,2),2e3)}),i&&d.jsx(Gl,{tool:e})]})})]})}const xb=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],yb=["output","stdout","stderr","result"];function vb(e){const t=ib(e.title),n=e.rawInput??{},s=lb(t,n,{writeOldContent:Ye(e.rawOutput??{},xb),writeUnknownLabel:G("tool.newFile")});if(s)return d.jsxs(d.Fragment,{children:[s.map((r,o)=>d.jsx(pb,{filePath:r.filePath,oldString:r.oldString,newString:r.newString,label:r.label},o)),Bl(e)&&d.jsx(Gl,{tool:e})]});if(ab.has(t)){const r=Ye(n,["command","cmd","script"]),o=kb(e);return r===void 0&&o.length===0?null:d.jsx(wb,{command:r!==void 0?Mt(r,500):void 0,output:o,isError:e.status==="error"})}return null}function wb({command:e,output:t,isError:n}){return d.jsx("div",{className:Q("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:d.jsxs("div",{className:"max-h-36 overflow-auto bg-zinc-900 px-2 py-1.5 font-mono text-xs text-zinc-300",children:[e&&d.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&d.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function Sb(e){const t=new Map;for(const s of e){const r=Cb(s.toolCall.title);t.set(r,(t.get(r)||0)+1)}const n=[];for(const[s,r]of t)n.push(r===1?s:Se("tool.callTimes",{n:r,name:s}));return n.length===0?Se("tool.summaryCalls",{n:e.length}):n.length===1?n[0]:Se("tool.summaryTools",{n:e.length,names:n.join("、")})}function Cb(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Bl(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function Wl(e){return!e.content||e.content.length===0?[]:e.content.filter(t=>t.type==="content").filter(t=>t.content.type==="text"&&"text"in t.content).map(t=>t.content.text)}function kb(e){const t=Wl(e);if(t.length>0)return Mt(t.join(`
356
+ `),2e3);const n=e.rawOutput;if(n){for(const s of yb){const r=n[s];if(typeof r=="string"&&r.length>0)return Mt(r,2e3)}if(Object.keys(n).length>0)return Mt(JSON.stringify(n,null,2),2e3)}return""}function Gl({tool:e}){return d.jsx("pre",{className:Q("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:Eb(e)})}function Eb(e){const t=Wl(e);return t.length>0?Mt(t.join(`
357
+ `),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?Mt(JSON.stringify(e.rawOutput,null,2),2e3):""}function Mt(e,t){return e.length>t?e.slice(0,t)+"...":e}function Ab({entry:e}){const[t,n]=p.useState(!1),{entries:s}=e;if(s.length===0)return null;const r=s.filter(i=>i.status==="completed").length,o=s.length,a=o>0?Math.round(r/o*100):0;return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Q("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:G("plan.title")}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",o]}),d.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:d.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&d.jsx("div",{className:Q("border-t border-border px-3 py-1.5 space-y-0.5",o>5&&"max-h-64 overflow-y-auto"),children:s.map((i,m)=>d.jsx(Tb,{entry:i},m))})]})})}function Tb({entry:e}){return d.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[d.jsx("span",{className:"flex-shrink-0 mt-0.5",children:d.jsx(_b,{status:e.status})}),d.jsx("span",{className:Q("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),d.jsx(Rb,{priority:e.priority})]})}function _b({status:e}){switch(e){case"completed":return d.jsx(Zd,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return d.jsx(Ma,{className:"h-3.5 w-3.5 text-brand-text animate-spin",style:{animationDuration:"2s"}});case"pending":return d.jsx(tu,{className:"h-3.5 w-3.5 text-text-muted"})}}function Rb({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand-text dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:G("plan.priority.high"),medium:G("plan.priority.medium"),low:G("plan.priority.low")};return d.jsx("span",{className:Q("text-[10px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Mb({entry:e}){const t=e.variant==="error";return d.jsxs("div",{className:"w-full",children:[d.jsx("div",{className:Q("border-t-2",t?"border-status-error":"border-border")}),d.jsxs("div",{className:"pt-3",children:[d.jsx("h3",{className:Q("font-bold font-display text-base",t?"text-status-error":"text-brand-text"),children:e.title}),e.subtitle&&d.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),d.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:d.jsx(Hs,{children:e.outputText})}),d.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:G("chat.cmdDone")})]})}/*!---------------------------------------------------------------------------------------------
358
358
  * Copyright (c) StackBlitz. All rights reserved.
359
359
  * Licensed under the MIT License. See License.txt in the project root for license information.
360
- *--------------------------------------------------------------------------------------------*/const Nb={damping:.7,stiffness:.05,mass:1.25},jb=70,Pb=1e3/60,Ib=350;let hr=!1;var ia;(ia=globalThis.document)==null||ia.addEventListener("mousedown",()=>{hr=!0});var la;(la=globalThis.document)==null||la.addEventListener("mouseup",()=>{hr=!1});var ca;(ca=globalThis.document)==null||ca.addEventListener("click",()=>{hr=!1});const Db=(e={})=>{const[t,n]=p.useState(!1),[r,s]=p.useState(e.initial!==!1),[o,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var k;if(!hr)return!1;const T=window.getSelection();if(!T||!T.rangeCount)return!1;const A=T.getRangeAt(0);return A.commonAncestorContainer.contains(w.current)||((k=w.current)==null?void 0:k.contains(A.commonAncestorContainer))},[]),f=p.useCallback(T=>{c.isAtBottom=T,s(T)},[]),l=p.useCallback(T=>{c.escapedFromLock=T,n(T)},[]),c=p.useMemo(()=>{let T;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var A;return((A=w.current)==null?void 0:A.scrollTop)??0},set scrollTop(A){if(w.current){const{scrollBehavior:k}=getComputedStyle(w.current);k!=="auto"&&(w.current.style.scrollBehavior="auto"),w.current.scrollTop=A,c.ignoreScrollToTop=w.current.scrollTop,k!=="auto"&&(w.current.style.scrollBehavior=k)}},get targetScrollTop(){return!w.current||!y.current?0:w.current.scrollHeight-1-w.current.clientHeight},get calculatedTargetScrollTop(){if(!w.current||!y.current)return 0;const{targetScrollTop:A}=this;if(!e.targetScrollTop)return A;if((T==null?void 0:T.targetScrollTop)===A)return T.calculatedScrollTop;const k=Math.max(Math.min(e.targetScrollTop(A,{scrollElement:w.current,contentElement:y.current}),A),0);return T={targetScrollTop:A,calculatedScrollTop:k},requestAnimationFrame(()=>{T=void 0}),k},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=jb}}},[]),u=p.useCallback((T={})=>{var x;typeof T=="string"&&(T={animation:T}),T.preserveScrollPosition||f(!0);const A=Date.now()+(Number(T.wait)||0),k=Ir(i.current,T.animation),{ignoreEscapes:O=!1}=T;let E,_=c.calculatedTargetScrollTop;T.duration instanceof Promise?T.duration.finally(()=>{E=Date.now()}):E=A+(T.duration??0);const g=async()=>{const M=new Promise(requestAnimationFrame).then(()=>{var j;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:I}=c,D=performance.now(),F=(D-(c.lastTick??D))/Pb;if(c.animation||(c.animation={behavior:k,promise:M,ignoreEscapes:O}),c.animation.behavior===k&&(c.lastTick=D),m()||A>Date.now())return g();if(I<Math.min(_,c.calculatedTargetScrollTop)){if(((j=c.animation)==null?void 0:j.behavior)===k){if(k==="instant")return c.scrollTop=c.calculatedTargetScrollTop,g();c.velocity=(k.damping*c.velocity+k.stiffness*c.scrollDifference)/k.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==I&&(c.accumulated=0)}return g()}return E>Date.now()?(_=c.calculatedTargetScrollTop,g()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?u({animation:Ir(i.current,i.current.resize),ignoreEscapes:O,duration:Math.max(0,E-Date.now())||void 0}):c.isAtBottom)});return M.then(I=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),I))};return T.wait!==!0&&(c.animation=void 0),((x=c.animation)==null?void 0:x.behavior)===k?c.animation.promise:g()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),b=p.useCallback(({target:T})=>{if(T!==w.current)return;const{scrollTop:A,ignoreScrollToTop:k}=c;let{lastScrollTop:O=A}=c;c.lastScrollTop=A,c.ignoreScrollToTop=void 0,k&&k>A&&(O=k),a(c.isNearBottom),setTimeout(()=>{var g;if(c.resizeDifference||A===k)return;if(m()){l(!0),f(!1);return}const E=A>O,_=A<O;if((g=c.animation)!=null&&g.ignoreEscapes){c.scrollTop=O;return}_&&(l(!0),f(!1)),E&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),v=p.useCallback(({target:T,deltaY:A})=>{var O;let k=T;for(;!["scroll","auto"].includes(getComputedStyle(k).overflow);){if(!k.parentElement)return;k=k.parentElement}k===w.current&&A<0&&w.current.scrollHeight>w.current.clientHeight&&!((O=c.animation)!=null&&O.ignoreEscapes)&&(l(!0),f(!1))},[l,f,c]),w=Vo(T=>{var A,k;(A=w.current)==null||A.removeEventListener("scroll",b),(k=w.current)==null||k.removeEventListener("wheel",v),T==null||T.addEventListener("scroll",b,{passive:!0}),T==null||T.addEventListener("wheel",v,{passive:!0})},[]),y=Vo(T=>{var k,O;if((k=c.resizeObserver)==null||k.disconnect(),!T)return;let A;c.resizeObserver=new ResizeObserver(([E])=>{const{height:_}=E.contentRect,g=_-(A??_);if(c.resizeDifference=g,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),g>=0){const x=Ir(i.current,A?i.current.resize:i.current.initial);u({animation:x,wait:!0,preserveScrollPosition:!0,duration:x==="instant"?void 0:Ib})}else c.isNearBottom&&(l(!1),f(!0));A=_,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===g&&(c.resizeDifference=0)},1)})}),(O=c.resizeObserver)==null||O.observe(T)},[]);return{contentRef:y,scrollRef:w,scrollToBottom:u,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:t,state:c}};function Vo(e,t){const n=p.useCallback(r=>(n.current=r,e(r)),t);return n}const Pr=new Map;function Ir(...e){const t={...Nb};let n=!1;for(const s of e){if(s==="instant"){n=!0;continue}typeof s=="object"&&(n=!1,t.damping=s.damping??t.damping,t.stiffness=s.stiffness??t.stiffness,t.mass=s.mass??t.mass)}const r=JSON.stringify(t);return Pr.has(r)||Pr.set(r,Object.freeze(t)),n?"instant":Pr.get(r)}/*!---------------------------------------------------------------------------------------------
360
+ *--------------------------------------------------------------------------------------------*/const Nb={damping:.7,stiffness:.05,mass:1.25},jb=70,Pb=1e3/60,Ib=350;let hr=!1;var ia;(ia=globalThis.document)==null||ia.addEventListener("mousedown",()=>{hr=!0});var la;(la=globalThis.document)==null||la.addEventListener("mouseup",()=>{hr=!1});var ca;(ca=globalThis.document)==null||ca.addEventListener("click",()=>{hr=!1});const Db=(e={})=>{const[t,n]=p.useState(!1),[s,r]=p.useState(e.initial!==!1),[o,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var k;if(!hr)return!1;const T=window.getSelection();if(!T||!T.rangeCount)return!1;const A=T.getRangeAt(0);return A.commonAncestorContainer.contains(w.current)||((k=w.current)==null?void 0:k.contains(A.commonAncestorContainer))},[]),f=p.useCallback(T=>{c.isAtBottom=T,r(T)},[]),l=p.useCallback(T=>{c.escapedFromLock=T,n(T)},[]),c=p.useMemo(()=>{let T;return{escapedFromLock:t,isAtBottom:s,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var A;return((A=w.current)==null?void 0:A.scrollTop)??0},set scrollTop(A){if(w.current){const{scrollBehavior:k}=getComputedStyle(w.current);k!=="auto"&&(w.current.style.scrollBehavior="auto"),w.current.scrollTop=A,c.ignoreScrollToTop=w.current.scrollTop,k!=="auto"&&(w.current.style.scrollBehavior=k)}},get targetScrollTop(){return!w.current||!y.current?0:w.current.scrollHeight-1-w.current.clientHeight},get calculatedTargetScrollTop(){if(!w.current||!y.current)return 0;const{targetScrollTop:A}=this;if(!e.targetScrollTop)return A;if((T==null?void 0:T.targetScrollTop)===A)return T.calculatedScrollTop;const k=Math.max(Math.min(e.targetScrollTop(A,{scrollElement:w.current,contentElement:y.current}),A),0);return T={targetScrollTop:A,calculatedScrollTop:k},requestAnimationFrame(()=>{T=void 0}),k},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=jb}}},[]),u=p.useCallback((T={})=>{var x;typeof T=="string"&&(T={animation:T}),T.preserveScrollPosition||f(!0);const A=Date.now()+(Number(T.wait)||0),k=Ir(i.current,T.animation),{ignoreEscapes:O=!1}=T;let E,_=c.calculatedTargetScrollTop;T.duration instanceof Promise?T.duration.finally(()=>{E=Date.now()}):E=A+(T.duration??0);const g=async()=>{const M=new Promise(requestAnimationFrame).then(()=>{var j;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:I}=c,D=performance.now(),F=(D-(c.lastTick??D))/Pb;if(c.animation||(c.animation={behavior:k,promise:M,ignoreEscapes:O}),c.animation.behavior===k&&(c.lastTick=D),m()||A>Date.now())return g();if(I<Math.min(_,c.calculatedTargetScrollTop)){if(((j=c.animation)==null?void 0:j.behavior)===k){if(k==="instant")return c.scrollTop=c.calculatedTargetScrollTop,g();c.velocity=(k.damping*c.velocity+k.stiffness*c.scrollDifference)/k.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==I&&(c.accumulated=0)}return g()}return E>Date.now()?(_=c.calculatedTargetScrollTop,g()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?u({animation:Ir(i.current,i.current.resize),ignoreEscapes:O,duration:Math.max(0,E-Date.now())||void 0}):c.isAtBottom)});return M.then(I=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),I))};return T.wait!==!0&&(c.animation=void 0),((x=c.animation)==null?void 0:x.behavior)===k?c.animation.promise:g()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),b=p.useCallback(({target:T})=>{if(T!==w.current)return;const{scrollTop:A,ignoreScrollToTop:k}=c;let{lastScrollTop:O=A}=c;c.lastScrollTop=A,c.ignoreScrollToTop=void 0,k&&k>A&&(O=k),a(c.isNearBottom),setTimeout(()=>{var g;if(c.resizeDifference||A===k)return;if(m()){l(!0),f(!1);return}const E=A>O,_=A<O;if((g=c.animation)!=null&&g.ignoreEscapes){c.scrollTop=O;return}_&&(l(!0),f(!1)),E&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),v=p.useCallback(({target:T,deltaY:A})=>{var O;let k=T;for(;!["scroll","auto"].includes(getComputedStyle(k).overflow);){if(!k.parentElement)return;k=k.parentElement}k===w.current&&A<0&&w.current.scrollHeight>w.current.clientHeight&&!((O=c.animation)!=null&&O.ignoreEscapes)&&(l(!0),f(!1))},[l,f,c]),w=Vo(T=>{var A,k;(A=w.current)==null||A.removeEventListener("scroll",b),(k=w.current)==null||k.removeEventListener("wheel",v),T==null||T.addEventListener("scroll",b,{passive:!0}),T==null||T.addEventListener("wheel",v,{passive:!0})},[]),y=Vo(T=>{var k,O;if((k=c.resizeObserver)==null||k.disconnect(),!T)return;let A;c.resizeObserver=new ResizeObserver(([E])=>{const{height:_}=E.contentRect,g=_-(A??_);if(c.resizeDifference=g,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),g>=0){const x=Ir(i.current,A?i.current.resize:i.current.initial);u({animation:x,wait:!0,preserveScrollPosition:!0,duration:x==="instant"?void 0:Ib})}else c.isNearBottom&&(l(!1),f(!0));A=_,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===g&&(c.resizeDifference=0)},1)})}),(O=c.resizeObserver)==null||O.observe(T)},[]);return{contentRef:y,scrollRef:w,scrollToBottom:u,stopScroll:h,isAtBottom:s||o,isNearBottom:o,escapedFromLock:t,state:c}};function Vo(e,t){const n=p.useCallback(s=>(n.current=s,e(s)),t);return n}const Pr=new Map;function Ir(...e){const t={...Nb};let n=!1;for(const r of e){if(r==="instant"){n=!0;continue}typeof r=="object"&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}const s=JSON.stringify(t);return Pr.has(s)||Pr.set(s,Object.freeze(t)),n?"instant":Pr.get(s)}/*!---------------------------------------------------------------------------------------------
361
361
  * Copyright (c) StackBlitz. All rights reserved.
362
362
  * Licensed under the MIT License. See License.txt in the project root for license information.
363
- *--------------------------------------------------------------------------------------------*/const Vl=p.createContext(null),Ob=typeof window<"u"?p.useLayoutEffect:p.useEffect;function er({instance:e,children:t,resize:n,initial:r,mass:s,damping:o,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((O,E)=>{const _=(k==null?void 0:k.targetScrollTop)??i;return(_==null?void 0:_(O,E))??O},[i]),u=Db({mass:s,damping:o,stiffness:a,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:b,scrollToBottom:v,stopScroll:w,isAtBottom:y,escapedFromLock:T,state:A}=e??u,k=p.useMemo(()=>({scrollToBottom:v,stopScroll:w,scrollRef:h,isAtBottom:y,escapedFromLock:T,contentRef:b,state:A,get targetScrollTop(){return l.current},set targetScrollTop(O){l.current=O}}),[v,y,b,h,w,T,A]);return p.useImperativeHandle(m,()=>k,[k]),Ob(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(Vl.Provider,{value:k},p.createElement("div",{...f},typeof t=="function"?t(k):t))}(function(e){function t({children:n,scrollClassName:r,...s}){const o=Vs();return p.createElement("div",{ref:o.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},p.createElement("div",{...s,ref:o.contentRef},typeof n=="function"?n(o):n))}e.Content=t})(er||(er={}));function Vs(){const e=p.useContext(Vl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const Lb=({className:e,...t})=>d.jsx(er,{className:Z("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Fb=({className:e,...t})=>d.jsx(er.Content,{className:Z("mx-auto flex page-measure flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),$b=({className:e,title:t=G("common.emptyTitle"),description:n=G("common.emptyDescription"),icon:r,children:s,...o})=>d.jsx("div",{className:Z("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...o,children:s??d.jsxs(d.Fragment,{children:[r&&d.jsx("div",{className:"text-text-muted",children:r}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&d.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),Ub=({className:e,...t})=>{const{scrollToBottom:n}=Vs(),r=p.useCallback(()=>{n()},[n]);return d.jsx(Dt,{className:Z("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:d.jsx(Bd,{className:"size-4"})})},zb="data-last-user-message",Hb=({className:e,...t})=>{const n=p.useCallback(()=>{const r=document.querySelector(`[${zb}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return d.jsx(Dt,{className:Z("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:d.jsx(Oa,{className:"size-4"})})},Bb=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Vs();return r?null:d.jsxs("div",{className:Z("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&d.jsx(Hb,{}),d.jsx(Ub,{})]})};function Wb({entries:e,isLoading:t=!1,turnStartedAt:n,onPermissionRespond:r,emptyTitle:s,emptyDescription:o,searchMatchIds:a,onRewindEntry:i}){var T;const m=qb(e),f=e.length>0;let l=-1;for(let A=m.length-1;A>=0;A--){const k=m[A];if(k.type==="single"&&k.entry.type==="user_message"){l=A;break}}const c=t&&e.length>0,u=`${e.length}:${((T=e[e.length-1])==null?void 0:T.type)??""}`,h=Sl(c),b=e.some(A=>A.type==="tool_call"&&A.toolCall.status==="running"),v=yg(h,u,b),w=!!a&&a.size>0,y=A=>w&&!a.has($n(A));return d.jsx(Lb,{className:"flex-1",children:d.jsxs(Fb,{children:[f?d.jsxs(d.Fragment,{children:[m.map((A,k)=>{if(A.type==="single"){const E=A.entry.type==="user_message"&&k===l,_=m[k+1],g=(_==null?void 0:_.type)==="single"?_.entry:(_==null?void 0:_.type)==="tool_group"?_.entries[0]:void 0;return d.jsx("div",{"data-last-user-message":E?"true":void 0,"data-entry-id":$n(A.entry),className:Z(Gb(A.entry,g),y(A.entry)&&"opacity-40"),children:d.jsx(Vb,{entry:A.entry,isLoading:t,onPermissionRespond:r,onRewindEntry:i})},`entry-${k}`)}const O=A.entries.every(y);return d.jsx("div",{"data-entry-id":$n(A.entries[0]),className:Z("-mt-2",O&&"opacity-40"),children:d.jsx(Hl,{entries:A.entries,onPermissionRespond:r})},`group-${k}`)}),c&&d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsx(l0,{stalled:v,since:n})]})]}):d.jsx($b,{title:s,description:o}),d.jsx(Bb,{hasUserMessages:e.some(A=>A.type==="user_message")})]})})}function Gb(e,t){return(e==null?void 0:e.type)==="user_message"?"pt-10 pb-3":(e==null?void 0:e.type)==="assistant_message"?(t==null?void 0:t.type)==="tool_call"?"pt-2 pb-0":"pt-3 pb-8":(e==null?void 0:e.type)==="plan"?"pt-3 pb-3":(e==null?void 0:e.type)==="command_output"?"pt-6 pb-3":"py-1"}function Vb({entry:e,isLoading:t,onPermissionRespond:n,onRewindEntry:r}){switch(e.type){case"user_message":return d.jsx(J0,{entry:e,onRewind:r?()=>r(e,"rewind"):void 0,onRewindAndEdit:r?()=>r(e,"edit"):void 0});case"assistant_message":return d.jsx(Z0,{entry:e,isStreaming:t});case"tool_call":return d.jsx(Hl,{entries:[e],onPermissionRespond:n});case"plan":return d.jsx(Ab,{entry:e});case"command_output":return d.jsx(Mb,{entry:e});default:return null}}function qb(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const s of e)s.type==="tool_call"?n.push(s):(r(),t.push({type:"single",entry:s}));return r(),t}function Kb(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function Yb({commands:e,filter:t,onSelect:n,onClose:r,className:s}){const o=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>Kb(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{o.current&&!o.current.contains(l.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=o.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),d.jsx("div",{ref:o,className:Z("rounded-xl border border-border bg-surface-2 shadow-lg",s),children:d.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?d.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:G("chat.noCommands")}):m.map((f,l)=>{var c;return d.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:Z("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[d.jsxs("span",{className:"text-sm font-display font-medium text-brand-text",children:["/",f.name]}),d.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&d.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function Rt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const ql="rcs_input_history_";function Kl(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function os(e,t=Kl()){if(!t||!e)return[];try{const n=t.getItem(ql+e);if(!n)return[];const r=JSON.parse(n);return Array.isArray(r)?r.filter(s=>typeof s=="string"):[]}catch{return[]}}function Xb(e,t,n=Kl()){const r=t.trim();if(!n||!e||!r)return os(e,n);const s=os(e,n);if(s[s.length-1]===r)return s;s.push(r);const o=s.slice(-100);try{n.setItem(ql+e,JSON.stringify(o))}catch{}return o}class Qb{constructor(){se(this,"entries",[]);se(this,"draft","");se(this,"cursor",-1)}get active(){return this.cursor>=0}begin(t,n){this.entries=t,this.draft=n,this.cursor=-1}up(){return this.entries.length===0?null:(this.cursor===-1?this.cursor=this.entries.length-1:this.cursor>0&&(this.cursor-=1),this.entries[this.cursor]??null)}down(){return this.cursor===-1?null:this.cursor>=this.entries.length-1?(this.cursor=-1,this.draft):(this.cursor+=1,this.entries[this.cursor]??null)}reset(){this.cursor=-1,this.entries=[],this.draft=""}}const Jb={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},Zb=500*1024,Yl=2*1024*1024,Dr=200,qo=5*1024*1024,ex=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),tx=new Set([".csv",".tsv",".xlsx",".xls"]);function pn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Xl(e){if(e.type.startsWith("text/"))return!0;const t=pn(e.name);return ex.has(t)}function as(e){const t=pn(e.name);return tx.has(t)}function nx({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:s,supportsAttachments:o,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:u,historyKey:h,draftOverride:b,className:v}){const w=o??a??!1,[y,T]=p.useState(""),[A,k]=p.useState([]),[O,E]=p.useState([]),[_,g]=p.useState(!1),[x,M]=p.useState(""),[I,D]=p.useState(!1),[F,j]=p.useState(!1),[z,C]=p.useState(!1),[S,H]=p.useState(null),[P,U]=p.useState([]),[Y,N]=p.useState(0),L=p.useRef(0),$=p.useRef(null),R=p.useRef(null),B=p.useRef(null),V=p.useRef(null),q=p.useRef(null),K=p.useRef(null),oe=p.useRef(null),ee=p.useRef(new Qb),re=p.useRef(h);re.current=h,p.useEffect(()=>{Rt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:w,commandsCount:(i==null?void 0:i.length)??0})},[w,i]),p.useEffect(()=>{!b||b.nonce===0||(T(b.text),ee.current.reset(),requestAnimationFrame(()=>{var W;return(W=$.current)==null?void 0:W.focus()}))},[b]),p.useEffect(()=>{if(!F)return;const W=X=>{var he,Me;const te=X.target,ue=(he=K.current)==null?void 0:he.contains(te),Ee=(Me=oe.current)==null?void 0:Me.contains(te);!ue&&!Ee&&j(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[F]);const ce=p.useCallback(W=>{const X=(W??y).trim(),te=A.length>0||O.length>0;!X&&!te||r||z||(e({text:X,images:A.length>0?A:void 0,attachments:O.length>0?O:void 0}),re.current&&X&&Xb(re.current,X),ee.current.reset(),T(""),k([]),E([]),g(!1),M(""),$.current&&($.current.style.height="auto"))},[y,A,O,r,z,e]),ve=p.useCallback(W=>{const X=re.current;if(!X)return!1;const te=ee.current;if(W==="up"){if(y!=="")return!1;te.active||te.begin(os(X),y);const Ee=te.up();return Ee===null?!1:(T(Ee),requestAnimationFrame(()=>{const he=$.current;he&&(he.focus(),he.setSelectionRange(Ee.length,Ee.length))}),!0)}if(!te.active)return!1;const ue=te.down();return ue===null?!1:(T(ue),requestAnimationFrame(()=>{const Ee=$.current;Ee&&(Ee.focus(),Ee.setSelectionRange(ue.length,ue.length))}),!0)},[y]),fe=p.useCallback(async W=>{if(!u)return;const X=++L.current;try{const te=await u(W);L.current===X&&U(te.slice(0,8))}catch{L.current===X&&U([])}},[u]),we=p.useCallback(W=>{const X=$.current;if(!X||S===null)return;const te=X.selectionStart??y.length,ue=y.slice(0,te),Ee=/(?:^|\s)@([^\s@]*)$/.exec(ue);if(!Ee)return;const he=te-Ee[1].length-1,Me=`@${W} `,Tn=y.slice(0,he)+Me+y.slice(te);T(Tn),H(null),U([]),requestAnimationFrame(()=>{const ct=he+Me.length;X.focus(),X.setSelectionRange(ct,ct)})},[y,S]),me=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(S!==null&&P.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),N(te=>{const ue=W.key==="ArrowDown"?1:-1;return(te+ue+P.length)%P.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const te=P[Y];te&&we(te);return}if(W.key==="Escape"){W.preventDefault(),H(null),U([]);return}}if(_){if(W.key==="Escape"){W.preventDefault(),g(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),g(!1);return}}if(W.key==="ArrowUp"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&ve("up")){W.preventDefault();return}if(W.key==="ArrowDown"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&ve("down")){W.preventDefault();return}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():ce())},[ce,t,f,m,n,_,S,P,Y,we,ve]),de=p.useCallback(W=>{const X=W.target.value;if(T(X),ee.current.reset(),X.startsWith("/")&&i&&i.length>0&&!/\s/.test(X.slice(1))?(g(!0),M(X.slice(1))):_&&(g(!1),M("")),u){const ue=W.target.selectionStart??X.length,Ee=X.slice(0,ue),he=/(?:^|\s)@([^\s@]*)$/.exec(Ee);if(he){const Me=he[1]||"";H(Me),N(0),fe(Me)}else H(null),U([])}const te=W.target;te.style.height="auto",te.style.height=Math.min(te.scrollHeight,200)+"px"},[i,_,u,fe]),xe=p.useCallback(async W=>{if(Rt("[ChatInput] paste event",{canAttach:w,files:W.clipboardData.files.length,types:W.clipboardData.types}),!w)return;const X=Array.from(W.clipboardData.files).filter(te=>te.type.startsWith("image/"));if(Rt("[ChatInput] paste image files",{count:X.length,types:X.map(te=>te.type)}),X.length!==0){W.preventDefault(),C(!0);try{const te=await Or(X);k(ue=>[...ue,...te])}finally{C(!1)}}},[w]),Ce=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await Or(Array.from(W));k(te=>[...te,...X])}finally{R.current.value="",C(!1)}}},[]),pe=p.useCallback(async()=>{if(!B.current)return;const W=B.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await Ko(Array.from(W));E(te=>[...te,...X])}finally{B.current.value="",C(!1)}}},[]),_e=p.useCallback(async()=>{if(!V.current)return;const W=V.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await Yo(Array.from(W));E(te=>[...te,...X])}finally{V.current.value="",C(!1)}}},[]),ke=p.useCallback(async()=>{if(!q.current)return;const W=q.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await sx(Array.from(W));X&&E(te=>[...te,X])}finally{q.current.value="",C(!1)}}},[]),ge=p.useCallback(W=>{k(X=>X.filter((te,ue)=>ue!==W))},[]),Ie=p.useCallback(W=>{E(X=>X.filter((te,ue)=>ue!==W))},[]),qe=p.useCallback(W=>{var te,ue;g(!1),M("");const X=`/${W.name}`;(te=W.input)!=null&&te.hint?(T(`${X} `),(ue=$.current)==null||ue.focus()):ce(X)},[ce]),Ft=p.useCallback(W=>{w&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",I||D(!0))},[w,I]),Re=p.useCallback(W=>{const X=W.relatedTarget;(!X||!W.currentTarget.contains(X))&&D(!1)},[]),tt=p.useCallback(async W=>{if(!w)return;const X=Array.from(W.dataTransfer.files);if(X.length!==0){W.preventDefault(),D(!1),C(!0);try{const te=X.filter(he=>he.type.startsWith("image/")),ue=X.filter(he=>!he.type.startsWith("image/")&&as(he)),Ee=X.filter(he=>!he.type.startsWith("image/")&&!as(he)&&Xl(he));if(te.length>0){const he=await Or(te);k(Me=>[...Me,...he])}if(ue.length>0){const he=await Yo(ue);E(Me=>[...Me,...he])}if(Ee.length>0){const he=await Ko(Ee);E(Me=>[...Me,...he])}}finally{C(!1)}}},[w]),je=A.length+O.length,Le=(y.trim()||je>0)&&!r&&!z;return d.jsxs("div",{className:Z("w-full page-measure mx-auto px-4 sm:px-8 pb-4 pt-2",v),children:[d.jsxs("div",{className:"relative",children:[_&&i&&i.length>0&&d.jsx(Yb,{commands:i,filter:x,onSelect:qe,onClose:()=>{g(!1),M("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),S!==null&&P.length>0&&d.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[d.jsx("div",{className:"border-b border-border px-3 py-1.5 text-[10px] text-text-muted",children:Se("chat.fileMatchHint",{query:S?`“@${S}”`:""})}),P.map((W,X)=>d.jsxs("button",{type:"button",onMouseDown:te=>{te.preventDefault(),we(W)},onMouseEnter:()=>N(X),className:Z("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",X===Y?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[d.jsx(Kt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),d.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),F&&w&&d.jsxs("div",{ref:K,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=R.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(cu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.image")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=B.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Kt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.textFile")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=V.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(gs,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.sheet")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=q.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(hs,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.directory")})]})]}),d.jsxs("div",{onDragOver:Ft,onDragLeave:Re,onDrop:tt,className:Z("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",I&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[A.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:A.map((W,X)=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${X+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),d.jsx("button",{type:"button",onClick:()=>ge(X),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${X+1}`,children:"×"})]},X))}),O.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:O.map((W,X)=>d.jsx(rx,{attachment:W,onRemove:()=>Ie(X)},X))}),d.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[w&&d.jsxs("div",{className:"relative flex-shrink-0",children:[d.jsxs("button",{ref:oe,type:"button",onClick:()=>j(W=>!W),disabled:r||z,className:Z("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",F?"bg-brand/15 text-brand-text":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[d.jsx(Eu,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Attach"})]}),d.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Ce}),d.jsx("input",{ref:B,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:pe}),d.jsx("input",{ref:V,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:_e}),d.jsx("input",{ref:q,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:ke})]}),d.jsx("textarea",{ref:$,value:y,onChange:de,onKeyDown:me,onPaste:xe,placeholder:z?G("chat.processingFile"):s,disabled:r,rows:1,className:Z("flex-1 resize-none border-none bg-transparent outline-none self-center","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),d.jsx("button",{type:"button",onClick:t?n:()=>ce(),disabled:!t&&!Le,className:Z("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":Le?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?d.jsx(Fu,{className:"h-3.5 w-3.5",fill:"currentColor"}):z?d.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):d.jsx(Nu,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&d.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[10px] text-text-muted font-display",children:[d.jsx(ru,{className:"h-3 w-3"}),d.jsxs("span",{children:[Se("chat.queued",{n:l}),c?G("chat.queuedCancel"):""]}),c&&d.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[d.jsx(bn,{className:"h-3 w-3"}),G("common.cancel")]})]}),d.jsx("div",{className:"text-center mt-1.5",children:d.jsxs("span",{className:"text-[10px] text-text-muted font-display",children:[G("chat.inputHint"),u?G("chat.inputHintSuffix"):""]})})]})}function rx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return d.jsx(Kt,{className:"h-3.5 w-3.5"});case"table":return d.jsx(gs,{className:"h-3.5 w-3.5"});case"directory":return d.jsx(hs,{className:"h-3.5 w-3.5"});default:return d.jsx(Kt,{className:"h-3.5 w-3.5"})}})(),r=e.size!=null?qt(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null;return d.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,d.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&d.jsx("span",{className:"text-text-muted text-[10px]",children:r}),s!=null&&d.jsx("span",{className:"text-text-muted text-[10px]",children:Se("chat.fileCount",{n:s})}),d.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:d.jsx(bn,{className:"h-3 w-3"})})]})}function qt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Or(e){const t=[];for(const n of e)try{let r=n,s=n.type;n.size>2*1024*1024&&(r=await Pe(n,Jb),s="image/jpeg");const o=await ox(r);t.push({mimeType:s,data:o})}catch(r){console.error("Failed to process image:",r)}return t}async function Ko(e){const t=[];for(const n of e)try{if(n.size>Yl){console.warn(`Skipping ${n.name}: too large (${qt(n.size)})`);continue}n.size>Zb&&console.warn(`File ${n.name} is large (${qt(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Yo(e){const t=[];for(const n of e)try{const r=pn(n.name);if(r===".csv"||r===".tsv"){const s=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const s=await n.arrayBuffer(),o=await Ql(s);t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function Ql(e){const t=await Ne(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const s of n.SheetNames){const o=n.Sheets[s];if(!o)continue;const a=t.utils.sheet_to_csv(o);n.SheetNames.length>1?r.push(`## Sheet: ${s}
363
+ *--------------------------------------------------------------------------------------------*/const Vl=p.createContext(null),Ob=typeof window<"u"?p.useLayoutEffect:p.useEffect;function er({instance:e,children:t,resize:n,initial:s,mass:r,damping:o,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((O,E)=>{const _=(k==null?void 0:k.targetScrollTop)??i;return(_==null?void 0:_(O,E))??O},[i]),u=Db({mass:r,damping:o,stiffness:a,resize:n,initial:s,targetScrollTop:c}),{scrollRef:h,contentRef:b,scrollToBottom:v,stopScroll:w,isAtBottom:y,escapedFromLock:T,state:A}=e??u,k=p.useMemo(()=>({scrollToBottom:v,stopScroll:w,scrollRef:h,isAtBottom:y,escapedFromLock:T,contentRef:b,state:A,get targetScrollTop(){return l.current},set targetScrollTop(O){l.current=O}}),[v,y,b,h,w,T,A]);return p.useImperativeHandle(m,()=>k,[k]),Ob(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(Vl.Provider,{value:k},p.createElement("div",{...f},typeof t=="function"?t(k):t))}(function(e){function t({children:n,scrollClassName:s,...r}){const o=Vs();return p.createElement("div",{ref:o.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:s},p.createElement("div",{...r,ref:o.contentRef},typeof n=="function"?n(o):n))}e.Content=t})(er||(er={}));function Vs(){const e=p.useContext(Vl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const Lb=({className:e,...t})=>d.jsx(er,{className:Q("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Fb=({className:e,...t})=>d.jsx(er.Content,{className:Q("mx-auto flex page-measure flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),$b=({className:e,title:t=G("common.emptyTitle"),description:n=G("common.emptyDescription"),icon:s,children:r,...o})=>d.jsx("div",{className:Q("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...o,children:r??d.jsxs(d.Fragment,{children:[s&&d.jsx("div",{className:"text-text-muted",children:s}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&d.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),Ub=({className:e,...t})=>{const{scrollToBottom:n}=Vs(),s=p.useCallback(()=>{n()},[n]);return d.jsx(Dt,{className:Q("rounded-full",e),onClick:s,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:d.jsx(Bd,{className:"size-4"})})},zb="data-last-user-message",Hb=({className:e,...t})=>{const n=p.useCallback(()=>{const s=document.querySelector(`[${zb}="true"]`);s&&s.scrollIntoView({behavior:"smooth",block:"start"})},[]);return d.jsx(Dt,{className:Q("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:d.jsx(Oa,{className:"size-4"})})},Bb=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:s}=Vs();return s?null:d.jsxs("div",{className:Q("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&d.jsx(Hb,{}),d.jsx(Ub,{})]})};function Wb({entries:e,isLoading:t=!1,turnStartedAt:n,onPermissionRespond:s,emptyTitle:r,emptyDescription:o,searchMatchIds:a,onRewindEntry:i}){var T;const m=qb(e),f=e.length>0;let l=-1;for(let A=m.length-1;A>=0;A--){const k=m[A];if(k.type==="single"&&k.entry.type==="user_message"){l=A;break}}const c=t&&e.length>0,u=`${e.length}:${((T=e[e.length-1])==null?void 0:T.type)??""}`,h=Sl(c),b=e.some(A=>A.type==="tool_call"&&A.toolCall.status==="running"),v=yg(h,u,b),w=!!a&&a.size>0,y=A=>w&&!a.has($n(A));return d.jsx(Lb,{className:"flex-1",children:d.jsxs(Fb,{children:[f?d.jsxs(d.Fragment,{children:[m.map((A,k)=>{if(A.type==="single"){const E=A.entry.type==="user_message"&&k===l,_=m[k+1],g=(_==null?void 0:_.type)==="single"?_.entry:(_==null?void 0:_.type)==="tool_group"?_.entries[0]:void 0;return d.jsx("div",{"data-last-user-message":E?"true":void 0,"data-entry-id":$n(A.entry),className:Q(Gb(A.entry,g),y(A.entry)&&"opacity-40"),children:d.jsx(Vb,{entry:A.entry,isLoading:t,onPermissionRespond:s,onRewindEntry:i})},`entry-${k}`)}const O=A.entries.every(y);return d.jsx("div",{"data-entry-id":$n(A.entries[0]),className:Q("-mt-2",O&&"opacity-40"),children:d.jsx(Hl,{entries:A.entries,onPermissionRespond:s})},`group-${k}`)}),c&&d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsx(l0,{stalled:v,since:n})]})]}):d.jsx($b,{title:r,description:o}),d.jsx(Bb,{hasUserMessages:e.some(A=>A.type==="user_message")})]})})}function Gb(e,t){return(e==null?void 0:e.type)==="user_message"?"pt-10 pb-3":(e==null?void 0:e.type)==="assistant_message"?(t==null?void 0:t.type)==="tool_call"?"pt-2 pb-0":"pt-3 pb-8":(e==null?void 0:e.type)==="plan"?"pt-3 pb-3":(e==null?void 0:e.type)==="command_output"?"pt-6 pb-3":"py-1"}function Vb({entry:e,isLoading:t,onPermissionRespond:n,onRewindEntry:s}){switch(e.type){case"user_message":return d.jsx(J0,{entry:e,onRewind:s?()=>s(e,"rewind"):void 0,onRewindAndEdit:s?()=>s(e,"edit"):void 0});case"assistant_message":return d.jsx(Z0,{entry:e,isStreaming:t});case"tool_call":return d.jsx(Hl,{entries:[e],onPermissionRespond:n});case"plan":return d.jsx(Ab,{entry:e});case"command_output":return d.jsx(Mb,{entry:e});default:return null}}function qb(e){const t=[];let n=[];const s=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const r of e)r.type==="tool_call"?n.push(r):(s(),t.push({type:"single",entry:r}));return s(),t}function Kb(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function Yb({commands:e,filter:t,onSelect:n,onClose:s,className:r}){const o=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>Kb(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{o.current&&!o.current.contains(l.target)&&s()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=o.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),d.jsx("div",{ref:o,className:Q("rounded-xl border border-border bg-surface-2 shadow-lg",r),children:d.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?d.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:G("chat.noCommands")}):m.map((f,l)=>{var c;return d.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:Q("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[d.jsxs("span",{className:"text-sm font-display font-medium text-brand-text",children:["/",f.name]}),d.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&d.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function Rt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const ql="rcs_input_history_";function Kl(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function os(e,t=Kl()){if(!t||!e)return[];try{const n=t.getItem(ql+e);if(!n)return[];const s=JSON.parse(n);return Array.isArray(s)?s.filter(r=>typeof r=="string"):[]}catch{return[]}}function Xb(e,t,n=Kl()){const s=t.trim();if(!n||!e||!s)return os(e,n);const r=os(e,n);if(r[r.length-1]===s)return r;r.push(s);const o=r.slice(-100);try{n.setItem(ql+e,JSON.stringify(o))}catch{}return o}class Qb{constructor(){se(this,"entries",[]);se(this,"draft","");se(this,"cursor",-1)}get active(){return this.cursor>=0}begin(t,n){this.entries=t,this.draft=n,this.cursor=-1}up(){return this.entries.length===0?null:(this.cursor===-1?this.cursor=this.entries.length-1:this.cursor>0&&(this.cursor-=1),this.entries[this.cursor]??null)}down(){return this.cursor===-1?null:this.cursor>=this.entries.length-1?(this.cursor=-1,this.draft):(this.cursor+=1,this.entries[this.cursor]??null)}reset(){this.cursor=-1,this.entries=[],this.draft=""}}const Jb={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},Zb=500*1024,Yl=2*1024*1024,Dr=200,qo=5*1024*1024,ex=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),tx=new Set([".csv",".tsv",".xlsx",".xls"]);function pn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Xl(e){if(e.type.startsWith("text/"))return!0;const t=pn(e.name);return ex.has(t)}function as(e){const t=pn(e.name);return tx.has(t)}function nx({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:s=!1,placeholder:r,supportsAttachments:o,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:u,historyKey:h,draftOverride:b,className:v}){const w=o??a??!1,[y,T]=p.useState(""),[A,k]=p.useState([]),[O,E]=p.useState([]),[_,g]=p.useState(!1),[x,M]=p.useState(""),[I,D]=p.useState(!1),[F,j]=p.useState(!1),[z,C]=p.useState(!1),[S,H]=p.useState(null),[P,U]=p.useState([]),[Y,N]=p.useState(0),L=p.useRef(0),$=p.useRef(null),R=p.useRef(null),B=p.useRef(null),V=p.useRef(null),q=p.useRef(null),K=p.useRef(null),oe=p.useRef(null),ee=p.useRef(new Qb),re=p.useRef(h);re.current=h,p.useEffect(()=>{Rt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:w,commandsCount:(i==null?void 0:i.length)??0})},[w,i]),p.useEffect(()=>{!b||b.nonce===0||(T(b.text),ee.current.reset(),requestAnimationFrame(()=>{var W;return(W=$.current)==null?void 0:W.focus()}))},[b]),p.useEffect(()=>{if(!F)return;const W=X=>{var he,Me;const te=X.target,ue=(he=K.current)==null?void 0:he.contains(te),Ee=(Me=oe.current)==null?void 0:Me.contains(te);!ue&&!Ee&&j(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[F]);const ce=p.useCallback(W=>{const X=(W??y).trim(),te=A.length>0||O.length>0;!X&&!te||s||z||(e({text:X,images:A.length>0?A:void 0,attachments:O.length>0?O:void 0}),re.current&&X&&Xb(re.current,X),ee.current.reset(),T(""),k([]),E([]),g(!1),M(""),$.current&&($.current.style.height="auto"))},[y,A,O,s,z,e]),ve=p.useCallback(W=>{const X=re.current;if(!X)return!1;const te=ee.current;if(W==="up"){if(y!=="")return!1;te.active||te.begin(os(X),y);const Ee=te.up();return Ee===null?!1:(T(Ee),requestAnimationFrame(()=>{const he=$.current;he&&(he.focus(),he.setSelectionRange(Ee.length,Ee.length))}),!0)}if(!te.active)return!1;const ue=te.down();return ue===null?!1:(T(ue),requestAnimationFrame(()=>{const Ee=$.current;Ee&&(Ee.focus(),Ee.setSelectionRange(ue.length,ue.length))}),!0)},[y]),fe=p.useCallback(async W=>{if(!u)return;const X=++L.current;try{const te=await u(W);L.current===X&&U(te.slice(0,8))}catch{L.current===X&&U([])}},[u]),we=p.useCallback(W=>{const X=$.current;if(!X||S===null)return;const te=X.selectionStart??y.length,ue=y.slice(0,te),Ee=/(?:^|\s)@([^\s@]*)$/.exec(ue);if(!Ee)return;const he=te-Ee[1].length-1,Me=`@${W} `,Tn=y.slice(0,he)+Me+y.slice(te);T(Tn),H(null),U([]),requestAnimationFrame(()=>{const ct=he+Me.length;X.focus(),X.setSelectionRange(ct,ct)})},[y,S]),me=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(S!==null&&P.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),N(te=>{const ue=W.key==="ArrowDown"?1:-1;return(te+ue+P.length)%P.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const te=P[Y];te&&we(te);return}if(W.key==="Escape"){W.preventDefault(),H(null),U([]);return}}if(_){if(W.key==="Escape"){W.preventDefault(),g(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),g(!1);return}}if(W.key==="ArrowUp"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&ve("up")){W.preventDefault();return}if(W.key==="ArrowDown"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&ve("down")){W.preventDefault();return}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():ce())},[ce,t,f,m,n,_,S,P,Y,we,ve]),de=p.useCallback(W=>{const X=W.target.value;if(T(X),ee.current.reset(),X.startsWith("/")&&i&&i.length>0&&!/\s/.test(X.slice(1))?(g(!0),M(X.slice(1))):_&&(g(!1),M("")),u){const ue=W.target.selectionStart??X.length,Ee=X.slice(0,ue),he=/(?:^|\s)@([^\s@]*)$/.exec(Ee);if(he){const Me=he[1]||"";H(Me),N(0),fe(Me)}else H(null),U([])}const te=W.target;te.style.height="auto",te.style.height=Math.min(te.scrollHeight,200)+"px"},[i,_,u,fe]),xe=p.useCallback(async W=>{if(Rt("[ChatInput] paste event",{canAttach:w,files:W.clipboardData.files.length,types:W.clipboardData.types}),!w)return;const X=Array.from(W.clipboardData.files).filter(te=>te.type.startsWith("image/"));if(Rt("[ChatInput] paste image files",{count:X.length,types:X.map(te=>te.type)}),X.length!==0){W.preventDefault(),C(!0);try{const te=await Or(X);k(ue=>[...ue,...te])}finally{C(!1)}}},[w]),Ce=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await Or(Array.from(W));k(te=>[...te,...X])}finally{R.current.value="",C(!1)}}},[]),pe=p.useCallback(async()=>{if(!B.current)return;const W=B.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await Ko(Array.from(W));E(te=>[...te,...X])}finally{B.current.value="",C(!1)}}},[]),_e=p.useCallback(async()=>{if(!V.current)return;const W=V.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await Yo(Array.from(W));E(te=>[...te,...X])}finally{V.current.value="",C(!1)}}},[]),ke=p.useCallback(async()=>{if(!q.current)return;const W=q.current.files;if(!(!W||W.length===0)){C(!0);try{const X=await sx(Array.from(W));X&&E(te=>[...te,X])}finally{q.current.value="",C(!1)}}},[]),ge=p.useCallback(W=>{k(X=>X.filter((te,ue)=>ue!==W))},[]),Ie=p.useCallback(W=>{E(X=>X.filter((te,ue)=>ue!==W))},[]),qe=p.useCallback(W=>{var te,ue;g(!1),M("");const X=`/${W.name}`;(te=W.input)!=null&&te.hint?(T(`${X} `),(ue=$.current)==null||ue.focus()):ce(X)},[ce]),Ft=p.useCallback(W=>{w&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",I||D(!0))},[w,I]),Re=p.useCallback(W=>{const X=W.relatedTarget;(!X||!W.currentTarget.contains(X))&&D(!1)},[]),tt=p.useCallback(async W=>{if(!w)return;const X=Array.from(W.dataTransfer.files);if(X.length!==0){W.preventDefault(),D(!1),C(!0);try{const te=X.filter(he=>he.type.startsWith("image/")),ue=X.filter(he=>!he.type.startsWith("image/")&&as(he)),Ee=X.filter(he=>!he.type.startsWith("image/")&&!as(he)&&Xl(he));if(te.length>0){const he=await Or(te);k(Me=>[...Me,...he])}if(ue.length>0){const he=await Yo(ue);E(Me=>[...Me,...he])}if(Ee.length>0){const he=await Ko(Ee);E(Me=>[...Me,...he])}}finally{C(!1)}}},[w]),je=A.length+O.length,Le=(y.trim()||je>0)&&!s&&!z;return d.jsxs("div",{className:Q("w-full page-measure mx-auto px-4 sm:px-8 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",v),children:[d.jsxs("div",{className:"relative",children:[_&&i&&i.length>0&&d.jsx(Yb,{commands:i,filter:x,onSelect:qe,onClose:()=>{g(!1),M("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),S!==null&&P.length>0&&d.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[d.jsx("div",{className:"border-b border-border px-3 py-1.5 text-[10px] text-text-muted",children:Se("chat.fileMatchHint",{query:S?`“@${S}”`:""})}),P.map((W,X)=>d.jsxs("button",{type:"button",onMouseDown:te=>{te.preventDefault(),we(W)},onMouseEnter:()=>N(X),className:Q("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",X===Y?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[d.jsx(Kt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),d.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),F&&w&&d.jsxs("div",{ref:K,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=R.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(cu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.image")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=B.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Kt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.textFile")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=V.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(gs,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.sheet")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=q.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(hs,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:G("chat.picker.directory")})]})]}),d.jsxs("div",{onDragOver:Ft,onDragLeave:Re,onDrop:tt,className:Q("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",I&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[A.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:A.map((W,X)=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${X+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),d.jsx("button",{type:"button",onClick:()=>ge(X),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs max-sm:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${X+1}`,children:"×"})]},X))}),O.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:O.map((W,X)=>d.jsx(rx,{attachment:W,onRemove:()=>Ie(X)},X))}),d.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[w&&d.jsxs("div",{className:"relative flex-shrink-0",children:[d.jsxs("button",{ref:oe,type:"button",onClick:()=>j(W=>!W),disabled:s||z,className:Q("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",F?"bg-brand/15 text-brand-text":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[d.jsx(Eu,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Attach"})]}),d.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Ce}),d.jsx("input",{ref:B,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:pe}),d.jsx("input",{ref:V,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:_e}),d.jsx("input",{ref:q,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:ke})]}),d.jsx("textarea",{ref:$,value:y,onChange:de,onKeyDown:me,onPaste:xe,placeholder:z?G("chat.processingFile"):r,disabled:s,rows:1,className:Q("flex-1 resize-none border-none bg-transparent outline-none self-center","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),d.jsx("button",{type:"button",onClick:t?n:()=>ce(),disabled:!t&&!Le,className:Q("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":Le?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?d.jsx(Fu,{className:"h-3.5 w-3.5",fill:"currentColor"}):z?d.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):d.jsx(Nu,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&d.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[10px] text-text-muted font-display",children:[d.jsx(ru,{className:"h-3 w-3"}),d.jsxs("span",{children:[Se("chat.queued",{n:l}),c?G("chat.queuedCancel"):""]}),c&&d.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[d.jsx(bn,{className:"h-3 w-3"}),G("common.cancel")]})]}),d.jsx("div",{className:"text-center mt-1.5",children:d.jsxs("span",{className:"text-[10px] text-text-muted font-display",children:[G("chat.inputHint"),u?G("chat.inputHintSuffix"):""]})})]})}function rx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return d.jsx(Kt,{className:"h-3.5 w-3.5"});case"table":return d.jsx(gs,{className:"h-3.5 w-3.5"});case"directory":return d.jsx(hs,{className:"h-3.5 w-3.5"});default:return d.jsx(Kt,{className:"h-3.5 w-3.5"})}})(),s=e.size!=null?qt(e.size):null,r=e.kind==="directory"&&e.files?e.files.length:null;return d.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,d.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),s&&d.jsx("span",{className:"text-text-muted text-[10px]",children:s}),r!=null&&d.jsx("span",{className:"text-text-muted text-[10px]",children:Se("chat.fileCount",{n:r})}),d.jsx("button",{type:"button",onClick:t,className:"ml-0.5 -my-1.5 -mr-1 min-h-[32px] min-w-[32px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary max-sm:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:d.jsx(bn,{className:"h-3 w-3"})})]})}function qt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Or(e){const t=[];for(const n of e)try{let s=n,r=n.type;n.size>2*1024*1024&&(s=await Pe(n,Jb),r="image/jpeg");const o=await ox(s);t.push({mimeType:r,data:o})}catch(s){console.error("Failed to process image:",s)}return t}async function Ko(e){const t=[];for(const n of e)try{if(n.size>Yl){console.warn(`Skipping ${n.name}: too large (${qt(n.size)})`);continue}n.size>Zb&&console.warn(`File ${n.name} is large (${qt(n.size)}), may slow down`);const s=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:s,mimeType:n.type||"text/plain"})}catch(s){console.error(`Failed to read text file ${n.name}:`,s)}return t}async function Yo(e){const t=[];for(const n of e)try{const s=pn(n.name);if(s===".csv"||s===".tsv"){const r=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/csv"})}else if(s===".xlsx"||s===".xls"){const r=await n.arrayBuffer(),o=await Ql(r);t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(s){console.error(`Failed to process table file ${n.name}:`,s)}return t}async function Ql(e){const t=await Ne(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),s=[];for(const r of n.SheetNames){const o=n.Sheets[r];if(!o)continue;const a=t.utils.sheet_to_csv(o);n.SheetNames.length>1?s.push(`## Sheet: ${r}
364
364
 
365
- ${a}`):r.push(a)}return r.join(`
365
+ ${a}`):s.push(a)}return s.join(`
366
366
 
367
- `)}async function sx(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>Yl));t.length>Dr&&console.warn(`Directory has ${t.length} files, truncating to ${Dr}`);const n=t.slice(0,Dr);let r=0;for(const u of n)r+=u.size;r>qo&&console.warn(`Directory total size ${qt(r)} exceeds limit, some files may be truncated`);const s=n[0].webkitRelativePath,o=s&&s.split("/")[0]||G("chat.directory"),a=[],i=[];let m=0;const f=[...n].sort((u,h)=>{const b=u.webkitRelativePath||u.name,v=h.webkitRelativePath||h.name;return b.localeCompare(v)});for(const u of f){const h=u.webkitRelativePath||u.name;if(a.push(h),Xl(u)||as(u))if(m+u.size<=qo)try{let b;if(pn(u.name)===".xlsx"||pn(u.name)===".xls"){const v=await u.arrayBuffer();b=await Ql(v)}else b=await u.text();i.push(`
367
+ `)}async function sx(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>Yl));t.length>Dr&&console.warn(`Directory has ${t.length} files, truncating to ${Dr}`);const n=t.slice(0,Dr);let s=0;for(const u of n)s+=u.size;s>qo&&console.warn(`Directory total size ${qt(s)} exceeds limit, some files may be truncated`);const r=n[0].webkitRelativePath,o=r&&r.split("/")[0]||G("chat.directory"),a=[],i=[];let m=0;const f=[...n].sort((u,h)=>{const b=u.webkitRelativePath||u.name,v=h.webkitRelativePath||h.name;return b.localeCompare(v)});for(const u of f){const h=u.webkitRelativePath||u.name;if(a.push(h),Xl(u)||as(u))if(m+u.size<=qo)try{let b;if(pn(u.name)===".xlsx"||pn(u.name)===".xls"){const v=await u.arrayBuffer();b=await Ql(v)}else b=await u.text();i.push(`
368
368
  ### ${h}
369
369
  \`\`\`
370
370
  ${b}
@@ -378,16 +378,16 @@ ${Se("attach.imageFile",{size:qt(u.size)})}`):i.push(`
378
378
  ### ${h}
379
379
  ${Se("attach.binaryFile",{size:qt(u.size)})}`)}const l=a.join(`
380
380
  `),c=[Se("attach.dumpHeader",{name:o}),Se("attach.dumpCount",{n:a.length}),"",G("attach.structure"),"```",l,"```","",G("attach.contents"),...i].join(`
381
- `);return{kind:"directory",name:o,size:r,textContent:c,files:a}}async function ox(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const s=r.result,o=s.indexOf(",");t(o>=0?s.slice(o+1):s)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function ax({requests:e,onRespond:t,className:n}){return e.length===0?null:d.jsx("div",{className:Z("w-full max-w-3xl mx-auto px-4",n),children:d.jsx("div",{className:"space-y-2",children:e.map(r=>d.jsx(ix,{request:r,onRespond:t},r.requestId))})})}function ix({request:e,onRespond:t}){return nn(),d.jsxs("div",{role:"group","aria-label":Se("permission.requestAria",{tool:e.toolName}),className:"flex items-center gap-3 rounded-xl border border-approve/30 bg-approve/5 px-4 py-3",children:[d.jsx(Ia,{className:"h-5 w-5 text-approve-text flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-bold font-display text-approve-text",children:e.toolName}),e.description&&d.jsx("div",{className:"text-xs text-text-secondary mt-0.5 truncate",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-approve text-white text-xs font-medium font-display hover:bg-approve-hover transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(hn,{className:"h-3.5 w-3.5"}),G("permission.approve")]}),d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-status-error/40 text-status-error text-xs font-medium font-display hover:bg-status-error/10 transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(bn,{className:"h-3.5 w-3.5"}),G("permission.reject")]})]})]})}function Xo(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Qo(e){return e<1e3?String(e):e<1e6?`${Xo((e/1e3).toFixed(1))}k`:`${Xo((e/1e6).toFixed(2))}M`}function Jo(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function lx({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Jo(e.cost)),t.push(`${Qo(e.used)} / ${Qo(e.size)} tokens`);const n=[Se("usage.context",{used:e.used.toLocaleString(),size:e.size.toLocaleString()})];return e.cost!=null&&e.cost.amount>0&&n.push(Se("usage.totalCost",{cost:Jo(e.cost)})),d.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var gr="Popover",[Jl]=it(gr,[tn]),En=tn(),[cx,St]=Jl(gr),Zl=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!1}=e,i=En(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,u]=gt({prop:r,defaultProp:s??!1,onChange:o,caller:gr});return d.jsx(As,{...i,children:d.jsx(cx,{scope:t,contentId:De(),triggerRef:m,open:c,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(h=>!h),[u]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};Zl.displayName=gr;var ec="PopoverAnchor",dx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=St(ec,n),o=En(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=s;return p.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(ir,{...o,...r,ref:t})});dx.displayName=ec;var tc="PopoverTrigger",nc=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=St(tc,n),o=En(n),a=Ae(t,s.triggerRef),i=d.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":ic(s.open),...r,ref:a,onClick:ne(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?i:d.jsx(ir,{asChild:!0,...o,children:i})});nc.displayName=tc;var qs="PopoverPortal",[ux,fx]=Jl(qs,{forceMount:void 0}),rc=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=St(qs,t);return d.jsx(ux,{scope:t,forceMount:n,children:d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};rc.displayName=qs;var Jt="PopoverContent",sc=p.forwardRef((e,t)=>{const n=fx(Jt,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=St(Jt,e.__scopePopover);return d.jsx(ze,{present:r||o.open,children:o.modal?d.jsx(px,{...s,ref:t}):d.jsx(hx,{...s,ref:t})})});sc.displayName=Jt;var mx=Yt("PopoverContent.RemoveScroll"),px=p.forwardRef((e,t)=>{const n=St(Jt,e.__scopePopover),r=p.useRef(null),s=Ae(t,r),o=p.useRef(!1);return p.useEffect(()=>{const a=r.current;if(a)return Rs(a)},[]),d.jsx(fs,{as:mx,allowPinchZoom:!0,children:d.jsx(oc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),hx=p.forwardRef((e,t)=>{const n=St(Jt,e.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return d.jsx(oc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),oc=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,u=St(Jt,n),h=En(n);return bs(),d.jsx(nr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(xn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>u.onOpenChange(!1),children:d.jsx(Ts,{"data-state":ic(u.open),role:"dialog",id:u.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ac="PopoverClose",gx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=St(ac,n);return d.jsx(be.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>s.onOpenChange(!1))})});gx.displayName=ac;var bx="PopoverArrow",xx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=En(n);return d.jsx(_s,{...s,...r,ref:t})});xx.displayName=bx;function ic(e){return e?"open":"closed"}var yx=Zl,vx=nc,wx=rc,Sx=sc;function lc({...e}){return d.jsx(yx,{"data-slot":"popover",...e})}function cc({...e}){return d.jsx(vx,{"data-slot":"popover-trigger",...e})}function dc({className:e,align:t="center",sideOffset:n=4,...r}){return d.jsx(wx,{children:d.jsx(Sx,{"data-slot":"popover-content",align:t,sideOffset:n,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var Zo=1,Cx=.9,kx=.8,Ex=.17,Lr=.1,Fr=.999,Ax=.9999,Tx=.99,_x=/[\\\/_+.#"@\[\(\{&]/,Rx=/[\\\/_+.#"@\[\(\{&]/g,Mx=/[\s-]/,uc=/[\s-]/g;function is(e,t,n,r,s,o,a){if(o===t.length)return s===e.length?Zo:Tx;var i=`${s},${o}`;if(a[i]!==void 0)return a[i];for(var m=r.charAt(o),f=n.indexOf(m,s),l=0,c,u,h,b;f>=0;)c=is(e,t,n,r,f+1,o+1,a),c>l&&(f===s?c*=Zo:_x.test(e.charAt(f-1))?(c*=kx,h=e.slice(s,f-1).match(Rx),h&&s>0&&(c*=Math.pow(Fr,h.length))):Mx.test(e.charAt(f-1))?(c*=Cx,b=e.slice(s,f-1).match(uc),b&&s>0&&(c*=Math.pow(Fr,b.length))):(c*=Ex,s>0&&(c*=Math.pow(Fr,f-s))),e.charAt(f)!==t.charAt(o)&&(c*=Ax)),(c<Lr&&n.charAt(f-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(f-1)!==r.charAt(o))&&(u=is(e,t,n,r,f+1,o+2,a),u*Lr>c&&(c=u*Lr)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function ea(e){return e.toLowerCase().replace(uc," ")}function Nx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,is(e,t,ea(e),ea(t),0,0,{})}var br="Dialog",[fc]=it(br),[jx,Ve]=fc(br),mc=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=gt({prop:r,defaultProp:s??!1,onChange:o,caller:br});return d.jsx(jx,{scope:t,triggerRef:i,contentRef:m,contentId:De(),titleId:De(),descriptionId:De(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};mc.displayName=br;var pc="DialogTrigger",Px=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(pc,n),o=Ae(t,s.triggerRef);return d.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Xs(s.open),...r,ref:o,onClick:ne(e.onClick,s.onOpenToggle)})});Px.displayName=pc;var Ks="DialogPortal",[Ix,hc]=fc(Ks,{forceMount:void 0}),gc=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Ve(Ks,t);return d.jsx(Ix,{scope:t,forceMount:n,children:p.Children.map(r,a=>d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:a})}))})};gc.displayName=Ks;var tr="DialogOverlay",bc=p.forwardRef((e,t)=>{const n=hc(tr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ve(tr,e.__scopeDialog);return o.modal?d.jsx(ze,{present:r||o.open,children:d.jsx(Ox,{...s,ref:t})}):null});bc.displayName=tr;var Dx=Yt("DialogOverlay.RemoveScroll"),Ox=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(tr,n);return d.jsx(fs,{as:Dx,allowPinchZoom:!0,shards:[s.contentRef],children:d.jsx(be.div,{"data-state":Xs(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),jt="DialogContent",xc=p.forwardRef((e,t)=>{const n=hc(jt,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ve(jt,e.__scopeDialog);return d.jsx(ze,{present:r||o.open,children:o.modal?d.jsx(Lx,{...s,ref:t}):d.jsx(Fx,{...s,ref:t})})});xc.displayName=jt;var Lx=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),r=p.useRef(null),s=Ae(t,n.contentRef,r);return p.useEffect(()=>{const o=r.current;if(o)return Rs(o)},[]),d.jsx(yc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&o.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault())})}),Fx=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),r=p.useRef(!1),s=p.useRef(!1);return d.jsx(yc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),yc=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=e,i=Ve(jt,n),m=p.useRef(null),f=Ae(t,m);return bs(),d.jsxs(d.Fragment,{children:[d.jsx(nr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(xn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Xs(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(Ux,{titleId:i.titleId}),d.jsx(Hx,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Ys="DialogTitle",vc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(Ys,n);return d.jsx(be.h2,{id:s.titleId,...r,ref:t})});vc.displayName=Ys;var wc="DialogDescription",$x=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(wc,n);return d.jsx(be.p,{id:s.descriptionId,...r,ref:t})});$x.displayName=wc;var Sc="DialogClose",Cc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(Sc,n);return d.jsx(be.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>s.onOpenChange(!1))})});Cc.displayName=Sc;function Xs(e){return e?"open":"closed"}var kc="DialogTitleWarning",[sw,Ec]=lf(kc,{contentName:jt,titleName:Ys,docsSlug:"dialog"}),Ux=({titleId:e})=>{const t=Ec(kc),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
381
+ `);return{kind:"directory",name:o,size:s,textContent:c,files:a}}async function ox(e){return new Promise((t,n)=>{const s=new FileReader;s.onloadend=()=>{const r=s.result,o=r.indexOf(",");t(o>=0?r.slice(o+1):r)},s.onerror=()=>n(new Error("FileReader error")),s.readAsDataURL(e)})}function ax({requests:e,onRespond:t,className:n}){return e.length===0?null:d.jsx("div",{className:Q("w-full max-w-3xl mx-auto px-4",n),children:d.jsx("div",{className:"space-y-2",children:e.map(s=>d.jsx(ix,{request:s,onRespond:t},s.requestId))})})}function ix({request:e,onRespond:t}){return nn(),d.jsxs("div",{role:"group","aria-label":Se("permission.requestAria",{tool:e.toolName}),className:"flex items-center gap-3 rounded-xl border border-approve/30 bg-approve/5 px-4 py-3",children:[d.jsx(Ia,{className:"h-5 w-5 text-approve-text flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-bold font-display text-approve-text",children:e.toolName}),e.description&&d.jsx("div",{className:"text-xs text-text-secondary mt-0.5 truncate",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-approve text-white text-xs font-medium font-display hover:bg-approve-hover transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(hn,{className:"h-3.5 w-3.5"}),G("permission.approve")]}),d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-status-error/40 text-status-error text-xs font-medium font-display hover:bg-status-error/10 transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(bn,{className:"h-3.5 w-3.5"}),G("permission.reject")]})]})]})}function Xo(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Qo(e){return e<1e3?String(e):e<1e6?`${Xo((e/1e3).toFixed(1))}k`:`${Xo((e/1e6).toFixed(2))}M`}function Jo(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function lx({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Jo(e.cost)),t.push(`${Qo(e.used)} / ${Qo(e.size)} tokens`);const n=[Se("usage.context",{used:e.used.toLocaleString(),size:e.size.toLocaleString()})];return e.cost!=null&&e.cost.amount>0&&n.push(Se("usage.totalCost",{cost:Jo(e.cost)})),d.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var gr="Popover",[Jl]=it(gr,[tn]),En=tn(),[cx,St]=Jl(gr),Zl=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:r,onOpenChange:o,modal:a=!1}=e,i=En(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,u]=gt({prop:s,defaultProp:r??!1,onChange:o,caller:gr});return d.jsx(As,{...i,children:d.jsx(cx,{scope:t,contentId:De(),triggerRef:m,open:c,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(h=>!h),[u]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};Zl.displayName=gr;var ec="PopoverAnchor",dx=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=St(ec,n),o=En(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=r;return p.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(ir,{...o,...s,ref:t})});dx.displayName=ec;var tc="PopoverTrigger",nc=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=St(tc,n),o=En(n),a=Ae(t,r.triggerRef),i=d.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":ic(r.open),...s,ref:a,onClick:ne(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:d.jsx(ir,{asChild:!0,...o,children:i})});nc.displayName=tc;var qs="PopoverPortal",[ux,fx]=Jl(qs,{forceMount:void 0}),rc=e=>{const{__scopePopover:t,forceMount:n,children:s,container:r}=e,o=St(qs,t);return d.jsx(ux,{scope:t,forceMount:n,children:d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:r,children:s})})})};rc.displayName=qs;var Jt="PopoverContent",sc=p.forwardRef((e,t)=>{const n=fx(Jt,e.__scopePopover),{forceMount:s=n.forceMount,...r}=e,o=St(Jt,e.__scopePopover);return d.jsx(ze,{present:s||o.open,children:o.modal?d.jsx(px,{...r,ref:t}):d.jsx(hx,{...r,ref:t})})});sc.displayName=Jt;var mx=Yt("PopoverContent.RemoveScroll"),px=p.forwardRef((e,t)=>{const n=St(Jt,e.__scopePopover),s=p.useRef(null),r=Ae(t,s),o=p.useRef(!1);return p.useEffect(()=>{const a=s.current;if(a)return Rs(a)},[]),d.jsx(fs,{as:mx,allowPinchZoom:!0,children:d.jsx(oc,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),hx=p.forwardRef((e,t)=>{const n=St(Jt,e.__scopePopover),s=p.useRef(!1),r=p.useRef(!1);return d.jsx(oc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&r.current&&o.preventDefault()}})}),oc=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,u=St(Jt,n),h=En(n);return bs(),d.jsx(nr,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:o,children:d.jsx(xn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>u.onOpenChange(!1),children:d.jsx(Ts,{"data-state":ic(u.open),role:"dialog",id:u.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ac="PopoverClose",gx=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=St(ac,n);return d.jsx(be.button,{type:"button",...s,ref:t,onClick:ne(e.onClick,()=>r.onOpenChange(!1))})});gx.displayName=ac;var bx="PopoverArrow",xx=p.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,r=En(n);return d.jsx(_s,{...r,...s,ref:t})});xx.displayName=bx;function ic(e){return e?"open":"closed"}var yx=Zl,vx=nc,wx=rc,Sx=sc;function lc({...e}){return d.jsx(yx,{"data-slot":"popover",...e})}function cc({...e}){return d.jsx(vx,{"data-slot":"popover-trigger",...e})}function dc({className:e,align:t="center",sideOffset:n=4,...s}){return d.jsx(wx,{children:d.jsx(Sx,{"data-slot":"popover-content",align:t,sideOffset:n,className:Q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...s})})}var Zo=1,Cx=.9,kx=.8,Ex=.17,Lr=.1,Fr=.999,Ax=.9999,Tx=.99,_x=/[\\\/_+.#"@\[\(\{&]/,Rx=/[\\\/_+.#"@\[\(\{&]/g,Mx=/[\s-]/,uc=/[\s-]/g;function is(e,t,n,s,r,o,a){if(o===t.length)return r===e.length?Zo:Tx;var i=`${r},${o}`;if(a[i]!==void 0)return a[i];for(var m=s.charAt(o),f=n.indexOf(m,r),l=0,c,u,h,b;f>=0;)c=is(e,t,n,s,f+1,o+1,a),c>l&&(f===r?c*=Zo:_x.test(e.charAt(f-1))?(c*=kx,h=e.slice(r,f-1).match(Rx),h&&r>0&&(c*=Math.pow(Fr,h.length))):Mx.test(e.charAt(f-1))?(c*=Cx,b=e.slice(r,f-1).match(uc),b&&r>0&&(c*=Math.pow(Fr,b.length))):(c*=Ex,r>0&&(c*=Math.pow(Fr,f-r))),e.charAt(f)!==t.charAt(o)&&(c*=Ax)),(c<Lr&&n.charAt(f-1)===s.charAt(o+1)||s.charAt(o+1)===s.charAt(o)&&n.charAt(f-1)!==s.charAt(o))&&(u=is(e,t,n,s,f+1,o+2,a),u*Lr>c&&(c=u*Lr)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function ea(e){return e.toLowerCase().replace(uc," ")}function Nx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,is(e,t,ea(e),ea(t),0,0,{})}var br="Dialog",[fc]=it(br),[jx,Ve]=fc(br),mc=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:o,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=gt({prop:s,defaultProp:r??!1,onChange:o,caller:br});return d.jsx(jx,{scope:t,triggerRef:i,contentRef:m,contentId:De(),titleId:De(),descriptionId:De(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};mc.displayName=br;var pc="DialogTrigger",Px=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ve(pc,n),o=Ae(t,r.triggerRef);return d.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Xs(r.open),...s,ref:o,onClick:ne(e.onClick,r.onOpenToggle)})});Px.displayName=pc;var Ks="DialogPortal",[Ix,hc]=fc(Ks,{forceMount:void 0}),gc=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,o=Ve(Ks,t);return d.jsx(Ix,{scope:t,forceMount:n,children:p.Children.map(s,a=>d.jsx(ze,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:r,children:a})}))})};gc.displayName=Ks;var tr="DialogOverlay",bc=p.forwardRef((e,t)=>{const n=hc(tr,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,o=Ve(tr,e.__scopeDialog);return o.modal?d.jsx(ze,{present:s||o.open,children:d.jsx(Ox,{...r,ref:t})}):null});bc.displayName=tr;var Dx=Yt("DialogOverlay.RemoveScroll"),Ox=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ve(tr,n);return d.jsx(fs,{as:Dx,allowPinchZoom:!0,shards:[r.contentRef],children:d.jsx(be.div,{"data-state":Xs(r.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),jt="DialogContent",xc=p.forwardRef((e,t)=>{const n=hc(jt,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,o=Ve(jt,e.__scopeDialog);return d.jsx(ze,{present:s||o.open,children:o.modal?d.jsx(Lx,{...r,ref:t}):d.jsx(Fx,{...r,ref:t})})});xc.displayName=jt;var Lx=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),s=p.useRef(null),r=Ae(t,n.contentRef,s);return p.useEffect(()=>{const o=s.current;if(o)return Rs(o)},[]),d.jsx(yc,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&o.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault())})}),Fx=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),s=p.useRef(!1),r=p.useRef(!1);return d.jsx(yc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&r.current&&o.preventDefault()}})}),yc=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:o,...a}=e,i=Ve(jt,n),m=p.useRef(null),f=Ae(t,m);return bs(),d.jsxs(d.Fragment,{children:[d.jsx(nr,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:o,children:d.jsx(xn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Xs(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(Ux,{titleId:i.titleId}),d.jsx(Hx,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Ys="DialogTitle",vc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ve(Ys,n);return d.jsx(be.h2,{id:r.titleId,...s,ref:t})});vc.displayName=Ys;var wc="DialogDescription",$x=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ve(wc,n);return d.jsx(be.p,{id:r.descriptionId,...s,ref:t})});$x.displayName=wc;var Sc="DialogClose",Cc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Ve(Sc,n);return d.jsx(be.button,{type:"button",...s,ref:t,onClick:ne(e.onClick,()=>r.onOpenChange(!1))})});Cc.displayName=Sc;function Xs(e){return e?"open":"closed"}var kc="DialogTitleWarning",[sw,Ec]=lf(kc,{contentName:jt,titleName:Ys,docsSlug:"dialog"}),Ux=({titleId:e})=>{const t=Ec(kc),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
382
382
 
383
383
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
384
384
 
385
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},zx="DialogDescriptionWarning",Hx=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ec(zx).contentName}}.`;return p.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Bx=mc,Wx=gc,Gx=bc,Vx=xc,ow=vc,aw=Cc,ln='[cmdk-group=""]',$r='[cmdk-group-items=""]',qx='[cmdk-group-heading=""]',Ac='[cmdk-item=""]',ta=`${Ac}:not([aria-disabled="true"])`,ls="cmdk-item-select",Bt="data-value",Kx=(e,t,n)=>Nx(e,t,n),Tc=p.createContext(void 0),An=()=>p.useContext(Tc),_c=p.createContext(void 0),Qs=()=>p.useContext(_c),Rc=p.createContext(void 0),Mc=p.forwardRef((e,t)=>{let n=Wt(()=>{var N,L;return{search:"",value:(L=(N=e.value)!=null?N:e.defaultValue)!=null?L:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Wt(()=>new Set),s=Wt(()=>new Map),o=Wt(()=>new Map),a=Wt(()=>new Set),i=Nc(e),{label:m,children:f,value:l,onValueChange:c,filter:u,shouldFilter:h,loop:b,disablePointerSelection:v=!1,vimBindings:w=!0,...y}=e,T=De(),A=De(),k=De(),O=p.useRef(null),E=oy();Pt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,_.emit()}},[l]),Pt(()=>{E(6,F)},[]);let _=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,L,$)=>{var R,B,V,q;if(!Object.is(n.current[N],L)){if(n.current[N]=L,N==="search")D(),M(),E(1,I);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(k);K?K.focus():(R=document.getElementById(T))==null||R.focus()}if(E(7,()=>{var K;n.current.selectedItemId=(K=j())==null?void 0:K.id,_.emit()}),$||E(5,F),((B=i.current)==null?void 0:B.value)!==void 0){let K=L??"";(q=(V=i.current).onValueChange)==null||q.call(V,K);return}}_.emit()}},emit:()=>{a.current.forEach(N=>N())}}),[]),g=p.useMemo(()=>({value:(N,L,$)=>{var R;L!==((R=o.current.get(N))==null?void 0:R.value)&&(o.current.set(N,{value:L,keywords:$}),n.current.filtered.items.set(N,x(L,$)),E(2,()=>{M(),_.emit()}))},item:(N,L)=>(r.current.add(N),L&&(s.current.has(L)?s.current.get(L).add(N):s.current.set(L,new Set([N]))),E(3,()=>{D(),M(),n.current.value||I(),_.emit()}),()=>{o.current.delete(N),r.current.delete(N),n.current.filtered.items.delete(N);let $=j();E(4,()=>{D(),($==null?void 0:$.getAttribute("id"))===N&&I(),_.emit()})}),group:N=>(s.current.has(N)||s.current.set(N,new Set),()=>{o.current.delete(N),s.current.delete(N)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:T,inputId:k,labelId:A,listInnerRef:O}),[]);function x(N,L){var $,R;let B=(R=($=i.current)==null?void 0:$.filter)!=null?R:Kx;return N?B(N,n.current.search,L):0}function M(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(R=>{let B=s.current.get(R),V=0;B.forEach(q=>{let K=N.get(q);V=Math.max(K,V)}),L.push([R,V])});let $=O.current;z().sort((R,B)=>{var V,q;let K=R.getAttribute("id"),oe=B.getAttribute("id");return((V=N.get(oe))!=null?V:0)-((q=N.get(K))!=null?q:0)}).forEach(R=>{let B=R.closest($r);B?B.appendChild(R.parentElement===B?R:R.closest(`${$r} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${$r} > *`))}),L.sort((R,B)=>B[1]-R[1]).forEach(R=>{var B;let V=(B=O.current)==null?void 0:B.querySelector(`${ln}[${Bt}="${encodeURIComponent(R[0])}"]`);V==null||V.parentElement.appendChild(V)})}function I(){let N=z().find($=>$.getAttribute("aria-disabled")!=="true"),L=N==null?void 0:N.getAttribute(Bt);_.setState("value",L||void 0)}function D(){var N,L,$,R;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let V of r.current){let q=(L=(N=o.current.get(V))==null?void 0:N.value)!=null?L:"",K=(R=($=o.current.get(V))==null?void 0:$.keywords)!=null?R:[],oe=x(q,K);n.current.filtered.items.set(V,oe),oe>0&&B++}for(let[V,q]of s.current)for(let K of q)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=B}function F(){var N,L,$;let R=j();R&&(((N=R.parentElement)==null?void 0:N.firstChild)===R&&(($=(L=R.closest(ln))==null?void 0:L.querySelector(qx))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function j(){var N;return(N=O.current)==null?void 0:N.querySelector(`${Ac}[aria-selected="true"]`)}function z(){var N;return Array.from(((N=O.current)==null?void 0:N.querySelectorAll(ta))||[])}function C(N){let L=z()[N];L&&_.setState("value",L.getAttribute(Bt))}function S(N){var L;let $=j(),R=z(),B=R.findIndex(q=>q===$),V=R[B+N];(L=i.current)!=null&&L.loop&&(V=B+N<0?R[R.length-1]:B+N===R.length?R[0]:R[B+N]),V&&_.setState("value",V.getAttribute(Bt))}function H(N){let L=j(),$=L==null?void 0:L.closest(ln),R;for(;$&&!R;)$=N>0?ry($,ln):sy($,ln),R=$==null?void 0:$.querySelector(ta);R?_.setState("value",R.getAttribute(Bt)):S(N)}let P=()=>C(z().length-1),U=N=>{N.preventDefault(),N.metaKey?P():N.altKey?H(1):S(1)},Y=N=>{N.preventDefault(),N.metaKey?C(0):N.altKey?H(-1):S(-1)};return p.createElement(wt.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:N=>{var L;(L=y.onKeyDown)==null||L.call(y,N);let $=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||$))switch(N.key){case"n":case"j":{w&&N.ctrlKey&&U(N);break}case"ArrowDown":{U(N);break}case"p":case"k":{w&&N.ctrlKey&&Y(N);break}case"ArrowUp":{Y(N);break}case"Home":{N.preventDefault(),C(0);break}case"End":{N.preventDefault(),P();break}case"Enter":{N.preventDefault();let R=j();if(R){let B=new Event(ls);R.dispatchEvent(B)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:g.inputId,id:g.labelId,style:iy},m),xr(e,N=>p.createElement(_c.Provider,{value:_},p.createElement(Tc.Provider,{value:g},N))))}),Yx=p.forwardRef((e,t)=>{var n,r;let s=De(),o=p.useRef(null),a=p.useContext(Rc),i=An(),m=Nc(e),f=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Pt(()=>{if(!f)return i.item(s,a==null?void 0:a.id)},[f]);let l=jc(s,o,[e.value,e.children,o],e.keywords),c=Qs(),u=yt(E=>E.value&&E.value===l.current),h=yt(E=>f||i.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);p.useEffect(()=>{let E=o.current;if(!(!E||e.disabled))return E.addEventListener(ls,b),()=>E.removeEventListener(ls,b)},[h,e.onSelect,e.disabled]);function b(){var E,_;v(),(_=(E=m.current).onSelect)==null||_.call(E,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:w,value:y,onSelect:T,forceMount:A,keywords:k,...O}=e;return p.createElement(wt.div,{ref:Ze(o,t),...O,id:s,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!u,"data-disabled":!!w,"data-selected":!!u,onPointerMove:w||i.getDisablePointerSelection()?void 0:v,onClick:w?void 0:b},e.children)}),Xx=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...o}=e,a=De(),i=p.useRef(null),m=p.useRef(null),f=De(),l=An(),c=yt(h=>s||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);Pt(()=>l.group(a),[]),jc(a,i,[e.value,e.heading,m]);let u=p.useMemo(()=>({id:a,forceMount:s}),[s]);return p.createElement(wt.div,{ref:Ze(i,t),...o,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),xr(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(Rc.Provider,{value:u},h))))}),Qx=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=p.useRef(null),o=yt(a=>!a.search);return!n&&!o?null:p.createElement(wt.div,{ref:Ze(s,t),...r,"cmdk-separator":"",role:"separator"})}),Jx=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=Qs(),a=yt(f=>f.search),i=yt(f=>f.selectedItemId),m=An();return p.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),p.createElement(wt.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:s?e.value:a,onChange:f=>{s||o.setState("search",f.target.value),n==null||n(f.target.value)}})}),Zx=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,o=p.useRef(null),a=p.useRef(null),i=yt(f=>f.selectedItemId),m=An();return p.useEffect(()=>{if(a.current&&o.current){let f=a.current,l=o.current,c,u=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return u.observe(f),()=>{cancelAnimationFrame(c),u.unobserve(f)}}},[]),p.createElement(wt.div,{ref:Ze(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:m.listId},xr(e,f=>p.createElement("div",{ref:Ze(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),ey=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:o,container:a,...i}=e;return p.createElement(Bx,{open:n,onOpenChange:r},p.createElement(Wx,{container:a},p.createElement(Gx,{"cmdk-overlay":"",className:s}),p.createElement(Vx,{"aria-label":e.label,"cmdk-dialog":"",className:o},p.createElement(Mc,{ref:t,...i}))))}),ty=p.forwardRef((e,t)=>yt(n=>n.filtered.count===0)?p.createElement(wt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ny=p.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...o}=e;return p.createElement(wt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},xr(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),rn=Object.assign(Mc,{List:Zx,Item:Yx,Input:Jx,Group:Xx,Separator:Qx,Dialog:ey,Empty:ty,Loading:ny});function ry(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function sy(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Nc(e){let t=p.useRef(e);return Pt(()=>{t.current=e}),t}var Pt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Wt(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function yt(e){let t=Qs(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function jc(e,t,n,r=[]){let s=p.useRef(),o=An();return Pt(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.current.textContent)==null?void 0:f.trim():s.current}})(),m=r.map(f=>f.trim());o.value(e,i,m),(a=t.current)==null||a.setAttribute(Bt,i),s.current=i}),s}var oy=()=>{let[e,t]=p.useState(),n=Wt(()=>new Map);return Pt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function ay(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function xr({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(ay(t),{ref:t.ref},n(t.props.children)):n(t)}var iy={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function ly({className:e,...t}){return d.jsx(rn,{"data-slot":"command",className:Z("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function cy({className:e,...t}){return d.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[d.jsx(Ru,{className:"size-4 shrink-0 opacity-50"}),d.jsx(rn.Input,{"data-slot":"command-input",className:Z("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function dy({className:e,...t}){return d.jsx(rn.List,{"data-slot":"command-list",className:Z("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function uy({...e}){return d.jsx(rn.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function fy({className:e,...t}){return d.jsx(rn.Group,{"data-slot":"command-group",className:Z("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function my({className:e,...t}){return d.jsx(rn.Item,{"data-slot":"command-item",className:Z("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function na(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let s=0;for(let o=0;o<r.length&&s<n.length;o++)r[o]===n[s]&&s++;return s===n.length}function py({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:s=!1}){const[o,a]=p.useState(""),[i,m]=p.useState(s?"__none__":void 0),f=p.useMemo(()=>o?e.filter(l=>na(o,l.name)||na(o,l.modelId)):e,[e,o]);return d.jsxs(ly,{shouldFilter:!1,value:i,onValueChange:m,children:[r&&d.jsx(cy,{placeholder:"Select a model…",value:o,onValueChange:a}),d.jsxs(dy,{children:[d.jsx(uy,{children:"No models found."}),d.jsx(fy,{children:f.map(l=>d.jsxs(my,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[d.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),d.jsx(hn,{className:Z("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function Pc(e){const[t,n]=p.useState(e.modelState),[r,s]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==c.currentModelId&&c.availableModels.some(h=>h.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},l=c=>{n(u=>u?{...u,currentModelId:c}:null),s(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const o=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>o.find(f=>f.modelId===a)??null,[o,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");s(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw s(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&o.length>0,availableModels:o,currentModelId:a,currentModel:i,setModel:m,isLoading:r}}function hy({client:e,onModelSelect:t}){const[n,r]=p.useState(!1),{supportsModelSelection:s,availableModels:o,currentModel:a,setModel:i,isLoading:m}=Pc(e),f=s&&o.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async u=>{try{await i(u.modelId),t==null||t(u.modelId),r(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return d.jsxs(lc,{open:n,onOpenChange:f?r:void 0,children:[d.jsx(cc,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?d.jsx(Ma,{className:"h-3 w-3 animate-spin"}):null,d.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?d.jsx(Ra,{className:"h-3 w-3"}):d.jsx(gn,{className:"h-3 w-3"})]})}),d.jsx(dc,{className:"w-72 p-0",align:"end",children:d.jsx(py,{models:o,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function gy(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const s=o=>{n(o)};return e.setAvailableCommandsChangedHandler(s),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}function Ic(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function by(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return Ic(e)}function xy(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!Ic(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const r of n)try{const s=await r.getType("text/plain");await t.writeText(await s.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const Js=new Set(["clear","new","help","status","model","copy","resume"]);function cs(){return[{name:"compact",desc:G("cmd.desc.compact")},{name:"cost",desc:G("cmd.desc.cost")},{name:"summary",desc:G("cmd.desc.summary")},{name:"files",desc:G("cmd.desc.files")}]}function Dc(){return cs().map(e=>({name:e.name,description:e.desc}))}function Oc(){return[{name:"clear",description:G("cmd.desc.clear")},{name:"new",description:G("cmd.desc.new")},{name:"help",description:G("cmd.desc.help")},{name:"status",description:G("cmd.desc.status")},{name:"model",description:G("cmd.desc.model"),input:{hint:G("cmd.hint.modelId")}},{name:"copy",description:G("cmd.desc.copy")},{name:"resume",description:G("cmd.desc.resume"),input:{hint:G("cmd.hint.sessionId")}}]}function yy(){return[...Oc(),...Dc()]}const ra=new Set(["compact","cost","summary","files"]);function iw(e,t=[]){if(e.length===0&&t.length===0)return yy();const n=Js,r=new Set,s=[],o=a=>{n.has(a.name)||r.has(a.name)||a.type!=="local-jsx"&&(a.type==="local"&&!ra.has(a.name)||a.type===void 0&&!ra.has(a.name)||(r.add(a.name),s.push({name:a.name,description:a.description||G("cmd.desc.agentFallback"),...a.argumentHint?{input:{hint:a.argumentHint}}:{}})))};for(const a of e)o(a);for(const a of t)o(a);for(const a of Dc())r.has(a.name)||(r.add(a.name),s.push(a));return[...Oc(),...s]}function vy(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";case"resume":return"Resume";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function wy(e){switch(e){case"help":return G("cmd.subtitle.help");case"status":return G("cmd.subtitle.status");case"model":return G("cmd.subtitle.model");case"copy":return G("cmd.subtitle.copy");case"resume":return G("cmd.subtitle.resume");default:return""}}function Sy(e){var r;const t=[];t.push(G("cmd.help.localHeader")),t.push("");const n=[{name:"clear",desc:G("cmd.desc.clear")},{name:"new",desc:G("cmd.desc.new")},{name:"help",desc:G("cmd.desc.help")},{name:"status",desc:G("cmd.desc.status")},{name:"model [id]",desc:G("cmd.desc.model")},{name:"copy",desc:G("cmd.desc.copy")},{name:"resume [会话id]",desc:G("cmd.desc.resume")}];for(const s of n)t.push(`- \`/${s.name}\` — ${s.desc}`);t.push(""),t.push(G("cmd.help.agentHeader")),t.push("");for(const s of cs())t.push(`- \`/${s.name}\` — ${s.desc}`);if(e.length>0){const s=new Set([...Js,...cs().map(o=>o.name)]);for(const o of e){if(s.has(o.name))continue;const a=(r=o.input)!=null&&r.hint?` ${o.input.hint}`:"";t.push(`- \`/${o.name}${a}\` — ${o.description}`)}}return t.join(`
386
- `)}function Cy(e){var n,r,s;const t=[G("cmd.status.header"),""];return t.push(`- ${G("cmd.status.sessionId")}: \`${e.sessionId??G("cmd.status.none")}\``),t.push(`- ${G("cmd.status.currentModel")}: ${((n=e.currentModel)==null?void 0:n.name)??((r=e.currentModel)==null?void 0:r.modelId)??G("cmd.status.unset")}`),(s=e.currentModel)!=null&&s.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- ${G("cmd.status.modelCount")}: ${e.modelCount}`),t.push(`- ${G("cmd.status.imageSupport")}: ${e.supportsImages?G("cmd.status.yes"):G("cmd.status.no")}`),t.push(`- ${G("cmd.status.messageCount")}: ${e.entryCount}`),t.join(`
387
- `)}function ky(e,t){if(e.length===0)return G("cmd.model.none");const n=[G("cmd.model.available"),""];for(const r of e){const s=r.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${r.modelId}\` — ${r.name}${s}`)}return n.push(""),n.push(G("cmd.model.hint")),n.join(`
388
- `)}async function Ey(e,t){var c;if(!e.startsWith("/"))return{handled:!1};const[n,...r]=e.slice(1).split(/\s+/),s=r.join(" ").trim(),o=n==null?void 0:n.toLowerCase();if(!o||!Js.has(o))return{handled:!1};if(o==="clear")return{handled:!0,clearEntries:!0};if(o==="new")return{handled:!0,newSession:!0};let a="",i=!1;if(o==="help")a=Sy(t.availableCommands);else if(o==="status")a=Cy({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(o==="model")if(s)try{await t.setModel(s),a=Se("cmd.model.switched",{id:s})}catch(u){a=Se("cmd.model.switchFailed",{message:u instanceof Error?u.message:String(u)}),i=!0}else a=ky(t.availableModels,t.currentModel);else if(o==="copy"){const u=[...t.entries].reverse().find(v=>v.type==="assistant_message"),h=((c=u==null?void 0:u.chunks)==null?void 0:c.map(v=>v.text).join(`
389
- `))??"";(h?await by(h):!0)?a=h?Se("cmd.copy.copied",{n:h.length}):G("cmd.copy.nothing"):(a=G("cmd.copy.failed"),i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:o,inputText:e,title:vy(o),subtitle:wy(o),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Ay={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Ty(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),s=n.match(/^data:([^;,]+)/),o=s?s[1]:"application/octet-stream",a=atob(r),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:o})}const Ur=[{value:"default",labelKey:"acp.mode.default",descKey:"acp.mode.defaultDesc"},{value:"acceptEdits",labelKey:"acp.mode.acceptEdits",descKey:"acp.mode.acceptEditsDesc"},{value:"bypassPermissions",labelKey:"acp.mode.bypass",descKey:"acp.mode.bypassDesc"},{value:"plan",labelKey:"acp.mode.plan",descKey:"acp.mode.planDesc"},{value:"dontAsk",labelKey:"acp.mode.dontAsk",descKey:"acp.mode.dontAskDesc"},{value:"auto",labelKey:"acp.mode.auto",descKey:"acp.mode.autoDesc"}];function _y({mode:e,onModeChange:t}){const[n,r]=p.useState(!1),s=Ur.find(o=>o.value===e)??Ur[0];return d.jsxs(lc,{open:n,onOpenChange:r,children:[d.jsx(cc,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[d.jsx(Ou,{className:"h-3 w-3"}),d.jsx("span",{className:"max-w-24 truncate",children:G(s.labelKey)}),n?d.jsx(Ra,{className:"h-3 w-3"}):d.jsx(gn,{className:"h-3 w-3"})]})}),d.jsx(dc,{className:"w-64 p-1",align:"start",children:Ur.map(o=>d.jsxs("button",{type:"button",onClick:()=>{t(o.value),r(!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:[d.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===o.value&&d.jsx(hn,{className:"h-3.5 w-3.5 text-brand-text"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-text-primary",children:G(o.labelKey)}),d.jsx("div",{className:"text-xs text-text-muted",children:G(o.descKey)})]})]},o.value))})]})}function sa(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function zr(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function Ry({client:e,agentId:t}){nn();const[n,r]=p.useState([]),[s,o]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[u,h]=p.useState(null),b=p.useRef(null),[v,w]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[y,T]=p.useState(e.usage),[A,k]=p.useState(e.currentModeId),[O,E]=p.useState(!1),{commands:_}=gy(e),{availableModels:g,currentModel:x,setModel:M}=Pc(e);p.useEffect(()=>{l.current=m},[m]);const I=p.useCallback(()=>{r([]),o(!1),i(!1),T(null),k(null)},[]),D=t?`acp_last_session_${t}`:null,F=p.useCallback((N,L)=>{if(((L==null?void 0:L.resetEntries)??!0)&&(r([]),o(!1)),f(N),i(!0),E(e.supportsImages),D)try{localStorage.setItem(D,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,D]),j=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),r(L=>{const $=zr(L,N.toolCall.toolCallId);if($>=0)return L.map((R,B)=>B!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:N.toolCall.toolCallId,title:N.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options},isStandalonePermission:!0}};return[...L,R]}}))},[]),z=p.useCallback((N,L)=>{if(!(l.current&&N!==l.current))if(L.sessionUpdate==="agent_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="message"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"message",text:q.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"message",text:$}]}]}const V={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,V]})}else if(L.sessionUpdate==="agent_thought_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="thought"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"thought",text:q.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"thought",text:$}]}]}const V={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,V]})}else if(L.sessionUpdate==="user_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="user_message")return[...R.slice(0,-1),{...B,content:B.content+$}];const V={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,V]})}else if(L.sessionUpdate==="tool_call"){const $={id:L.toolCallId,title:L.title,status:sa(L.status),content:L.content,rawInput:L.rawInput,rawOutput:L.rawOutput};r(R=>{const B=zr(R,L.toolCallId);if(B>=0)return R.map((q,K)=>K!==B||q.type!=="tool_call"?q:{type:"tool_call",toolCall:{...q.toolCall,...$}});const V={type:"tool_call",toolCall:$};return[...R,V]})}else L.sessionUpdate==="tool_call_update"?r($=>{const R=zr($,L.toolCallId);if(R<0){console.warn(`[ChatInterface] Tool call not found for update: ${L.toolCallId}`);const B={type:"tool_call",toolCall:{id:L.toolCallId,title:L.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,B]}return $.map((B,V)=>{if(V!==R||B.type!=="tool_call")return B;const q=L.status?sa(L.status):B.toolCall.status,K=L.content?[...B.toolCall.content||[],...L.content]:B.toolCall.content;return{type:"tool_call",toolCall:{...B.toolCall,status:q,...L.title&&{title:L.title},content:K,...L.rawInput&&{rawInput:L.rawInput},...L.rawOutput&&{rawOutput:L.rawOutput}}}})}):L.sessionUpdate==="plan"?r($=>{if(L.entries.length===0)return $.filter(V=>V.type!=="plan");const R=$.reduce((V,q,K)=>q.type==="plan"?K:V,-1);if(R>=0)return $.map((V,q)=>q===R?{...V,entries:L.entries}:V);const B={type:"plan",id:`plan-${Date.now()}`,entries:L.entries};return[...$,B]}):L.sessionUpdate==="usage_update"?T(L):L.sessionUpdate==="current_mode_update"&&k(L.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(L=>{console.log("[ChatInterface] Session created:",L),F(L)}),e.setSessionLoadedHandler(L=>{console.log("[ChatInterface] Session loaded/resumed:",L),F(L,{resetEntries:!1})}),e.setSessionSwitchingHandler(L=>{console.log("[ChatInterface] Switching to session:",L),f(L),I()}),e.setSessionUpdateHandler((L,$)=>{z(L,$)}),e.setPromptCompleteHandler(L=>{console.log("[ChatInterface] Prompt complete:",L),o(!1)}),e.setPermissionRequestHandler(j),e.setErrorMessageHandler(L=>{console.error("[ChatInterface] Agent error:",L),h(L),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>h(null),5e3)});const N=D?localStorage.getItem(D):null;return N&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",N),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:N}):await e.resumeSession({sessionId:N})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{b.current&&clearTimeout(b.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,j,z,I]);const C=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),s&&e.cancel(),I(),f(null),e.createSession(void 0,v)},[e,s,I,v]),S=()=>{console.log("[ChatInterface] Cancel requested"),r(N=>N.map(L=>L.type!=="tool_call"||!(L.toolCall.status==="running"||L.toolCall.status==="waiting_for_confirmation")?L:(console.log("[ChatInterface] Marking tool call as canceled:",L.toolCall.id),{type:"tool_call",toolCall:{...L.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},H=p.useCallback((N,L,$)=>{console.log("[ChatInterface] Permission response:",{requestId:N,optionId:L,optionKind:$}),e.respondToPermission(N,L);const R=$==="reject_once"||$==="reject_always"||L===null;r(B=>B.map(V=>{var K;if(V.type!=="tool_call"||((K=V.toolCall.permissionRequest)==null?void 0:K.requestId)!==N)return V;let q;return R?q="rejected":V.toolCall.isStandalonePermission?q="complete":q="running",{type:"tool_call",toolCall:{...V.toolCall,status:q,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),P=n.filter(N=>N.type==="tool_call"&&N.toolCall.status==="waiting_for_confirmation"&&!!N.toolCall.permissionRequest).map(N=>({requestId:N.toolCall.permissionRequest.requestId,toolName:N.toolCall.title,toolInput:N.toolCall.rawInput||{},description:N.toolCall.title,options:N.toolCall.permissionRequest.options})),U=p.useCallback((N,L)=>{const $=P.find(V=>V.requestId===N);let R=null,B=null;if($!=null&&$.options&&$.options.length>0)if(L){const V=$.options.find(q=>q.kind==="allow_once")??$.options.find(q=>q.kind==="allow_always");V&&(R=V.optionId,B=V.kind)}else{const V=$.options.find(q=>q.kind==="reject_once")??$.options.find(q=>q.kind==="reject_always");V&&(R=V.optionId,B=V.kind)}R||(B=L?"allow_once":"reject_once"),H(N,R,B)},[H,P]),Y=p.useCallback(async N=>{var oe;const L=N.text.trim(),$=N.images||[],R=N.attachments||[];if(!L&&$.length===0&&R.length===0||!a)return;if(L.startsWith("/")&&$.length===0){Rt("[ChatInterface] slash command input",{text:L});const ee=await Ey(L,{sessionId:m,availableCommands:_,availableModels:g,currentModel:x,supportsImages:O,entries:c.current,setModel:M,onNewSession:C}).catch(()=>null);if(ee){if(Rt("[ChatInterface] local command handled",ee),"clearEntries"in ee&&ee.clearEntries){r([]);return}if("newSession"in ee&&ee.newSession){C();return}if("userEntry"in ee){r(re=>[...re,ee.userEntry,ee.cmdEntry]);return}}Rt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:L})}Rt("[ChatInterface] forwarding to agent",{text:L,hasImages:$.length>0,sessionReady:a,isLoading:s});const B=[];L&&B.push({type:"text",text:L});const V=[];for(const ee of $)try{const re=`data:${ee.mimeType};base64,${ee.data}`;let ce;re.startsWith("data:")?ce=Ty(re):ce=await(await fetch(re)).blob();let ve=ce,fe=ee.mimeType;if(ce.size>2*1024*1024){const de=new File([ce],"image.jpg",{type:ce.type});ve=await Pe(de,Ay),fe="image/jpeg"}const we=await new Promise((de,xe)=>{const Ce=new FileReader;Ce.onloadend=()=>{const pe=Ce.result,_e=pe.indexOf(",");de(_e>=0?pe.slice(_e+1):pe)},Ce.onerror=()=>{var pe;return xe(new Error("FileReader error: "+((pe=Ce.error)==null?void 0:pe.message)))},Ce.readAsDataURL(ve)}),me={type:"image",mimeType:fe,data:we};B.push(me),V.push({mimeType:fe,data:we})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const q=[];for(const ee of R)try{if(ee.textContent){let re;if(ee.kind==="directory"){const ce=((oe=ee.files)==null?void 0:oe.length)??0;re=`${Se("attach.directoryHeader",{name:ee.name})} ${Se("attach.fileCount",{n:ce})}
385
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},zx="DialogDescriptionWarning",Hx=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ec(zx).contentName}}.`;return p.useEffect(()=>{var o;const r=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Bx=mc,Wx=gc,Gx=bc,Vx=xc,ow=vc,aw=Cc,ln='[cmdk-group=""]',$r='[cmdk-group-items=""]',qx='[cmdk-group-heading=""]',Ac='[cmdk-item=""]',ta=`${Ac}:not([aria-disabled="true"])`,ls="cmdk-item-select",Bt="data-value",Kx=(e,t,n)=>Nx(e,t,n),Tc=p.createContext(void 0),An=()=>p.useContext(Tc),_c=p.createContext(void 0),Qs=()=>p.useContext(_c),Rc=p.createContext(void 0),Mc=p.forwardRef((e,t)=>{let n=Wt(()=>{var N,L;return{search:"",value:(L=(N=e.value)!=null?N:e.defaultValue)!=null?L:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=Wt(()=>new Set),r=Wt(()=>new Map),o=Wt(()=>new Map),a=Wt(()=>new Set),i=Nc(e),{label:m,children:f,value:l,onValueChange:c,filter:u,shouldFilter:h,loop:b,disablePointerSelection:v=!1,vimBindings:w=!0,...y}=e,T=De(),A=De(),k=De(),O=p.useRef(null),E=oy();Pt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,_.emit()}},[l]),Pt(()=>{E(6,F)},[]);let _=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,L,$)=>{var R,B,V,q;if(!Object.is(n.current[N],L)){if(n.current[N]=L,N==="search")D(),M(),E(1,I);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(k);K?K.focus():(R=document.getElementById(T))==null||R.focus()}if(E(7,()=>{var K;n.current.selectedItemId=(K=j())==null?void 0:K.id,_.emit()}),$||E(5,F),((B=i.current)==null?void 0:B.value)!==void 0){let K=L??"";(q=(V=i.current).onValueChange)==null||q.call(V,K);return}}_.emit()}},emit:()=>{a.current.forEach(N=>N())}}),[]),g=p.useMemo(()=>({value:(N,L,$)=>{var R;L!==((R=o.current.get(N))==null?void 0:R.value)&&(o.current.set(N,{value:L,keywords:$}),n.current.filtered.items.set(N,x(L,$)),E(2,()=>{M(),_.emit()}))},item:(N,L)=>(s.current.add(N),L&&(r.current.has(L)?r.current.get(L).add(N):r.current.set(L,new Set([N]))),E(3,()=>{D(),M(),n.current.value||I(),_.emit()}),()=>{o.current.delete(N),s.current.delete(N),n.current.filtered.items.delete(N);let $=j();E(4,()=>{D(),($==null?void 0:$.getAttribute("id"))===N&&I(),_.emit()})}),group:N=>(r.current.has(N)||r.current.set(N,new Set),()=>{o.current.delete(N),r.current.delete(N)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:T,inputId:k,labelId:A,listInnerRef:O}),[]);function x(N,L){var $,R;let B=(R=($=i.current)==null?void 0:$.filter)!=null?R:Kx;return N?B(N,n.current.search,L):0}function M(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(R=>{let B=r.current.get(R),V=0;B.forEach(q=>{let K=N.get(q);V=Math.max(K,V)}),L.push([R,V])});let $=O.current;z().sort((R,B)=>{var V,q;let K=R.getAttribute("id"),oe=B.getAttribute("id");return((V=N.get(oe))!=null?V:0)-((q=N.get(K))!=null?q:0)}).forEach(R=>{let B=R.closest($r);B?B.appendChild(R.parentElement===B?R:R.closest(`${$r} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${$r} > *`))}),L.sort((R,B)=>B[1]-R[1]).forEach(R=>{var B;let V=(B=O.current)==null?void 0:B.querySelector(`${ln}[${Bt}="${encodeURIComponent(R[0])}"]`);V==null||V.parentElement.appendChild(V)})}function I(){let N=z().find($=>$.getAttribute("aria-disabled")!=="true"),L=N==null?void 0:N.getAttribute(Bt);_.setState("value",L||void 0)}function D(){var N,L,$,R;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let V of s.current){let q=(L=(N=o.current.get(V))==null?void 0:N.value)!=null?L:"",K=(R=($=o.current.get(V))==null?void 0:$.keywords)!=null?R:[],oe=x(q,K);n.current.filtered.items.set(V,oe),oe>0&&B++}for(let[V,q]of r.current)for(let K of q)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=B}function F(){var N,L,$;let R=j();R&&(((N=R.parentElement)==null?void 0:N.firstChild)===R&&(($=(L=R.closest(ln))==null?void 0:L.querySelector(qx))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function j(){var N;return(N=O.current)==null?void 0:N.querySelector(`${Ac}[aria-selected="true"]`)}function z(){var N;return Array.from(((N=O.current)==null?void 0:N.querySelectorAll(ta))||[])}function C(N){let L=z()[N];L&&_.setState("value",L.getAttribute(Bt))}function S(N){var L;let $=j(),R=z(),B=R.findIndex(q=>q===$),V=R[B+N];(L=i.current)!=null&&L.loop&&(V=B+N<0?R[R.length-1]:B+N===R.length?R[0]:R[B+N]),V&&_.setState("value",V.getAttribute(Bt))}function H(N){let L=j(),$=L==null?void 0:L.closest(ln),R;for(;$&&!R;)$=N>0?ry($,ln):sy($,ln),R=$==null?void 0:$.querySelector(ta);R?_.setState("value",R.getAttribute(Bt)):S(N)}let P=()=>C(z().length-1),U=N=>{N.preventDefault(),N.metaKey?P():N.altKey?H(1):S(1)},Y=N=>{N.preventDefault(),N.metaKey?C(0):N.altKey?H(-1):S(-1)};return p.createElement(wt.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:N=>{var L;(L=y.onKeyDown)==null||L.call(y,N);let $=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||$))switch(N.key){case"n":case"j":{w&&N.ctrlKey&&U(N);break}case"ArrowDown":{U(N);break}case"p":case"k":{w&&N.ctrlKey&&Y(N);break}case"ArrowUp":{Y(N);break}case"Home":{N.preventDefault(),C(0);break}case"End":{N.preventDefault(),P();break}case"Enter":{N.preventDefault();let R=j();if(R){let B=new Event(ls);R.dispatchEvent(B)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:g.inputId,id:g.labelId,style:iy},m),xr(e,N=>p.createElement(_c.Provider,{value:_},p.createElement(Tc.Provider,{value:g},N))))}),Yx=p.forwardRef((e,t)=>{var n,s;let r=De(),o=p.useRef(null),a=p.useContext(Rc),i=An(),m=Nc(e),f=(s=(n=m.current)==null?void 0:n.forceMount)!=null?s:a==null?void 0:a.forceMount;Pt(()=>{if(!f)return i.item(r,a==null?void 0:a.id)},[f]);let l=jc(r,o,[e.value,e.children,o],e.keywords),c=Qs(),u=yt(E=>E.value&&E.value===l.current),h=yt(E=>f||i.filter()===!1?!0:E.search?E.filtered.items.get(r)>0:!0);p.useEffect(()=>{let E=o.current;if(!(!E||e.disabled))return E.addEventListener(ls,b),()=>E.removeEventListener(ls,b)},[h,e.onSelect,e.disabled]);function b(){var E,_;v(),(_=(E=m.current).onSelect)==null||_.call(E,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:w,value:y,onSelect:T,forceMount:A,keywords:k,...O}=e;return p.createElement(wt.div,{ref:Ze(o,t),...O,id:r,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!u,"data-disabled":!!w,"data-selected":!!u,onPointerMove:w||i.getDisablePointerSelection()?void 0:v,onClick:w?void 0:b},e.children)}),Xx=p.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:r,...o}=e,a=De(),i=p.useRef(null),m=p.useRef(null),f=De(),l=An(),c=yt(h=>r||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);Pt(()=>l.group(a),[]),jc(a,i,[e.value,e.heading,m]);let u=p.useMemo(()=>({id:a,forceMount:r}),[r]);return p.createElement(wt.div,{ref:Ze(i,t),...o,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),xr(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(Rc.Provider,{value:u},h))))}),Qx=p.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,r=p.useRef(null),o=yt(a=>!a.search);return!n&&!o?null:p.createElement(wt.div,{ref:Ze(r,t),...s,"cmdk-separator":"",role:"separator"})}),Jx=p.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,r=e.value!=null,o=Qs(),a=yt(f=>f.search),i=yt(f=>f.selectedItemId),m=An();return p.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),p.createElement(wt.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:r?e.value:a,onChange:f=>{r||o.setState("search",f.target.value),n==null||n(f.target.value)}})}),Zx=p.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...r}=e,o=p.useRef(null),a=p.useRef(null),i=yt(f=>f.selectedItemId),m=An();return p.useEffect(()=>{if(a.current&&o.current){let f=a.current,l=o.current,c,u=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return u.observe(f),()=>{cancelAnimationFrame(c),u.unobserve(f)}}},[]),p.createElement(wt.div,{ref:Ze(o,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":s,id:m.listId},xr(e,f=>p.createElement("div",{ref:Ze(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),ey=p.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:r,contentClassName:o,container:a,...i}=e;return p.createElement(Bx,{open:n,onOpenChange:s},p.createElement(Wx,{container:a},p.createElement(Gx,{"cmdk-overlay":"",className:r}),p.createElement(Vx,{"aria-label":e.label,"cmdk-dialog":"",className:o},p.createElement(Mc,{ref:t,...i}))))}),ty=p.forwardRef((e,t)=>yt(n=>n.filtered.count===0)?p.createElement(wt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ny=p.forwardRef((e,t)=>{let{progress:n,children:s,label:r="Loading...",...o}=e;return p.createElement(wt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},xr(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),rn=Object.assign(Mc,{List:Zx,Item:Yx,Input:Jx,Group:Xx,Separator:Qx,Dialog:ey,Empty:ty,Loading:ny});function ry(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function sy(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Nc(e){let t=p.useRef(e);return Pt(()=>{t.current=e}),t}var Pt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Wt(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function yt(e){let t=Qs(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function jc(e,t,n,s=[]){let r=p.useRef(),o=An();return Pt(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.current.textContent)==null?void 0:f.trim():r.current}})(),m=s.map(f=>f.trim());o.value(e,i,m),(a=t.current)==null||a.setAttribute(Bt,i),r.current=i}),r}var oy=()=>{let[e,t]=p.useState(),n=Wt(()=>new Map);return Pt(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,r)=>{n.current.set(s,r),t({})}};function ay(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function xr({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(ay(t),{ref:t.ref},n(t.props.children)):n(t)}var iy={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function ly({className:e,...t}){return d.jsx(rn,{"data-slot":"command",className:Q("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function cy({className:e,...t}){return d.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[d.jsx(Ru,{className:"size-4 shrink-0 opacity-50"}),d.jsx(rn.Input,{"data-slot":"command-input",className:Q("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function dy({className:e,...t}){return d.jsx(rn.List,{"data-slot":"command-list",className:Q("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function uy({...e}){return d.jsx(rn.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function fy({className:e,...t}){return d.jsx(rn.Group,{"data-slot":"command-group",className:Q("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function my({className:e,...t}){return d.jsx(rn.Item,{"data-slot":"command-item",className:Q("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function na(e,t){if(!e)return!0;const n=e.toLowerCase(),s=t.toLowerCase();let r=0;for(let o=0;o<s.length&&r<n.length;o++)s[o]===n[r]&&r++;return r===n.length}function py({models:e,currentModelId:t,onSelect:n,showSearch:s=!0,isMobile:r=!1}){const[o,a]=p.useState(""),[i,m]=p.useState(r?"__none__":void 0),f=p.useMemo(()=>o?e.filter(l=>na(o,l.name)||na(o,l.modelId)):e,[e,o]);return d.jsxs(ly,{shouldFilter:!1,value:i,onValueChange:m,children:[s&&d.jsx(cy,{placeholder:"Select a model…",value:o,onValueChange:a}),d.jsxs(dy,{children:[d.jsx(uy,{children:"No models found."}),d.jsx(fy,{children:f.map(l=>d.jsxs(my,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[d.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),d.jsx(hn,{className:Q("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function Pc(e){const[t,n]=p.useState(e.modelState),[s,r]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==c.currentModelId&&c.availableModels.some(h=>h.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},l=c=>{n(u=>u?{...u,currentModelId:c}:null),r(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const o=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>o.find(f=>f.modelId===a)??null,[o,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");r(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw r(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&o.length>0,availableModels:o,currentModelId:a,currentModel:i,setModel:m,isLoading:s}}function hy({client:e,onModelSelect:t}){const[n,s]=p.useState(!1),{supportsModelSelection:r,availableModels:o,currentModel:a,setModel:i,isLoading:m}=Pc(e),f=r&&o.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async u=>{try{await i(u.modelId),t==null||t(u.modelId),s(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return d.jsxs(lc,{open:n,onOpenChange:f?s:void 0,children:[d.jsx(cc,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?d.jsx(Ma,{className:"h-3 w-3 animate-spin"}):null,d.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?d.jsx(Ra,{className:"h-3 w-3"}):d.jsx(gn,{className:"h-3 w-3"})]})}),d.jsx(dc,{className:"w-72 p-0",align:"end",children:d.jsx(py,{models:o,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function gy(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const r=o=>{n(o)};return e.setAvailableCommandsChangedHandler(r),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const s=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:s}}function Ic(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function by(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return Ic(e)}function xy(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!Ic(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const s of n)try{const r=await s.getType("text/plain");await t.writeText(await r.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const Js=new Set(["clear","new","help","status","model","copy","resume"]);function cs(){return[{name:"compact",desc:G("cmd.desc.compact")},{name:"cost",desc:G("cmd.desc.cost")},{name:"summary",desc:G("cmd.desc.summary")},{name:"files",desc:G("cmd.desc.files")}]}function Dc(){return cs().map(e=>({name:e.name,description:e.desc}))}function Oc(){return[{name:"clear",description:G("cmd.desc.clear")},{name:"new",description:G("cmd.desc.new")},{name:"help",description:G("cmd.desc.help")},{name:"status",description:G("cmd.desc.status")},{name:"model",description:G("cmd.desc.model"),input:{hint:G("cmd.hint.modelId")}},{name:"copy",description:G("cmd.desc.copy")},{name:"resume",description:G("cmd.desc.resume"),input:{hint:G("cmd.hint.sessionId")}}]}function yy(){return[...Oc(),...Dc()]}const ra=new Set(["compact","cost","summary","files"]);function iw(e,t=[]){if(e.length===0&&t.length===0)return yy();const n=Js,s=new Set,r=[],o=a=>{n.has(a.name)||s.has(a.name)||a.type!=="local-jsx"&&(a.type==="local"&&!ra.has(a.name)||a.type===void 0&&!ra.has(a.name)||(s.add(a.name),r.push({name:a.name,description:a.description||G("cmd.desc.agentFallback"),...a.argumentHint?{input:{hint:a.argumentHint}}:{}})))};for(const a of e)o(a);for(const a of t)o(a);for(const a of Dc())s.has(a.name)||(s.add(a.name),r.push(a));return[...Oc(),...r]}function vy(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";case"resume":return"Resume";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function wy(e){switch(e){case"help":return G("cmd.subtitle.help");case"status":return G("cmd.subtitle.status");case"model":return G("cmd.subtitle.model");case"copy":return G("cmd.subtitle.copy");case"resume":return G("cmd.subtitle.resume");default:return""}}function Sy(e){var s;const t=[];t.push(G("cmd.help.localHeader")),t.push("");const n=[{name:"clear",desc:G("cmd.desc.clear")},{name:"new",desc:G("cmd.desc.new")},{name:"help",desc:G("cmd.desc.help")},{name:"status",desc:G("cmd.desc.status")},{name:"model [id]",desc:G("cmd.desc.model")},{name:"copy",desc:G("cmd.desc.copy")},{name:"resume [会话id]",desc:G("cmd.desc.resume")}];for(const r of n)t.push(`- \`/${r.name}\` — ${r.desc}`);t.push(""),t.push(G("cmd.help.agentHeader")),t.push("");for(const r of cs())t.push(`- \`/${r.name}\` — ${r.desc}`);if(e.length>0){const r=new Set([...Js,...cs().map(o=>o.name)]);for(const o of e){if(r.has(o.name))continue;const a=(s=o.input)!=null&&s.hint?` ${o.input.hint}`:"";t.push(`- \`/${o.name}${a}\` — ${o.description}`)}}return t.join(`
386
+ `)}function Cy(e){var n,s,r;const t=[G("cmd.status.header"),""];return t.push(`- ${G("cmd.status.sessionId")}: \`${e.sessionId??G("cmd.status.none")}\``),t.push(`- ${G("cmd.status.currentModel")}: ${((n=e.currentModel)==null?void 0:n.name)??((s=e.currentModel)==null?void 0:s.modelId)??G("cmd.status.unset")}`),(r=e.currentModel)!=null&&r.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- ${G("cmd.status.modelCount")}: ${e.modelCount}`),t.push(`- ${G("cmd.status.imageSupport")}: ${e.supportsImages?G("cmd.status.yes"):G("cmd.status.no")}`),t.push(`- ${G("cmd.status.messageCount")}: ${e.entryCount}`),t.join(`
387
+ `)}function ky(e,t){if(e.length===0)return G("cmd.model.none");const n=[G("cmd.model.available"),""];for(const s of e){const r=s.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${s.modelId}\` — ${s.name}${r}`)}return n.push(""),n.push(G("cmd.model.hint")),n.join(`
388
+ `)}async function Ey(e,t){var c;if(!e.startsWith("/"))return{handled:!1};const[n,...s]=e.slice(1).split(/\s+/),r=s.join(" ").trim(),o=n==null?void 0:n.toLowerCase();if(!o||!Js.has(o))return{handled:!1};if(o==="clear")return{handled:!0,clearEntries:!0};if(o==="new")return{handled:!0,newSession:!0};let a="",i=!1;if(o==="help")a=Sy(t.availableCommands);else if(o==="status")a=Cy({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(o==="model")if(r)try{await t.setModel(r),a=Se("cmd.model.switched",{id:r})}catch(u){a=Se("cmd.model.switchFailed",{message:u instanceof Error?u.message:String(u)}),i=!0}else a=ky(t.availableModels,t.currentModel);else if(o==="copy"){const u=[...t.entries].reverse().find(v=>v.type==="assistant_message"),h=((c=u==null?void 0:u.chunks)==null?void 0:c.map(v=>v.text).join(`
389
+ `))??"";(h?await by(h):!0)?a=h?Se("cmd.copy.copied",{n:h.length}):G("cmd.copy.nothing"):(a=G("cmd.copy.failed"),i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:o,inputText:e,title:vy(o),subtitle:wy(o),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Ay={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Ty(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),s=e.slice(t+1),r=n.match(/^data:([^;,]+)/),o=r?r[1]:"application/octet-stream",a=atob(s),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:o})}const Ur=[{value:"default",labelKey:"acp.mode.default",descKey:"acp.mode.defaultDesc"},{value:"acceptEdits",labelKey:"acp.mode.acceptEdits",descKey:"acp.mode.acceptEditsDesc"},{value:"bypassPermissions",labelKey:"acp.mode.bypass",descKey:"acp.mode.bypassDesc"},{value:"plan",labelKey:"acp.mode.plan",descKey:"acp.mode.planDesc"},{value:"dontAsk",labelKey:"acp.mode.dontAsk",descKey:"acp.mode.dontAskDesc"},{value:"auto",labelKey:"acp.mode.auto",descKey:"acp.mode.autoDesc"}];function _y({mode:e,onModeChange:t}){const[n,s]=p.useState(!1),r=Ur.find(o=>o.value===e)??Ur[0];return d.jsxs(lc,{open:n,onOpenChange:s,children:[d.jsx(cc,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[d.jsx(Ou,{className:"h-3 w-3"}),d.jsx("span",{className:"max-w-24 truncate",children:G(r.labelKey)}),n?d.jsx(Ra,{className:"h-3 w-3"}):d.jsx(gn,{className:"h-3 w-3"})]})}),d.jsx(dc,{className:"w-64 p-1",align:"start",children:Ur.map(o=>d.jsxs("button",{type:"button",onClick:()=>{t(o.value),s(!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:[d.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===o.value&&d.jsx(hn,{className:"h-3.5 w-3.5 text-brand-text"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-text-primary",children:G(o.labelKey)}),d.jsx("div",{className:"text-xs text-text-muted",children:G(o.descKey)})]})]},o.value))})]})}function sa(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function zr(e,t){for(let n=e.length-1;n>=0;n--){const s=e[n];if(s&&s.type==="tool_call"&&s.toolCall.id===t)return n}return-1}function Ry({client:e,agentId:t}){nn();const[n,s]=p.useState([]),[r,o]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[u,h]=p.useState(null),b=p.useRef(null),[v,w]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[y,T]=p.useState(e.usage),[A,k]=p.useState(e.currentModeId),[O,E]=p.useState(!1),{commands:_}=gy(e),{availableModels:g,currentModel:x,setModel:M}=Pc(e);p.useEffect(()=>{l.current=m},[m]);const I=p.useCallback(()=>{s([]),o(!1),i(!1),T(null),k(null)},[]),D=t?`acp_last_session_${t}`:null,F=p.useCallback((N,L)=>{if(((L==null?void 0:L.resetEntries)??!0)&&(s([]),o(!1)),f(N),i(!0),E(e.supportsImages),D)try{localStorage.setItem(D,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,D]),j=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),s(L=>{const $=zr(L,N.toolCall.toolCallId);if($>=0)return L.map((R,B)=>B!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:N.toolCall.toolCallId,title:N.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options},isStandalonePermission:!0}};return[...L,R]}}))},[]),z=p.useCallback((N,L)=>{if(!(l.current&&N!==l.current))if(L.sessionUpdate==="agent_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;s(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="message"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"message",text:q.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"message",text:$}]}]}const V={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,V]})}else if(L.sessionUpdate==="agent_thought_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;s(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="thought"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"thought",text:q.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"thought",text:$}]}]}const V={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,V]})}else if(L.sessionUpdate==="user_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;s(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="user_message")return[...R.slice(0,-1),{...B,content:B.content+$}];const V={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,V]})}else if(L.sessionUpdate==="tool_call"){const $={id:L.toolCallId,title:L.title,status:sa(L.status),content:L.content,rawInput:L.rawInput,rawOutput:L.rawOutput};s(R=>{const B=zr(R,L.toolCallId);if(B>=0)return R.map((q,K)=>K!==B||q.type!=="tool_call"?q:{type:"tool_call",toolCall:{...q.toolCall,...$}});const V={type:"tool_call",toolCall:$};return[...R,V]})}else L.sessionUpdate==="tool_call_update"?s($=>{const R=zr($,L.toolCallId);if(R<0){console.warn(`[ChatInterface] Tool call not found for update: ${L.toolCallId}`);const B={type:"tool_call",toolCall:{id:L.toolCallId,title:L.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,B]}return $.map((B,V)=>{if(V!==R||B.type!=="tool_call")return B;const q=L.status?sa(L.status):B.toolCall.status,K=L.content?[...B.toolCall.content||[],...L.content]:B.toolCall.content;return{type:"tool_call",toolCall:{...B.toolCall,status:q,...L.title&&{title:L.title},content:K,...L.rawInput&&{rawInput:L.rawInput},...L.rawOutput&&{rawOutput:L.rawOutput}}}})}):L.sessionUpdate==="plan"?s($=>{if(L.entries.length===0)return $.filter(V=>V.type!=="plan");const R=$.reduce((V,q,K)=>q.type==="plan"?K:V,-1);if(R>=0)return $.map((V,q)=>q===R?{...V,entries:L.entries}:V);const B={type:"plan",id:`plan-${Date.now()}`,entries:L.entries};return[...$,B]}):L.sessionUpdate==="usage_update"?T(L):L.sessionUpdate==="current_mode_update"&&k(L.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(L=>{console.log("[ChatInterface] Session created:",L),F(L)}),e.setSessionLoadedHandler(L=>{console.log("[ChatInterface] Session loaded/resumed:",L),F(L,{resetEntries:!1})}),e.setSessionSwitchingHandler(L=>{console.log("[ChatInterface] Switching to session:",L),f(L),I()}),e.setSessionUpdateHandler((L,$)=>{z(L,$)}),e.setPromptCompleteHandler(L=>{console.log("[ChatInterface] Prompt complete:",L),o(!1)}),e.setPermissionRequestHandler(j),e.setErrorMessageHandler(L=>{console.error("[ChatInterface] Agent error:",L),h(L),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>h(null),5e3)});const N=D?localStorage.getItem(D):null;return N&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",N),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:N}):await e.resumeSession({sessionId:N})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{b.current&&clearTimeout(b.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,j,z,I]);const C=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),r&&e.cancel(),I(),f(null),e.createSession(void 0,v)},[e,r,I,v]),S=()=>{console.log("[ChatInterface] Cancel requested"),s(N=>N.map(L=>L.type!=="tool_call"||!(L.toolCall.status==="running"||L.toolCall.status==="waiting_for_confirmation")?L:(console.log("[ChatInterface] Marking tool call as canceled:",L.toolCall.id),{type:"tool_call",toolCall:{...L.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},H=p.useCallback((N,L,$)=>{console.log("[ChatInterface] Permission response:",{requestId:N,optionId:L,optionKind:$}),e.respondToPermission(N,L);const R=$==="reject_once"||$==="reject_always"||L===null;s(B=>B.map(V=>{var K;if(V.type!=="tool_call"||((K=V.toolCall.permissionRequest)==null?void 0:K.requestId)!==N)return V;let q;return R?q="rejected":V.toolCall.isStandalonePermission?q="complete":q="running",{type:"tool_call",toolCall:{...V.toolCall,status:q,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),P=n.filter(N=>N.type==="tool_call"&&N.toolCall.status==="waiting_for_confirmation"&&!!N.toolCall.permissionRequest).map(N=>({requestId:N.toolCall.permissionRequest.requestId,toolName:N.toolCall.title,toolInput:N.toolCall.rawInput||{},description:N.toolCall.title,options:N.toolCall.permissionRequest.options})),U=p.useCallback((N,L)=>{const $=P.find(V=>V.requestId===N);let R=null,B=null;if($!=null&&$.options&&$.options.length>0)if(L){const V=$.options.find(q=>q.kind==="allow_once")??$.options.find(q=>q.kind==="allow_always");V&&(R=V.optionId,B=V.kind)}else{const V=$.options.find(q=>q.kind==="reject_once")??$.options.find(q=>q.kind==="reject_always");V&&(R=V.optionId,B=V.kind)}R||(B=L?"allow_once":"reject_once"),H(N,R,B)},[H,P]),Y=p.useCallback(async N=>{var oe;const L=N.text.trim(),$=N.images||[],R=N.attachments||[];if(!L&&$.length===0&&R.length===0||!a)return;if(L.startsWith("/")&&$.length===0){Rt("[ChatInterface] slash command input",{text:L});const ee=await Ey(L,{sessionId:m,availableCommands:_,availableModels:g,currentModel:x,supportsImages:O,entries:c.current,setModel:M,onNewSession:C}).catch(()=>null);if(ee){if(Rt("[ChatInterface] local command handled",ee),"clearEntries"in ee&&ee.clearEntries){s([]);return}if("newSession"in ee&&ee.newSession){C();return}if("userEntry"in ee){s(re=>[...re,ee.userEntry,ee.cmdEntry]);return}}Rt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:L})}Rt("[ChatInterface] forwarding to agent",{text:L,hasImages:$.length>0,sessionReady:a,isLoading:r});const B=[];L&&B.push({type:"text",text:L});const V=[];for(const ee of $)try{const re=`data:${ee.mimeType};base64,${ee.data}`;let ce;re.startsWith("data:")?ce=Ty(re):ce=await(await fetch(re)).blob();let ve=ce,fe=ee.mimeType;if(ce.size>2*1024*1024){const de=new File([ce],"image.jpg",{type:ce.type});ve=await Pe(de,Ay),fe="image/jpeg"}const we=await new Promise((de,xe)=>{const Ce=new FileReader;Ce.onloadend=()=>{const pe=Ce.result,_e=pe.indexOf(",");de(_e>=0?pe.slice(_e+1):pe)},Ce.onerror=()=>{var pe;return xe(new Error("FileReader error: "+((pe=Ce.error)==null?void 0:pe.message)))},Ce.readAsDataURL(ve)}),me={type:"image",mimeType:fe,data:we};B.push(me),V.push({mimeType:fe,data:we})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const q=[];for(const ee of R)try{if(ee.textContent){let re;if(ee.kind==="directory"){const ce=((oe=ee.files)==null?void 0:oe.length)??0;re=`${Se("attach.directoryHeader",{name:ee.name})} ${Se("attach.fileCount",{n:ce})}
390
390
  ${ee.textContent}`}else{const ce=ee.size!=null?` (${My(ee.size)})`:"";re=`📎 ${ee.name}${ce}
391
391
  \`\`\`
392
392
  ${ee.textContent}
393
- \`\`\``}B.push({type:"text",text:re}),q.push(ee)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(B.length===0)return;const K={type:"user_message",id:`user-${Date.now()}`,content:L,images:V.length>0?V:void 0,attachments:q.length>0?q:void 0};r(ee=>[...ee,K]),o(!0);try{await e.sendPrompt(B)}catch(ee){console.error("[ChatInterface] Failed to send prompt:",ee),o(!1)}},[s,a,e,_,g,x,O,m,M,C]);return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx(Wb,{entries:n,isLoading:s&&!a?!1:s,onPermissionRespond:(N,L,$)=>{H(N,L,$)},emptyTitle:a?G("session.emptyTitle"):void 0,emptyDescription:a?G("acp.emptyDescription"):void 0}),d.jsx(ax,{requests:P,onRespond:U}),u&&d.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:d.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[d.jsx("span",{children:u}),d.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),d.jsxs("div",{className:"flex-shrink-0",children:[d.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(_y,{mode:A??v,onModeChange:N=>{k(null),w(N),localStorage.setItem("acp_permission_mode",N)}}),d.jsx(hy,{client:e}),d.jsx(lx,{usage:y})]}),n.length>0&&d.jsxs(D0,{children:[d.jsx(O0,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand-text font-display gap-1",onClick:C,children:[d.jsx(Pa,{className:"h-3 w-3"}),G("acp.newSession")]})}),d.jsx(L0,{children:"New Thread"})]})]}),d.jsx(nx,{onSubmit:Y,isLoading:s,onInterrupt:S,disabled:!a,placeholder:G(a?"acp.inputPlaceholder":"acp.waitingPlaceholder"),supportsAttachments:O,commands:_.length>0?_:void 0,queueWhileLoading:!0})]})]})}function My(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ny({client:e,agentId:t}){nn();const[n,r]=p.useState(!1),s=p.useCallback(async o=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:o.sessionId,cwd:o.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:o.sessionId,cwd:o.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return d.jsxs("div",{className:"flex h-full w-full",children:[d.jsxs("div",{className:Z("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&d.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:G("acp.sessions")}),d.jsxs("div",{className:Z("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&d.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:G("acp.newSession"),children:d.jsx(Pa,{className:"h-4 w-4"})}),d.jsx("button",{type:"button",onClick:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?d.jsx(Cu,{className:"h-4 w-4"}):d.jsx(wu,{className:"h-4 w-4"})})]})]}),!n&&d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(jy,{client:e,onSelectSession:s})})]}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d.jsx(Ry,{client:e,agentId:t})})]})}function jy({client:e,onSelectSession:t}){const[n,r]=p.useState([]),[s,o]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[u,h]=p.useState(!0),b=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){o(!1);return}o(!0);try{const _=await e.listSessions();r(_.sessions)}catch(_){console.warn("[SidebarSessionList] Failed to load:",_)}finally{o(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const _=g=>{g==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(_),()=>e.removeConnectionStateHandler(_)},[e,v]),p.useEffect(()=>{const _=setInterval(v,1e4);return()=>clearInterval(_)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(_=>{v()}),e.setSessionRenamedHandler((_,g)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(_=>{/Method not found/i.test(_)&&/session\/(rename|delete)/i.test(_)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&b.current&&(b.current.focus(),b.current.select())},[m]);const w=p.useCallback(_=>{const g=_.title&&_.title.trim()?_.title:_.sessionId.slice(0,8);if(window.confirm(Se("acp.confirmDelete",{label:g})))try{e.deleteSession(_.sessionId),r(x=>x.filter(M=>M.sessionId!==_.sessionId)),a===_.sessionId&&i(null)}catch(x){console.error("[SidebarSessionList] delete failed:",x)}},[e,a]),y=p.useCallback(_=>{f(_.sessionId),c(_.title&&_.title.trim()?_.title:"")},[]),T=p.useCallback(()=>{if(!m)return;const _=l.trim();if(!_){f(null);return}try{e.renameSession(m,_),r(g=>g.map(x=>x.sessionId===m?{...x,title:_}:x))}catch(g){console.error("[SidebarSessionList] rename failed:",g)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),k=p.useCallback(_=>{_.key==="Enter"?(_.preventDefault(),T()):_.key==="Escape"&&(_.preventDefault(),A())},[T,A]),O=p.useMemo(()=>[...n].sort((_,g)=>{const x=_.updatedAt?new Date(_.updatedAt).getTime():0;return(g.updatedAt?new Date(g.updatedAt).getTime():0)-x}),[n]);if(s&&n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:G("common.loading")})});if(n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:G("acp.emptySessions")})});const E=Py(O);return d.jsx("nav",{className:"py-1","aria-label":G("acp.historyNav"),children:E.map((_,g)=>d.jsxs("div",{children:[g>0&&d.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),d.jsx("div",{className:"px-4 py-2",children:d.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:_.label})}),_.sessions.map(x=>{const M=m===x.sessionId;return d.jsxs("div",{className:Z("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",x.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[d.jsx(gu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),M?d.jsx("input",{ref:b,type:"text",value:l,onChange:I=>c(I.target.value),onKeyDown:k,onBlur:T,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-sm font-display text-text-primary outline-none focus:border-brand",onClick:I=>I.stopPropagation()}):d.jsx("button",{type:"button",onClick:()=>{i(x.sessionId),t(x)},className:"flex-1 min-w-0 text-left",title:x.title||x.sessionId,children:d.jsx("span",{className:"text-sm font-display truncate leading-snug block",children:x.title&&x.title.trim()?x.title:G("acp.newSession")})}),M?d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[d.jsx("button",{type:"button",onClick:T,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:G("acp.confirm"),children:d.jsx(hn,{className:"h-3.5 w-3.5"})}),d.jsx("button",{type:"button",onClick:A,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:G("common.cancel"),children:d.jsx(bn,{className:"h-3.5 w-3.5"})})]}):d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:u?void 0:G("acp.noSessionManagement"),children:[d.jsx("button",{type:"button",disabled:!u,onClick:I=>{I.stopPropagation(),u&&y(x)},className:Z("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-brand-text hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:G(u?"acp.rename":"acp.renameUnsupported"),children:d.jsx(ja,{className:"h-3 w-3"})}),d.jsx("button",{type:"button",disabled:!u,onClick:I=>{I.stopPropagation(),u&&w(x)},className:Z("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:G(u?"acp.delete":"acp.deleteUnsupported"),children:d.jsx(Hu,{className:"h-3 w-3"})})]})]},x.sessionId)})]},_.label))})}function Py(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),s=[{label:G("resume.today"),sessions:[]},{label:G("resume.yesterday"),sessions:[]},{label:G("resume.earlier"),sessions:[]}];for(const o of e){const a=o.updatedAt?new Date(o.updatedAt):new Date(0);a>=n?s[0].sessions.push(o):a>=r?s[1].sessions.push(o):s[2].sessions.push(o)}return s.filter(o=>o.sessions.length>0)}function Iy({url:e,token:t,onBack:n}){const[r,s]=p.useState(null),[o,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new es({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,u)=>{a(c),m(u||null)}),f.current=l,s(l),l.connect().catch(c=>{c instanceof ll||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,s(null),a("disconnected")}},[e,t]),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&o==="error"&&d.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,d.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),o==="connecting"&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),d.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),o==="error"&&!r&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),d.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),d.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),r&&o==="connected"&&d.jsx(Ny,{client:r})]})}const ds="rcs_admin_key";function Dy(){try{return localStorage.getItem(ds)}catch{return null}}function Oy(){const[e,t]=p.useState(Dy),n=p.useCallback(r=>{const s=r.trim();t(s||null);try{s?localStorage.setItem(ds,s):localStorage.removeItem(ds)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const oa=p.lazy(()=>Ne(()=>import("./Dashboard-CC-Am4QG.js"),__vite__mapDeps([4,2,5,6,7,8,1,9])).then(e=>({default:e.Dashboard}))),Ly=p.lazy(()=>Ne(()=>import("./SessionDetail-BtVDoMg8.js"),__vite__mapDeps([10,2,6,8,11,12,13,14,7,15,1,9,16])).then(e=>({default:e.SessionDetail}))),Fy=p.lazy(()=>Ne(()=>import("./ShareLanding-DUksxKDO.js"),__vite__mapDeps([17,2,1,9])).then(e=>({default:e.ShareLanding}))),aa=p.lazy(()=>Ne(()=>import("./ArtifactsGallery-DYZ5MTsU.js").then(e=>e.a),__vite__mapDeps([14,2,8,13])).then(e=>({default:e.ArtifactsGallery}))),$y=p.lazy(()=>Ne(()=>import("./ArtifactView-rXn5UHd0.js"),__vite__mapDeps([18,2,14,8,13,11,1,9])).then(e=>({default:e.ArtifactView}))),Uy=p.lazy(()=>Ne(()=>import("./MemoriesGallery-DmhB-a-r.js"),__vite__mapDeps([15,2,8,1,9])).then(e=>({default:e.MemoriesGallery}))),zy=p.lazy(()=>Ne(()=>import("./Claim-55pIPPu9.js"),__vite__mapDeps([19,2,1,9])).then(e=>({default:e.Claim}))),Hy=p.lazy(()=>Ne(()=>import("./Login-CQvhBtmI.js"),__vite__mapDeps([20,2,1,9])).then(e=>({default:e.Login}))),By=p.lazy(()=>Ne(()=>import("./Register-CWCr9uhR.js"),__vite__mapDeps([21,2,1,9])).then(e=>({default:e.Register}))),Wy=p.lazy(()=>Ne(()=>import("./Setup-BOa1QZgo.js"),__vite__mapDeps([22,2,1,9])).then(e=>({default:e.Setup}))),Gy=p.lazy(()=>Ne(()=>import("./Join-Bv_quRru.js"),__vite__mapDeps([23,2,1,9])).then(e=>({default:e.Join}))),Vy=p.lazy(()=>Ne(()=>import("./UserSettings-Cnr-Z5oi.js"),__vite__mapDeps([24,2,16,13,1,9])).then(e=>({default:e.UserSettings}))),qy=p.lazy(()=>Ne(()=>import("./TeamList-Dkroa-DR.js"),__vite__mapDeps([25,2,8,1,9])).then(e=>({default:e.TeamList}))),Ky=p.lazy(()=>Ne(()=>import("./TeamDetail-N4R7QgkK.js"),__vite__mapDeps([26,2,5,6,12,13,1,9])).then(e=>({default:e.TeamDetail}))),Yy=p.lazy(()=>Ne(()=>import("./TeamSettings-sH6k3cBB.js"),__vite__mapDeps([27,2,1,9])).then(e=>({default:e.TeamSettings}))),Xy=p.lazy(()=>Ne(()=>import("./AdminPanel-DugQ1zJs.js"),__vite__mapDeps([28,2,1,9])).then(e=>({default:e.AdminPanel}))),Qy=new Set(["login","register","setup","join","share"]),Jy=new Set(["login","register","setup","join"]);function Zy(){return d.jsx(Xu,{defaultTheme:"system",children:d.jsx(Zh,{children:d.jsx(ev,{})})})}function ev(){const[e,t]=p.useState("dashboard"),[n,r]=p.useState(null),[s,o]=p.useState(null),[a,i]=p.useState(null),[m,f]=p.useState(null),{adminKey:l}=Oy(),{user:c,isLoading:u,checkSetupStatus:h}=il();p.useEffect(()=>{zh(l)},[l]);const[b,v]=p.useState(!1);p.useEffect(()=>{!u&&!c?h().then(v):c&&v(!1)},[u,c,h]);const w=p.useCallback(()=>{const x=window.location.pathname,M=new URLSearchParams(window.location.search);if(M.get("acp")==="1"){const P=sessionStorage.getItem("acp_connection");if(P)try{const U=JSON.parse(P);if(U.url&&U.token){f({url:U.url,token:U.token}),sessionStorage.removeItem("acp_connection");const Y=new URL(window.location.href);Y.searchParams.delete("acp"),window.history.replaceState(null,"",Y),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const D=M.get("sid");if(D){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${D}`),r(D),i(null),t("session");return}if(x==="/login"){t("login");return}if(x==="/register"){t("register");return}if(x==="/setup"){t("setup");return}if(x==="/join"){t("join");return}if(x==="/settings"){t("settings");return}if(x==="/admin"){t("admin");return}if(x.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(x.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(x==="/teams"){t("teams");return}const z=x.match(/^\/code\/s\/([^/]+)/);if(z&&z[1]){i(z[1]),r(null),t("share");return}const C=x.match(/^\/code\/a\/([^/]+)/);if(C&&C[1]){o(C[1]),r(null),i(null),t("artifact-view");return}if(x==="/code/artifacts"||x==="/code/artifacts/"){o(null),r(null),i(null),t("artifacts");return}if(x==="/code/memories"||x==="/code/memories/"){o(null),r(null),i(null),t("memories");return}const S=x.match(/^\/code\/claim\/([^/]+)/);if(S&&S[1]){t("claim");return}const H=x.match(/^\/code\/([^/]+)/);H&&H[1]?(r(H[1]),i(null),t("session")):(r(null),i(null),t("dashboard"))},[]);p.useEffect(()=>(w(),window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)),[w]);const y=p.useCallback(x=>{window.history.pushState(null,"",`/code/${x}`),r(x),i(null),o(null),t("session")},[]),T=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),o(null),r(null),i(null),t("artifacts")},[]),A=p.useCallback(()=>{window.history.pushState(null,"","/code/memories"),o(null),r(null),i(null),t("memories")},[]),k=p.useCallback(()=>{window.history.pushState(null,"","/code/"),r(null),i(null),o(null),f(null),t("dashboard")},[]),O=(()=>{let x=e;return u||(b&&x!=="setup"&&x!=="join"&&(x="setup"),!c&&!Qy.has(x)&&(x="login"),c&&(x==="login"||x==="setup")&&(x="dashboard")),x})();if(p.useEffect(()=>{u||(O==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):O==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):O==="dashboard"&&c&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[O,c,u]),u)return d.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const E=()=>{if(m&&O==="acp")return d.jsx(Iy,{url:m.url,token:m.token,onBack:k});switch(O){case"login":return d.jsx(Hy,{onSuccess:k,onNavigateRegister:()=>t("register")});case"register":return d.jsx(By,{onSuccess:k,onBack:()=>t("login")});case"setup":return d.jsx(Wy,{onSuccess:k,onAlreadyDone:k});case"join":return d.jsx(Gy,{onSuccess:k,onInvalidInvite:k});case"settings":return d.jsx(Vy,{});case"teams":return d.jsx(qy,{});case"team-detail":return d.jsx(Ky,{});case"team-settings":return d.jsx(Yy,{});case"admin":return(c==null?void 0:c.role)!=="admin"?d.jsx("div",{className:"flex flex-1 items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),d.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:G("nav.dashboard")})]})}):d.jsx(Xy,{});case"share":return d.jsx(Fy,{});case"claim":return d.jsx(zy,{});case"artifacts":return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(aa,{})});case"artifact-view":return s?d.jsx($y,{artifactId:s,onBack:T}):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(aa,{})});case"memories":return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Uy,{})});case"session":return n?d.jsx(Ly,{sessionId:n,onBack:k},n):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(oa,{onNavigateSession:y})});default:return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(oa,{onNavigateSession:y})})}},_=!Jy.has(O)&&O!=="session",g=O==="artifact-view";return d.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[_&&d.jsx(tg,{sessionTitle:m?"ACP":void 0,sessionSource:m?"acp":void 0,onBack:m||a?k:void 0,onNavigateArtifacts:g?void 0:T,onNavigateMemories:A}),d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:E()})]})}xy();zc.createRoot(document.getElementById("root")).render(d.jsx(p.StrictMode,{children:d.jsx(Zy,{})}));export{Jv as $,es as A,_a as B,nx as C,pb as D,Ou as E,ou as F,Ia as G,Fu as H,nw as I,ow as J,I0 as K,Ma as L,Hs as M,Hu as N,Gx as O,ja as P,eg as Q,Bx as R,Ru as S,Dh as T,Oa as U,qu as V,ae as W,bn as X,Dv as Y,Av as Z,Fv as _,Ny as a,nn as a$,Hv as a0,_v as a1,Nv as a2,$v as a3,Xv as a4,Wv as a5,Ev as a6,hv as a7,Lv as a8,Ov as a9,Bv as aA,Yv as aB,fa as aC,Z as aD,by as aE,le as aF,Rt as aG,Id as aH,lb as aI,ov as aJ,lv as aK,mv as aL,$n as aM,dv as aN,av as aO,cv as aP,iw as aQ,rw as aR,fv as aS,G as aT,Se as aU,ib as aV,iv as aW,Ey as aX,Hh as aY,Pd as aZ,il as a_,yv as aa,tw as ab,Kv as ac,qv as ad,Vv as ae,Uv as af,zv as ag,gv as ah,bv as ai,xv as aj,pv as ak,kv as al,Mv as am,Qv as an,Gv as ao,ew as ap,Tv as aq,Rv as ar,jv as as,Sv as at,Zv as au,vv as av,Cv as aw,wv as ax,Pv as ay,Iv as az,_r as b,Yh as b0,$h as c,Wb as d,hn as e,gn as f,Ra as g,tu as h,ru as i,aw as j,Vx as k,ll as l,tl as m,rl as n,Ln as o,Ph as p,Po as q,nl as r,py as s,Pa as t,lc as u,dc as v,cc as w,Wx as x,Nu as y,Pu as z};
393
+ \`\`\``}B.push({type:"text",text:re}),q.push(ee)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(B.length===0)return;const K={type:"user_message",id:`user-${Date.now()}`,content:L,images:V.length>0?V:void 0,attachments:q.length>0?q:void 0};s(ee=>[...ee,K]),o(!0);try{await e.sendPrompt(B)}catch(ee){console.error("[ChatInterface] Failed to send prompt:",ee),o(!1)}},[r,a,e,_,g,x,O,m,M,C]);return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx(Wb,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(N,L,$)=>{H(N,L,$)},emptyTitle:a?G("session.emptyTitle"):void 0,emptyDescription:a?G("acp.emptyDescription"):void 0}),d.jsx(ax,{requests:P,onRespond:U}),u&&d.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:d.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[d.jsx("span",{children:u}),d.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),d.jsxs("div",{className:"flex-shrink-0",children:[d.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(_y,{mode:A??v,onModeChange:N=>{k(null),w(N),localStorage.setItem("acp_permission_mode",N)}}),d.jsx(hy,{client:e}),d.jsx(lx,{usage:y})]}),n.length>0&&d.jsxs(D0,{children:[d.jsx(O0,{asChild:!0,children:d.jsxs(Dt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand-text font-display gap-1",onClick:C,children:[d.jsx(Pa,{className:"h-3 w-3"}),G("acp.newSession")]})}),d.jsx(L0,{children:"New Thread"})]})]}),d.jsx(nx,{onSubmit:Y,isLoading:r,onInterrupt:S,disabled:!a,placeholder:G(a?"acp.inputPlaceholder":"acp.waitingPlaceholder"),supportsAttachments:O,commands:_.length>0?_:void 0,queueWhileLoading:!0})]})]})}function My(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ny({client:e,agentId:t}){nn();const[n,s]=p.useState(!1),r=p.useCallback(async o=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:o.sessionId,cwd:o.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:o.sessionId,cwd:o.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return d.jsxs("div",{className:"flex h-full w-full",children:[d.jsxs("div",{className:Q("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&d.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:G("acp.sessions")}),d.jsxs("div",{className:Q("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&d.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:G("acp.newSession"),children:d.jsx(Pa,{className:"h-4 w-4"})}),d.jsx("button",{type:"button",onClick:()=>s(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?d.jsx(Cu,{className:"h-4 w-4"}):d.jsx(wu,{className:"h-4 w-4"})})]})]}),!n&&d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(jy,{client:e,onSelectSession:r})})]}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d.jsx(Ry,{client:e,agentId:t})})]})}function jy({client:e,onSelectSession:t}){const[n,s]=p.useState([]),[r,o]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[u,h]=p.useState(!0),b=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){o(!1);return}o(!0);try{const _=await e.listSessions();s(_.sessions)}catch(_){console.warn("[SidebarSessionList] Failed to load:",_)}finally{o(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const _=g=>{g==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(_),()=>e.removeConnectionStateHandler(_)},[e,v]),p.useEffect(()=>{const _=setInterval(v,1e4);return()=>clearInterval(_)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(_=>{v()}),e.setSessionRenamedHandler((_,g)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(_=>{/Method not found/i.test(_)&&/session\/(rename|delete)/i.test(_)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&b.current&&(b.current.focus(),b.current.select())},[m]);const w=p.useCallback(_=>{const g=_.title&&_.title.trim()?_.title:_.sessionId.slice(0,8);if(window.confirm(Se("acp.confirmDelete",{label:g})))try{e.deleteSession(_.sessionId),s(x=>x.filter(M=>M.sessionId!==_.sessionId)),a===_.sessionId&&i(null)}catch(x){console.error("[SidebarSessionList] delete failed:",x)}},[e,a]),y=p.useCallback(_=>{f(_.sessionId),c(_.title&&_.title.trim()?_.title:"")},[]),T=p.useCallback(()=>{if(!m)return;const _=l.trim();if(!_){f(null);return}try{e.renameSession(m,_),s(g=>g.map(x=>x.sessionId===m?{...x,title:_}:x))}catch(g){console.error("[SidebarSessionList] rename failed:",g)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),k=p.useCallback(_=>{_.key==="Enter"?(_.preventDefault(),T()):_.key==="Escape"&&(_.preventDefault(),A())},[T,A]),O=p.useMemo(()=>[...n].sort((_,g)=>{const x=_.updatedAt?new Date(_.updatedAt).getTime():0;return(g.updatedAt?new Date(g.updatedAt).getTime():0)-x}),[n]);if(r&&n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:G("common.loading")})});if(n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:G("acp.emptySessions")})});const E=Py(O);return d.jsx("nav",{className:"py-1","aria-label":G("acp.historyNav"),children:E.map((_,g)=>d.jsxs("div",{children:[g>0&&d.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),d.jsx("div",{className:"px-4 py-2",children:d.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:_.label})}),_.sessions.map(x=>{const M=m===x.sessionId;return d.jsxs("div",{className:Q("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",x.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[d.jsx(gu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),M?d.jsx("input",{ref:b,type:"text",value:l,onChange:I=>c(I.target.value),onKeyDown:k,onBlur:T,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-sm font-display text-text-primary outline-none focus:border-brand",onClick:I=>I.stopPropagation()}):d.jsx("button",{type:"button",onClick:()=>{i(x.sessionId),t(x)},className:"flex-1 min-w-0 text-left",title:x.title||x.sessionId,children:d.jsx("span",{className:"text-sm font-display truncate leading-snug block",children:x.title&&x.title.trim()?x.title:G("acp.newSession")})}),M?d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[d.jsx("button",{type:"button",onClick:T,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:G("acp.confirm"),children:d.jsx(hn,{className:"h-3.5 w-3.5"})}),d.jsx("button",{type:"button",onClick:A,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:G("common.cancel"),children:d.jsx(bn,{className:"h-3.5 w-3.5"})})]}):d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:u?void 0:G("acp.noSessionManagement"),children:[d.jsx("button",{type:"button",disabled:!u,onClick:I=>{I.stopPropagation(),u&&y(x)},className:Q("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-brand-text hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:G(u?"acp.rename":"acp.renameUnsupported"),children:d.jsx(ja,{className:"h-3 w-3"})}),d.jsx("button",{type:"button",disabled:!u,onClick:I=>{I.stopPropagation(),u&&w(x)},className:Q("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:G(u?"acp.delete":"acp.deleteUnsupported"),children:d.jsx(Hu,{className:"h-3 w-3"})})]})]},x.sessionId)})]},_.label))})}function Py(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),s=new Date(n.getTime()-864e5),r=[{label:G("resume.today"),sessions:[]},{label:G("resume.yesterday"),sessions:[]},{label:G("resume.earlier"),sessions:[]}];for(const o of e){const a=o.updatedAt?new Date(o.updatedAt):new Date(0);a>=n?r[0].sessions.push(o):a>=s?r[1].sessions.push(o):r[2].sessions.push(o)}return r.filter(o=>o.sessions.length>0)}function Iy({url:e,token:t,onBack:n}){const[s,r]=p.useState(null),[o,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new es({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,u)=>{a(c),m(u||null)}),f.current=l,r(l),l.connect().catch(c=>{c instanceof ll||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&o==="error"&&d.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,d.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),o==="connecting"&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),d.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),o==="error"&&!s&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),d.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),d.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),s&&o==="connected"&&d.jsx(Ny,{client:s})]})}const ds="rcs_admin_key";function Dy(){try{return localStorage.getItem(ds)}catch{return null}}function Oy(){const[e,t]=p.useState(Dy),n=p.useCallback(s=>{const r=s.trim();t(r||null);try{r?localStorage.setItem(ds,r):localStorage.removeItem(ds)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const oa=p.lazy(()=>Ne(()=>import("./Dashboard-DNk4dBkp.js"),__vite__mapDeps([4,2,5,6,7,8,1,9])).then(e=>({default:e.Dashboard}))),Ly=p.lazy(()=>Ne(()=>import("./SessionDetail-Czr-xzEy.js"),__vite__mapDeps([10,2,6,8,11,12,13,14,7,15,1,9,16])).then(e=>({default:e.SessionDetail}))),Fy=p.lazy(()=>Ne(()=>import("./ShareLanding-DzIeZduO.js"),__vite__mapDeps([17,2,1,9])).then(e=>({default:e.ShareLanding}))),aa=p.lazy(()=>Ne(()=>import("./ArtifactsGallery-CMBl4_tW.js").then(e=>e.a),__vite__mapDeps([14,2,8,13])).then(e=>({default:e.ArtifactsGallery}))),$y=p.lazy(()=>Ne(()=>import("./ArtifactView-CaZ6Bn-5.js"),__vite__mapDeps([18,2,14,8,13,11,1,9])).then(e=>({default:e.ArtifactView}))),Uy=p.lazy(()=>Ne(()=>import("./MemoriesGallery-BZi7L7O1.js"),__vite__mapDeps([15,2,8,1,9])).then(e=>({default:e.MemoriesGallery}))),zy=p.lazy(()=>Ne(()=>import("./Claim-BZ03VZxd.js"),__vite__mapDeps([19,2,1,9])).then(e=>({default:e.Claim}))),Hy=p.lazy(()=>Ne(()=>import("./Login-DypP2NZb.js"),__vite__mapDeps([20,2,1,9])).then(e=>({default:e.Login}))),By=p.lazy(()=>Ne(()=>import("./Register-BF2mhSpw.js"),__vite__mapDeps([21,2,1,9])).then(e=>({default:e.Register}))),Wy=p.lazy(()=>Ne(()=>import("./Setup-CVwnJSHR.js"),__vite__mapDeps([22,2,1,9])).then(e=>({default:e.Setup}))),Gy=p.lazy(()=>Ne(()=>import("./Join-CL9s-HWG.js"),__vite__mapDeps([23,2,1,9])).then(e=>({default:e.Join}))),Vy=p.lazy(()=>Ne(()=>import("./UserSettings-CXKAmil9.js"),__vite__mapDeps([24,2,16,13,1,9])).then(e=>({default:e.UserSettings}))),qy=p.lazy(()=>Ne(()=>import("./TeamList-wAXXbAI0.js"),__vite__mapDeps([25,2,8,1,9])).then(e=>({default:e.TeamList}))),Ky=p.lazy(()=>Ne(()=>import("./TeamDetail-Bx5Dwc5B.js"),__vite__mapDeps([26,2,5,6,12,13,1,9])).then(e=>({default:e.TeamDetail}))),Yy=p.lazy(()=>Ne(()=>import("./TeamSettings-BH6epZ5p.js"),__vite__mapDeps([27,2,1,9])).then(e=>({default:e.TeamSettings}))),Xy=p.lazy(()=>Ne(()=>import("./AdminPanel-CoSNNH8v.js"),__vite__mapDeps([28,2,1,9])).then(e=>({default:e.AdminPanel}))),Qy=new Set(["login","register","setup","join","share"]),Jy=new Set(["login","register","setup","join"]);function Zy(){return d.jsx(Xu,{defaultTheme:"system",children:d.jsx(Zh,{children:d.jsx(ev,{})})})}function ev(){const[e,t]=p.useState("dashboard"),[n,s]=p.useState(null),[r,o]=p.useState(null),[a,i]=p.useState(null),[m,f]=p.useState(null),{adminKey:l}=Oy(),{user:c,isLoading:u,checkSetupStatus:h}=il();p.useEffect(()=>{zh(l)},[l]);const[b,v]=p.useState(!1);p.useEffect(()=>{!u&&!c?h().then(v):c&&v(!1)},[u,c,h]);const w=p.useCallback(()=>{const x=window.location.pathname,M=new URLSearchParams(window.location.search);if(M.get("acp")==="1"){const P=sessionStorage.getItem("acp_connection");if(P)try{const U=JSON.parse(P);if(U.url&&U.token){f({url:U.url,token:U.token}),sessionStorage.removeItem("acp_connection");const Y=new URL(window.location.href);Y.searchParams.delete("acp"),window.history.replaceState(null,"",Y),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const D=M.get("sid");if(D){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${D}`),s(D),i(null),t("session");return}if(x==="/login"){t("login");return}if(x==="/register"){t("register");return}if(x==="/setup"){t("setup");return}if(x==="/join"){t("join");return}if(x==="/settings"){t("settings");return}if(x==="/admin"){t("admin");return}if(x.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(x.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(x==="/teams"){t("teams");return}const z=x.match(/^\/code\/s\/([^/]+)/);if(z&&z[1]){i(z[1]),s(null),t("share");return}const C=x.match(/^\/code\/a\/([^/]+)/);if(C&&C[1]){o(C[1]),s(null),i(null),t("artifact-view");return}if(x==="/code/artifacts"||x==="/code/artifacts/"){o(null),s(null),i(null),t("artifacts");return}if(x==="/code/memories"||x==="/code/memories/"){o(null),s(null),i(null),t("memories");return}const S=x.match(/^\/code\/claim\/([^/]+)/);if(S&&S[1]){t("claim");return}const H=x.match(/^\/code\/([^/]+)/);H&&H[1]?(s(H[1]),i(null),t("session")):(s(null),i(null),t("dashboard"))},[]);p.useEffect(()=>(w(),window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)),[w]);const y=p.useCallback(x=>{window.history.pushState(null,"",`/code/${x}`),s(x),i(null),o(null),t("session")},[]),T=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),o(null),s(null),i(null),t("artifacts")},[]),A=p.useCallback(()=>{window.history.pushState(null,"","/code/memories"),o(null),s(null),i(null),t("memories")},[]),k=p.useCallback(()=>{window.history.pushState(null,"","/code/"),s(null),i(null),o(null),f(null),t("dashboard")},[]),O=(()=>{let x=e;return u||(b&&x!=="setup"&&x!=="join"&&(x="setup"),!c&&!Qy.has(x)&&(x="login"),c&&(x==="login"||x==="setup")&&(x="dashboard")),x})();if(p.useEffect(()=>{u||(O==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):O==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):O==="dashboard"&&c&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[O,c,u]),u)return d.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const E=()=>{if(m&&O==="acp")return d.jsx(Iy,{url:m.url,token:m.token,onBack:k});switch(O){case"login":return d.jsx(Hy,{onSuccess:k,onNavigateRegister:()=>t("register")});case"register":return d.jsx(By,{onSuccess:k,onBack:()=>t("login")});case"setup":return d.jsx(Wy,{onSuccess:k,onAlreadyDone:k});case"join":return d.jsx(Gy,{onSuccess:k,onInvalidInvite:k});case"settings":return d.jsx(Vy,{});case"teams":return d.jsx(qy,{});case"team-detail":return d.jsx(Ky,{});case"team-settings":return d.jsx(Yy,{});case"admin":return(c==null?void 0:c.role)!=="admin"?d.jsx("div",{className:"flex flex-1 items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),d.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:G("nav.dashboard")})]})}):d.jsx(Xy,{});case"share":return d.jsx(Fy,{});case"claim":return d.jsx(zy,{});case"artifacts":return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(aa,{})});case"artifact-view":return r?d.jsx($y,{artifactId:r,onBack:T}):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(aa,{})});case"memories":return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Uy,{})});case"session":return n?d.jsx(Ly,{sessionId:n,onBack:k},n):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(oa,{onNavigateSession:y})});default:return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(oa,{onNavigateSession:y})})}},_=!Jy.has(O)&&O!=="session",g=O==="artifact-view";return d.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[_&&d.jsx(tg,{sessionTitle:m?"ACP":void 0,sessionSource:m?"acp":void 0,onBack:m||a?k:void 0,onNavigateArtifacts:g?void 0:T,onNavigateMemories:A}),d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:E()})]})}xy();zc.createRoot(document.getElementById("root")).render(d.jsx(p.StrictMode,{children:d.jsx(Zy,{})}));export{Jv as $,es as A,_a as B,nx as C,pb as D,Ou as E,ou as F,Ia as G,Fu as H,nw as I,ow as J,I0 as K,Ma as L,Hs as M,Hu as N,Gx as O,ja as P,eg as Q,Bx as R,Ru as S,Dh as T,Oa as U,qu as V,ae as W,bn as X,Dv as Y,Av as Z,Fv as _,Ny as a,nn as a$,Hv as a0,_v as a1,Nv as a2,$v as a3,Xv as a4,Wv as a5,Ev as a6,hv as a7,Lv as a8,Ov as a9,Bv as aA,Yv as aB,fa as aC,Q as aD,by as aE,le as aF,Rt as aG,Id as aH,lb as aI,ov as aJ,lv as aK,mv as aL,$n as aM,dv as aN,av as aO,cv as aP,iw as aQ,rw as aR,fv as aS,G as aT,Se as aU,ib as aV,iv as aW,Ey as aX,Hh as aY,Pd as aZ,il as a_,yv as aa,tw as ab,Kv as ac,qv as ad,Vv as ae,Uv as af,zv as ag,gv as ah,bv as ai,xv as aj,pv as ak,kv as al,Mv as am,Qv as an,Gv as ao,ew as ap,Tv as aq,Rv as ar,jv as as,Sv as at,Zv as au,vv as av,Cv as aw,wv as ax,Pv as ay,Iv as az,_r as b,Yh as b0,$h as c,Wb as d,hn as e,gn as f,Ra as g,tu as h,ru as i,aw as j,Vx as k,ll as l,tl as m,rl as n,Ln as o,Ph as p,Po as q,nl as r,py as s,Pa as t,lc as u,dc as v,cc as w,Wx as x,Nu as y,Pu as z};