termdock 1.4.285 → 1.4.286

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 (329) hide show
  1. package/.desktop-dist/main.js +10 -553
  2. package/README.md +2 -4
  3. package/dist/client/assets/{App--hZmWk-u.js → App-qs0jye8B.js} +29 -28
  4. package/dist/client/assets/App-qs0jye8B.js.br +0 -0
  5. package/dist/client/assets/App-qs0jye8B.js.gz +0 -0
  6. package/dist/client/assets/{ChangeWalkthroughPanel-BQ1hdwzt.js → ChangeWalkthroughPanel-X-M6nxKJ.js} +1 -1
  7. package/dist/client/assets/ChangeWalkthroughPanel-X-M6nxKJ.js.br +0 -0
  8. package/dist/client/assets/ChangeWalkthroughPanel-X-M6nxKJ.js.gz +0 -0
  9. package/dist/client/assets/{DagPlayground-BERXHwib.js → DagPlayground-DgiUaUkH.js} +1 -1
  10. package/dist/client/assets/DagPlayground-DgiUaUkH.js.br +0 -0
  11. package/dist/client/assets/DagPlayground-DgiUaUkH.js.gz +0 -0
  12. package/dist/client/assets/{DiffLab-DF14_TAz.js → DiffLab-u8njwj0d.js} +1 -1
  13. package/dist/client/assets/DiffLab-u8njwj0d.js.br +0 -0
  14. package/dist/client/assets/DiffLab-u8njwj0d.js.gz +0 -0
  15. package/dist/client/assets/{DiffReview-BQcIn0zl.js → DiffReview-DoQY-klj.js} +1 -1
  16. package/dist/client/assets/DiffReview-DoQY-klj.js.br +0 -0
  17. package/dist/client/assets/DiffReview-DoQY-klj.js.gz +0 -0
  18. package/dist/client/assets/{DiffReviewLab-CgChwzQr.js → DiffReviewLab-DlKbMbfq.js} +1 -1
  19. package/dist/client/assets/DiffReviewLab-DlKbMbfq.js.br +0 -0
  20. package/dist/client/assets/DiffReviewLab-DlKbMbfq.js.gz +0 -0
  21. package/dist/client/assets/{DiffViewer-hDpe-wvG.js → DiffViewer-nlvDqGPJ.js} +1 -1
  22. package/dist/client/assets/DiffViewer-nlvDqGPJ.js.br +0 -0
  23. package/dist/client/assets/DiffViewer-nlvDqGPJ.js.gz +0 -0
  24. package/dist/client/assets/{ModelPreview-vg3vRIhx.js → ModelPreview-C3beTH3N.js} +1 -1
  25. package/dist/client/assets/ModelPreview-C3beTH3N.js.br +0 -0
  26. package/dist/client/assets/ModelPreview-C3beTH3N.js.gz +0 -0
  27. package/dist/client/assets/{RightSidebar-5H4vhn3k.js → RightSidebar-BtktcUdh.js} +5 -5
  28. package/dist/client/assets/RightSidebar-BtktcUdh.js.br +0 -0
  29. package/dist/client/assets/RightSidebar-BtktcUdh.js.gz +0 -0
  30. package/dist/client/assets/{abnfDiagram-VCTEODGH-DI7938HB.js → abnfDiagram-VCTEODGH-7J_hDjG2.js} +1 -1
  31. package/dist/client/assets/abnfDiagram-VCTEODGH-7J_hDjG2.js.br +0 -0
  32. package/dist/client/assets/abnfDiagram-VCTEODGH-7J_hDjG2.js.gz +0 -0
  33. package/dist/client/assets/{app-BeVXUQb-.js → app-CHKqaWIE.js} +7 -7
  34. package/dist/client/assets/app-CHKqaWIE.js.br +0 -0
  35. package/dist/client/assets/app-CHKqaWIE.js.gz +0 -0
  36. package/dist/client/assets/{arc-D4qDm5Yn.js → arc-Bg_CuCZm.js} +1 -1
  37. package/dist/client/assets/arc-Bg_CuCZm.js.br +0 -0
  38. package/dist/client/assets/arc-Bg_CuCZm.js.gz +0 -0
  39. package/dist/client/assets/{architectureDiagram-5GKGNRK7-C4IZCNC9.js → architectureDiagram-5GKGNRK7-CsSHwySz.js} +1 -1
  40. package/dist/client/assets/architectureDiagram-5GKGNRK7-CsSHwySz.js.br +0 -0
  41. package/dist/client/assets/architectureDiagram-5GKGNRK7-CsSHwySz.js.gz +0 -0
  42. package/dist/client/assets/{blockDiagram-I7D4REHJ-DHVOr_jQ.js → blockDiagram-I7D4REHJ-DePM_hkV.js} +1 -1
  43. package/dist/client/assets/blockDiagram-I7D4REHJ-DePM_hkV.js.br +0 -0
  44. package/dist/client/assets/blockDiagram-I7D4REHJ-DePM_hkV.js.gz +0 -0
  45. package/dist/client/assets/{c4Diagram-7LVT6UL2-kQqkOkIe.js → c4Diagram-7LVT6UL2-BQ8B9h53.js} +1 -1
  46. package/dist/client/assets/c4Diagram-7LVT6UL2-BQ8B9h53.js.br +0 -0
  47. package/dist/client/assets/c4Diagram-7LVT6UL2-BQ8B9h53.js.gz +0 -0
  48. package/dist/client/assets/channel-8p7Zocq1.js +1 -0
  49. package/dist/client/assets/{chunk-2Q5K7J3B-D2kOR60I.js → chunk-2Q5K7J3B-Bo9Nc-d4.js} +1 -1
  50. package/dist/client/assets/{chunk-5VM5RSS4-CxaDg0nL.js → chunk-5VM5RSS4-D_qQp7an.js} +1 -1
  51. package/dist/client/assets/{chunk-F27PBJKO-Bxf7XPNj.js → chunk-F27PBJKO-CJvGLWuF.js} +1 -1
  52. package/dist/client/assets/chunk-F27PBJKO-CJvGLWuF.js.br +0 -0
  53. package/dist/client/assets/chunk-F27PBJKO-CJvGLWuF.js.gz +0 -0
  54. package/dist/client/assets/{chunk-IMKFNOWR-BTifpaB5.js → chunk-IMKFNOWR-e4fa23mF.js} +1 -1
  55. package/dist/client/assets/chunk-IMKFNOWR-e4fa23mF.js.br +0 -0
  56. package/dist/client/assets/chunk-IMKFNOWR-e4fa23mF.js.gz +0 -0
  57. package/dist/client/assets/{chunk-JWPE2WC7-Deieql_u.js → chunk-JWPE2WC7-D9qVRvQs.js} +1 -1
  58. package/dist/client/assets/{chunk-POPQ4Y6H-CqZwUpjK.js → chunk-POPQ4Y6H-7eOizLll.js} +1 -1
  59. package/dist/client/assets/{chunk-SVP7TREG-Bm1spPMb.js → chunk-SVP7TREG-Co1wDBYI.js} +1 -1
  60. package/dist/client/assets/chunk-SVP7TREG-Co1wDBYI.js.br +0 -0
  61. package/dist/client/assets/chunk-SVP7TREG-Co1wDBYI.js.gz +0 -0
  62. package/dist/client/assets/{chunk-TICWLB2K-BGLj-zGP.js → chunk-TICWLB2K-yKjTtLNf.js} +1 -1
  63. package/dist/client/assets/chunk-TICWLB2K-yKjTtLNf.js.br +0 -0
  64. package/dist/client/assets/chunk-TICWLB2K-yKjTtLNf.js.gz +0 -0
  65. package/dist/client/assets/{chunk-XXDRQBXY-CR77bUfc.js → chunk-XXDRQBXY-DDFq5Eoi.js} +1 -1
  66. package/dist/client/assets/classDiagram-ZZMXUADV-DM8VyUpP.js +1 -0
  67. package/dist/client/assets/classDiagram-v2-VYDZK3BY-DM8VyUpP.js +1 -0
  68. package/dist/client/assets/{cose-bilkent-JH36ORCC-GTawhnoV.js → cose-bilkent-JH36ORCC-Ng2b-szu.js} +1 -1
  69. package/dist/client/assets/cose-bilkent-JH36ORCC-Ng2b-szu.js.br +0 -0
  70. package/dist/client/assets/cose-bilkent-JH36ORCC-Ng2b-szu.js.gz +0 -0
  71. package/dist/client/assets/{cynefin-OW5HDTMX-DHdRkQdW.js → cynefin-OW5HDTMX-BUzoxsoE.js} +1 -1
  72. package/dist/client/assets/cynefin-OW5HDTMX-BUzoxsoE.js.br +0 -0
  73. package/dist/client/assets/cynefin-OW5HDTMX-BUzoxsoE.js.gz +0 -0
  74. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Cj2ytLun.js → cynefinDiagram-5FMLGOSQ-9sKimYPk.js} +1 -1
  75. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-9sKimYPk.js.br +0 -0
  76. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-9sKimYPk.js.gz +0 -0
  77. package/dist/client/assets/{dagre-GXQ25YYZ-BdFZmtIj.js → dagre-GXQ25YYZ-C6GZ4pYU.js} +1 -1
  78. package/dist/client/assets/dagre-GXQ25YYZ-C6GZ4pYU.js.br +0 -0
  79. package/dist/client/assets/dagre-GXQ25YYZ-C6GZ4pYU.js.gz +0 -0
  80. package/dist/client/assets/{diagram-S7CK7UJ4-D5WQNuKI.js → diagram-S7CK7UJ4-DHewWm_2.js} +1 -1
  81. package/dist/client/assets/diagram-S7CK7UJ4-DHewWm_2.js.br +0 -0
  82. package/dist/client/assets/diagram-S7CK7UJ4-DHewWm_2.js.gz +0 -0
  83. package/dist/client/assets/{diagram-UQ7AKVKN-ChwjfMce.js → diagram-UQ7AKVKN-BU-Qm_iS.js} +1 -1
  84. package/dist/client/assets/diagram-UQ7AKVKN-BU-Qm_iS.js.br +0 -0
  85. package/dist/client/assets/diagram-UQ7AKVKN-BU-Qm_iS.js.gz +0 -0
  86. package/dist/client/assets/{diagram-VSXAHHWV-DT4FET5f.js → diagram-VSXAHHWV-DEvxj92u.js} +1 -1
  87. package/dist/client/assets/diagram-VSXAHHWV-DEvxj92u.js.br +0 -0
  88. package/dist/client/assets/diagram-VSXAHHWV-DEvxj92u.js.gz +0 -0
  89. package/dist/client/assets/{diagram-VX7I27RA-BLJsAGx6.js → diagram-VX7I27RA-DwwnVInb.js} +1 -1
  90. package/dist/client/assets/diagram-VX7I27RA-DwwnVInb.js.br +0 -0
  91. package/dist/client/assets/diagram-VX7I27RA-DwwnVInb.js.gz +0 -0
  92. package/dist/client/assets/{diagram-Z3DM3KII-C1ofLllK.js → diagram-Z3DM3KII-DDhqqeca.js} +1 -1
  93. package/dist/client/assets/diagram-Z3DM3KII-DDhqqeca.js.br +0 -0
  94. package/dist/client/assets/diagram-Z3DM3KII-DDhqqeca.js.gz +0 -0
  95. package/dist/client/assets/{ebnfDiagram-PWID7BFC-apxDEeqe.js → ebnfDiagram-PWID7BFC-CQz2BRgT.js} +1 -1
  96. package/dist/client/assets/ebnfDiagram-PWID7BFC-CQz2BRgT.js.br +0 -0
  97. package/dist/client/assets/ebnfDiagram-PWID7BFC-CQz2BRgT.js.gz +0 -0
  98. package/dist/client/assets/{erDiagram-RLTQ6QDP-Dq9hBYpH.js → erDiagram-RLTQ6QDP-D2eLjKEA.js} +1 -1
  99. package/dist/client/assets/erDiagram-RLTQ6QDP-D2eLjKEA.js.br +0 -0
  100. package/dist/client/assets/erDiagram-RLTQ6QDP-D2eLjKEA.js.gz +0 -0
  101. package/dist/client/assets/{flowDiagram-HODETNUW-Juk-Qv9f.js → flowDiagram-HODETNUW-B7oJq5P3.js} +1 -1
  102. package/dist/client/assets/flowDiagram-HODETNUW-B7oJq5P3.js.br +0 -0
  103. package/dist/client/assets/flowDiagram-HODETNUW-B7oJq5P3.js.gz +0 -0
  104. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-mmwd0mxs.js → ganttDiagram-EL5Y4UJY-BUA_LsMw.js} +1 -1
  105. package/dist/client/assets/ganttDiagram-EL5Y4UJY-BUA_LsMw.js.br +0 -0
  106. package/dist/client/assets/ganttDiagram-EL5Y4UJY-BUA_LsMw.js.gz +0 -0
  107. package/dist/client/assets/{gestureArbiter-CM_xJnCS.js → gestureArbiter-8VtxF9dg.js} +1 -1
  108. package/dist/client/assets/gestureArbiter-8VtxF9dg.js.br +0 -0
  109. package/dist/client/assets/gestureArbiter-8VtxF9dg.js.gz +0 -0
  110. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX--UL7HV4P.js → gitGraphDiagram-WWUBYQGX-BlbsPdki.js} +1 -1
  111. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BlbsPdki.js.br +0 -0
  112. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BlbsPdki.js.gz +0 -0
  113. package/dist/client/assets/{index-pZsldTFS.css → index-DUCUcxTy.css} +1 -1
  114. package/dist/client/assets/index-DUCUcxTy.css.br +0 -0
  115. package/dist/client/assets/{index-pZsldTFS.css.gz → index-DUCUcxTy.css.gz} +0 -0
  116. package/dist/client/assets/{infoDiagram-27XIBGKW-CcsxyqYJ.js → infoDiagram-27XIBGKW-DdYvRIDS.js} +1 -1
  117. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-CNVFPx1_.js → ishikawaDiagram-5VMMS53U-CZbBbDjz.js} +1 -1
  118. package/dist/client/assets/ishikawaDiagram-5VMMS53U-CZbBbDjz.js.br +0 -0
  119. package/dist/client/assets/ishikawaDiagram-5VMMS53U-CZbBbDjz.js.gz +0 -0
  120. package/dist/client/assets/{journeyDiagram-3NMN7TZE-BtIuJLUp.js → journeyDiagram-3NMN7TZE-DtxlqtaG.js} +1 -1
  121. package/dist/client/assets/journeyDiagram-3NMN7TZE-DtxlqtaG.js.br +0 -0
  122. package/dist/client/assets/journeyDiagram-3NMN7TZE-DtxlqtaG.js.gz +0 -0
  123. package/dist/client/assets/{kanban-definition-UXKFOSKX-gOFjuFZV.js → kanban-definition-UXKFOSKX-UMDV9UCG.js} +1 -1
  124. package/dist/client/assets/kanban-definition-UXKFOSKX-UMDV9UCG.js.br +0 -0
  125. package/dist/client/assets/kanban-definition-UXKFOSKX-UMDV9UCG.js.gz +0 -0
  126. package/dist/client/assets/{layout-KEP24zEE.js → layout-CAAXci79.js} +1 -1
  127. package/dist/client/assets/layout-CAAXci79.js.br +0 -0
  128. package/dist/client/assets/layout-CAAXci79.js.gz +0 -0
  129. package/dist/client/assets/{linear-BwUXWDLn.js → linear-BGBP_FE_.js} +1 -1
  130. package/dist/client/assets/linear-BGBP_FE_.js.br +0 -0
  131. package/dist/client/assets/linear-BGBP_FE_.js.gz +0 -0
  132. package/dist/client/assets/{mermaid.core-DkzJYwWa.js → mermaid.core-BH_WDKpZ.js} +5 -5
  133. package/dist/client/assets/mermaid.core-BH_WDKpZ.js.br +0 -0
  134. package/dist/client/assets/mermaid.core-BH_WDKpZ.js.gz +0 -0
  135. package/dist/client/assets/{mindmap-definition-YA3MSWOX-BE1H8WPd.js → mindmap-definition-YA3MSWOX-7yyx6kg5.js} +1 -1
  136. package/dist/client/assets/mindmap-definition-YA3MSWOX-7yyx6kg5.js.br +0 -0
  137. package/dist/client/assets/mindmap-definition-YA3MSWOX-7yyx6kg5.js.gz +0 -0
  138. package/dist/client/assets/{passwordBootstrap-Dhzj9-U2.js → passwordBootstrap-Dt3dN800.js} +1 -1
  139. package/dist/client/assets/passwordBootstrap-Dt3dN800.js.br +0 -0
  140. package/dist/client/assets/passwordBootstrap-Dt3dN800.js.gz +0 -0
  141. package/dist/client/assets/{pegDiagram-XKGWAZYB-CorBwvfP.js → pegDiagram-XKGWAZYB-D254I9Yl.js} +1 -1
  142. package/dist/client/assets/pegDiagram-XKGWAZYB-D254I9Yl.js.br +0 -0
  143. package/dist/client/assets/pegDiagram-XKGWAZYB-D254I9Yl.js.gz +0 -0
  144. package/dist/client/assets/{pieDiagram-E7YTZNPT-A017Uk-W.js → pieDiagram-E7YTZNPT-DTy-4KXi.js} +1 -1
  145. package/dist/client/assets/pieDiagram-E7YTZNPT-DTy-4KXi.js.br +0 -0
  146. package/dist/client/assets/pieDiagram-E7YTZNPT-DTy-4KXi.js.gz +0 -0
  147. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-CNNywvhG.js → quadrantDiagram-AXDQQJYC-BMsaHxl0.js} +1 -1
  148. package/dist/client/assets/quadrantDiagram-AXDQQJYC-BMsaHxl0.js.br +0 -0
  149. package/dist/client/assets/quadrantDiagram-AXDQQJYC-BMsaHxl0.js.gz +0 -0
  150. package/dist/client/assets/{railroadDiagram-O6MQD6OU-DIxiWn5A.js → railroadDiagram-O6MQD6OU-D4c39AAQ.js} +1 -1
  151. package/dist/client/assets/railroadDiagram-O6MQD6OU-D4c39AAQ.js.br +0 -0
  152. package/dist/client/assets/railroadDiagram-O6MQD6OU-D4c39AAQ.js.gz +0 -0
  153. package/dist/client/assets/{referenceLongPress-Bp8q50sv.js → referenceLongPress-TTIbwCKV.js} +1 -1
  154. package/dist/client/assets/referenceLongPress-TTIbwCKV.js.br +0 -0
  155. package/dist/client/assets/referenceLongPress-TTIbwCKV.js.gz +0 -0
  156. package/dist/client/assets/{requirementDiagram-BXWQKSXE-Ob4lS23U.js → requirementDiagram-BXWQKSXE-CwJjBKnR.js} +1 -1
  157. package/dist/client/assets/requirementDiagram-BXWQKSXE-CwJjBKnR.js.br +0 -0
  158. package/dist/client/assets/requirementDiagram-BXWQKSXE-CwJjBKnR.js.gz +0 -0
  159. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-Cc5e7umb.js → sankeyDiagram-P5KCCOFB-DVlRBDMK.js} +1 -1
  160. package/dist/client/assets/sankeyDiagram-P5KCCOFB-DVlRBDMK.js.br +0 -0
  161. package/dist/client/assets/sankeyDiagram-P5KCCOFB-DVlRBDMK.js.gz +0 -0
  162. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-CLTRKFht.js → sequenceDiagram-WJ2MYXX4-BsWqKeoD.js} +1 -1
  163. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BsWqKeoD.js.br +0 -0
  164. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BsWqKeoD.js.gz +0 -0
  165. package/dist/client/assets/{sizeCapture-INFHLROL-h6hFhQw6.js → sizeCapture-INFHLROL-1FEOsRFT.js} +1 -1
  166. package/dist/client/assets/sizeCapture-INFHLROL-1FEOsRFT.js.br +0 -0
  167. package/dist/client/assets/sizeCapture-INFHLROL-1FEOsRFT.js.gz +0 -0
  168. package/dist/client/assets/{sparkles-9OJtJfyK.js → sparkles-hN4VSTDx.js} +1 -1
  169. package/dist/client/assets/{stateDiagram-D77RDMKH-DSaJxX_r.js → stateDiagram-D77RDMKH-DWNE48Sc.js} +1 -1
  170. package/dist/client/assets/stateDiagram-D77RDMKH-DWNE48Sc.js.br +0 -0
  171. package/dist/client/assets/stateDiagram-D77RDMKH-DWNE48Sc.js.gz +0 -0
  172. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BMprFuVB.js +1 -0
  173. package/dist/client/assets/{swimlanes-42K2YHIH-CP7ABWyE.js → swimlanes-42K2YHIH-ghhxa8QM.js} +1 -1
  174. package/dist/client/assets/swimlanes-42K2YHIH-ghhxa8QM.js.br +0 -0
  175. package/dist/client/assets/swimlanes-42K2YHIH-ghhxa8QM.js.gz +0 -0
  176. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Dg4tYXGL.js +8 -0
  177. package/dist/client/assets/{timeline-definition-24CTP7MA-CdwVIVF6.js → timeline-definition-24CTP7MA-B0eZfCze.js} +1 -1
  178. package/dist/client/assets/timeline-definition-24CTP7MA-B0eZfCze.js.br +0 -0
  179. package/dist/client/assets/timeline-definition-24CTP7MA-B0eZfCze.js.gz +0 -0
  180. package/dist/client/assets/{triangle-alert-BvT4KSYf.js → triangle-alert-zb36qQ-j.js} +1 -1
  181. package/dist/client/assets/{vennDiagram-4TSXK5OY-BXGgQFVY.js → vennDiagram-4TSXK5OY-DCdV0A4l.js} +1 -1
  182. package/dist/client/assets/vennDiagram-4TSXK5OY-DCdV0A4l.js.br +0 -0
  183. package/dist/client/assets/vennDiagram-4TSXK5OY-DCdV0A4l.js.gz +0 -0
  184. package/dist/client/assets/{videoCompression-BFXJyhpz.js → videoCompression-BzT-9eWg.js} +1 -1
  185. package/dist/client/assets/videoCompression-BzT-9eWg.js.br +0 -0
  186. package/dist/client/assets/videoCompression-BzT-9eWg.js.gz +0 -0
  187. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CtLophqU.js → wardleyDiagram-VM6X3IG4-BQvk-8b6.js} +1 -1
  188. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BQvk-8b6.js.br +0 -0
  189. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BQvk-8b6.js.gz +0 -0
  190. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-YZ9bnI1e.js → xychartDiagram-S5SC5T6Z-D1VdK6g5.js} +1 -1
  191. package/dist/client/assets/xychartDiagram-S5SC5T6Z-D1VdK6g5.js.br +0 -0
  192. package/dist/client/assets/xychartDiagram-S5SC5T6Z-D1VdK6g5.js.gz +0 -0
  193. package/dist/client/index.html +2 -2
  194. package/dist/client/index.html.br +0 -0
  195. package/dist/client/index.html.gz +0 -0
  196. package/dist/client/sw.js +1 -1
  197. package/dist/client/sw.js.br +0 -0
  198. package/dist/client/sw.js.gz +0 -0
  199. package/dist/server/entry.js +2 -6
  200. package/dist/server/routes/terminal.js +4 -22
  201. package/dist/server/utils/enableSupervision.js +2 -3
  202. package/dist/server/utils/runtimeClient.js +0 -32
  203. package/package.json +3 -3
  204. package/runtime-manifest.json +3 -3
  205. package/scripts/classify-release.mjs +0 -1
  206. package/dist/client/assets/App--hZmWk-u.js.br +0 -0
  207. package/dist/client/assets/App--hZmWk-u.js.gz +0 -0
  208. package/dist/client/assets/ChangeWalkthroughPanel-BQ1hdwzt.js.br +0 -0
  209. package/dist/client/assets/ChangeWalkthroughPanel-BQ1hdwzt.js.gz +0 -0
  210. package/dist/client/assets/DagPlayground-BERXHwib.js.br +0 -0
  211. package/dist/client/assets/DagPlayground-BERXHwib.js.gz +0 -0
  212. package/dist/client/assets/DiffLab-DF14_TAz.js.br +0 -0
  213. package/dist/client/assets/DiffLab-DF14_TAz.js.gz +0 -0
  214. package/dist/client/assets/DiffReview-BQcIn0zl.js.br +0 -0
  215. package/dist/client/assets/DiffReview-BQcIn0zl.js.gz +0 -0
  216. package/dist/client/assets/DiffReviewLab-CgChwzQr.js.br +0 -0
  217. package/dist/client/assets/DiffReviewLab-CgChwzQr.js.gz +0 -0
  218. package/dist/client/assets/DiffViewer-hDpe-wvG.js.br +0 -0
  219. package/dist/client/assets/DiffViewer-hDpe-wvG.js.gz +0 -0
  220. package/dist/client/assets/ModelPreview-vg3vRIhx.js.br +0 -0
  221. package/dist/client/assets/ModelPreview-vg3vRIhx.js.gz +0 -0
  222. package/dist/client/assets/RightSidebar-5H4vhn3k.js.br +0 -0
  223. package/dist/client/assets/RightSidebar-5H4vhn3k.js.gz +0 -0
  224. package/dist/client/assets/abnfDiagram-VCTEODGH-DI7938HB.js.br +0 -0
  225. package/dist/client/assets/abnfDiagram-VCTEODGH-DI7938HB.js.gz +0 -0
  226. package/dist/client/assets/app-BeVXUQb-.js.br +0 -0
  227. package/dist/client/assets/app-BeVXUQb-.js.gz +0 -0
  228. package/dist/client/assets/arc-D4qDm5Yn.js.br +0 -0
  229. package/dist/client/assets/arc-D4qDm5Yn.js.gz +0 -0
  230. package/dist/client/assets/architectureDiagram-5GKGNRK7-C4IZCNC9.js.br +0 -0
  231. package/dist/client/assets/architectureDiagram-5GKGNRK7-C4IZCNC9.js.gz +0 -0
  232. package/dist/client/assets/blockDiagram-I7D4REHJ-DHVOr_jQ.js.br +0 -0
  233. package/dist/client/assets/blockDiagram-I7D4REHJ-DHVOr_jQ.js.gz +0 -0
  234. package/dist/client/assets/c4Diagram-7LVT6UL2-kQqkOkIe.js.br +0 -0
  235. package/dist/client/assets/c4Diagram-7LVT6UL2-kQqkOkIe.js.gz +0 -0
  236. package/dist/client/assets/channel-DNlwrmA4.js +0 -1
  237. package/dist/client/assets/chunk-F27PBJKO-Bxf7XPNj.js.br +0 -0
  238. package/dist/client/assets/chunk-F27PBJKO-Bxf7XPNj.js.gz +0 -0
  239. package/dist/client/assets/chunk-IMKFNOWR-BTifpaB5.js.br +0 -0
  240. package/dist/client/assets/chunk-IMKFNOWR-BTifpaB5.js.gz +0 -0
  241. package/dist/client/assets/chunk-SVP7TREG-Bm1spPMb.js.br +0 -0
  242. package/dist/client/assets/chunk-SVP7TREG-Bm1spPMb.js.gz +0 -0
  243. package/dist/client/assets/chunk-TICWLB2K-BGLj-zGP.js.br +0 -0
  244. package/dist/client/assets/chunk-TICWLB2K-BGLj-zGP.js.gz +0 -0
  245. package/dist/client/assets/classDiagram-ZZMXUADV-CUt4JCwJ.js +0 -1
  246. package/dist/client/assets/classDiagram-v2-VYDZK3BY-CUt4JCwJ.js +0 -1
  247. package/dist/client/assets/cose-bilkent-JH36ORCC-GTawhnoV.js.br +0 -0
  248. package/dist/client/assets/cose-bilkent-JH36ORCC-GTawhnoV.js.gz +0 -0
  249. package/dist/client/assets/cynefin-OW5HDTMX-DHdRkQdW.js.br +0 -0
  250. package/dist/client/assets/cynefin-OW5HDTMX-DHdRkQdW.js.gz +0 -0
  251. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-Cj2ytLun.js.br +0 -0
  252. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-Cj2ytLun.js.gz +0 -0
  253. package/dist/client/assets/dagre-GXQ25YYZ-BdFZmtIj.js.br +0 -0
  254. package/dist/client/assets/dagre-GXQ25YYZ-BdFZmtIj.js.gz +0 -0
  255. package/dist/client/assets/diagram-S7CK7UJ4-D5WQNuKI.js.br +0 -0
  256. package/dist/client/assets/diagram-S7CK7UJ4-D5WQNuKI.js.gz +0 -0
  257. package/dist/client/assets/diagram-UQ7AKVKN-ChwjfMce.js.br +0 -0
  258. package/dist/client/assets/diagram-UQ7AKVKN-ChwjfMce.js.gz +0 -0
  259. package/dist/client/assets/diagram-VSXAHHWV-DT4FET5f.js.br +0 -0
  260. package/dist/client/assets/diagram-VSXAHHWV-DT4FET5f.js.gz +0 -0
  261. package/dist/client/assets/diagram-VX7I27RA-BLJsAGx6.js.br +0 -0
  262. package/dist/client/assets/diagram-VX7I27RA-BLJsAGx6.js.gz +0 -0
  263. package/dist/client/assets/diagram-Z3DM3KII-C1ofLllK.js.br +0 -0
  264. package/dist/client/assets/diagram-Z3DM3KII-C1ofLllK.js.gz +0 -0
  265. package/dist/client/assets/ebnfDiagram-PWID7BFC-apxDEeqe.js.br +0 -0
  266. package/dist/client/assets/ebnfDiagram-PWID7BFC-apxDEeqe.js.gz +0 -0
  267. package/dist/client/assets/erDiagram-RLTQ6QDP-Dq9hBYpH.js.br +0 -0
  268. package/dist/client/assets/erDiagram-RLTQ6QDP-Dq9hBYpH.js.gz +0 -0
  269. package/dist/client/assets/flowDiagram-HODETNUW-Juk-Qv9f.js.br +0 -0
  270. package/dist/client/assets/flowDiagram-HODETNUW-Juk-Qv9f.js.gz +0 -0
  271. package/dist/client/assets/ganttDiagram-EL5Y4UJY-mmwd0mxs.js.br +0 -0
  272. package/dist/client/assets/ganttDiagram-EL5Y4UJY-mmwd0mxs.js.gz +0 -0
  273. package/dist/client/assets/gestureArbiter-CM_xJnCS.js.br +0 -0
  274. package/dist/client/assets/gestureArbiter-CM_xJnCS.js.gz +0 -0
  275. package/dist/client/assets/gitGraphDiagram-WWUBYQGX--UL7HV4P.js.br +0 -0
  276. package/dist/client/assets/gitGraphDiagram-WWUBYQGX--UL7HV4P.js.gz +0 -0
  277. package/dist/client/assets/index-pZsldTFS.css.br +0 -0
  278. package/dist/client/assets/ishikawaDiagram-5VMMS53U-CNVFPx1_.js.br +0 -0
  279. package/dist/client/assets/ishikawaDiagram-5VMMS53U-CNVFPx1_.js.gz +0 -0
  280. package/dist/client/assets/journeyDiagram-3NMN7TZE-BtIuJLUp.js.br +0 -0
  281. package/dist/client/assets/journeyDiagram-3NMN7TZE-BtIuJLUp.js.gz +0 -0
  282. package/dist/client/assets/kanban-definition-UXKFOSKX-gOFjuFZV.js.br +0 -0
  283. package/dist/client/assets/kanban-definition-UXKFOSKX-gOFjuFZV.js.gz +0 -0
  284. package/dist/client/assets/layout-KEP24zEE.js.br +0 -0
  285. package/dist/client/assets/layout-KEP24zEE.js.gz +0 -0
  286. package/dist/client/assets/linear-BwUXWDLn.js.br +0 -0
  287. package/dist/client/assets/linear-BwUXWDLn.js.gz +0 -0
  288. package/dist/client/assets/mermaid.core-DkzJYwWa.js.br +0 -0
  289. package/dist/client/assets/mermaid.core-DkzJYwWa.js.gz +0 -0
  290. package/dist/client/assets/mindmap-definition-YA3MSWOX-BE1H8WPd.js.br +0 -0
  291. package/dist/client/assets/mindmap-definition-YA3MSWOX-BE1H8WPd.js.gz +0 -0
  292. package/dist/client/assets/passwordBootstrap-Dhzj9-U2.js.br +0 -0
  293. package/dist/client/assets/passwordBootstrap-Dhzj9-U2.js.gz +0 -0
  294. package/dist/client/assets/pegDiagram-XKGWAZYB-CorBwvfP.js.br +0 -0
  295. package/dist/client/assets/pegDiagram-XKGWAZYB-CorBwvfP.js.gz +0 -0
  296. package/dist/client/assets/pieDiagram-E7YTZNPT-A017Uk-W.js.br +0 -0
  297. package/dist/client/assets/pieDiagram-E7YTZNPT-A017Uk-W.js.gz +0 -0
  298. package/dist/client/assets/quadrantDiagram-AXDQQJYC-CNNywvhG.js.br +0 -0
  299. package/dist/client/assets/quadrantDiagram-AXDQQJYC-CNNywvhG.js.gz +0 -0
  300. package/dist/client/assets/railroadDiagram-O6MQD6OU-DIxiWn5A.js.br +0 -0
  301. package/dist/client/assets/railroadDiagram-O6MQD6OU-DIxiWn5A.js.gz +0 -0
  302. package/dist/client/assets/referenceLongPress-Bp8q50sv.js.br +0 -0
  303. package/dist/client/assets/referenceLongPress-Bp8q50sv.js.gz +0 -0
  304. package/dist/client/assets/requirementDiagram-BXWQKSXE-Ob4lS23U.js.br +0 -0
  305. package/dist/client/assets/requirementDiagram-BXWQKSXE-Ob4lS23U.js.gz +0 -0
  306. package/dist/client/assets/sankeyDiagram-P5KCCOFB-Cc5e7umb.js.br +0 -0
  307. package/dist/client/assets/sankeyDiagram-P5KCCOFB-Cc5e7umb.js.gz +0 -0
  308. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CLTRKFht.js.br +0 -0
  309. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CLTRKFht.js.gz +0 -0
  310. package/dist/client/assets/sizeCapture-INFHLROL-h6hFhQw6.js.br +0 -0
  311. package/dist/client/assets/sizeCapture-INFHLROL-h6hFhQw6.js.gz +0 -0
  312. package/dist/client/assets/stateDiagram-D77RDMKH-DSaJxX_r.js.br +0 -0
  313. package/dist/client/assets/stateDiagram-D77RDMKH-DSaJxX_r.js.gz +0 -0
  314. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CQ9iS9Nl.js +0 -1
  315. package/dist/client/assets/swimlanes-42K2YHIH-CP7ABWyE.js.br +0 -0
  316. package/dist/client/assets/swimlanes-42K2YHIH-CP7ABWyE.js.gz +0 -0
  317. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BbfCRvRt.js +0 -8
  318. package/dist/client/assets/timeline-definition-24CTP7MA-CdwVIVF6.js.br +0 -0
  319. package/dist/client/assets/timeline-definition-24CTP7MA-CdwVIVF6.js.gz +0 -0
  320. package/dist/client/assets/vennDiagram-4TSXK5OY-BXGgQFVY.js.br +0 -0
  321. package/dist/client/assets/vennDiagram-4TSXK5OY-BXGgQFVY.js.gz +0 -0
  322. package/dist/client/assets/videoCompression-BFXJyhpz.js.br +0 -0
  323. package/dist/client/assets/videoCompression-BFXJyhpz.js.gz +0 -0
  324. package/dist/client/assets/wardleyDiagram-VM6X3IG4-CtLophqU.js.br +0 -0
  325. package/dist/client/assets/wardleyDiagram-VM6X3IG4-CtLophqU.js.gz +0 -0
  326. package/dist/client/assets/xychartDiagram-S5SC5T6Z-YZ9bnI1e.js.br +0 -0
  327. package/dist/client/assets/xychartDiagram-S5SC5T6Z-YZ9bnI1e.js.gz +0 -0
  328. package/dist/server/utils/desktopRuntimeOwner.js +0 -105
  329. package/scripts/prepare-desktop-runtime.mjs +0 -228
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPreview-vg3vRIhx.js","assets/app-BeVXUQb-.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-pZsldTFS.css","assets/App--hZmWk-u.js","assets/gestureArbiter-CM_xJnCS.js","assets/gestureArbiter-C2J0D0kV.css","assets/triangle-alert-BvT4KSYf.js","assets/referenceLongPress-Bp8q50sv.js","assets/DiffReview-BQcIn0zl.js","assets/sparkles-9OJtJfyK.js","assets/DiffViewer-hDpe-wvG.js","assets/DiffViewer-T3uj2-aP.css","assets/ChangeWalkthroughPanel-BQ1hdwzt.js","assets/katex-55ZPZeOF.css","assets/mermaid.core-DkzJYwWa.js","assets/purify.es-4eNOHKSq.js"])))=>i.map(i=>d[i]);
2
- import{a7 as or,cS as kt,bk as t,g as po,d0 as At,bD as ht,a as Ys,aS as Cu,C as go,c as Xs,X as Yt,cP as lo,b8 as fm,H as Ts,aq as hm,cW as Y,bc as mm,be as wl,bf as pm,bg as Nu,bd as Is,aD as gm,E as bm,j as xm,bb as vm,bF as wm,bH as ym,bI as km,b3 as Sm,bG as Rd,G as Ct,f as jm,L as wt,i as $i,y as Rm,b as Cm,cR as Ai,b2 as Cd,az as Nd,av as Nm,aH as Li,aI as Ed,d1 as Gs,am as Ds,aJ as Em,cQ as Ya,bw as Mm,cB as Md,aB as $m,cN as Am,c8 as Lm,aM as Pm,U as $d,R as Tm,aw as Ad,aA as Im,aF as Ld,ca as Dm,u as Pd,n as Td,z as Eu,ah as Fm,_ as Js,c1 as _m,c_ as Bm,br as Om,d as Hs,l as Um,ak as Hm}from"./app-BeVXUQb-.js";import{b as a,r as Fr}from"./dnd-BCFAPC0L.js";import{q as Mu,k as zm,r as Id,v as co,g as Wm,V as Gm,P as Km,o as qm,i as Vm,M as Ym,R as uo,w as $u,x as Xm,S as ss,D as Jm,e as Au,c as Qm,N as Lu,A as Pi,J as Zm,E as En,y as ep,z as tp,I as rp,K as np,B as Dd,O as Fd,T as _d,H as Bd,f as Od,n as Ti,m as Xa,d as sp,s as ap,l as op,h as ip,t as lp,F as Ud,C as cp,a as dp,G as up}from"./App--hZmWk-u.js";import{a as Hd,S as zd,b as Pu,c as Zi,F as fp}from"./gestureArbiter-CM_xJnCS.js";import{D as el,C as Ks,L as Tu,f as hp,n as mp}from"./DiffReview-BQcIn0zl.js";import{T as pp,L as bo,M as Iu,G as vr}from"./triangle-alert-BvT4KSYf.js";import{S as Qs}from"./sparkles-9OJtJfyK.js";import{C as Du,M as Fu}from"./ChangeWalkthroughPanel-BQ1hdwzt.js";import{r as _u,s as Bu,l as Ou,a as Wd,h as tl,u as gp,g as rl,b as Uu}from"./DiffViewer-hDpe-wvG.js";import{u as Hu,G as zu}from"./referenceLongPress-Bp8q50sv.js";const bp=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],xp=or("archive",bp);const vp=[["path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16",key:"d5nyq2"}],["path",{d:"M22 9v7",key:"pvm9v3"}],["path",{d:"M3.304 13h6.392",key:"1q3zxz"}],["circle",{cx:"18.5",cy:"12.5",r:"3.5",key:"z97x68"}]],wp=or("case-sensitive",vp);const yp=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],kp=or("eye-off",yp);const Sp=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],nl=or("eye",Sp);const jp=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],sl=or("file-text",jp);const Rp=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Cp=or("funnel",Rp);const Np=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],Ep=or("image-plus",Np);const Mp=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],$p=or("regex",Mp);const Ap=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],Lp=or("scan",Ap);const Pp=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Tp=or("upload",Pp);const Ip=[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]],Dp=or("whole-word",Ip);function Gd({children:r,actions:n}){const{t:s}=kt(),[l,f]=a.useState(!1),d=a.useId(),h=a.useRef(null),g=a.useRef(null),p=()=>{f(!1),h.current?.focus({preventScroll:!0})};return a.useLayoutEffect(()=>{if(!l)return;const m=h.current,u=g.current;if(!m||!u)return;const y=window.visualViewport,b=()=>{const L=m.getBoundingClientRect(),F=(y?.offsetLeft??0)+8,B=(y?.offsetTop??0)+8,_=Math.max(0,(y?.width??window.innerWidth)-16),C=B+(y?.height??window.innerHeight)-16,N=Math.min(240,_),P=Math.max(0,L.top-B-6),U=Math.max(0,C-L.bottom-6),T=u.scrollHeight>U&&P>U;Object.assign(u.style,{width:`${N}px`,left:`${Math.max(F,Math.min(L.right-N,F+_-N))}px`,top:`${T?L.top-6:L.bottom+6}px`,maxHeight:`${T?P:U}px`,transform:T?"translateY(-100%)":"none"})};b();const E=typeof ResizeObserver>"u"?null:new ResizeObserver(b);return E?.observe(m),E?.observe(u),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),y?.addEventListener("resize",b),y?.addEventListener("scroll",b),()=>{E?.disconnect(),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0),y?.removeEventListener("resize",b),y?.removeEventListener("scroll",b)}},[l]),a.useEffect(()=>{if(!l)return;g.current?.querySelector("button:not(:disabled)")?.focus({preventScroll:!0});const m=u=>{u.target instanceof Node&&!h.current?.contains(u.target)&&!g.current?.contains(u.target)&&f(!1)};return document.addEventListener("pointerdown",m),()=>document.removeEventListener("pointerdown",m)},[l]),t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[r,t.jsxs("button",{ref:h,type:"button","aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?d:void 0,onClick:()=>f(m=>!m),onKeyDown:m=>{(m.key==="ArrowDown"||m.key==="ArrowUp")&&(m.preventDefault(),f(!0))},className:`ml-auto inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[11px] font-medium transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${l?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[t.jsx(po,{size:14}),s("sidebar.moreActions")]})]}),typeof document<"u"&&Fr.createPortal(t.jsx("div",{ref:g,id:d,hidden:!l,role:"menu","data-sidebar-gesture-ignore":!0,"aria-label":s("sidebar.moreActions"),className:"fixed z-menu-panel overflow-y-auto overscroll-contain rounded-lg border border-border/30 bg-surface p-1 shadow-[0_8px_24px_var(--app-shadow-soft)]",onKeyDown:m=>{if(!m.currentTarget.contains(m.target))return;const u=[...m.currentTarget.querySelectorAll("button:not(:disabled)")],y=u.indexOf(document.activeElement);let b;if(m.key==="Escape"){m.preventDefault(),m.stopPropagation(),p();return}if(m.key==="Tab"){p();return}if(m.key==="ArrowDown")b=(y+1)%u.length;else if(m.key==="ArrowUp")b=(y-1+u.length)%u.length;else if(m.key==="Home")b=0;else if(m.key==="End")b=u.length-1;else return;m.preventDefault(),u[b]?.focus({preventScroll:!0})},children:n(p)}),document.body)]})}const Ii="a[href],button,input,select,textarea,[tabindex],[contenteditable],iframe,summary,audio[controls],video[controls]",Ja=a.memo(function({active:n,mounted:s=!0,fallback:l=null,children:f}){const d=a.useRef(null);return a.useLayoutEffect(()=>{const h=d.current;if(!h||n)return;const g=new Map,p=y=>{g.has(y)||(g.set(y,y.inert),y.inert=!0)},m=y=>{y instanceof HTMLElement&&y.matches(Ii)&&p(y),y.querySelectorAll(Ii).forEach(p)};m(h);const u=new MutationObserver(y=>{for(const b of y)b.type==="attributes"?b.target instanceof HTMLElement&&b.target.matches(Ii)&&p(b.target):b.addedNodes.forEach(E=>{E instanceof Element&&m(E)})});return u.observe(h,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabindex","href","contenteditable","controls"]}),()=>{u.disconnect();for(const[y,b]of g)y.inert=b}},[n,s]),t.jsx("div",{ref:d,className:"absolute inset-0 min-h-0 overflow-hidden bg-surface text-foreground",style:n?void 0:{clipPath:"inset(100%)"},"aria-hidden":!n,children:s?typeof f=="function"?f():f:l})},(r,n)=>!r.active&&!n.active&&r.mounted===n.mounted);async function Fp(r){let n;try{await Promise.race([r(),new Promise(s=>{n=setTimeout(s,3e3)})])}catch{}finally{clearTimeout(n)}}function _p({active:r,rootPath:n,loading:s,delay:l,lastStartedRoot:f,load:d}){a.useEffect(()=>{if(!r||!n||s||f.current===n)return;const h=window.setTimeout(()=>{f.current=n,d(n)},l);return()=>window.clearTimeout(h)},[r,n,s,l,f,d])}function Bp(r,n,s){try{const l=r instanceof HTMLImageElement?r.naturalWidth:r.width,f=r instanceof HTMLImageElement?r.naturalHeight:r.height;if(!l||!f)return Promise.resolve(null);const d=r instanceof HTMLImageElement?1400/Math.max(l,f):Math.min(1,1400/Math.max(l,f)),h=document.createElement("canvas");h.width=Math.max(1,Math.round(l*d)),h.height=Math.max(1,Math.round(f*d));const g=h.getContext("2d");if(!g)return Promise.resolve(null);const p=getComputedStyle(document.documentElement);if(g.fillStyle=p.getPropertyValue("--surface").trim()||"white",g.fillRect(0,0,h.width,h.height),g.drawImage(r,0,0,h.width,h.height),s){const m=Math.max(10,Math.min(16,h.width/35));g.font=`${m}px sans-serif`;const u=[];let y="";for(const b of s.split(" "))y&&g.measureText(`${y} ${b}`).width>h.width-20?(u.push(y),y=b):y=y?`${y} ${b}`:b;y&&u.push(y),g.fillStyle=p.getPropertyValue("--surface").trim()||"white",g.fillRect(0,0,h.width,u.length*(m+4)+12),g.fillStyle=p.getPropertyValue("--foreground").trim()||"black",u.forEach((b,E)=>g.fillText(b,10,8+m+E*(m+4)))}if(n){const m=n.xPercent*h.width/100,u=n.yPercent*h.height/100,y=Math.max(4,Math.min(12,Math.min(h.width,h.height)*.015)),b=y*1.6;g.strokeStyle=p.getPropertyValue("--primary").trim()||"black",g.lineWidth=Math.max(1,y/3),g.beginPath(),g.arc(m,u,y,0,Math.PI*2),g.stroke(),g.beginPath(),g.moveTo(m-b,u),g.lineTo(m+b,u),g.moveTo(m,u-b),g.lineTo(m,u+b),g.stroke()}return new Promise(m=>h.toBlob(m,"image/png"))}catch{return Promise.resolve(null)}}function Op(r,n,s,l){return[r.trim(),n.trim(),l?`截图:${l}`:""].filter(Boolean).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPreview-C3beTH3N.js","assets/app-CHKqaWIE.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-DUCUcxTy.css","assets/App-qs0jye8B.js","assets/gestureArbiter-8VtxF9dg.js","assets/gestureArbiter-C2J0D0kV.css","assets/triangle-alert-zb36qQ-j.js","assets/referenceLongPress-TTIbwCKV.js","assets/DiffReview-DoQY-klj.js","assets/sparkles-hN4VSTDx.js","assets/DiffViewer-nlvDqGPJ.js","assets/DiffViewer-T3uj2-aP.css","assets/ChangeWalkthroughPanel-X-M6nxKJ.js","assets/katex-55ZPZeOF.css","assets/mermaid.core-BH_WDKpZ.js","assets/purify.es-4eNOHKSq.js"])))=>i.map(i=>d[i]);
2
+ import{a7 as or,cS as kt,bk as t,g as po,d0 as At,bD as ht,a as Ys,aS as Cu,C as go,c as Xs,X as Yt,cP as lo,b8 as fm,H as Ts,aq as hm,cW as Y,bc as mm,be as wl,bf as pm,bg as Nu,bd as Is,aD as gm,E as bm,j as xm,bb as vm,bF as wm,bH as ym,bI as km,b3 as Sm,bG as Rd,G as Ct,f as jm,L as wt,i as $i,y as Rm,b as Cm,cR as Ai,b2 as Cd,az as Nd,av as Nm,aH as Li,aI as Ed,d1 as Gs,am as Ds,aJ as Em,cQ as Ya,bw as Mm,cB as Md,aB as $m,cN as Am,c8 as Lm,aM as Pm,U as $d,R as Tm,aw as Ad,aA as Im,aF as Ld,ca as Dm,u as Pd,n as Td,z as Eu,ah as Fm,_ as Js,c1 as _m,c_ as Bm,br as Om,d as Hs,l as Um,ak as Hm}from"./app-CHKqaWIE.js";import{b as a,r as Fr}from"./dnd-BCFAPC0L.js";import{q as Mu,k as zm,r as Id,v as co,g as Wm,V as Gm,P as Km,o as qm,i as Vm,M as Ym,R as uo,w as $u,x as Xm,S as ss,D as Jm,e as Au,c as Qm,N as Lu,A as Pi,J as Zm,E as En,y as ep,z as tp,I as rp,K as np,B as Dd,O as Fd,T as _d,H as Bd,f as Od,n as Ti,m as Xa,d as sp,s as ap,l as op,h as ip,t as lp,F as Ud,C as cp,a as dp,G as up}from"./App-qs0jye8B.js";import{a as Hd,S as zd,b as Pu,c as Zi,F as fp}from"./gestureArbiter-8VtxF9dg.js";import{D as el,C as Ks,L as Tu,f as hp,n as mp}from"./DiffReview-DoQY-klj.js";import{T as pp,L as bo,M as Iu,G as vr}from"./triangle-alert-zb36qQ-j.js";import{S as Qs}from"./sparkles-hN4VSTDx.js";import{C as Du,M as Fu}from"./ChangeWalkthroughPanel-X-M6nxKJ.js";import{r as _u,s as Bu,l as Ou,a as Wd,h as tl,u as gp,g as rl,b as Uu}from"./DiffViewer-nlvDqGPJ.js";import{u as Hu,G as zu}from"./referenceLongPress-TTIbwCKV.js";const bp=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],xp=or("archive",bp);const vp=[["path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16",key:"d5nyq2"}],["path",{d:"M22 9v7",key:"pvm9v3"}],["path",{d:"M3.304 13h6.392",key:"1q3zxz"}],["circle",{cx:"18.5",cy:"12.5",r:"3.5",key:"z97x68"}]],wp=or("case-sensitive",vp);const yp=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],kp=or("eye-off",yp);const Sp=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],nl=or("eye",Sp);const jp=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],sl=or("file-text",jp);const Rp=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Cp=or("funnel",Rp);const Np=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],Ep=or("image-plus",Np);const Mp=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],$p=or("regex",Mp);const Ap=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],Lp=or("scan",Ap);const Pp=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Tp=or("upload",Pp);const Ip=[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]],Dp=or("whole-word",Ip);function Gd({children:r,actions:n}){const{t:s}=kt(),[l,f]=a.useState(!1),d=a.useId(),h=a.useRef(null),g=a.useRef(null),p=()=>{f(!1),h.current?.focus({preventScroll:!0})};return a.useLayoutEffect(()=>{if(!l)return;const m=h.current,u=g.current;if(!m||!u)return;const y=window.visualViewport,b=()=>{const L=m.getBoundingClientRect(),F=(y?.offsetLeft??0)+8,B=(y?.offsetTop??0)+8,_=Math.max(0,(y?.width??window.innerWidth)-16),C=B+(y?.height??window.innerHeight)-16,N=Math.min(240,_),P=Math.max(0,L.top-B-6),U=Math.max(0,C-L.bottom-6),T=u.scrollHeight>U&&P>U;Object.assign(u.style,{width:`${N}px`,left:`${Math.max(F,Math.min(L.right-N,F+_-N))}px`,top:`${T?L.top-6:L.bottom+6}px`,maxHeight:`${T?P:U}px`,transform:T?"translateY(-100%)":"none"})};b();const E=typeof ResizeObserver>"u"?null:new ResizeObserver(b);return E?.observe(m),E?.observe(u),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),y?.addEventListener("resize",b),y?.addEventListener("scroll",b),()=>{E?.disconnect(),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0),y?.removeEventListener("resize",b),y?.removeEventListener("scroll",b)}},[l]),a.useEffect(()=>{if(!l)return;g.current?.querySelector("button:not(:disabled)")?.focus({preventScroll:!0});const m=u=>{u.target instanceof Node&&!h.current?.contains(u.target)&&!g.current?.contains(u.target)&&f(!1)};return document.addEventListener("pointerdown",m),()=>document.removeEventListener("pointerdown",m)},[l]),t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[r,t.jsxs("button",{ref:h,type:"button","aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?d:void 0,onClick:()=>f(m=>!m),onKeyDown:m=>{(m.key==="ArrowDown"||m.key==="ArrowUp")&&(m.preventDefault(),f(!0))},className:`ml-auto inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[11px] font-medium transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${l?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[t.jsx(po,{size:14}),s("sidebar.moreActions")]})]}),typeof document<"u"&&Fr.createPortal(t.jsx("div",{ref:g,id:d,hidden:!l,role:"menu","data-sidebar-gesture-ignore":!0,"aria-label":s("sidebar.moreActions"),className:"fixed z-menu-panel overflow-y-auto overscroll-contain rounded-lg border border-border/30 bg-surface p-1 shadow-[0_8px_24px_var(--app-shadow-soft)]",onKeyDown:m=>{if(!m.currentTarget.contains(m.target))return;const u=[...m.currentTarget.querySelectorAll("button:not(:disabled)")],y=u.indexOf(document.activeElement);let b;if(m.key==="Escape"){m.preventDefault(),m.stopPropagation(),p();return}if(m.key==="Tab"){p();return}if(m.key==="ArrowDown")b=(y+1)%u.length;else if(m.key==="ArrowUp")b=(y-1+u.length)%u.length;else if(m.key==="Home")b=0;else if(m.key==="End")b=u.length-1;else return;m.preventDefault(),u[b]?.focus({preventScroll:!0})},children:n(p)}),document.body)]})}const Ii="a[href],button,input,select,textarea,[tabindex],[contenteditable],iframe,summary,audio[controls],video[controls]",Ja=a.memo(function({active:n,mounted:s=!0,fallback:l=null,children:f}){const d=a.useRef(null);return a.useLayoutEffect(()=>{const h=d.current;if(!h||n)return;const g=new Map,p=y=>{g.has(y)||(g.set(y,y.inert),y.inert=!0)},m=y=>{y instanceof HTMLElement&&y.matches(Ii)&&p(y),y.querySelectorAll(Ii).forEach(p)};m(h);const u=new MutationObserver(y=>{for(const b of y)b.type==="attributes"?b.target instanceof HTMLElement&&b.target.matches(Ii)&&p(b.target):b.addedNodes.forEach(E=>{E instanceof Element&&m(E)})});return u.observe(h,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabindex","href","contenteditable","controls"]}),()=>{u.disconnect();for(const[y,b]of g)y.inert=b}},[n,s]),t.jsx("div",{ref:d,className:"absolute inset-0 min-h-0 overflow-hidden bg-surface text-foreground",style:n?void 0:{clipPath:"inset(100%)"},"aria-hidden":!n,children:s?typeof f=="function"?f():f:l})},(r,n)=>!r.active&&!n.active&&r.mounted===n.mounted);async function Fp(r){let n;try{await Promise.race([r(),new Promise(s=>{n=setTimeout(s,3e3)})])}catch{}finally{clearTimeout(n)}}function _p({active:r,rootPath:n,loading:s,delay:l,lastStartedRoot:f,load:d}){a.useEffect(()=>{if(!r||!n||s||f.current===n)return;const h=window.setTimeout(()=>{f.current=n,d(n)},l);return()=>window.clearTimeout(h)},[r,n,s,l,f,d])}function Bp(r,n,s){try{const l=r instanceof HTMLImageElement?r.naturalWidth:r.width,f=r instanceof HTMLImageElement?r.naturalHeight:r.height;if(!l||!f)return Promise.resolve(null);const d=r instanceof HTMLImageElement?1400/Math.max(l,f):Math.min(1,1400/Math.max(l,f)),h=document.createElement("canvas");h.width=Math.max(1,Math.round(l*d)),h.height=Math.max(1,Math.round(f*d));const g=h.getContext("2d");if(!g)return Promise.resolve(null);const p=getComputedStyle(document.documentElement);if(g.fillStyle=p.getPropertyValue("--surface").trim()||"white",g.fillRect(0,0,h.width,h.height),g.drawImage(r,0,0,h.width,h.height),s){const m=Math.max(10,Math.min(16,h.width/35));g.font=`${m}px sans-serif`;const u=[];let y="";for(const b of s.split(" "))y&&g.measureText(`${y} ${b}`).width>h.width-20?(u.push(y),y=b):y=y?`${y} ${b}`:b;y&&u.push(y),g.fillStyle=p.getPropertyValue("--surface").trim()||"white",g.fillRect(0,0,h.width,u.length*(m+4)+12),g.fillStyle=p.getPropertyValue("--foreground").trim()||"black",u.forEach((b,E)=>g.fillText(b,10,8+m+E*(m+4)))}if(n){const m=n.xPercent*h.width/100,u=n.yPercent*h.height/100,y=Math.max(4,Math.min(12,Math.min(h.width,h.height)*.015)),b=y*1.6;g.strokeStyle=p.getPropertyValue("--primary").trim()||"black",g.lineWidth=Math.max(1,y/3),g.beginPath(),g.arc(m,u,y,0,Math.PI*2),g.stroke(),g.beginPath(),g.moveTo(m-b,u),g.lineTo(m+b,u),g.moveTo(m,u-b),g.lineTo(m,u+b),g.stroke()}return new Promise(m=>h.toBlob(m,"image/png"))}catch{return Promise.resolve(null)}}function Op(r,n,s,l){return[r.trim(),n.trim(),l?`截图:${l}`:""].filter(Boolean).join(`
3
3
  `)}function _x(r,n,s){const l=n*Math.PI/360,f=Math.min(l,Math.atan(Math.tan(l)*Math.max(s,.05)));return Math.max(r,1e-6)/Math.sin(f)*1.15}async function Up(r,n,s,l){if(!s?.snapshot){l.isCurrent()&&l.insert(r,n);return}const f=new Date().toISOString(),d=new AbortController;let h,g;try{g=await Promise.race([(async()=>{const p=await s.snapshot;if(!(!p||d.signal.aborted||!l.isCurrent()))return l.upload(new File([p],`termdock-review-${crypto.randomUUID()}.png`,{type:"image/png"}),d.signal)})(),new Promise(p=>{h=setTimeout(()=>{d.abort(),p(void 0)},3e3)})])}catch{}finally{clearTimeout(h),d.abort()}l.isCurrent()&&l.insert(g?Op(r,"",f,g):r,n)}function Hp(r,n){return r===n||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function Kd(r,n){return`${r??""}\0${n}`}function zp(r,n,s){if(!r||r.length===0||!s)return{explained:0,stale:0};const l=Kd(n,s);let f=0,d=0;for(const h of r){const g=[h.filePath,h.newPath,h.oldPath].filter(m=>typeof m=="string"&&m.length>0);(g.some(m=>Kd(h.repoRoot,m)===l)||g.some(m=>Hp(m,s)))&&(f+=1)}return{explained:f,stale:d}}function Wp({status:r}){if(!r)return null;const n=r.stale>0&&r.explained===0;if(!(r.explained>0||r.stale>0))return null;const l=n?"AI audit explanation is stale":"AI audit explanation available";return t.jsx("span",{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full ${n?"bg-[color:var(--warning)]/15 text-[color:var(--warning)]":"bg-accent/10 text-accent"}`,title:l,"aria-label":l,children:n?t.jsx(pp,{size:10}):t.jsx(Qs,{size:10})})}function al({changeStatus:r,auditStatus:n,renderChangeBadge:s}){return t.jsxs("span",{className:"inline-flex items-center gap-1",children:[s(r),t.jsx(Wp,{status:n})]})}const Wu="termdock:right-sidebar:diff-change-list-mode:v1";function Gp(r){return r==="list"||r==="tree"}function Kp(){return ht(Wu,Gp)??"tree"}function qp(r){for(const l of r){const f=l.hunk;if(f.oldPath&&f.newPath&&f.oldPath!==f.newPath)return"renamed";if(!f.oldPath&&f.newPath)return"added";if(f.oldPath&&!f.newPath)return"deleted"}const n=r.some(l=>l.hunk.additions>0),s=r.some(l=>l.hunk.deletions>0);return n&&!s?"added":!n&&s?"deleted":"modified"}function Vp(r){const n=new Map;for(const l of r){const f=n.get(l.hunk.filePath)??{key:l.hunk.filePath,filePath:l.hunk.filePath,items:[],additions:0,deletions:0,explained:0,stale:0,changeType:"modified"};f.items.push(l),f.additions+=l.hunk.additions,f.deletions+=l.hunk.deletions,l.current&&(f.explained+=1),l.stale&&(f.stale+=1),n.set(l.hunk.filePath,f)}const s=Array.from(n.values()).sort((l,f)=>l.filePath.localeCompare(f.filePath));for(const l of s)l.changeType=qp(l.items);return s}function Yp(r){const n=r.filePath.split("/").pop()??r.filePath;return{key:r.key,path:r.filePath,displayName:n,displayDir:r.filePath.includes("/")?r.filePath.slice(0,-n.length-1):"",status:r.changeType,title:r.filePath}}function Xp(r,n){const s=r.filter(d=>d.trim().length>0);if(s.length<=1)return s[0]??"";const l=[],f=new Set;for(const[d,h]of s.entries()){const g=h.split(`
4
4
  `),p=g.findIndex(y=>y.startsWith("@@ "));if(p<0){l.push(...g);continue}d===0&&l.push(...g.slice(0,p));const m=n[d];let u=p;for(;u>=0&&u<g.length;){const y=g.findIndex((_,C)=>C>u&&_.startsWith("@@ ")),b=y>=0?y:g.length,E=g.slice(u,b),L=E[0]??"",F=m?L===m:!0,B=L||m||E.join(`
5
5
  `);F&&!f.has(B)&&(l.push(...E),f.add(B)),u=y}}return l.join(`
@@ -1635,12 +1635,12 @@ function installPreviewRuntime(capability, base, externalOrigins, shimUrl) {
1635
1635
  `,eo="/api/terminal/fs/preview/",Bg=8*1024*1024,Og=32*1024*1024,Ug=128,Hg="data:,";function $t(r){throw new Error(r)}function zg(r){return JSON.stringify(r).replace(/</g,"\\u003c")}async function Qd(r,n,s){let l="",f=0;for(const d of r.matchAll(n))l+=r.slice(f,d.index)+await s(d),f=d.index+d[0].length;return l+r.slice(f)}async function Yu(r,n){const s=n.origin??location.origin,l=new URL(r,s);(l.origin!==s||!Ts(l.pathname)?.startsWith(eo))&&$t("预览地址不是有效的本地文件入口");const f=crypto.randomUUID(),d=`https://termdock-preview.invalid/${f}/`,h=[],g=W=>{!h.includes(W)&&h.length<20&&h.push(W)},p=new Set,m=[],u=new Set,y=new Map,b=new Map;let E=0,L=!1;const F=new Set,B=()=>{L=!0;for(const W of[...F])W();p.clear(),m.length=0};async function _(W){W.ok||$t(`预览资源读取失败(${W.status})`);const Z=W.body?.getReader(),A=[];let D=0;try{if(Z)for(;;){const me=await Z.read();if(me.done)break;D+=me.value.byteLength,E+=me.value.byteLength,(D>Bg||E>Og)&&$t("预览资源超出大小限制"),A.push(me.value)}}catch(me){throw await Z?.cancel().catch(()=>{}),me}finally{Z?.releaseLock()}const X=new Uint8Array(D);let ue=0;for(const me of A)X.set(me,ue),ue+=me.length;return{bytes:X,type:W.headers.get("content-type")??"application/octet-stream",status:W.status}}let C=l,N;for(let W=0;W<4;W++){const Z=await n.fetch(C.pathname+C.search,{signal:n.signal,redirect:"manual"});if(![301,302,303,307,308].includes(Z.status)){N=Z;break}const A=Z.headers.get("location");await Z.body?.cancel(),A||$t("预览重定向缺少目标");const D=new URL(A,C);(D.origin!==s||!Ts(D.pathname)?.startsWith(eo))&&$t("预览重定向越出文件范围"),C=D}N||$t("预览重定向次数过多");const P=Ts(C.pathname),U=P.slice(eo.length).split("/");/^[a-f0-9]{32}$/.test(U[0])||$t("服务未提供有效的预览资源授权");const T=Ts(l.pathname).slice(eo.length).split("/");/^[a-f0-9]{32}$/.test(T[0])&&T.shift(),T.join("/").replace(/\/$/,"")!==U.slice(1).join("/").replace(/\/$/,"")&&$t("预览重定向改变了文件范围");const k=P.endsWith("/")?P:P.slice(0,P.lastIndexOf("/")+1),o=new URL(C.pathname.endsWith("/")?C.pathname:C.pathname.slice(0,C.pathname.lastIndexOf("/")+1),s);function O(W,Z){const A=new URL(W,Z);return A.origin!==s?null:(Ts(A.pathname)?.startsWith(k)||$t("已阻止预览访问目录之外的资源"),A)}function z(W){const Z=new URL(W,d);(Z.origin!==new URL(d).origin||!Z.pathname.startsWith(new URL(d).pathname))&&$t("已阻止预览访问服务接口或目录之外的资源");const A=Z.pathname.slice(new URL(d).pathname.length)+Z.search;return O(A,o)??$t("预览资源无效")}function re(W){const Z=W.pathname+W.search,A=y.get(Z);if(A)return A;if(L||n.signal?.aborted)return Promise.reject(new Error("预览已关闭"));if(y.size>=Ug)return Promise.reject(new Error("预览资源数量超出限制"));const D=n.fetch(Z,{signal:n.signal,redirect:"manual"}).then(_);return y.set(Z,D),D}function M(W,Z){L&&$t("预览已关闭");const A=`termdock-resource-${f}-${m.length}`;return m.push({token:A,data:W,type:Z}),p.add(A),A}async function q(W,Z,A,D=new Set){if(!W||W.startsWith("#")||/^data:(?:image|font)\//i.test(W)&&A==="resource")return W;try{const X=O(W,Z);if(!X){const Ce=new URL(W,Z);return(Ce.protocol!=="https:"||Ce.username||Ce.password||Ce.origin===new URL(d).origin)&&$t("已阻止不安全的外部资源"),u.add(Ce.origin),Ce.href}const ue=`${A}:${X.href}`;(D.has(ue)||D.size>=8)&&$t("预览资源存在循环或过深引用");const me=b.get(ue);if(me)return me;const we=new Set(D);we.add(ue);const je=(async()=>{const Ce=await re(X);return A==="css"?M(await pe(new TextDecoder().decode(Ce.bytes),X,we),"text/css"):A==="script"?M(Ce.bytes,"text/javascript"):M(Ce.bytes,Ce.type)})();return b.set(ue,je),await je}catch(X){return g(X instanceof Error?X.message:"部分预览资源未能加载"),Hg}}async function pe(W,Z,A){return W=await Qd(W,/@import\s+(?:url\(\s*)?["']([^"']+)["']\s*\)?([^;]*);/gi,async D=>`@import url("${await q(D[1],Z,"css",A)}")${D[2]};`),Qd(W,/url\(\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\s*\)/gi,async D=>{const X=(D[1]??D[2]??D[3]).trim();return p.has(X)?D[0]:`url("${await q(X,Z,"resource",A)}")`})}try{const W=await _(N),Z=M(Fg,"text/javascript"),A=new DOMParser().parseFromString(new TextDecoder().decode(W.bytes),"text/html");A.querySelectorAll("base,meta[http-equiv],iframe,frame,object,embed").forEach($=>$.remove());for(const $ of A.querySelectorAll("*")){if($.removeAttribute("ping"),$.removeAttribute("srcdoc"),$.hasAttribute("style")&&$.setAttribute("style",await pe($.getAttribute("style"),C,new Set)),$.tagName==="STYLE"&&($.textContent=await pe($.textContent??"",C,new Set)),$.tagName==="A"||$.tagName==="AREA"){const J=$.getAttribute("href");try{if(J&&!J.startsWith("#")){const ne=O(J,C);if(ne)$.setAttribute("href",new URL(ne.pathname.slice(o.pathname.length)+ne.search+ne.hash,d).href);else{const Ae=new URL(J,C);if(Ae.protocol!=="https:"){$.removeAttribute("href");continue}u.add(Ae.origin),$.setAttribute("href",Ae.href)}}}catch(ne){$.removeAttribute("href"),g(ne instanceof Error?ne.message:"预览链接无法加载")}}for(const J of["data","manifest"])$.removeAttribute(J);if($.tagName==="SCRIPT"&&$.getAttribute("type")==="module"){$.setAttribute("type","module-shim");const J=$.getAttribute("src");if(J){const ne=O(J,C);if(ne)$.setAttribute("src",new URL(ne.pathname.slice(o.pathname.length)+ne.search,d).href);else{const Ae=new URL(J,C);if(Ae.protocol!=="https:"){$.remove();continue}u.add(Ae.origin),$.setAttribute("src",Ae.href)}}continue}if($.tagName==="SCRIPT"&&$.getAttribute("type")==="importmap"){$.setAttribute("type","importmap-shim");continue}if($.tagName==="LINK"){const J=($.getAttribute("rel")??"").toLowerCase();if(!["stylesheet","icon"].includes(J)){$.remove();continue}const ne=$.getAttribute("href");ne&&$.setAttribute("href",await q(ne,C,J==="stylesheet"?"css":"resource"))}if($.hasAttribute("src")&&$.setAttribute("src",await q($.getAttribute("src"),C,$.tagName==="SCRIPT"?"script":"resource")),$.hasAttribute("poster")&&$.setAttribute("poster",await q($.getAttribute("poster"),C,"resource")),$.hasAttribute("srcset")){const J=$.getAttribute("srcset");/data:/i.test(J)?($.removeAttribute("srcset"),g("混合内嵌图片候选暂不支持安全预览")):$.setAttribute("srcset",(await Promise.all(J.split(",").map(async ne=>{const[Ae,...Ye]=ne.trim().split(/\s+/);return`${await q(Ae,C,"resource")} ${Ye.join(" ")}`}))).join(", "))}$.setAttribute("referrerpolicy","no-referrer"),$.removeAttribute("integrity"),$.removeAttribute("crossorigin")}const D=[...u].join(" "),X=A.createElement("meta");X.httpEquiv="Content-Security-Policy",X.content=`default-src 'none'; script-src 'unsafe-inline' 'wasm-unsafe-eval' blob: ${D}; style-src 'unsafe-inline' blob: ${D}; img-src blob: data: ${D}; font-src blob: data: ${D}; media-src blob: data: ${D}; connect-src blob: ${D} ${[...u].map($=>$.replace(/^https:/,"wss:")).join(" ")}; worker-src blob:; frame-src 'none'; object-src 'none'; base-uri https://termdock-preview.invalid; form-action 'none'`;const ue=A.createElement("base");ue.href=d;const me=A.createElement("meta");me.name="referrer",me.content="no-referrer";const we=A.createElement("script");we.textContent=_g+`
1636
1636
  installPreviewRuntime(`+[f,d,[...u],Z].map(zg).join(",")+");";const je=A.createElement("script");je.src=Z,A.head.prepend(X,me,ue,we,je);const Ce=`<!doctype html>
1637
1637
  `+A.documentElement.outerHTML;return{html:Ce,shellUrl:`/preview-shell.html#${f}`,errors:h,attach($,J){const ne=new Set,Ae=De=>{if(De.source!==$.contentWindow||De.data?.capability!==f)return;if(De.data.type==="preview-ready"){$.contentWindow?.postMessage({type:"preview-init",capability:f,html:Ce,resources:m},"*");return}if(De.data.type==="preview-error"){J("部分动态内容被安全预览限制");return}if(De.data.type==="preview-navigate"){(async()=>{const _e=z(String(De.data.url)),R=await Yu(_e.pathname+_e.search,n);if(L){R.dispose();return}const se=R.attach($,J);F.add(()=>{se(),R.dispose()}),$.src=R.shellUrl.replace("#","?navigation="+crypto.randomUUID()+"#")})().catch(_e=>J(_e instanceof Error?_e.message:"无法打开预览页面"));return}if(De.data.type==="preview-external"){try{const _e=new URL(String(De.data.url));_e.protocol==="https:"&&u.has(_e.origin)&&window.open(_e.href,"_blank","noopener,noreferrer")}catch{}return}if(De.data.type!=="preview-fetch"||De.ports.length!==1)return;const rt=De.ports[0];if(ne.size>=8||!["GET","HEAD"].includes(De.data.method)){rt.postMessage({error:"预览仅允许读取已授权目录资源"}),rt.close();return}ne.add(rt),(async()=>{const _e=z(String(De.data.url)),R=await re(_e);if(!ne.has(rt)||L)return;const se=De.data.method==="HEAD"?new Uint8Array:R.bytes.slice();rt.postMessage({status:R.status,headers:{"content-type":R.type},data:se.buffer},[se.buffer])})().catch(()=>{rt.postMessage({error:"预览资源不在授权范围或无法加载"}),J("部分动态资源不可用或超出预览目录")}).finally(()=>{ne.delete(rt),rt.close()})};window.addEventListener("message",Ae);const Ye=()=>{window.removeEventListener("message",Ae);for(const De of ne)De.close();ne.clear(),F.delete(Ye)};return F.add(Ye),Ye},dispose:B}}catch(W){throw B(),W}}const Wg=a.forwardRef(function({src:n,title:s,exitFullscreenLabel:l,onFullscreenChange:f},d){const h=a.useRef(null),[g,p]=a.useState(null),[m,u]=a.useState(),[y,b]=a.useState("");a.useEffect(()=>{const P=new AbortController;let U;return u(void 0),b(""),(async()=>{const T=await hm();if(U=await Yu(n,{fetch:(k,o)=>T.fetch(k,o),signal:P.signal}),P.signal.aborted){U.dispose();return}u(U),U.errors.length&&b(U.errors.join(";"))})().catch(T=>{P.signal.aborted||b(T instanceof Error?T.message:"安全预览加载失败")}),()=>{P.abort(),U?.dispose()}},[n]),a.useEffect(()=>{if(!(!m||!g))return m.attach(g,b)},[m,g]);const[E,L]=a.useState(!1),[F,B]=a.useState(!1),_=E||F;a.useEffect(()=>{f?.(_)},[_,f]),a.useEffect(()=>{const P=()=>{L(document.fullscreenElement===h.current)};return document.addEventListener("fullscreenchange",P),()=>document.removeEventListener("fullscreenchange",P)},[]),a.useEffect(()=>{if(!F)return;const P=U=>{U.key==="Escape"&&B(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[F]);const C=a.useCallback(async()=>{const P=h.current;if(P){if(F){B(!1);return}if(document.fullscreenElement===P){await document.exitFullscreen();return}if(P.requestFullscreen&&document.fullscreenEnabled!==!1)try{await P.requestFullscreen();return}catch{}B(!0)}},[F]);a.useImperativeHandle(d,()=>({toggleFullscreen:C}),[C]);const N=t.jsxs("div",{ref:h,"data-html-preview-frame":!0,className:_?"fixed inset-0 z-modal-panel flex min-h-0 flex-col overflow-hidden bg-surface pt-[env(safe-area-inset-top,0px)] text-foreground":"flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[_&&t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between gap-3 border-b border-border/15 bg-[var(--chrome-bg)] px-3",children:[t.jsx("span",{className:"min-w-0 truncate text-[12px] font-semibold",children:s}),t.jsx("button",{type:"button",onClick:()=>{C()},"aria-label":l,title:`${l} (Esc)`,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:t.jsx(Fu,{size:15})})]}),y&&t.jsx("div",{role:"status",className:"shrink-0 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:y}),!m&&!y&&t.jsx("div",{role:"status",className:"p-3 text-xs text-muted-foreground",children:"正在安全加载预览资源…"}),t.jsx("iframe",{ref:p,src:m?.shellUrl,referrerPolicy:"no-referrer",title:s,sandbox:"allow-scripts",className:"block min-h-0 w-full flex-1 border-0 bg-white"})]});return F?Fr.createPortal(N,document.body):N}),Xu="termdock-file-search-match",ll="termdock-file-search-current";function Gg(r){const n=r.metaKey||r.ctrlKey,s=r.key.toLocaleLowerCase();return n&&s==="f"?"open":n&&s==="g"||r.key==="F3"?r.shiftKey?"previous":"next":r.key==="Escape"?"close":null}function Kg(r){return r.parentElement?.closest("[data-markdown-preview-block-start], [data-file-preview-line]")??null}function qg(r,n){const s=n.trim().toLocaleLowerCase();if(!s)return[];const l=[];let f="",d=null;const h=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);for(let u=h.nextNode();u;u=h.nextNode()){if(!(u instanceof Text)||!u.data)continue;const y=Kg(u);if(!y)continue;d&&d!==y&&(f+=`
1638
- `);const b=f.length;f+=u.data,l.push({node:u,start:b,end:f.length,group:y}),d=y}const g=f.toLocaleLowerCase(),p=[];let m=0;for(;m<=g.length-s.length;){const u=g.indexOf(s,m);if(u<0)break;const y=u+s.length,b=l.find(L=>L.start<=u&&L.end>u),E=l.find(L=>L.start<y&&L.end>=y);if(b&&E&&b.group===E.group){const L=document.createRange();L.setStart(b.node,u-b.start),L.setEnd(E.node,y-E.start),p.push(L)}m=u+Math.max(s.length,1)}return p}function Ju(){return typeof CSS<"u"&&CSS.highlights?CSS.highlights:null}function to(){const r=Ju();r?.delete(Xu),r?.delete(ll)}function Zd(r,n){const s=Ju();if(!s||typeof Highlight>"u")return;s.set(Xu,new Highlight(...r));const l=r[n];l?s.set(ll,new Highlight(l)):s.delete(ll)}function eu(r){r?.startContainer.parentElement?.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})}function Vg(r){return Array.from(new Set(r.split(/[\n,]/).map(n=>n.trim().replace(/^!+/,"")).filter(Boolean))).slice(0,24)}function Yg(r,n){const s=n.trim();return!s||s==="."?r:/^(?:[/\\]|[A-Za-z]:[/\\])/.test(s)?s.replace(/[\\/]+$/,""):`${r.replace(/[\\/]+$/,"")}/${s.replace(/^\.?[\\/]+/,"").replace(/[\\/]+$/,"")}`}function Xg(r,n){if(n===r)return".";const s=`${r.replace(/[\\/]+$/,"")}/`;return n.startsWith(s)?n.slice(s.length):n}function Qu(r,n,s){return n?r:Fr.createPortal(r,s)}const yl="termdock:right-sidebar:file-tree-scroll:v1",kl="termdock:right-sidebar:file-preview-reading-state:v1",zs="termdock:right-sidebar:file-tree-width:v1",Zu="termdock:right-sidebar:markdown-view-mode:v1",ef="termdock:right-sidebar:diff-change-list-mode:v1",tf="termdock:right-sidebar:diff-wrap:v1",rf="termdock:diff-viewer:view-type:v1",nf="termdock:right-sidebar:file-search-mode:v1",_i="termdock:right-sidebar:collapsed-git-repo-groups:v1",tu="termdock:right-sidebar:collapsed-diff-directories:v1",Bi="termdock:right-sidebar:branch-audit-module-open:v1",sf="termdock:right-sidebar:branch-audit-module:v1",Jg=150,ru="termdock:right-sidebar:context-draft-enabled:v1",nu="termdock:right-sidebar:context-draft-collapsed:v1",su="termdock:right-sidebar:context-draft-auto-collapse:v1",Oi="termdock:right-sidebar:context-draft-text:v1",Qg=300,Zg=20,eb=120,tb=250,rb=250,nb=120,sb=700,Ui=600,ab=6e4;function Fs(r){return!!(r&&Y.getState().nestedGitScanRoots[r])}const au=[2e3,5e3,15e3,3e4],ob=320,ib=500,lb=20,cb=12e3,cl=300,ou=240,db=560,af="border-r px-2 py-1.5 sm:px-3 sm:py-2",xo="min-w-full max-w-[18rem] whitespace-normal break-words sm:max-w-[27rem]",of=`${af} border-b border-border/15 font-semibold last:border-r-0`,lf=`${af} border-border/10 align-top text-muted-foreground last:border-r-0`,Sl="termdock-file-preview-horizontal-scroll",iu=a.lazy(()=>Js(()=>import("./ModelPreview-vg3vRIhx.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),cf=`${Sl} termdock-md-table-scroll max-w-full overflow-x-auto overflow-y-hidden rounded-lg border border-border/20 bg-surface`;function df(r,n,s){return r&&!n?"unified":s}const ub=new Set([".md",".markdown",".mdown",".mkdn",".mkd"]);function fb(r){return r==="preview"||r==="source"}function hb(r){return r==="list"||r==="tree"||r==="ai"}function lu(){return ht(Zu,fb)??"preview"}function mb(){return ht(ef,hb)??"tree"}function Ws(r){return typeof r=="boolean"}function pb(r){return typeof r=="string"}function gb(){return ht(tf,Ws)??!0}function bb(r){return r==="unified"||r==="split"}function xb(){return ht(rf,bb)??"unified"}function vb(r){return r==="name"||r==="content"||r==="regex"}function wb(){return ht(nf,vb)??"name"}function uf(r){return r.repositories??(r.context?.root?[{id:r.context.root,root:r.context.root,relativeRoot:".",name:yt(r.context.root)||r.context.root,depth:0,nested:!1,available:r.available,files:r.files,context:r.context,error:r.error}]:[])}function yb(r,n){if(!n)return null;const s=new Set((r.repoFilters??[]).map(l=>l.root));return s.has(n)?n:s.size>0?null:(r.repositories??[]).some(l=>l.root===n)?n:null}function dl(r){return!r.activeGitRepoRoot&&(r.groupCount>1||r.label!==r.rootName)}function ff(...r){const n=new Set;for(const s of r)for(const l of s)n.add(l.root);return n}function ul(r){return Array.isArray(r)&&r.every(n=>typeof n=="string")}function cu(r){const n=ht(r,ul);return n?new Set(n):new Set}function Hi(r,n){At(r,[...n])}function kb(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.filePath=="string"&&typeof n.hunkHeader=="string"&&typeof n.hunkIndex=="number"&&typeof n.fingerprint=="string"&&typeof n.additions=="number"&&typeof n.deletions=="number"&&typeof n.diff=="string"&&(n.oldPath===void 0||n.oldPath===null||typeof n.oldPath=="string")&&(n.newPath===void 0||n.newPath===null||typeof n.newPath=="string")&&(n.source===void 0||n.source==="committed"||n.source==="uncommitted"||n.source==="unknown")&&(n.commit===void 0||n.commit===null||typeof n.commit=="string")}function Sb(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.available=="boolean"&&(n.repoRoot===void 0||typeof n.repoRoot=="string")&&(n.workspaceRoot===void 0||typeof n.workspaceRoot=="string")&&(n.baseRef===void 0||typeof n.baseRef=="string")&&(n.baseBranch===void 0||typeof n.baseBranch=="string")&&(n.currentBranch===void 0||n.currentBranch===null||typeof n.currentBranch=="string")&&(n.headRef===void 0||n.headRef===null||typeof n.headRef=="string")&&(n.diffFingerprint===void 0||typeof n.diffFingerprint=="string")&&(n.stat===void 0||typeof n.stat=="string")&&(n.files===void 0||ul(n.files))&&(n.hunks===void 0||Array.isArray(n.hunks)&&n.hunks.every(kb))&&(n.commits===void 0||ul(n.commits))&&(n.commitCount===void 0||typeof n.commitCount=="number")&&(n.diff===void 0||typeof n.diff=="string")&&(n.truncated===void 0||typeof n.truncated=="boolean")&&(n.error===void 0||typeof n.error=="string")}function jb(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.key=="string"&&Sb(n.diff)&&typeof n.repoLabel=="string"&&typeof n.createdAt=="number"}function Rb(r){return!r||typeof r!="object"||Array.isArray(r)?!1:Object.values(r).every(n=>{if(!n||typeof n!="object"||Array.isArray(n))return!1;const s=n;return Array.isArray(s.selectedRepoRoots)&&s.selectedRepoRoots.every(l=>typeof l=="string")&&!!s.repoTargetBranches&&typeof s.repoTargetBranches=="object"&&!Array.isArray(s.repoTargetBranches)&&Object.values(s.repoTargetBranches).every(l=>typeof l=="string")&&(s.repoBaseBranches===void 0||!!s.repoBaseBranches&&typeof s.repoBaseBranches=="object"&&!Array.isArray(s.repoBaseBranches)&&Object.values(s.repoBaseBranches).every(l=>typeof l=="string"))&&(s.previewEntries===void 0||Array.isArray(s.previewEntries)&&s.previewEntries.every(jb))&&(s.selectedPreviewKey===void 0||s.selectedPreviewKey===null||typeof s.selectedPreviewKey=="string")&&(s.selectedPreviewFileKey===void 0||s.selectedPreviewFileKey===null||typeof s.selectedPreviewFileKey=="string")&&(s.previewDetailOpen===void 0||typeof s.previewDetailOpen=="boolean")&&(s.previewScrollTops===void 0||!!s.previewScrollTops&&typeof s.previewScrollTops=="object"&&!Array.isArray(s.previewScrollTops)&&Object.values(s.previewScrollTops).every(l=>typeof l=="number"))&&(s.previewMobileSlideIndex===void 0||typeof s.previewMobileSlideIndex=="number")&&(s.repoIncludeUncommitted===void 0||!!s.repoIncludeUncommitted&&typeof s.repoIncludeUncommitted=="object"&&!Array.isArray(s.repoIncludeUncommitted)&&Object.values(s.repoIncludeUncommitted).every(l=>typeof l=="boolean"))&&(s.includeUncommitted===void 0||typeof s.includeUncommitted=="boolean")&&typeof s.updatedAt=="number"})}function du(){return ht(sf,Rb)??{}}function uu(r){return[r.repoRoot,r.baseRef,r.branchName??"",r.headRef??"",r.diffFingerprint??""].join("\0")}function fu(r){const n=r?.trim()??"",s=n.indexOf("/");return s>=0?n.slice(s+1):n}function hf(r,n){const s=r?.trim(),l=n?.trim();return!s||!l?!1:s===l||fu(s)===fu(l)}function hu(r){const n=r?.branch??null;return[r?.upstream,...r?.remoteBranches??[],...r?.branches??[]].find(l=>l&&!hf(l,n))??""}function fl(r,n){const s=Math.max(ou,n-320),l=Math.min(db,s);return Math.min(l,Math.max(ou,r))}function Cb(r){return typeof r=="number"&&Number.isFinite(r)}function Nb(r){return fl(ht(zs,Cb)??cl,r)}function mf(r){const n=r.split(/[\\/]/).pop()??r,s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function _s(r){return ub.has(mf(r))}function pf(r){const n=r.trim().replace(/\s+/g,"");return/^-{3,}$/.test(n)||/^\*{3,}$/.test(n)||/^_{3,}$/.test(n)}function hl(r){const n=r.trim();return/^#{1,6}\s+/.test(n)||pf(r)||/^>\s?/.test(n)||/^(```|~~~)/.test(n)||/^(?:[-+*]|\d+[.)])\s+/.test(n)}function gf(r){const n=r.trim();return/^(https?:|mailto:|#|\/|\.\/|\.\.\/)/i.test(n)||!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!/[<>]/.test(n)?n:null}const bf=a.createContext(null);function ho(r){return r.trim().replace(/\s+/g," ").toLowerCase()}function xf(r){return r.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/[`*_~]/g,"").replace(/<[^>]+>/g,"").trim()}function vf(r){return r.replace(/\s+#+\s*$/,"").trim()}function ml(r,n){const l=xf(r).toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-")||"section",f=n.headingSlugCounts.get(l)??0;return n.headingSlugCounts.set(l,f+1),f===0?l:`${l}-${f}`}function mu(r){return xf(r)||r.trim()}function vo(r){const n=r.match(/^\s{0,3}\[([^\]]+)\]:\s+(.+?)\s*$/);if(!n)return null;const s=gl(n[2]);return s?{id:ho(n[1]),definition:{href:s.href,title:s.title}}:null}function Eb(r){const n=new Map;for(const s of r){const l=vo(s);l&&n.set(l.id,l.definition)}return n}function wf(r){return r.trim().toLowerCase()}function yf(r){const n=r.match(/^\s{0,3}\[\^([^\]]+)\]:\s+(.+)\s*$/);return n?{id:wf(n[1]),text:n[2]}:null}function Mb(r){const n=new Map;let s=null;for(const l of r){const f=yf(l);if(f){s=f.id,n.set(f.id,{id:f.id,text:f.text,index:n.size+1});continue}if(s&&/^\s{4,}\S/.test(l)){const d=n.get(s);d&&(d.text=`${d.text} ${l.trim()}`);continue}l.trim()&&(s=null)}return n}function kf(r){const n=new Set;let s=!1;return r.forEach((l,f)=>{if(yf(l)){n.add(f),s=!0;return}if(s&&/^\s{4,}\S/.test(l)){n.add(f);return}l.trim()&&(s=!1)}),n}function $b(r){const n=[...r];let s=0;const l=r[0]?.trim();if(l==="---"||l==="+++"){for(n[0]="",s=1;s<r.length&&r[s].trim()!==l;)n[s]="",s+=1;s<r.length&&(n[s]="",s+=1)}for(;s<r.length;){const f=r[s].trim();if(f.startsWith("<!--")){if(n[s]="",!f.includes("-->")){for(s+=1;s<r.length&&!r[s].includes("-->");)n[s]="",s+=1;s<r.length&&(n[s]="")}s+=1;continue}s+=1}return n}function Sf(r){const n=r.replace(/\/+$/,""),s=n.lastIndexOf("/");return s<=0?s===0?"/":"":n.slice(0,s)}function qs(r){const n=r.split(/[?#]/,1)[0],s=n.startsWith("/"),l=[];for(const d of n.split("/"))if(!(!d||d===".")){if(d===".."){l.length>0&&l.pop();continue}l.push(d)}return`${s?"/":""}${l.join("/")}`||(s?"/":".")}function jl(r,n,s){const l=r.trim();if(!l||/^(?:https?:|mailto:|javascript:|data:)/i.test(l)||/^[a-z][a-z0-9+.-]*:/i.test(l))return null;if(l.startsWith("#")){if(!n)return null;try{return{path:n,fragment:decodeURIComponent(l.slice(1))||null,directory:!1}}catch{return null}}const f=l.indexOf("#"),d=f>=0?l.slice(0,f):l,h=f>=0?l.slice(f+1):"",g=d.split("?",1)[0];if(!g)return null;let p,m=null;try{p=decodeURIComponent(g),m=h?decodeURIComponent(h):null}catch{return null}const u=s?qs(s):null;let y;if(p.startsWith("/")){const b=u&&(p===u||p.startsWith(`${u}/`));y=qs(u&&!b?`${u}/${p.slice(1)}`:p)}else{if(!n)return null;y=qs(`${Sf(n)}/${p}`)}return u&&y!==u&&!y.startsWith(`${u}/`)?null:{path:y,fragment:m,directory:/\/$/.test(g)}}function Rl(r,n,s,l,f){const d=r.trim();if(!d||/^(?:javascript|data):/i.test(d))return null;if(/^https?:\/\//i.test(d))return d;if(!l(d.split(/[?#]/,1)[0]))return null;let h;if(d.startsWith("/")){const g=s&&(d===s||d.startsWith(`${s}/`));h=qs(s&&!g?`${s}/${d.slice(1)}`:d)}else{if(!n)return null;h=qs(`${Sf(n)}/${d}`)}return f(h)}function Ab(r,n,s){return Rl(r,n,s,wl,l=>`/api/terminal/fs/blob?path=${encodeURIComponent(l)}`)}function Lb(r,n,s){return Rl(r,n,s,Nu,Eu)}const pl=128,Pb=360,zi=480;function No(r){try{return/\.svg(?=$|[?#&])/i.test(decodeURIComponent(r))}catch{return!1}}function jf(r,n,s,l,f=0){if(!n||!s)return null;let d,h;return f>0?(d=l>0?Math.min(f,l):f,h=s*d/n):No(r)?(h=Math.min(Math.max(s,pl),Pb),d=n*h/s):(d=n,h=s),l>0&&d>l&&(h=h*l/d,d=l),h>zi&&(d=d*zi/h,h=zi),{width:Math.max(1,Math.round(d)),height:Math.max(1,Math.round(h))}}function Tb(r){if(!r.startsWith("/api/terminal/fs/blob?"))return null;try{return new URLSearchParams(r.slice(r.indexOf("?"))).get("path")}catch{return null}}function Rf(r){const n=Tb(r),s=Y(l=>n?(l.fileChangeVersions.get(n)??0)+l.fileWatchEpoch:0);return n&&s>0?`${r}&v=${s}`:r}function Ib({src:r,alt:n,title:s,requestedWidthPx:l}){const f=No(r),d=Rf(r),h=Ro(d),g=a.useRef(null),[p,m]=a.useState(!1),[u,y]=a.useState(0),[b,E]=a.useState({status:"loading"}),[L,F]=a.useState(null);a.useLayoutEffect(()=>{const C=g.current,N=C?.parentElement?.parentElement??C?.parentElement;if(!N)return;const P=()=>y(N.clientWidth);if(P(),typeof ResizeObserver>"u")return;const U=new ResizeObserver(P);return U.observe(N),()=>U.disconnect()},[]),a.useEffect(()=>{if(p)return;const C=g.current;if(!C||typeof IntersectionObserver>"u"){m(!0);return}const N=new IntersectionObserver(P=>{P.some(U=>U.isIntersecting)&&(m(!0),N.disconnect())},{rootMargin:"400px"});return N.observe(C),()=>N.disconnect()},[p]),a.useEffect(()=>{if(!p)return;const C=new AbortController;let N=null;E({status:"loading"});const P=window.setTimeout(()=>{C.abort(new DOMException("Image fetch timed out","TimeoutError"))},15e3);return Hm(d,{signal:C.signal}).then(async U=>{if(!U.ok)throw new Error(`HTTP ${U.status}`);const T=Number(U.headers.get("X-Image-Width"))||0,k=Number(U.headers.get("X-Image-Height"))||0;return{blob:await U.blob(),width:T,height:k}}).then(({blob:U,width:T,height:k})=>{C.signal.aborted||(N=URL.createObjectURL(U),T>0&&k>0&&F({width:T,height:k}),E({status:"ready",objectUrl:N}))}).catch(()=>{const U=C.signal.reason;C.signal.aborted&&!(U instanceof DOMException&&U.name==="TimeoutError")||E({status:"fallback"})}).finally(()=>{window.clearTimeout(P)}),()=>{window.clearTimeout(P),C.abort(),N&&URL.revokeObjectURL(N)}},[p,d]);const B=jf(r,L?.width??0,L?.height??0,u,l??0),_=B??(l?{width:u>0?Math.min(l,u):l,height:Math.round(l*.75)}:{width:pl*2,height:pl});return t.jsx("div",{ref:g,className:"block max-w-full",style:B?{width:B.width,height:B.height}:void 0,children:b.status==="ready"?t.jsx("img",{src:b.objectUrl,alt:n,title:s,decoding:"async",className:`${f?"":"termdock-fade-in "}block max-h-[480px] max-w-full object-contain`,style:B?{width:B.width,height:B.height}:void 0,onLoad:C=>{if(L)return;const N=C.currentTarget;N.naturalWidth>0&&N.naturalHeight>0&&F({width:N.naturalWidth,height:N.naturalHeight})}}):b.status==="fallback"?t.jsx("img",{src:h,alt:n,title:s,loading:"lazy",decoding:"async",className:"block max-h-[480px] max-w-full object-contain",style:B?{width:B.width,height:B.height}:void 0,onLoad:C=>{if(L)return;const N=C.currentTarget;N.naturalWidth>0&&N.naturalHeight>0&&F({width:N.naturalWidth,height:N.naturalHeight})}}):t.jsx("div",{"aria-hidden":!0,className:"flex max-w-full animate-pulse items-center justify-center rounded bg-surface-elevated/60",style:{width:_.width,height:_.height},children:t.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:n||"…"})})})}function Vs(r,n,s,l,f,d){const h=Ab(s,f.markdownFilePath,f.rootPath);if(!h)return d?.fallbackText??`![${n}](${s})`;const g=f.images.length;f.images.push({kind:"image",src:h,alt:n,title:l});const p=t.jsx(Ib,{src:h,alt:n,title:l,requestedWidthPx:d?.requestedWidthPx});return f.onImageOpen&&d?.interactive!==!1?t.jsx("button",{type:"button",className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2 text-left transition hover:border-border-strong focus:outline-none focus:ring-2 focus:ring-ring/45",title:l||n||"Open image",onClick:m=>{m.stopPropagation(),f.onImageOpen?.(g)},children:p},r):t.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:p},r)}function Wi(r){let n=r,s="";for(;/[.,;:!?)]$/.test(n);)s=`${n.slice(-1)}${s}`,n=n.slice(0,-1);return{linkText:n,suffix:s}}function pu(r){return/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/.test(r)}function gl(r){const n=r.trim(),s=n.match(/^<([^>]+)>(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(s)return{href:s[1],title:s[2]??s[3]??s[4]};const l=n.match(/^(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);return l?{href:l[1],title:l[2]??l[3]??l[4]}:null}const Cf="",Db=/\\([\\`*{}\[\]#+\-.!_|~>$])/g;function Fb(r){return r.replace(Db,(n,s)=>`${Cf}${s.charCodeAt(0).toString(16).padStart(4,"0")}`)}function gu(r){return r.replace(new RegExp(`${Cf}([0-9a-f]{4})`,"g"),(n,s)=>String.fromCharCode(Number.parseInt(s,16))).replace(/\\([()])/g,"$1")}function _b(r){const n=r.replace(/[\r\n]+/g," ");return/^ .+ $/.test(n)&&/[^ ]/.test(n.slice(1,-1))?n.slice(1,-1):n}const Nf={ALLOWED_TAGS:["a","abbr","b","blockquote","br","code","del","details","div","em","i","kbd","li","mark","ol","p","pre","s","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],ALLOWED_ATTR:["href","title","class","id","colspan","rowspan"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!0};let ro=null;function Ef(){return ro||(ro=Js(()=>import("./purify.es-4eNOHKSq.js"),[]).then(r=>r.default??r).catch(r=>{throw ro=null,r})),ro}function Mf({html:r}){const{t:n}=kt(),[s,l]=a.useState(null);return a.useEffect(()=>{let f=!1;return l(null),Ef().then(d=>{f||l(d.sanitize(r,Nf))}).catch(()=>{f||l("")}),()=>{f=!0}},[r]),s===null?t.jsx("div",{className:"py-2 text-xs text-muted-foreground",children:n("rightSidebar.renderingHtml")}):s?t.jsx("div",{className:"text-muted-foreground",dangerouslySetInnerHTML:{__html:s}}):null}function Bb({html:r}){const[n,s]=a.useState(null);return a.useEffect(()=>{let l=!1;return s(null),Ef().then(f=>{l||s(f.sanitize(r,Nf))}).catch(()=>{l||s("")}),()=>{l=!0}},[r]),n===null?null:n?t.jsx("span",{dangerouslySetInnerHTML:{__html:n}}):r}function $f(r){const n=r.trim().match(/^<(div|section|article|aside|table|p|ul|ol|li|blockquote|pre|figure|figcaption)\b[^>]*>/i);if(!n)return null;const s=n[1].toLowerCase();return{tag:s,selfContained:new RegExp(`</${s}>`,"i").test(r)}}let no=null;function Ob(){return no||(no=Promise.all([Js(()=>import("./katex-DnlPpQZa.js"),[]),Js(()=>Promise.resolve({}),__vite__mapDeps([16]))]).then(([r])=>r.default??r).catch(r=>{throw no=null,r})),no}function Zs({tex:r,display:n=!1}){const[s,l]=a.useState(null),[f,d]=a.useState(!1);if(a.useEffect(()=>{let g=!1;return l(null),d(!1),Ob().then(p=>{g||l(p.renderToString(r,{displayMode:n,throwOnError:!1,trust:!1,strict:"ignore"}))}).catch(()=>{g||d(!0)}),()=>{g=!0}},[n,r]),f)return t.jsx("code",{className:"rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground",children:n?`$$${r}$$`:`$${r}$`});if(!s)return t.jsx("span",{className:"text-muted-foreground/70",children:n?"Rendering formula...":r});const h=n?"my-2 overflow-auto rounded-md bg-surface-2 px-3 py-2 text-center":"inline-block align-middle";return t.jsx("span",{className:h,dangerouslySetInnerHTML:{__html:s}})}function Cl(r){const n=new Map;for(const s of r.matchAll(/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/gi))n.set(s[1].toLowerCase(),s[2]??s[3]??s[4]);return n}function bu(r){const n=Cl(r),s=n.get("src")?.trim()??"",l=n.get("width")?.trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i);return{src:s,alt:n.get("alt"),title:n.get("title"),widthPx:l?Number(l[1]):void 0}}function Ub(r){const n=r.indexOf(">"),s=n<0?r:r.slice(0,n+1),l=Cl(s),f=l.get("src")?.trim()??"",d=l.get("width")?.trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i),h=s.replace(/=\s*(?:"[^"]*"|'[^']*')/g," "),g=n<0?"":r.slice(n+1).replace(/<\/video\s*>$/i,"").replace(/<[^>]*>/g,"").trim();return{src:f,fallbackText:g,widthPx:d?Number(d[1]):void 0,controls:/\bcontrols\b/i.test(h)}}function Hb({url:r,fallbackText:n,widthPx:s,hasControls:l}){const{t:f}=kt(),[d,h]=a.useState(!1),g=Ro(r,()=>h(!0));return g?t.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:d?t.jsx("span",{className:"block px-3 py-2 text-xs text-muted-foreground",children:n?.trim()||f("rightSidebar.videoUnsupported")}):t.jsx("video",{className:"block max-w-full",src:g,style:s?{width:`${s}px`}:void 0,controls:l,preload:"metadata",playsInline:!0,onError:()=>h(!0)})}):null}function zb(r,n,s){if(/^<a\b[^>]*>\s*<\s*img\b[^>]*>\s*<\/a\s*>$/i.test(r)){const h=r.slice(0,r.indexOf(">")+1),g=Cl(h).get("href")?.trim()??"",p=r.match(/<\s*img\b[^>]*>/i)?.[0]??"",{src:m,alt:u,title:y,widthPx:b}=bu(p);if(!m)return null;const E=Rl(m,s.markdownFilePath,s.rootPath,wl,C=>C);if(!E)return null;const L=g?jl(g,s.markdownFilePath,s.rootPath):null,B=!!!(L&&L.path===E)&&g?gf(g):null,_=Vs(n,u??"",m,y,s,{requestedWidthPx:b,interactive:B?!1:void 0});return B?t.jsx("a",{href:B,target:"_blank",rel:"noreferrer",children:_},n):_}if(/^<\s*img\b[^>]*>$/i.test(r)){const{src:h,alt:g,title:p,widthPx:m}=bu(r);return h?Vs(n,g??"",h,p,s,{fallbackText:r,requestedWidthPx:m}):null}if(/^<\s*video\b[^>]*>[\s\S]*?<\/video\s*>$/i.test(r)){const{src:h,fallbackText:g,widthPx:p,controls:m}=Ub(r);if(!h)return null;const u=Lb(h,s.markdownFilePath,s.rootPath);return u?t.jsx(Hb,{url:u,fallbackText:g,widthPx:p,hasControls:m},n):null}if(/^<br\s*\/?>$/i.test(r))return t.jsx("br",{},n);const l=r.match(/^<(kbd|mark|sub|sup)>(.*?)<\/\1>$/i);if(!l)return/^<(a|abbr|span|b|strong|em|i|u|s|del|code)\b[\s\S]*<\/\1>$/i.test(r)?t.jsx(Bb,{html:r},n):null;const f=l[1].toLowerCase(),d=ct(l[2],`${n}-${f}`,!0,s);return f==="kbd"?t.jsx("kbd",{className:"rounded border border-border/30 bg-surface-2 px-1.5 py-0.5 font-mono text-[0.85em] text-foreground shadow-sm",children:d},n):f==="mark"?t.jsx("mark",{className:"rounded bg-warning/25 px-0.5 text-foreground",children:d},n):f==="sub"?t.jsx("sub",{children:d},n):t.jsx("sup",{children:d},n)}function ct(r,n,s=!0,l){const f=Fb(r),d=/(\\\([^)]*\\\)|\$[^$\n]+\$|<br\s*\/?>|<\s*img\b[^>]*>|<\s*video\b[^>]*>[\s\S]*?<\/video\s*>|<(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)\b[\s\S]*?<\/(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)>|!?\[[^\]]*\]\((?:<[^>]+>|(?:[^\s()]+|\([^()\s]*\))+)(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\)|!?\[[^\]]+\]\[[^\]]*\]|!?\[[^\]]+\]|\[\^[^\]]+\]|(`+)([\s\S]*?)\2|~~[^~]+~~|\*\*[^*]+\*\*|__[^_]+__|\*[^*\s][^*]*\*|_[^_\s][^_]*_|<https?:\/\/[^>\s]+>|<[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+>|https?:\/\/[^\s<]+|www\.[^\s<]+|[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+)/gi,h=[];let g=0,p;for(;(p=d.exec(f))!==null;){p.index>g&&h.push(gu(f.slice(g,p.index)));const m=p[0],u=`${n}-${p.index}`,y=m.startsWith("<")?zb(m,u,l):null;if(y)h.push(y);else if(m.startsWith("\\(")&&m.endsWith("\\)"))h.push(t.jsx(Zs,{tex:m.slice(2,-2)},u));else if(m.startsWith("$")&&m.endsWith("$"))h.push(t.jsx(Zs,{tex:m.slice(1,-1)},u));else if(m.startsWith("`")){const b=m.match(/^`+/)?.[0].length??1;h.push(t.jsx("code",{className:`${s?"break-all":"whitespace-nowrap"} rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground`,children:_b(m.slice(b,-b))},u))}else if(m.startsWith("~~"))h.push(t.jsx("del",{className:"text-muted-foreground decoration-border-strong",children:ct(m.slice(2,-2),`${u}-del`,s,l)},u));else if(m.startsWith("**")||m.startsWith("__"))h.push(t.jsx("strong",{className:"font-semibold text-foreground",children:ct(m.slice(2,-2),`${u}-strong`,s,l)},u));else if(m.startsWith("*")||m.startsWith("_"))h.push(t.jsx("em",{className:"italic",children:ct(m.slice(1,-1),`${u}-em`,s,l)},u));else if(m.startsWith("![")){const b=m.match(/^!\[([^\]]*)\]\((.*)\)$/),E=m.match(/^!\[([^\]]+)\]\[([^\]]*)\]$/),L=m.match(/^!\[([^\]]+)\]$/);if(b){const F=gl(b[2]);h.push(F?Vs(u,b[1],F.href,F.title,l):m)}else if(E){const F=E[2]||E[1],B=l.referenceDefinitions.get(ho(F));h.push(B?Vs(u,E[1],B.href,B.title,l):m)}else if(L){const F=l.referenceDefinitions.get(ho(L[1]));h.push(F?Vs(u,L[1],F.href,F.title,l):m)}else h.push(m)}else if(m.startsWith("[^")){const b=wf(m.slice(2,-1)),E=l.footnoteDefinitions.get(b);h.push(E?t.jsx("sup",{id:`fnref-${E.id}`,title:E.text,className:"ml-0.5 rounded bg-surface-2 px-1 text-[0.72em] font-semibold text-primary",children:t.jsx("a",{href:`#fn-${E.id}`,className:"text-primary no-underline",children:E.index})},u):m)}else if(m.startsWith("<http")){const b=m.slice(1,-1);h.push(t.jsx("a",{href:b,target:"_blank",rel:"noreferrer",className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u))}else if(m.startsWith("<")&&m.endsWith(">")&&pu(m.slice(1,-1))){const b=m.slice(1,-1);h.push(t.jsx("a",{href:`mailto:${b}`,className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u))}else if(pu(Wi(m).linkText)){const{linkText:b,suffix:E}=Wi(m);h.push(t.jsx("a",{href:`mailto:${b}`,className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u)),E&&h.push(E)}else if(m.startsWith("http")||m.startsWith("www.")){const{linkText:b,suffix:E}=Wi(m),L=b.startsWith("www.")?`https://${b}`:b;h.push(t.jsx("a",{href:L,target:"_blank",rel:"noreferrer",className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u)),E&&h.push(E)}else{const b=m.match(/^\[([^\]]+)\]\((.*)\)$/),E=m.match(/^\[([^\]]+)\]\[([^\]]*)\]$/),L=m.match(/^\[([^\]]+)\]$/),F=E?E[2]||E[1]:L?.[1]??null,B=F?l.referenceDefinitions.get(ho(F)):null,_=b?gl(b[2]):null,C=_?.href??B?.href??null,N=C?gf(C):null,P=b?.[1]??E?.[1]??L?.[1]??"";h.push(N?t.jsx("a",{href:N,title:_?.title??B?.title,target:"_blank",rel:"noreferrer",className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:ct(P,`${u}-link`,s,l)},u):m)}g=d.lastIndex}return g<f.length&&h.push(gu(f.slice(g))),h.length>0?h:[r]}function Af(r){return/(?: {2,}|\\)$/.test(r)}function Lf(r){return r.replace(/(?: {2,}|\\)$/,"")}function wo(r){return/^(?: {4}|\t)/.test(r)}function Pf(r){return r.startsWith(" ")?r.slice(1):r.replace(/^ {4}/,"")}function Tf(r,n,s){const l=[];return r.forEach((f,d)=>{const h=Af(f);l.push(...ct(Lf(f),`${n}-${d}`,!0,s)),d<r.length-1&&l.push(h?t.jsx("br",{},`${n}-${d}-br`):" ")}),l}function bl(r,n,s){const l=[],f=[];return r.forEach((d,h)=>{f.push(Af(d)),l.push(ct(Lf(d),`${n}-${h}`,!0,s))}),{perLine:l,hardBreaks:f}}function xl(r,n,s,l,f){const d=[];return r.forEach((h,g)=>{const p=s[g]??0,m=!!(f&&p>=f.start&&p<=f.end);d.push(t.jsx("span",{"data-md-ref-start":p,"data-md-ref-end":p,"data-selected":m?"true":void 0,children:h},`${l}-ref-${g}`)),g<r.length-1&&d.push(n[g]?t.jsx("br",{},`${l}-${g}-br`):" ")}),d}function ea(r){const n=r.trim().replace(/^\|/,"").replace(/\|$/,""),s=[];let l="",f=!1,d=0,h=0;for(let g=0;g<n.length;g+=1){const p=n[g];if(f){l+=p,f=!1;continue}if(p==="\\"){f=!0;continue}if(p==="`"){const m=g;for(;g+1<n.length&&n[g+1]==="`";)g+=1;const u=g-m+1;l+="`".repeat(u),d===0?d=u:d===u&&(d=0);continue}if(d===0&&p==="["?h+=1:d===0&&p==="]"&&h>0&&(h-=1),p==="|"&&d===0&&h===0){s.push(l.trim()),l="";continue}l+=p}return f&&(l+="\\"),s.push(l.trim()),s}function If(r){return ea(r).map(n=>/^:-+:$/.test(n)?"center":/^-+:$/.test(n)?"right":/^:-+$/.test(n)?"left":null)}function yo(r){return r==="center"?"text-center":r==="right"?"text-right":"text-left"}function ko(r){return/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/.test(r.trim())}function Df(r,n){return r>96||r>44&&n>.35}function Eo(r){return(r.match(/^\s*/)?.[0]??"").replace(/\t/g," ").length}function ta(r){const n=r.trim().match(/^([-+*]|\d+[.)])\s+(.+)$/);if(!n)return null;const s=/^\d+[.)]$/.test(n[1]);return{ordered:s,start:s?Number.parseInt(n[1],10):void 0,content:n[2]}}function Nl(r,n,s,l,f,d=new Set){const h=[],g=[];let p=n;for(;p<r.length;){const m=r[p];if(f&&(vo(m)||d.has(p))){p+=1;continue}const u=ta(m),y=Eo(m);if(!u){if(y>s&&g.length>0){([...g].reverse().find(F=>F.indent<y)?.item??g[g.length-1].item).paragraphs.push(m.trim());for(const F of g)F.item.lineEnd=p+1;p+=1;continue}break}if(y<s||y===s&&u.ordered!==l)break;const b={content:u.content,ordered:u.ordered,start:u.start,children:[],paragraphs:[],lineStart:p+1,lineEnd:p+1};for(;g.length>0&&g[g.length-1].indent>=y;)g.pop();const E=g[g.length-1]?.item??null;E?E.children.push(b):h.push(b),g.push({indent:y,item:b});for(const L of g)L.item.lineEnd=p+1;p+=1}return{items:h,nextIndex:p}}function Wb(r){const n=r.find(l=>ta(l));if(!n)return[];const s=ta(n);return s?Nl(r,0,Eo(n),s.ordered,!0,kf(r)).items:[]}function El(r,n,s,l=0){return r.map((f,d)=>{const h=f.content.match(/^\[([ xX])\]\s+(.+)$/);return{key:`item-${d}`,taskItem:!!h,refStart:f.lineStart+l,refEnd:f.lineEnd+l,content:t.jsxs(t.Fragment,{children:[h?t.jsx("input",{type:"checkbox",checked:h[1].toLowerCase()==="x",readOnly:!0,className:"mr-2 align-[-2px] accent-primary"}):null,ct(h?.[2]??f.content,`li-${n}-${d}`,!0,s),f.paragraphs.length>0&&t.jsx("div",{className:"mt-1 space-y-1 text-muted-foreground",children:f.paragraphs.map((g,p)=>t.jsx("p",{children:ct(g,`li-${n}-${d}-p-${p}`,!0,s)},`paragraph-${p}`))})]}),groups:Gb(f.children,`${n}-${d}`,s,l)}})}function Gb(r,n,s,l=0){const f=[];for(const d of r){const h=f[f.length-1];h&&h.ordered===d.ordered?h.items.push(d):f.push({ordered:d.ordered,items:[d]})}return f.map((d,h)=>({ordered:d.ordered,start:d.ordered?d.items[0]?.start:void 0,items:El(d.items,`${n}-g${h}`,s,l)}))}function Ml(r,n){return r.map(s=>{const l=!!(n&&s.refStart<=n.end&&s.refEnd>=n.start);return t.jsxs("li",{className:s.taskItem?"list-none":void 0,"data-md-ref-start":s.refStart,"data-md-ref-end":s.refEnd,"data-selected":l?"true":void 0,children:[s.content,s.groups.length>0&&Kb(s.groups,n)]},s.key)})}function Kb(r,n){return r.map((s,l)=>{const f=s.ordered?"ol":"ul";return t.jsx(f,{start:s.start,className:`${s.ordered?"list-decimal":"list-disc"} mt-1 space-y-0.5 pl-4 marker:text-muted-foreground/60`,children:Ml(s.items,n)},`nested-${l}`)})}function qb(r){const n=Array.from(r.footnoteDefinitions.values()).sort((s,l)=>s.index-l.index);return n.length===0?null:t.jsxs("section",{className:"mt-3 border-t border-border/20 pt-2 text-[12px] leading-5 text-muted-foreground",children:[t.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/80",children:r.footnotesLabel}),t.jsx("ol",{className:"list-decimal space-y-1 pl-5",children:n.map(s=>t.jsxs("li",{id:`fn-${s.id}`,children:[ct(s.text,`footnote-${s.id}`,!0,r)," ",t.jsx("a",{href:`#fnref-${s.id}`,className:"text-primary no-underline","aria-label":r.backToFootnoteLabel(s.index),children:"↩"})]},s.id))})]})}function Vb(r,n,s,l){const f=[];let d=0;const h=g=>l?.[g]??g+1;for(;d<r.length;){const g=r[d],p=g.trim();if(!p){d+=1;continue}if(/^<details>\s*$/i.test(p)){const _=d;let C="Details";const N=[];for(d+=1;d<r.length&&!/^<\/details>\s*$/i.test(r[d].trim());){const P=r[d].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);P?C=P[1].trim()||C:N.push(r[d].trimStart()),d+=1}d<r.length&&(d+=1),f.push({kind:"static",node:t.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[t.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:ct(C,`${n}-details-${_}-summary`,!0,s)}),N.length>0&&t.jsx("div",{className:"mt-2 text-sm leading-6",children:Tf(N,`${n}-details-${_}`,s)})]},`${n}-details-${_}`)});continue}const m=$f(g);if(m){const _=[g],C=d;for(d+=1;d<r.length&&!m.selfContained&&!new RegExp(`</${m.tag}>`,"i").test(r[d]);)_.push(r[d]),d+=1;d<r.length&&!m.selfContained&&(_.push(r[d]),d+=1),f.push({kind:"static",node:t.jsx(Mf,{html:_.join(`
1638
+ `);const b=f.length;f+=u.data,l.push({node:u,start:b,end:f.length,group:y}),d=y}const g=f.toLocaleLowerCase(),p=[];let m=0;for(;m<=g.length-s.length;){const u=g.indexOf(s,m);if(u<0)break;const y=u+s.length,b=l.find(L=>L.start<=u&&L.end>u),E=l.find(L=>L.start<y&&L.end>=y);if(b&&E&&b.group===E.group){const L=document.createRange();L.setStart(b.node,u-b.start),L.setEnd(E.node,y-E.start),p.push(L)}m=u+Math.max(s.length,1)}return p}function Ju(){return typeof CSS<"u"&&CSS.highlights?CSS.highlights:null}function to(){const r=Ju();r?.delete(Xu),r?.delete(ll)}function Zd(r,n){const s=Ju();if(!s||typeof Highlight>"u")return;s.set(Xu,new Highlight(...r));const l=r[n];l?s.set(ll,new Highlight(l)):s.delete(ll)}function eu(r){r?.startContainer.parentElement?.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})}function Vg(r){return Array.from(new Set(r.split(/[\n,]/).map(n=>n.trim().replace(/^!+/,"")).filter(Boolean))).slice(0,24)}function Yg(r,n){const s=n.trim();return!s||s==="."?r:/^(?:[/\\]|[A-Za-z]:[/\\])/.test(s)?s.replace(/[\\/]+$/,""):`${r.replace(/[\\/]+$/,"")}/${s.replace(/^\.?[\\/]+/,"").replace(/[\\/]+$/,"")}`}function Xg(r,n){if(n===r)return".";const s=`${r.replace(/[\\/]+$/,"")}/`;return n.startsWith(s)?n.slice(s.length):n}function Qu(r,n,s){return n?r:Fr.createPortal(r,s)}const yl="termdock:right-sidebar:file-tree-scroll:v1",kl="termdock:right-sidebar:file-preview-reading-state:v1",zs="termdock:right-sidebar:file-tree-width:v1",Zu="termdock:right-sidebar:markdown-view-mode:v1",ef="termdock:right-sidebar:diff-change-list-mode:v1",tf="termdock:right-sidebar:diff-wrap:v1",rf="termdock:diff-viewer:view-type:v1",nf="termdock:right-sidebar:file-search-mode:v1",_i="termdock:right-sidebar:collapsed-git-repo-groups:v1",tu="termdock:right-sidebar:collapsed-diff-directories:v1",Bi="termdock:right-sidebar:branch-audit-module-open:v1",sf="termdock:right-sidebar:branch-audit-module:v1",Jg=150,ru="termdock:right-sidebar:context-draft-enabled:v1",nu="termdock:right-sidebar:context-draft-collapsed:v1",su="termdock:right-sidebar:context-draft-auto-collapse:v1",Oi="termdock:right-sidebar:context-draft-text:v1",Qg=300,Zg=20,eb=120,tb=250,rb=250,nb=120,sb=700,Ui=600,ab=6e4;function Fs(r){return!!(r&&Y.getState().nestedGitScanRoots[r])}const au=[2e3,5e3,15e3,3e4],ob=320,ib=500,lb=20,cb=12e3,cl=300,ou=240,db=560,af="border-r px-2 py-1.5 sm:px-3 sm:py-2",xo="min-w-full max-w-[18rem] whitespace-normal break-words sm:max-w-[27rem]",of=`${af} border-b border-border/15 font-semibold last:border-r-0`,lf=`${af} border-border/10 align-top text-muted-foreground last:border-r-0`,Sl="termdock-file-preview-horizontal-scroll",iu=a.lazy(()=>Js(()=>import("./ModelPreview-C3beTH3N.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),cf=`${Sl} termdock-md-table-scroll max-w-full overflow-x-auto overflow-y-hidden rounded-lg border border-border/20 bg-surface`;function df(r,n,s){return r&&!n?"unified":s}const ub=new Set([".md",".markdown",".mdown",".mkdn",".mkd"]);function fb(r){return r==="preview"||r==="source"}function hb(r){return r==="list"||r==="tree"||r==="ai"}function lu(){return ht(Zu,fb)??"preview"}function mb(){return ht(ef,hb)??"tree"}function Ws(r){return typeof r=="boolean"}function pb(r){return typeof r=="string"}function gb(){return ht(tf,Ws)??!0}function bb(r){return r==="unified"||r==="split"}function xb(){return ht(rf,bb)??"unified"}function vb(r){return r==="name"||r==="content"||r==="regex"}function wb(){return ht(nf,vb)??"name"}function uf(r){return r.repositories??(r.context?.root?[{id:r.context.root,root:r.context.root,relativeRoot:".",name:yt(r.context.root)||r.context.root,depth:0,nested:!1,available:r.available,files:r.files,context:r.context,error:r.error}]:[])}function yb(r,n){if(!n)return null;const s=new Set((r.repoFilters??[]).map(l=>l.root));return s.has(n)?n:s.size>0?null:(r.repositories??[]).some(l=>l.root===n)?n:null}function dl(r){return!r.activeGitRepoRoot&&(r.groupCount>1||r.label!==r.rootName)}function ff(...r){const n=new Set;for(const s of r)for(const l of s)n.add(l.root);return n}function ul(r){return Array.isArray(r)&&r.every(n=>typeof n=="string")}function cu(r){const n=ht(r,ul);return n?new Set(n):new Set}function Hi(r,n){At(r,[...n])}function kb(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.filePath=="string"&&typeof n.hunkHeader=="string"&&typeof n.hunkIndex=="number"&&typeof n.fingerprint=="string"&&typeof n.additions=="number"&&typeof n.deletions=="number"&&typeof n.diff=="string"&&(n.oldPath===void 0||n.oldPath===null||typeof n.oldPath=="string")&&(n.newPath===void 0||n.newPath===null||typeof n.newPath=="string")&&(n.source===void 0||n.source==="committed"||n.source==="uncommitted"||n.source==="unknown")&&(n.commit===void 0||n.commit===null||typeof n.commit=="string")}function Sb(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.available=="boolean"&&(n.repoRoot===void 0||typeof n.repoRoot=="string")&&(n.workspaceRoot===void 0||typeof n.workspaceRoot=="string")&&(n.baseRef===void 0||typeof n.baseRef=="string")&&(n.baseBranch===void 0||typeof n.baseBranch=="string")&&(n.currentBranch===void 0||n.currentBranch===null||typeof n.currentBranch=="string")&&(n.headRef===void 0||n.headRef===null||typeof n.headRef=="string")&&(n.diffFingerprint===void 0||typeof n.diffFingerprint=="string")&&(n.stat===void 0||typeof n.stat=="string")&&(n.files===void 0||ul(n.files))&&(n.hunks===void 0||Array.isArray(n.hunks)&&n.hunks.every(kb))&&(n.commits===void 0||ul(n.commits))&&(n.commitCount===void 0||typeof n.commitCount=="number")&&(n.diff===void 0||typeof n.diff=="string")&&(n.truncated===void 0||typeof n.truncated=="boolean")&&(n.error===void 0||typeof n.error=="string")}function jb(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const n=r;return typeof n.key=="string"&&Sb(n.diff)&&typeof n.repoLabel=="string"&&typeof n.createdAt=="number"}function Rb(r){return!r||typeof r!="object"||Array.isArray(r)?!1:Object.values(r).every(n=>{if(!n||typeof n!="object"||Array.isArray(n))return!1;const s=n;return Array.isArray(s.selectedRepoRoots)&&s.selectedRepoRoots.every(l=>typeof l=="string")&&!!s.repoTargetBranches&&typeof s.repoTargetBranches=="object"&&!Array.isArray(s.repoTargetBranches)&&Object.values(s.repoTargetBranches).every(l=>typeof l=="string")&&(s.repoBaseBranches===void 0||!!s.repoBaseBranches&&typeof s.repoBaseBranches=="object"&&!Array.isArray(s.repoBaseBranches)&&Object.values(s.repoBaseBranches).every(l=>typeof l=="string"))&&(s.previewEntries===void 0||Array.isArray(s.previewEntries)&&s.previewEntries.every(jb))&&(s.selectedPreviewKey===void 0||s.selectedPreviewKey===null||typeof s.selectedPreviewKey=="string")&&(s.selectedPreviewFileKey===void 0||s.selectedPreviewFileKey===null||typeof s.selectedPreviewFileKey=="string")&&(s.previewDetailOpen===void 0||typeof s.previewDetailOpen=="boolean")&&(s.previewScrollTops===void 0||!!s.previewScrollTops&&typeof s.previewScrollTops=="object"&&!Array.isArray(s.previewScrollTops)&&Object.values(s.previewScrollTops).every(l=>typeof l=="number"))&&(s.previewMobileSlideIndex===void 0||typeof s.previewMobileSlideIndex=="number")&&(s.repoIncludeUncommitted===void 0||!!s.repoIncludeUncommitted&&typeof s.repoIncludeUncommitted=="object"&&!Array.isArray(s.repoIncludeUncommitted)&&Object.values(s.repoIncludeUncommitted).every(l=>typeof l=="boolean"))&&(s.includeUncommitted===void 0||typeof s.includeUncommitted=="boolean")&&typeof s.updatedAt=="number"})}function du(){return ht(sf,Rb)??{}}function uu(r){return[r.repoRoot,r.baseRef,r.branchName??"",r.headRef??"",r.diffFingerprint??""].join("\0")}function fu(r){const n=r?.trim()??"",s=n.indexOf("/");return s>=0?n.slice(s+1):n}function hf(r,n){const s=r?.trim(),l=n?.trim();return!s||!l?!1:s===l||fu(s)===fu(l)}function hu(r){const n=r?.branch??null;return[r?.upstream,...r?.remoteBranches??[],...r?.branches??[]].find(l=>l&&!hf(l,n))??""}function fl(r,n){const s=Math.max(ou,n-320),l=Math.min(db,s);return Math.min(l,Math.max(ou,r))}function Cb(r){return typeof r=="number"&&Number.isFinite(r)}function Nb(r){return fl(ht(zs,Cb)??cl,r)}function mf(r){const n=r.split(/[\\/]/).pop()??r,s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function _s(r){return ub.has(mf(r))}function pf(r){const n=r.trim().replace(/\s+/g,"");return/^-{3,}$/.test(n)||/^\*{3,}$/.test(n)||/^_{3,}$/.test(n)}function hl(r){const n=r.trim();return/^#{1,6}\s+/.test(n)||pf(r)||/^>\s?/.test(n)||/^(```|~~~)/.test(n)||/^(?:[-+*]|\d+[.)])\s+/.test(n)}function gf(r){const n=r.trim();return/^(https?:|mailto:|#|\/|\.\/|\.\.\/)/i.test(n)||!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!/[<>]/.test(n)?n:null}const bf=a.createContext(null);function ho(r){return r.trim().replace(/\s+/g," ").toLowerCase()}function xf(r){return r.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/[`*_~]/g,"").replace(/<[^>]+>/g,"").trim()}function vf(r){return r.replace(/\s+#+\s*$/,"").trim()}function ml(r,n){const l=xf(r).toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-")||"section",f=n.headingSlugCounts.get(l)??0;return n.headingSlugCounts.set(l,f+1),f===0?l:`${l}-${f}`}function mu(r){return xf(r)||r.trim()}function vo(r){const n=r.match(/^\s{0,3}\[([^\]]+)\]:\s+(.+?)\s*$/);if(!n)return null;const s=gl(n[2]);return s?{id:ho(n[1]),definition:{href:s.href,title:s.title}}:null}function Eb(r){const n=new Map;for(const s of r){const l=vo(s);l&&n.set(l.id,l.definition)}return n}function wf(r){return r.trim().toLowerCase()}function yf(r){const n=r.match(/^\s{0,3}\[\^([^\]]+)\]:\s+(.+)\s*$/);return n?{id:wf(n[1]),text:n[2]}:null}function Mb(r){const n=new Map;let s=null;for(const l of r){const f=yf(l);if(f){s=f.id,n.set(f.id,{id:f.id,text:f.text,index:n.size+1});continue}if(s&&/^\s{4,}\S/.test(l)){const d=n.get(s);d&&(d.text=`${d.text} ${l.trim()}`);continue}l.trim()&&(s=null)}return n}function kf(r){const n=new Set;let s=!1;return r.forEach((l,f)=>{if(yf(l)){n.add(f),s=!0;return}if(s&&/^\s{4,}\S/.test(l)){n.add(f);return}l.trim()&&(s=!1)}),n}function $b(r){const n=[...r];let s=0;const l=r[0]?.trim();if(l==="---"||l==="+++"){for(n[0]="",s=1;s<r.length&&r[s].trim()!==l;)n[s]="",s+=1;s<r.length&&(n[s]="",s+=1)}for(;s<r.length;){const f=r[s].trim();if(f.startsWith("<!--")){if(n[s]="",!f.includes("-->")){for(s+=1;s<r.length&&!r[s].includes("-->");)n[s]="",s+=1;s<r.length&&(n[s]="")}s+=1;continue}s+=1}return n}function Sf(r){const n=r.replace(/\/+$/,""),s=n.lastIndexOf("/");return s<=0?s===0?"/":"":n.slice(0,s)}function qs(r){const n=r.split(/[?#]/,1)[0],s=n.startsWith("/"),l=[];for(const d of n.split("/"))if(!(!d||d===".")){if(d===".."){l.length>0&&l.pop();continue}l.push(d)}return`${s?"/":""}${l.join("/")}`||(s?"/":".")}function jl(r,n,s){const l=r.trim();if(!l||/^(?:https?:|mailto:|javascript:|data:)/i.test(l)||/^[a-z][a-z0-9+.-]*:/i.test(l))return null;if(l.startsWith("#")){if(!n)return null;try{return{path:n,fragment:decodeURIComponent(l.slice(1))||null,directory:!1}}catch{return null}}const f=l.indexOf("#"),d=f>=0?l.slice(0,f):l,h=f>=0?l.slice(f+1):"",g=d.split("?",1)[0];if(!g)return null;let p,m=null;try{p=decodeURIComponent(g),m=h?decodeURIComponent(h):null}catch{return null}const u=s?qs(s):null;let y;if(p.startsWith("/")){const b=u&&(p===u||p.startsWith(`${u}/`));y=qs(u&&!b?`${u}/${p.slice(1)}`:p)}else{if(!n)return null;y=qs(`${Sf(n)}/${p}`)}return u&&y!==u&&!y.startsWith(`${u}/`)?null:{path:y,fragment:m,directory:/\/$/.test(g)}}function Rl(r,n,s,l,f){const d=r.trim();if(!d||/^(?:javascript|data):/i.test(d))return null;if(/^https?:\/\//i.test(d))return d;if(!l(d.split(/[?#]/,1)[0]))return null;let h;if(d.startsWith("/")){const g=s&&(d===s||d.startsWith(`${s}/`));h=qs(s&&!g?`${s}/${d.slice(1)}`:d)}else{if(!n)return null;h=qs(`${Sf(n)}/${d}`)}return f(h)}function Ab(r,n,s){return Rl(r,n,s,wl,l=>`/api/terminal/fs/blob?path=${encodeURIComponent(l)}`)}function Lb(r,n,s){return Rl(r,n,s,Nu,Eu)}const pl=128,Pb=360,zi=480;function No(r){try{return/\.svg(?=$|[?#&])/i.test(decodeURIComponent(r))}catch{return!1}}function jf(r,n,s,l,f=0){if(!n||!s)return null;let d,h;return f>0?(d=l>0?Math.min(f,l):f,h=s*d/n):No(r)?(h=Math.min(Math.max(s,pl),Pb),d=n*h/s):(d=n,h=s),l>0&&d>l&&(h=h*l/d,d=l),h>zi&&(d=d*zi/h,h=zi),{width:Math.max(1,Math.round(d)),height:Math.max(1,Math.round(h))}}function Tb(r){if(!r.startsWith("/api/terminal/fs/blob?"))return null;try{return new URLSearchParams(r.slice(r.indexOf("?"))).get("path")}catch{return null}}function Rf(r){const n=Tb(r),s=Y(l=>n?(l.fileChangeVersions.get(n)??0)+l.fileWatchEpoch:0);return n&&s>0?`${r}&v=${s}`:r}function Ib({src:r,alt:n,title:s,requestedWidthPx:l}){const f=No(r),d=Rf(r),h=Ro(d),g=a.useRef(null),[p,m]=a.useState(!1),[u,y]=a.useState(0),[b,E]=a.useState({status:"loading"}),[L,F]=a.useState(null);a.useLayoutEffect(()=>{const C=g.current,N=C?.parentElement?.parentElement??C?.parentElement;if(!N)return;const P=()=>y(N.clientWidth);if(P(),typeof ResizeObserver>"u")return;const U=new ResizeObserver(P);return U.observe(N),()=>U.disconnect()},[]),a.useEffect(()=>{if(p)return;const C=g.current;if(!C||typeof IntersectionObserver>"u"){m(!0);return}const N=new IntersectionObserver(P=>{P.some(U=>U.isIntersecting)&&(m(!0),N.disconnect())},{rootMargin:"400px"});return N.observe(C),()=>N.disconnect()},[p]),a.useEffect(()=>{if(!p)return;const C=new AbortController;let N=null;E({status:"loading"});const P=window.setTimeout(()=>{C.abort(new DOMException("Image fetch timed out","TimeoutError"))},15e3);return Hm(d,{signal:C.signal}).then(async U=>{if(!U.ok)throw new Error(`HTTP ${U.status}`);const T=Number(U.headers.get("X-Image-Width"))||0,k=Number(U.headers.get("X-Image-Height"))||0;return{blob:await U.blob(),width:T,height:k}}).then(({blob:U,width:T,height:k})=>{C.signal.aborted||(N=URL.createObjectURL(U),T>0&&k>0&&F({width:T,height:k}),E({status:"ready",objectUrl:N}))}).catch(()=>{const U=C.signal.reason;C.signal.aborted&&!(U instanceof DOMException&&U.name==="TimeoutError")||E({status:"fallback"})}).finally(()=>{window.clearTimeout(P)}),()=>{window.clearTimeout(P),C.abort(),N&&URL.revokeObjectURL(N)}},[p,d]);const B=jf(r,L?.width??0,L?.height??0,u,l??0),_=B??(l?{width:u>0?Math.min(l,u):l,height:Math.round(l*.75)}:{width:pl*2,height:pl});return t.jsx("div",{ref:g,className:"block max-w-full",style:B?{width:B.width,height:B.height}:void 0,children:b.status==="ready"?t.jsx("img",{src:b.objectUrl,alt:n,title:s,decoding:"async",className:`${f?"":"termdock-fade-in "}block max-h-[480px] max-w-full object-contain`,style:B?{width:B.width,height:B.height}:void 0,onLoad:C=>{if(L)return;const N=C.currentTarget;N.naturalWidth>0&&N.naturalHeight>0&&F({width:N.naturalWidth,height:N.naturalHeight})}}):b.status==="fallback"?t.jsx("img",{src:h,alt:n,title:s,loading:"lazy",decoding:"async",className:"block max-h-[480px] max-w-full object-contain",style:B?{width:B.width,height:B.height}:void 0,onLoad:C=>{if(L)return;const N=C.currentTarget;N.naturalWidth>0&&N.naturalHeight>0&&F({width:N.naturalWidth,height:N.naturalHeight})}}):t.jsx("div",{"aria-hidden":!0,className:"flex max-w-full animate-pulse items-center justify-center rounded bg-surface-elevated/60",style:{width:_.width,height:_.height},children:t.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:n||"…"})})})}function Vs(r,n,s,l,f,d){const h=Ab(s,f.markdownFilePath,f.rootPath);if(!h)return d?.fallbackText??`![${n}](${s})`;const g=f.images.length;f.images.push({kind:"image",src:h,alt:n,title:l});const p=t.jsx(Ib,{src:h,alt:n,title:l,requestedWidthPx:d?.requestedWidthPx});return f.onImageOpen&&d?.interactive!==!1?t.jsx("button",{type:"button",className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2 text-left transition hover:border-border-strong focus:outline-none focus:ring-2 focus:ring-ring/45",title:l||n||"Open image",onClick:m=>{m.stopPropagation(),f.onImageOpen?.(g)},children:p},r):t.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:p},r)}function Wi(r){let n=r,s="";for(;/[.,;:!?)]$/.test(n);)s=`${n.slice(-1)}${s}`,n=n.slice(0,-1);return{linkText:n,suffix:s}}function pu(r){return/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/.test(r)}function gl(r){const n=r.trim(),s=n.match(/^<([^>]+)>(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(s)return{href:s[1],title:s[2]??s[3]??s[4]};const l=n.match(/^(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);return l?{href:l[1],title:l[2]??l[3]??l[4]}:null}const Cf="",Db=/\\([\\`*{}\[\]#+\-.!_|~>$])/g;function Fb(r){return r.replace(Db,(n,s)=>`${Cf}${s.charCodeAt(0).toString(16).padStart(4,"0")}`)}function gu(r){return r.replace(new RegExp(`${Cf}([0-9a-f]{4})`,"g"),(n,s)=>String.fromCharCode(Number.parseInt(s,16))).replace(/\\([()])/g,"$1")}function _b(r){const n=r.replace(/[\r\n]+/g," ");return/^ .+ $/.test(n)&&/[^ ]/.test(n.slice(1,-1))?n.slice(1,-1):n}const Nf={ALLOWED_TAGS:["a","abbr","b","blockquote","br","code","del","details","div","em","i","kbd","li","mark","ol","p","pre","s","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],ALLOWED_ATTR:["href","title","class","id","colspan","rowspan"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!0};let ro=null;function Ef(){return ro||(ro=Js(()=>import("./purify.es-4eNOHKSq.js"),[]).then(r=>r.default??r).catch(r=>{throw ro=null,r})),ro}function Mf({html:r}){const{t:n}=kt(),[s,l]=a.useState(null);return a.useEffect(()=>{let f=!1;return l(null),Ef().then(d=>{f||l(d.sanitize(r,Nf))}).catch(()=>{f||l("")}),()=>{f=!0}},[r]),s===null?t.jsx("div",{className:"py-2 text-xs text-muted-foreground",children:n("rightSidebar.renderingHtml")}):s?t.jsx("div",{className:"text-muted-foreground",dangerouslySetInnerHTML:{__html:s}}):null}function Bb({html:r}){const[n,s]=a.useState(null);return a.useEffect(()=>{let l=!1;return s(null),Ef().then(f=>{l||s(f.sanitize(r,Nf))}).catch(()=>{l||s("")}),()=>{l=!0}},[r]),n===null?null:n?t.jsx("span",{dangerouslySetInnerHTML:{__html:n}}):r}function $f(r){const n=r.trim().match(/^<(div|section|article|aside|table|p|ul|ol|li|blockquote|pre|figure|figcaption)\b[^>]*>/i);if(!n)return null;const s=n[1].toLowerCase();return{tag:s,selfContained:new RegExp(`</${s}>`,"i").test(r)}}let no=null;function Ob(){return no||(no=Promise.all([Js(()=>import("./katex-DnlPpQZa.js"),[]),Js(()=>Promise.resolve({}),__vite__mapDeps([16]))]).then(([r])=>r.default??r).catch(r=>{throw no=null,r})),no}function Zs({tex:r,display:n=!1}){const[s,l]=a.useState(null),[f,d]=a.useState(!1);if(a.useEffect(()=>{let g=!1;return l(null),d(!1),Ob().then(p=>{g||l(p.renderToString(r,{displayMode:n,throwOnError:!1,trust:!1,strict:"ignore"}))}).catch(()=>{g||d(!0)}),()=>{g=!0}},[n,r]),f)return t.jsx("code",{className:"rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground",children:n?`$$${r}$$`:`$${r}$`});if(!s)return t.jsx("span",{className:"text-muted-foreground/70",children:n?"Rendering formula...":r});const h=n?"my-2 overflow-auto rounded-md bg-surface-2 px-3 py-2 text-center":"inline-block align-middle";return t.jsx("span",{className:h,dangerouslySetInnerHTML:{__html:s}})}function Cl(r){const n=new Map;for(const s of r.matchAll(/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/gi))n.set(s[1].toLowerCase(),s[2]??s[3]??s[4]);return n}function bu(r){const n=Cl(r),s=n.get("src")?.trim()??"",l=n.get("width")?.trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i);return{src:s,alt:n.get("alt"),title:n.get("title"),widthPx:l?Number(l[1]):void 0}}function Ub(r){const n=r.indexOf(">"),s=n<0?r:r.slice(0,n+1),l=Cl(s),f=l.get("src")?.trim()??"",d=l.get("width")?.trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i),h=s.replace(/=\s*(?:"[^"]*"|'[^']*')/g," "),g=n<0?"":r.slice(n+1).replace(/<\/video\s*>$/i,"").replace(/<[^>]*>/g,"").trim();return{src:f,fallbackText:g,widthPx:d?Number(d[1]):void 0,controls:/\bcontrols\b/i.test(h)}}function Hb({url:r,fallbackText:n,widthPx:s,hasControls:l}){const{t:f}=kt(),[d,h]=a.useState(!1),g=Ro(r,()=>h(!0));return g?t.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:d?t.jsx("span",{className:"block px-3 py-2 text-xs text-muted-foreground",children:n?.trim()||f("rightSidebar.videoUnsupported")}):t.jsx("video",{className:"block max-w-full",src:g,style:s?{width:`${s}px`}:void 0,controls:l,preload:"metadata",playsInline:!0,onError:()=>h(!0)})}):null}function zb(r,n,s){if(/^<a\b[^>]*>\s*<\s*img\b[^>]*>\s*<\/a\s*>$/i.test(r)){const h=r.slice(0,r.indexOf(">")+1),g=Cl(h).get("href")?.trim()??"",p=r.match(/<\s*img\b[^>]*>/i)?.[0]??"",{src:m,alt:u,title:y,widthPx:b}=bu(p);if(!m)return null;const E=Rl(m,s.markdownFilePath,s.rootPath,wl,C=>C);if(!E)return null;const L=g?jl(g,s.markdownFilePath,s.rootPath):null,B=!!!(L&&L.path===E)&&g?gf(g):null,_=Vs(n,u??"",m,y,s,{requestedWidthPx:b,interactive:B?!1:void 0});return B?t.jsx("a",{href:B,target:"_blank",rel:"noreferrer",children:_},n):_}if(/^<\s*img\b[^>]*>$/i.test(r)){const{src:h,alt:g,title:p,widthPx:m}=bu(r);return h?Vs(n,g??"",h,p,s,{fallbackText:r,requestedWidthPx:m}):null}if(/^<\s*video\b[^>]*>[\s\S]*?<\/video\s*>$/i.test(r)){const{src:h,fallbackText:g,widthPx:p,controls:m}=Ub(r);if(!h)return null;const u=Lb(h,s.markdownFilePath,s.rootPath);return u?t.jsx(Hb,{url:u,fallbackText:g,widthPx:p,hasControls:m},n):null}if(/^<br\s*\/?>$/i.test(r))return t.jsx("br",{},n);const l=r.match(/^<(kbd|mark|sub|sup)>(.*?)<\/\1>$/i);if(!l)return/^<(a|abbr|span|b|strong|em|i|u|s|del|code)\b[\s\S]*<\/\1>$/i.test(r)?t.jsx(Bb,{html:r},n):null;const f=l[1].toLowerCase(),d=ct(l[2],`${n}-${f}`,!0,s);return f==="kbd"?t.jsx("kbd",{className:"rounded border border-border/30 bg-surface-2 px-1.5 py-0.5 font-mono text-[0.85em] text-foreground shadow-sm",children:d},n):f==="mark"?t.jsx("mark",{className:"rounded bg-warning/25 px-0.5 text-foreground",children:d},n):f==="sub"?t.jsx("sub",{children:d},n):t.jsx("sup",{children:d},n)}function ct(r,n,s=!0,l){const f=Fb(r),d=/(\\\([^)]*\\\)|\$[^$\n]+\$|<br\s*\/?>|<\s*img\b[^>]*>|<\s*video\b[^>]*>[\s\S]*?<\/video\s*>|<(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)\b[\s\S]*?<\/(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)>|!?\[[^\]]*\]\((?:<[^>]+>|(?:[^\s()]+|\([^()\s]*\))+)(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\)|!?\[[^\]]+\]\[[^\]]*\]|!?\[[^\]]+\]|\[\^[^\]]+\]|(`+)([\s\S]*?)\2|~~[^~]+~~|\*\*[^*]+\*\*|__[^_]+__|\*[^*\s][^*]*\*|_[^_\s][^_]*_|<https?:\/\/[^>\s]+>|<[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+>|https?:\/\/[^\s<]+|www\.[^\s<]+|[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+)/gi,h=[];let g=0,p;for(;(p=d.exec(f))!==null;){p.index>g&&h.push(gu(f.slice(g,p.index)));const m=p[0],u=`${n}-${p.index}`,y=m.startsWith("<")?zb(m,u,l):null;if(y)h.push(y);else if(m.startsWith("\\(")&&m.endsWith("\\)"))h.push(t.jsx(Zs,{tex:m.slice(2,-2)},u));else if(m.startsWith("$")&&m.endsWith("$"))h.push(t.jsx(Zs,{tex:m.slice(1,-1)},u));else if(m.startsWith("`")){const b=m.match(/^`+/)?.[0].length??1;h.push(t.jsx("code",{className:`${s?"break-all":"whitespace-nowrap"} rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground`,children:_b(m.slice(b,-b))},u))}else if(m.startsWith("~~"))h.push(t.jsx("del",{className:"text-muted-foreground decoration-border-strong",children:ct(m.slice(2,-2),`${u}-del`,s,l)},u));else if(m.startsWith("**")||m.startsWith("__"))h.push(t.jsx("strong",{className:"font-semibold text-foreground",children:ct(m.slice(2,-2),`${u}-strong`,s,l)},u));else if(m.startsWith("*")||m.startsWith("_"))h.push(t.jsx("em",{className:"italic",children:ct(m.slice(1,-1),`${u}-em`,s,l)},u));else if(m.startsWith("![")){const b=m.match(/^!\[([^\]]*)\]\((.*)\)$/),E=m.match(/^!\[([^\]]+)\]\[([^\]]*)\]$/),L=m.match(/^!\[([^\]]+)\]$/);if(b){const F=gl(b[2]);h.push(F?Vs(u,b[1],F.href,F.title,l):m)}else if(E){const F=E[2]||E[1],B=l.referenceDefinitions.get(ho(F));h.push(B?Vs(u,E[1],B.href,B.title,l):m)}else if(L){const F=l.referenceDefinitions.get(ho(L[1]));h.push(F?Vs(u,L[1],F.href,F.title,l):m)}else h.push(m)}else if(m.startsWith("[^")){const b=wf(m.slice(2,-1)),E=l.footnoteDefinitions.get(b);h.push(E?t.jsx("sup",{id:`fnref-${E.id}`,title:E.text,className:"ml-0.5 rounded bg-surface-2 px-1 text-[0.72em] font-semibold text-primary",children:t.jsx("a",{href:`#fn-${E.id}`,className:"text-primary no-underline",children:E.index})},u):m)}else if(m.startsWith("<http")){const b=m.slice(1,-1);h.push(t.jsx("a",{href:b,target:"_blank",rel:"noreferrer",className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u))}else if(m.startsWith("<")&&m.endsWith(">")&&pu(m.slice(1,-1))){const b=m.slice(1,-1);h.push(t.jsx("a",{href:`mailto:${b}`,className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u))}else if(pu(Wi(m).linkText)){const{linkText:b,suffix:E}=Wi(m);h.push(t.jsx("a",{href:`mailto:${b}`,className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u)),E&&h.push(E)}else if(m.startsWith("http")||m.startsWith("www.")){const{linkText:b,suffix:E}=Wi(m),L=b.startsWith("www.")?`https://${b}`:b;h.push(t.jsx("a",{href:L,target:"_blank",rel:"noreferrer",className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:b},u)),E&&h.push(E)}else{const b=m.match(/^\[([^\]]+)\]\((.*)\)$/),E=m.match(/^\[([^\]]+)\]\[([^\]]*)\]$/),L=m.match(/^\[([^\]]+)\]$/),F=E?E[2]||E[1]:L?.[1]??null,B=F?l.referenceDefinitions.get(ho(F)):null,_=b?gl(b[2]):null,C=_?.href??B?.href??null,N=C?gf(C):null,P=b?.[1]??E?.[1]??L?.[1]??"";h.push(N?t.jsx("a",{href:N,title:_?.title??B?.title,target:"_blank",rel:"noreferrer",className:`${s?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:ct(P,`${u}-link`,s,l)},u):m)}g=d.lastIndex}return g<f.length&&h.push(gu(f.slice(g))),h.length>0?h:[r]}function Af(r){return/(?: {2,}|\\)$/.test(r)}function Lf(r){return r.replace(/(?: {2,}|\\)$/,"")}function wo(r){return/^(?: {4}|\t)/.test(r)}function Pf(r){return r.startsWith(" ")?r.slice(1):r.replace(/^ {4}/,"")}function Tf(r,n,s){const l=[];return r.forEach((f,d)=>{const h=Af(f);l.push(...ct(Lf(f),`${n}-${d}`,!0,s)),d<r.length-1&&l.push(h?t.jsx("br",{},`${n}-${d}-br`):" ")}),l}function bl(r,n,s){const l=[],f=[];return r.forEach((d,h)=>{f.push(Af(d)),l.push(ct(Lf(d),`${n}-${h}`,!0,s))}),{perLine:l,hardBreaks:f}}function xl(r,n,s,l,f){const d=[];return r.forEach((h,g)=>{const p=s[g]??0,m=!!(f&&p>=f.start&&p<=f.end);d.push(t.jsx("span",{"data-md-ref-start":p,"data-md-ref-end":p,"data-selected":m?"true":void 0,children:h},`${l}-ref-${g}`)),g<r.length-1&&d.push(n[g]?t.jsx("br",{},`${l}-${g}-br`):" ")}),d}function ea(r){const n=r.trim().replace(/^\|/,"").replace(/\|$/,""),s=[];let l="",f=!1,d=0,h=0;for(let g=0;g<n.length;g+=1){const p=n[g];if(f){l+=p,f=!1;continue}if(p==="\\"){f=!0;continue}if(p==="`"){const m=g;for(;g+1<n.length&&n[g+1]==="`";)g+=1;const u=g-m+1;l+="`".repeat(u),d===0?d=u:d===u&&(d=0);continue}if(d===0&&p==="["?h+=1:d===0&&p==="]"&&h>0&&(h-=1),p==="|"&&d===0&&h===0){s.push(l.trim()),l="";continue}l+=p}return f&&(l+="\\"),s.push(l.trim()),s}function If(r){return ea(r).map(n=>/^:-+:$/.test(n)?"center":/^-+:$/.test(n)?"right":/^:-+$/.test(n)?"left":null)}function yo(r){return r==="center"?"text-center":r==="right"?"text-right":"text-left"}function ko(r){return/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/.test(r.trim())}function Df(r,n){return r>96||r>44&&n>.35}function Eo(r){return(r.match(/^\s*/)?.[0]??"").replace(/\t/g," ").length}function ta(r){const n=r.trim().match(/^([-+*]|\d+[.)])\s+(.+)$/);if(!n)return null;const s=/^\d+[.)]$/.test(n[1]);return{ordered:s,start:s?Number.parseInt(n[1],10):void 0,content:n[2]}}function Nl(r,n,s,l,f,d=new Set){const h=[],g=[];let p=n;for(;p<r.length;){const m=r[p];if(f&&(vo(m)||d.has(p))){p+=1;continue}const u=ta(m),y=Eo(m);if(!u){if(y>s&&g.length>0){([...g].reverse().find(F=>F.indent<y)?.item??g[g.length-1].item).paragraphs.push(m.trim());for(const F of g)F.item.lineEnd=p+1;p+=1;continue}break}if(y<s||y===s&&u.ordered!==l)break;const b={content:u.content,ordered:u.ordered,start:u.start,children:[],paragraphs:[],lineStart:p+1,lineEnd:p+1};for(;g.length>0&&g[g.length-1].indent>=y;)g.pop();const E=g[g.length-1]?.item??null;E?E.children.push(b):h.push(b),g.push({indent:y,item:b});for(const L of g)L.item.lineEnd=p+1;p+=1}return{items:h,nextIndex:p}}function Wb(r){const n=r.find(l=>ta(l));if(!n)return[];const s=ta(n);return s?Nl(r,0,Eo(n),s.ordered,!0,kf(r)).items:[]}function El(r,n,s,l=0){return r.map((f,d)=>{const h=f.content.match(/^\[([ xX])\]\s+(.+)$/);return{key:`item-${d}`,taskItem:!!h,refStart:f.lineStart+l,refEnd:f.lineEnd+l,content:t.jsxs(t.Fragment,{children:[h?t.jsx("input",{type:"checkbox",checked:h[1].toLowerCase()==="x",readOnly:!0,className:"mr-2 align-[-2px] accent-primary"}):null,ct(h?.[2]??f.content,`li-${n}-${d}`,!0,s),f.paragraphs.length>0&&t.jsx("div",{className:"mt-1 space-y-1 text-muted-foreground",children:f.paragraphs.map((g,p)=>t.jsx("p",{children:ct(g,`li-${n}-${d}-p-${p}`,!0,s)},`paragraph-${p}`))})]}),groups:Gb(f.children,`${n}-${d}`,s,l)}})}function Gb(r,n,s,l=0){const f=[];for(const d of r){const h=f[f.length-1];h&&h.ordered===d.ordered?h.items.push(d):f.push({ordered:d.ordered,items:[d]})}return f.map((d,h)=>({ordered:d.ordered,start:d.ordered?d.items[0]?.start:void 0,items:El(d.items,`${n}-g${h}`,s,l)}))}function Ml(r,n){return r.map(s=>{const l=!!(n&&s.refStart<=n.end&&s.refEnd>=n.start);return t.jsxs("li",{className:s.taskItem?"list-none":void 0,"data-md-ref-start":s.refStart,"data-md-ref-end":s.refEnd,"data-selected":l?"true":void 0,children:[s.content,s.groups.length>0&&Kb(s.groups,n)]},s.key)})}function Kb(r,n){return r.map((s,l)=>{const f=s.ordered?"ol":"ul";return t.jsx(f,{start:s.start,className:`${s.ordered?"list-decimal":"list-disc"} mt-1 space-y-0.5 pl-4 marker:text-muted-foreground/60`,children:Ml(s.items,n)},`nested-${l}`)})}function qb(r){const n=Array.from(r.footnoteDefinitions.values()).sort((s,l)=>s.index-l.index);return n.length===0?null:t.jsxs("section",{className:"mt-3 border-t border-border/20 pt-2 text-[12px] leading-5 text-muted-foreground",children:[t.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/80",children:r.footnotesLabel}),t.jsx("ol",{className:"list-decimal space-y-1 pl-5",children:n.map(s=>t.jsxs("li",{id:`fn-${s.id}`,children:[ct(s.text,`footnote-${s.id}`,!0,r)," ",t.jsx("a",{href:`#fnref-${s.id}`,className:"text-primary no-underline","aria-label":r.backToFootnoteLabel(s.index),children:"↩"})]},s.id))})]})}function Vb(r,n,s,l){const f=[];let d=0;const h=g=>l?.[g]??g+1;for(;d<r.length;){const g=r[d],p=g.trim();if(!p){d+=1;continue}if(/^<details>\s*$/i.test(p)){const _=d;let C="Details";const N=[];for(d+=1;d<r.length&&!/^<\/details>\s*$/i.test(r[d].trim());){const P=r[d].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);P?C=P[1].trim()||C:N.push(r[d].trimStart()),d+=1}d<r.length&&(d+=1),f.push({kind:"static",node:t.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[t.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:ct(C,`${n}-details-${_}-summary`,!0,s)}),N.length>0&&t.jsx("div",{className:"mt-2 text-sm leading-6",children:Tf(N,`${n}-details-${_}`,s)})]},`${n}-details-${_}`)});continue}const m=$f(g);if(m){const _=[g],C=d;for(d+=1;d<r.length&&!m.selfContained&&!new RegExp(`</${m.tag}>`,"i").test(r[d]);)_.push(r[d]),d+=1;d<r.length&&!m.selfContained&&(_.push(r[d]),d+=1),f.push({kind:"static",node:t.jsx(Mf,{html:_.join(`
1639
1639
  `)},`${n}-html-${C}`)});continue}const u=p.match(/^(```|~~~)\s*(.*)$/);if(u){const _=[],C=u[1],N=u[2]?.trim(),P=d;for(d+=1;d<r.length&&!r[d].trim().startsWith(C);)_.push(r[d]),d+=1;d<r.length&&(d+=1),N.toLowerCase()==="mermaid"?f.push({kind:"static",node:t.jsx(_f,{code:_.join(`
1640
1640
  `),blockKey:`${n}-code-${P}`},`${n}-code-${P}`)}):["math","latex","tex"].includes(N.toLowerCase())?f.push({kind:"static",node:t.jsx(Zs,{tex:_.join(`
1641
1641
  `),display:!0},`${n}-code-${P}`)}):f.push({kind:"code",key:`${n}-code-${P}`,code:_.join(`
1642
1642
  `),lang:N,blockKey:`${n}-code-${P}`,codeStartLine:h(P)+1});continue}if(wo(g)){const _=[],C=d;for(;d<r.length&&(wo(r[d])||!r[d].trim());)_.push(r[d].trim()?Pf(r[d]):""),d+=1;f.push({kind:"code",key:`${n}-indented-code-${C}`,code:_.join(`
1643
- `).replace(/\n+$/,""),lang:"",blockKey:`${n}-indented-code-${C}`,codeStartLine:h(C)});continue}const y=p.match(/^(#{1,6})\s+(.+)$/);if(y){const C=`h${Math.min(6,y[1].length+1)}`,N=vf(y[2]),P=ml(N,s);f.push({kind:"static",node:t.jsx(C,{id:P,className:"scroll-mt-16 font-semibold text-foreground",children:ct(N,`${n}-heading-${d}`,!0,s)},`${n}-heading-${d}`)}),d+=1;continue}if(d+1<r.length&&g.includes("|")&&ko(r[d+1])){const _=ea(g),C=If(r[d+1]),N=[],P=d;for(d+=2;d<r.length&&r[d].includes("|")&&r[d].trim();)N.push(ea(r[d])),d+=1;f.push({kind:"static",node:t.jsx("div",{className:cf,"data-markdown-table-scroll":!0,children:t.jsxs("table",{className:"w-max min-w-full max-w-none table-auto border-collapse text-left text-[11px] sm:text-xs",children:[t.jsx("thead",{className:"bg-surface-2 text-foreground",children:t.jsx("tr",{children:_.map((U,T)=>t.jsx("th",{className:`${of} ${yo(C[T]??null)}`,children:t.jsx("div",{className:xo,children:ct(U,`${n}-th-${P}-${T}`,!0,s)})},`h-${T}`))})}),t.jsx("tbody",{children:N.map((U,T)=>t.jsx("tr",{className:"border-t border-border/10",children:_.map((k,o)=>t.jsx("td",{className:`${lf} ${yo(C[o]??null)}`,children:t.jsx("div",{className:xo,children:ct(U[o]??"",`${n}-td-${P}-${T}-${o}`,!0,s)})},`c-${o}`))},`r-${T}`))})]})},`${n}-table-${P}`)});continue}const b=ta(g);if(b){const _=b.ordered,C=Eo(g),N=b.start,P=d,U=Nl(r,d,C,_,!1);d=U.nextIndex,f.push({kind:"list",keyPrefix:`${n}-list-${P}`,ordered:_,start:_?N:void 0,renders:El(U.items,`${n}-list-${P}`,s,h(0)-1)});continue}const E=[g.trimStart()],L=[h(d)],F=d;for(d+=1;d<r.length&&r[d].trim()&&!hl(r[d])&&!(d+1<r.length&&r[d].includes("|")&&ko(r[d+1]));)E.push(r[d].trimStart()),L.push(h(d)),d+=1;const B=bl(E,`${n}-p-${F}`,s);f.push({kind:"paragraph",keyPrefix:`${n}-p-${F}`,perLine:B.perLine,hardBreaks:B.hardBreaks,lineNums:L})}return f}function Yb(r,n){return r.map(s=>{switch(s.kind){case"static":return s.node;case"paragraph":return t.jsx("p",{children:xl(s.perLine,s.hardBreaks,s.lineNums,s.keyPrefix,n)},s.keyPrefix);case"list":{const l=s.ordered?"ol":"ul";return t.jsx(l,{start:s.start,className:`${s.ordered?"list-decimal":"list-disc"} space-y-0.5 pl-4 marker:text-muted-foreground/70`,children:Ml(s.renders,n)},s.keyPrefix)}case"code":return t.jsx(So,{code:s.code,lang:s.lang,blockKey:s.blockKey,codeStartLine:s.codeStartLine,lineRange:n},s.key)}})}let so=null,xu=!1;const ao=16,Ff=192;function Xb(){return so||(so=Js(()=>import("./mermaid.core-DkzJYwWa.js").then(r=>r.bl),__vite__mapDeps([17,1,2,3,4,5,18])).then(r=>r.default??r).catch(r=>{throw so=null,r})),so}function Jb(r){xu||(r.initialize({startOnLoad:!1,securityLevel:"strict",theme:"neutral"}),xu=!0)}function Qb(r){const n=r.match(/\sviewBox=(["'])([^"']+)\1/i);if(!n)return r;const[,,s]=n,l=s.trim().split(/[\s,]+/).map(Number),[,,f,d]=l;if(!Number.isFinite(f)||!Number.isFinite(d)||f<=0||d<=0)return r;const h=Math.max(Ff,Math.ceil(f)),g=Math.ceil(h/f*d);return r.replace(/<svg\b([^>]*)>/i,(p,m)=>`<svg${m.replace(/\s(?:width|height)=(["']).*?\1/gi,"").replace(/\sstyle=(["']).*?\1/gi,"")} width="${h}" height="${g}">`)}function Zb(r){const n=r?.querySelector("svg");if(!n)return;let s;try{s=n.getBBox()}catch{return}if(!Number.isFinite(s.width)||!Number.isFinite(s.height)||s.width<=0||s.height<=0)return;const l=s.x-ao,f=s.y-ao,d=s.width+ao*2,h=s.height+ao*2,g=Math.max(Ff,Math.ceil(d)),p=Math.ceil(g/d*h);n.setAttribute("viewBox",`${l} ${f} ${d} ${h}`),n.setAttribute("width",String(g)),n.setAttribute("height",String(p)),n.removeAttribute("style")}function ex(r){const n=r.trim().split(/\s+/,1)[0]?.toLowerCase();if(!n)return null;const s=n.replace(/^language-/,"");return _u(`code.${s}`)??s}function _f({code:r,blockKey:n}){const{t:s}=kt(),[l,f]=a.useState(null),[d,h]=a.useState(!1),g=a.useRef(null),p=a.useContext(bf);a.useEffect(()=>{let u=!1;return f(null),h(!1),Xb().then(async y=>{Jb(y);const b=`termdock-md-mermaid-${n.replace(/[^a-zA-Z0-9_-]/g,"-")}`,{svg:E}=await y.render(b,r);u||f(Qb(E))}).catch(()=>{u||h(!0)}),()=>{u=!0}},[n,r]),a.useLayoutEffect(()=>{l&&Zb(g.current)},[l]);const m=a.useCallback(()=>{const u=g.current?.querySelector("svg")?.outerHTML??l;u&&p?.(u)},[p,l]);return d?t.jsx(So,{code:r,lang:"mermaid",blockKey:`${n}-fallback`}):t.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[t.jsx("div",{className:"border-b border-border/15 bg-surface-2 px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"mermaid"}),t.jsx("div",{className:"bg-surface p-3",children:l?t.jsx("button",{type:"button",className:"block max-w-full rounded text-left focus:outline-none focus:ring-2 focus:ring-ring/45",title:s("rightSidebar.openMermaidDiagram"),onClick:u=>{u.stopPropagation(),m()},children:t.jsx("span",{ref:g,role:"img","aria-label":s("rightSidebar.mermaidDiagram"),className:"block max-h-[70vh] max-w-full overflow-auto rounded bg-white p-2 text-slate-900 [&_svg]:block [&_svg]:h-auto [&_svg]:max-w-full",dangerouslySetInnerHTML:{__html:l}})}):t.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s("rightSidebar.renderingDiagram")})})]})}function So({code:r,lang:n,blockKey:s,codeStartLine:l,lineRange:f}){const d=ex(n),[h,g]=a.useState(null);a.useEffect(()=>{if(!d||!Bu(r)){g(null);return}let m=!1;return Ou().then(u=>{if(m||!u.registered(d)){m||g(null);return}try{g(Uu(u,r,d))}catch{m||g(null)}}).catch(()=>{m||g(null)}),()=>{m=!0}},[s,r,d]);const p=h??(r||" ").split(`
1643
+ `).replace(/\n+$/,""),lang:"",blockKey:`${n}-indented-code-${C}`,codeStartLine:h(C)});continue}const y=p.match(/^(#{1,6})\s+(.+)$/);if(y){const C=`h${Math.min(6,y[1].length+1)}`,N=vf(y[2]),P=ml(N,s);f.push({kind:"static",node:t.jsx(C,{id:P,className:"scroll-mt-16 font-semibold text-foreground",children:ct(N,`${n}-heading-${d}`,!0,s)},`${n}-heading-${d}`)}),d+=1;continue}if(d+1<r.length&&g.includes("|")&&ko(r[d+1])){const _=ea(g),C=If(r[d+1]),N=[],P=d;for(d+=2;d<r.length&&r[d].includes("|")&&r[d].trim();)N.push(ea(r[d])),d+=1;f.push({kind:"static",node:t.jsx("div",{className:cf,"data-markdown-table-scroll":!0,children:t.jsxs("table",{className:"w-max min-w-full max-w-none table-auto border-collapse text-left text-[11px] sm:text-xs",children:[t.jsx("thead",{className:"bg-surface-2 text-foreground",children:t.jsx("tr",{children:_.map((U,T)=>t.jsx("th",{className:`${of} ${yo(C[T]??null)}`,children:t.jsx("div",{className:xo,children:ct(U,`${n}-th-${P}-${T}`,!0,s)})},`h-${T}`))})}),t.jsx("tbody",{children:N.map((U,T)=>t.jsx("tr",{className:"border-t border-border/10",children:_.map((k,o)=>t.jsx("td",{className:`${lf} ${yo(C[o]??null)}`,children:t.jsx("div",{className:xo,children:ct(U[o]??"",`${n}-td-${P}-${T}-${o}`,!0,s)})},`c-${o}`))},`r-${T}`))})]})},`${n}-table-${P}`)});continue}const b=ta(g);if(b){const _=b.ordered,C=Eo(g),N=b.start,P=d,U=Nl(r,d,C,_,!1);d=U.nextIndex,f.push({kind:"list",keyPrefix:`${n}-list-${P}`,ordered:_,start:_?N:void 0,renders:El(U.items,`${n}-list-${P}`,s,h(0)-1)});continue}const E=[g.trimStart()],L=[h(d)],F=d;for(d+=1;d<r.length&&r[d].trim()&&!hl(r[d])&&!(d+1<r.length&&r[d].includes("|")&&ko(r[d+1]));)E.push(r[d].trimStart()),L.push(h(d)),d+=1;const B=bl(E,`${n}-p-${F}`,s);f.push({kind:"paragraph",keyPrefix:`${n}-p-${F}`,perLine:B.perLine,hardBreaks:B.hardBreaks,lineNums:L})}return f}function Yb(r,n){return r.map(s=>{switch(s.kind){case"static":return s.node;case"paragraph":return t.jsx("p",{children:xl(s.perLine,s.hardBreaks,s.lineNums,s.keyPrefix,n)},s.keyPrefix);case"list":{const l=s.ordered?"ol":"ul";return t.jsx(l,{start:s.start,className:`${s.ordered?"list-decimal":"list-disc"} space-y-0.5 pl-4 marker:text-muted-foreground/70`,children:Ml(s.renders,n)},s.keyPrefix)}case"code":return t.jsx(So,{code:s.code,lang:s.lang,blockKey:s.blockKey,codeStartLine:s.codeStartLine,lineRange:n},s.key)}})}let so=null,xu=!1;const ao=16,Ff=192;function Xb(){return so||(so=Js(()=>import("./mermaid.core-BH_WDKpZ.js").then(r=>r.bl),__vite__mapDeps([17,1,2,3,4,5,18])).then(r=>r.default??r).catch(r=>{throw so=null,r})),so}function Jb(r){xu||(r.initialize({startOnLoad:!1,securityLevel:"strict",theme:"neutral"}),xu=!0)}function Qb(r){const n=r.match(/\sviewBox=(["'])([^"']+)\1/i);if(!n)return r;const[,,s]=n,l=s.trim().split(/[\s,]+/).map(Number),[,,f,d]=l;if(!Number.isFinite(f)||!Number.isFinite(d)||f<=0||d<=0)return r;const h=Math.max(Ff,Math.ceil(f)),g=Math.ceil(h/f*d);return r.replace(/<svg\b([^>]*)>/i,(p,m)=>`<svg${m.replace(/\s(?:width|height)=(["']).*?\1/gi,"").replace(/\sstyle=(["']).*?\1/gi,"")} width="${h}" height="${g}">`)}function Zb(r){const n=r?.querySelector("svg");if(!n)return;let s;try{s=n.getBBox()}catch{return}if(!Number.isFinite(s.width)||!Number.isFinite(s.height)||s.width<=0||s.height<=0)return;const l=s.x-ao,f=s.y-ao,d=s.width+ao*2,h=s.height+ao*2,g=Math.max(Ff,Math.ceil(d)),p=Math.ceil(g/d*h);n.setAttribute("viewBox",`${l} ${f} ${d} ${h}`),n.setAttribute("width",String(g)),n.setAttribute("height",String(p)),n.removeAttribute("style")}function ex(r){const n=r.trim().split(/\s+/,1)[0]?.toLowerCase();if(!n)return null;const s=n.replace(/^language-/,"");return _u(`code.${s}`)??s}function _f({code:r,blockKey:n}){const{t:s}=kt(),[l,f]=a.useState(null),[d,h]=a.useState(!1),g=a.useRef(null),p=a.useContext(bf);a.useEffect(()=>{let u=!1;return f(null),h(!1),Xb().then(async y=>{Jb(y);const b=`termdock-md-mermaid-${n.replace(/[^a-zA-Z0-9_-]/g,"-")}`,{svg:E}=await y.render(b,r);u||f(Qb(E))}).catch(()=>{u||h(!0)}),()=>{u=!0}},[n,r]),a.useLayoutEffect(()=>{l&&Zb(g.current)},[l]);const m=a.useCallback(()=>{const u=g.current?.querySelector("svg")?.outerHTML??l;u&&p?.(u)},[p,l]);return d?t.jsx(So,{code:r,lang:"mermaid",blockKey:`${n}-fallback`}):t.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[t.jsx("div",{className:"border-b border-border/15 bg-surface-2 px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"mermaid"}),t.jsx("div",{className:"bg-surface p-3",children:l?t.jsx("button",{type:"button",className:"block max-w-full rounded text-left focus:outline-none focus:ring-2 focus:ring-ring/45",title:s("rightSidebar.openMermaidDiagram"),onClick:u=>{u.stopPropagation(),m()},children:t.jsx("span",{ref:g,role:"img","aria-label":s("rightSidebar.mermaidDiagram"),className:"block max-h-[70vh] max-w-full overflow-auto rounded bg-white p-2 text-slate-900 [&_svg]:block [&_svg]:h-auto [&_svg]:max-w-full",dangerouslySetInnerHTML:{__html:l}})}):t.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:s("rightSidebar.renderingDiagram")})})]})}function So({code:r,lang:n,blockKey:s,codeStartLine:l,lineRange:f}){const d=ex(n),[h,g]=a.useState(null);a.useEffect(()=>{if(!d||!Bu(r)){g(null);return}let m=!1;return Ou().then(u=>{if(m||!u.registered(d)){m||g(null);return}try{g(Uu(u,r,d))}catch{m||g(null)}}).catch(()=>{m||g(null)}),()=>{m=!0}},[s,r,d]);const p=h??(r||" ").split(`
1644
1644
  `).map(m=>[m||" "]);return t.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[n&&t.jsx("div",{className:"border-b border-border/15 bg-surface-2 px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:n}),t.jsx("pre",{className:`${Sl} termdock-code overflow-auto p-3 text-[11px] leading-relaxed text-foreground`,children:t.jsx("code",{children:p.map((m,u)=>{const y=l!=null?l+u:null,b=!!(f&&y!=null&&y>=f.start&&y<=f.end);return t.jsxs("span",{"data-md-ref-start":y??void 0,"data-md-ref-end":y??void 0,"data-selected":b?"true":void 0,children:[m,u<p.length-1?`
1645
1645
  `:null]},`${s}-line-${u}`)})})})]})}function $l(r,n,s,l,f){r=$b(r);const d=Eb(r),h=kf(r),g=[],p={markdownFilePath:n,rootPath:s,referenceDefinitions:d,footnoteDefinitions:Mb(r),headingSlugCounts:new Map,images:g,onImageOpen:l,footnotesLabel:f?.footnotes??"Footnotes",backToFootnoteLabel:f?.backToFootnote??(b=>`Back to footnote ${b}`)},m=[];let u=0;for(;u<r.length;){const b=r[u],E=b.trim();if(vo(b)||h.has(u)){u+=1;continue}if(!E){u+=1;continue}if(/^<details>\s*$/i.test(E)){const T=u;let k="Details";const o=[];for(u+=1;u<r.length&&!/^<\/details>\s*$/i.test(r[u].trim());){const O=r[u].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);O?k=O[1].trim()||k:o.push(r[u].trimStart()),u+=1}u<r.length&&(u+=1),m.push({key:`details-${T}`,startLine:T+1,endLine:u,content:t.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[t.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:ct(k,`details-${T}-summary`,!0,p)}),o.length>0&&t.jsx("div",{className:"mt-2 text-sm leading-6",children:Tf(o,`details-${T}`,p)})]})});continue}const L=$f(b);if(L){const T=[b],k=u;for(u+=1;u<r.length&&!L.selfContained&&!new RegExp(`</${L.tag}>`,"i").test(r[u]);)T.push(r[u]),u+=1;u<r.length&&!L.selfContained&&(T.push(r[u]),u+=1),m.push({key:`html-${k}`,startLine:k+1,endLine:u,content:t.jsx(Mf,{html:T.join(`
1646
1646
  `)})});continue}const F=E.match(/^(```|~~~)\s*(.*)$/);if(F){const T=[],k=F[1],o=F[2]?.trim(),O=u;for(u+=1;u<r.length&&!r[u].trim().startsWith(k);)T.push(r[u]),u+=1;u<r.length&&(u+=1),m.push({key:`code-${O}`,startLine:O+1,endLine:u,fineGrained:o.toLowerCase()!=="mermaid"&&!["math","latex","tex"].includes(o.toLowerCase()),content:o.toLowerCase()==="mermaid"?t.jsx(_f,{code:T.join(`
@@ -1675,4 +1675,4 @@ ${ce}
1675
1675
  `)},[ln,Zn,Es,Et,rr,x]),Kh=a.useCallback((e="generate")=>{const i=e==="generate"?ki:[e==="regenerate"?"模式:重新生成。请基于当前分支导出结果重新生成全部 hunk 解释并覆盖写回。":"模式:补充失效。请基于当前分支导出结果只补充新增、变更或已失效的 hunk 解释,仍有效的解释不要重复写回。","",ki].join(`
1676
1676
  `);Dr(o("rightSidebar.branchAuditShort"),i,`context:branch-audit-scope:${e}`),d||l()},[ki,Dr,l,d,o]),Si=a.useCallback(async(e={})=>{const i=e.refresh===!0,c=i&&xe?.comparisonRepos?xe.comparisonRepos:Es.map(j=>{const ie=(rr[j.root]||j.branch||"").trim();return{repoRoot:j.root,label:j.label,base:Et[j.root]?.trim()??"",head:ie||null,includeUncommitted:ln[j.root]??!0}});if(!x||c.length===0)return;const w=++It.current,v=x,S=()=>Re(v)&&w===It.current;ye(!0),Fe(null),i||(er(null),Ue(null));try{const j=await Promise.all(c.map(async V=>{if(!V.base)throw new Error(o("rightSidebar.branchAuditMissingBase",{repo:V.label}));return Ad({cwd:x,repoRoot:V.repoRoot,base:V.base,head:V.head,includeUncommitted:e.repoRoot===V.repoRoot?e.includeUncommitted??!1:V.includeUncommitted??xe?.includeUncommitted??!0,requestSlotId:`right-sidebar-branch-preview:${V.repoRoot}`})}));if(!S())return;const ie=j.find(V=>!V.available);if(ie){Fe(ie.error??"Branch diff is unavailable");return}const ee=j.length===1?j[0]:{available:!0,workspaceRoot:x,repoRoot:x,baseRef:j.map(V=>V.baseRef??V.baseBranch).filter(Boolean).join(", "),currentBranch:j.map(V=>V.currentBranch??"HEAD").filter(Boolean).join(", "),headRef:j.map(V=>V.headRef).filter(Boolean).join(", "),diffFingerprint:j.map(V=>V.diffFingerprint).filter(Boolean).join("+"),stat:j.map(V=>V.stat).filter(Boolean).join(`
1677
1677
  `),files:j.flatMap((V,K)=>{const ge=c[K];return(V.files??[]).map($e=>`${ge?.label??V.repoRoot??"repo"}/${$e}`)}),hunks:j.flatMap((V,K)=>{const $e=c[K]?.label??V.repoRoot??"repo";return(V.hunks??[]).map(Ge=>({...Ge,filePath:`${$e}/${Ge.filePath}`,oldPath:Ge.oldPath?`${$e}/${Ge.oldPath}`:Ge.oldPath,newPath:Ge.newPath?`${$e}/${Ge.newPath}`:Ge.newPath}))}),commits:j.flatMap(V=>V.commits??[]),commitCount:j.reduce((V,K)=>V+(K.commitCount??K.commits?.length??0),0),diff:j.map(V=>V.diff).filter(Boolean).join(`
1678
- `),truncated:j.some(V=>V.truncated)};if(ee.comparisonRepos=c.map((V,K)=>({...V,head:V.head??j[K].currentBranch??null,includeUncommitted:j[K].includeUncommitted===!0,canIncludeUncommitted:j[K].canIncludeUncommitted})),ee.canIncludeUncommitted=j.every(V=>V.canIncludeUncommitted===!0),ee.includeUncommitted=j.some(V=>V.includeUncommitted===!0),Io(V=>({...V,...Object.fromEntries(ee.comparisonRepos.map(K=>[K.repoRoot,K.includeUncommitted??!1]))})),!i&&(ee.hunks??[]).length===0){Fe(o("rightSidebar.branchAuditDiffEmpty"));return}const be=Date.now(),Ne=(i?qe:null)??["preview",ee.repoRoot??x,ee.baseRef??ee.baseBranch??"",ee.currentBranch??"",ee.headRef??"",ee.diffFingerprint??be].join("\0"),Ve=c.length===1?c[0].label:`${c.length} repos`;er(ee),Pn(V=>[{key:Ne,diff:ee,repoLabel:Ve,createdAt:be},...V.filter(K=>K.key!==Ne)].slice(0,8)),i||nn(V=>V[Ne]===void 0?V:{...V,[Ne]:0}),cn(Ne),dn(V=>{const K=ee.hunks?.[0],ge=K?`${K.filePath}\0${K.hunkHeader}\0${K.hunkIndex}`:null;return i&&V&&(ee.hunks??[]).some($e=>$e.filePath===V.split("\0")[0])?V:ge}),fr(!0)}catch(j){if(!S()||yr(j))return;Fe(j instanceof Error?j.message:"Failed to load branch diff")}finally{S()&&ye(!1)}},[ln,xe,qe,Es,Et,rr,Re,x,o]),qh=a.useCallback(e=>{++It.current,ye(!1),er(e.diff),Fe(null),cn(e.key),dn(e.diff.hunks?.[0]?`${e.diff.hunks[0].filePath}\0${e.diff.hunks[0].hunkHeader}\0${e.diff.hunks[0].hunkIndex}`:null),fr(!0)},[]),Vh=a.useCallback(e=>{Pn(i=>i.filter(c=>c.key!==e)),nn(i=>{if(!(e in i))return i;const c={...i};return delete c[e],c}),qe===e&&(cn(null),er(null),fr(!1))},[qe]),Yh=a.useCallback(e=>{++It.current,ye(!1);const i=es.find(c=>c.key===e);i&&(er(null),Fe(null),cn(e),dn(i.records[0]?.filePath??null),fr(!0))},[es]),Xh=a.useCallback(async e=>{if(!x||!Se)return;const[i]=e.split(/\s+/);if(i){gt(i),tr(null),Ue(null);try{const c=await Im({cwd:x,repoRoot:Se,commit:i,requestSlotId:"right-sidebar-commit-diff"});if(!c.available){tr(c.error??"Commit diff is unavailable");return}Ue(c);const w=c.hunks?.[0];aa(w?`${w.filePath}\0${w.hunkHeader}\0${w.hunkIndex}`:null)}catch(c){tr(c instanceof Error?c.message:"Failed to load commit diff")}finally{gt(null)}}},[Se,x]),Jh=a.useCallback(e=>{if(!xe||!qe)return;const i=Math.max(0,Math.round(e));nn(c=>Math.abs((c[qe]??0)-i)<24?c:{...c,[qe]:i})},[xe,qe]);a.useEffect(()=>{!xe||!qe||Pn(e=>e.map(i=>i.key===qe&&i.diff!==xe?{...i,diff:xe}:i))},[xe,qe]);const rd=!!xe;a.useEffect(()=>{if(!oe||!ur||!rd)return;const e=hc.current;if(!e||e.destroyed)return;e.update(),e.slideTo(1,0);const i=window.requestAnimationFrame(()=>{e.destroyed||(e.update(),e.slideTo(1,0))});return()=>window.cancelAnimationFrame(i)},[ur,rd,oe]);const nd=a.useCallback(e=>{e&&ch(i=>mp(i,e))},[]),sd=xa.key===nt?xa.key:null,Ua=a.useCallback(e=>{const i=Y.getState(),c=jx();Us("select_diff_file",{interactionId:c,path:e,previousSelectedFilePath:i.selectedFilePath,rootPath:i.rootPath,activeGitRepoRoot:le,changedFiles:i.changedFiles.size,gitBundleLoading:i.gitBundleLoading,gitBundleLastLoadedAt:i.gitBundleLastLoadedAt,rightTab:i.rightTab}),st(e),$r("diff"),oe&&e&&gc(1),nd(e),queueMicrotask(()=>{const w=Y.getState();Us("select_diff_file_after",{interactionId:c,requestedPath:e,selectedFilePath:w.selectedFilePath,rootPath:w.rootPath,rightTab:w.rightTab,changedFiles:w.changedFiles.size,activeGitRepoRoot:le})})},[le,oe,nd,st,$r,gc]),ad=a.useCallback(e=>{const i=Array.from(Ie.values()).find(c=>{const w=pt(c,x),v=wr(c);return c.path===e.filePath||v===e.filePath||c.absolutePath===e.filePath||(w?`${w}/${c.path}`===e.filePath:!1)||e.repoRoot&&w===e.repoRoot&&c.path===e.filePath});if(i){Ua(wr(i)),window.setTimeout(()=>Mn(e),90),window.setTimeout(()=>Mn(e),320),window.setTimeout(()=>Mn(e),760);return}Mn(e)},[Ie,x,Ua]),od=a.useCallback(({slideToDetail:e,fullscreen:i,toggleFullscreen:c}={})=>cs.length>0?t.jsx(Du,{walkthroughs:cs,repoRoot:le,fullscreen:i,onToggleFullscreen:c,onNavigate:w=>{oe&&window.requestAnimationFrame(()=>e?.()),ad(w)}}):t.jsxs("div",{className:"rounded-lg border border-border/15 bg-surface px-3 py-6 text-center text-xs text-muted-foreground",children:[t.jsx(Qs,{size:18,className:"mx-auto mb-2 text-muted-foreground/80"}),o("rightSidebar.changeWalkthroughEmpty")]}),[le,cs,ad,oe,o]),Qh=a.useCallback(e=>{e&&lr(i=>{const c=new Set(i);return c.has(e)?c.delete(e):c.add(e),Hi(_i,c),c})},[]),id=a.useCallback(e=>{Or(i=>{const c=new Set(i);return c.has(e)?c.delete(e):c.add(e),Hi(tu,c),c})},[]),Ha=a.useCallback(e=>{jr(e),At(ef,e)},[]);a.useEffect(()=>{Ia||Ur!=="ai"||Ha("tree")},[Ur,Ha,Ia]);const za=a.useCallback(()=>{na(e=>{const i=!e;return At(tf,i),i})},[]),ld=a.useCallback(e=>{is(e),At(rf,e)},[]),{whitespace:cd,context:dd}=gp(),ud=a.useMemo(()=>({algorithm:"histogram",whitespace:cd,context:dd}),[cd,dd]),fd=a.useCallback(e=>{X(e),At(nf,e)},[]),Wa=a.useCallback(async(e,i,c,w)=>{let v=e;for(;v.ok&&v.status==="running";)await new Promise(j=>window.setTimeout(j,1500)),v=await Ld({jobId:v.jobId,cwd:i.cwd,action:i.action});if(!v.ok)throw new Error("Git action status is unavailable");if(v.status==="error")throw new Error(v.error||v.message||"Git action failed");const S={action:i.action,path:w,label:c};return vs(S),window.setTimeout(()=>vs(j=>j?.action===S.action&&j.path===S.path?null:j),1400),v},[]),vt=a.useCallback(async(e,i,c)=>{const w=x;x&&gr.current.delete(x),xt(null),vs(null),xs({action:e.action,path:c});try{const v=await Dm({...e,includeNested:Fs(x)}),S=await Wa(v,e,i,c);if(!Re(w))return!1;const j=x?await Li(x,void 0,{includeNested:Fs(x),cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:Bs(x)}).catch(()=>S.bundle):S.bundle;return Re(w)?(j&&Vn(j,{reloadDiff:!0,cacheOnly:!0}),un(null),!0):!1}catch(v){return vs(null),xt(o("rightSidebar.gitActionFailed",{message:v instanceof Error?v.message:"Unknown error"})),!1}finally{Re(w)&&xs(null)}},[Vn,Re,x,o,Wa]),hd=a.useCallback(async e=>{const i=x;await Pd({...e,includeNested:Fs(x)}),Re(i)&&Dt(x??void 0,{refresh:!0,background:!0})},[Re,Dt,x]),Zh=a.useCallback(async e=>{const i=xe,c=It.current,w=i?.hunks?.find(S=>S.previewRevert?.cwd===e.cwd&&S.previewRevert.path===e.path);if(!i||!w||!e.comparisonBase)throw new Error(o("diffViewer.hunkActionUnavailable"));G(S=>S+1),Fe(null);try{await Pd(e)}catch(S){throw G(j=>j-1),S}if(c!==It.current||!Re(x)){G(S=>S-1);return}const v=S=>{er(j=>{if(!j||c!==It.current)return j;const ie=j.hunks??[],ee=S===void 0?ie.filter(Ne=>!(Ne.previewRevert?.cwd===e.cwd&&Ne.previewRevert.patch===e.patch)):[...ie.filter(Ne=>Ne.filePath!==w.filePath),...S];return{...j,hunks:ee}})};v(),Ad({cwd:e.cwd,repoRoot:e.cwd,base:e.comparisonBase,comparisonBase:e.comparisonBase,filePath:e.path,requestSlotId:`branch-preview-file:${e.cwd}:${e.path}`}).then(S=>{if(c!==It.current||!Re(x))return;if(!S.available||S.truncated)throw new Error(S.error??o("diffViewer.hunkActionUnavailable"));const j=e.path.slice(e.cwd.length+1),ie=w.filePath.slice(0,w.filePath.length-j.length);v((S.hunks??[]).map(ee=>({...ee,filePath:`${ie}${ee.filePath}`,oldPath:ee.oldPath?`${ie}${ee.oldPath}`:ee.oldPath,newPath:ee.newPath?`${ie}${ee.newPath}`:ee.newPath})))}).catch(S=>{c===It.current&&Re(x)&&!yr(S)&&Fe(`${o("diffViewer.hunkActionReverted")} · ${S instanceof Error?S.message:String(S)}`)}).finally(()=>G(S=>S-1))},[xe,Re,x,o]),Ga=a.useCallback((e,i,c)=>{if(i){if(e==="stage-all"){vt({action:"stage-all",cwd:i},o("rightSidebar.stageAll"),`repo:${i}`);return}un({kind:"stash-all",repoRoot:i,repoLabel:c})}},[vt,o]),md=a.useCallback(e=>{Le(e),ha(""),ma(""),pa(""),st(Oc(e)),ot||$r("diff"),e&&Pa(at.get(e))},[Pa,Oc,ot,at,st,Le,$r]),pd=a.useCallback(e=>{const i=new Set([...zt.current.keys(),...xn.current,...gr.current]);for(const c of i)c!==e&&(Ht.current.delete(c),zt.current.get(c)?.abort(),zt.current.delete(c),Ct(`right-sidebar-git-untracked:${c}`),xn.current.delete(c),gr.current.delete(c))},[]),em=a.useCallback(async e=>{const i=x;if(!i||(await Y.getState().setNestedGitScanRoot(i,e),!Re(i)))return;if(e){await Dt(i,{includeNested:!0,discoverOnly:!0,replaceWorkspace:!0,background:!0,reloadDiff:!0});return}pd(i),ha(""),ma(""),pa(""),To(w=>w.filter(v=>v===i));const c=Kt;c&&pt(c,i)!==i&&st(null),await Dt(i,{includeNested:!1,replaceWorkspace:!0,background:!0,reloadDiff:!0})},[pd,Re,Dt,x,st,Kt]),tm=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=_n.trim();!e||e===he?.branch||await vt({action:"switch-branch",cwd:Se,branch:e},o("rightSidebar.switchBranch"))},[he?.branch,Se,Je,vt,_n,o]),gd=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=fa.trim();if(!e)return;await vt({action:"commit",cwd:Se,message:e},o("rightSidebar.commitChanges"))&&zl("")},[Se,fa,Je,vt,o]),rm=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=hn.trim(),i=mn.trim();await vt({action:"push",cwd:Se,...e?{remote:e}:{},...i?{branch:i}:{}},o("rightSidebar.pushChanges"))},[Se,mn,hn,Je,vt,o]),nm=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=hn.trim(),i=mn.trim();await vt({action:"pull",cwd:Se,...e?{remote:e}:{},...i?{branch:i}:{}},o("rightSidebar.pullChanges"))},[Se,mn,hn,Je,vt,o]);a.useEffect(()=>{if(!ot||!Se||ze)return;let e=!1;const i={push:o("rightSidebar.pushChanges"),pull:o("rightSidebar.pullChanges"),commit:o("rightSidebar.commitChanges"),"switch-branch":o("rightSidebar.switchBranch"),"stage-all":o("rightSidebar.stageAll"),"stash-all":o("rightSidebar.stashAll")};return(async()=>{for(const c of["push","pull","commit","switch-branch","stage-all","stash-all"]){if(e)return;const w=await Ld({cwd:Se,action:c}).catch(()=>null);if(!w?.ok||w.status!=="running")continue;const v={action:c,cwd:Se},S=i[c]??c;xs({action:c});try{const j=await Wa(w,v,S);if(e||!Re(x))return;const ie=x?await Li(x,void 0,{includeNested:Fs(x),cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:Bs(x)}).catch(()=>j.bundle):j.bundle;ie&&Vn(ie,{reloadDiff:!0,cacheOnly:!0})}catch(j){e||xt(o("rightSidebar.gitActionFailed",{message:j instanceof Error?j.message:"Unknown error"}))}finally{e||xs(null)}return}})(),()=>{e=!0}},[Se,Vn,ot,Re,x,ze,o,Wa]);const ji=Dn?.action==="commit",Ri=Dn?.action==="switch-branch",Ci=Dn?.action==="pull",Ni=Dn?.action==="push",Ka=ot||ih,Ei=Fa?o("rightSidebar.changeAuditScopeAll"):xr.length===1?xr[0].label:`${xr.length} repos`,sm=xr.length>0,bd=Es.length>0,am=x?t.jsx(vu,{open:Lo,onOpenChange:Po,showScopePicker:!0,selectedAll:Fa,repos:qt,selectedRoots:Da,onToggleRepo:Hh,onGenerate:()=>Kh(wi?"regenerate":"generate"),disabled:!sm,generateDisabled:!bd,inserted:ke?.startsWith("context:branch-audit-scope:")??!1,buttonLabel:o(wi?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),insertedLabel:o("rightSidebar.inserted"),title:o("rightSidebar.branchAuditGenerateTitle"),ariaLabel:o("rightSidebar.branchAuditShort"),scopeTitle:o("rightSidebar.changeAuditScopeLabel"),scopeLabel:Ei,allLabel:o("rightSidebar.changeAuditScopeAll"),generateLabel:o(wi?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),onSecondaryAction:()=>{Si()},secondaryDisabled:!bd||ce,secondaryLabel:o("rightSidebar.branchAuditViewDiff"),secondaryTitle:o("rightSidebar.branchAuditViewDiffTitle"),secondaryLoading:ce,loading:Il.size>0,statusTitle:Il.size>0?o("rightSidebar.branchCandidatesLoading"):void 0,extraContent:t.jsx("div",{className:"mb-2 space-y-1.5",children:Gc.length>0&&t.jsx("div",{className:"rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[10px] text-[color:var(--warning)]",children:o("rightSidebar.missingBaseReposSkipped",{repositories:Gc.map(e=>e.label).join(O==="zh"?"、":", ")})})}),renderRepoExtra:e=>{const i=at.get(e.root),c=Zn(e.root,rr[e.root]||i?.context?.branch),w=[],v=new Set,S=(be,Ne)=>{!be||v.has(be)||(v.add(be),w.push({value:be,label:be,meta:Ne}))};S(rr[e.root]||i?.context?.branch,o("rightSidebar.pushCurrentBranchBadge"));for(const be of i?.context?.branches??[])S(be,be===i?.context?.branch?o("rightSidebar.pushCurrentBranchBadge"):o("rightSidebar.localBranch"));for(const be of i?.context?.remoteBranches??[])S(be,o("rightSidebar.remoteBranch"));const j=[],ie=new Set,ee=(be,Ne)=>{!be||ie.has(be)||(ie.add(be),j.push({value:be,label:be,meta:Ne}))};ee(Et[e.root],Et[e.root]?o("rightSidebar.pushUpstreamBadge"):void 0),ee(i?.context?.upstream,i?.context?.upstream?o("rightSidebar.pushUpstreamBadge"):void 0);for(const be of i?.context?.remoteBranches??[])ee(be,"remote");for(const be of i?.context?.branches??[])ee(be,be===i?.context?.branch?o("rightSidebar.pushCurrentBranchBadge"):"local");return t.jsxs("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:[t.jsx(ns,{label:o("rightSidebar.currentBranchLabel"),value:rr[e.root]||i?.context?.branch||"",options:w,placeholder:o("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:o("rightSidebar.switchBranchSearchPlaceholder"),emptyText:o("rightSidebar.switchNoBranches"),onChange:be=>{ia(Ne=>({...Ne,[e.root]:be}))}}),t.jsx(ns,{label:o("rightSidebar.branchAuditBaseLabel"),value:Et[e.root]||"",options:j,placeholder:o("rightSidebar.branchAuditBasePlaceholder"),searchPlaceholder:o("rightSidebar.branchAuditBaseSearchPlaceholder"),emptyText:o("rightSidebar.branchAuditBaseEmpty"),onChange:be=>{la(Ne=>({...Ne,[e.root]:be}))}}),t.jsxs("label",{className:"sm:col-span-2 flex cursor-pointer items-center justify-between gap-3 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-foreground",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block font-medium",children:o("rightSidebar.includeUncommitted")}),t.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:o(c?"rightSidebar.includeUncommittedHint":"rightSidebar.includeUncommittedCurrentBranchOnly")})]}),t.jsx("input",{type:"checkbox",checked:c&&(ln[e.root]??!0),disabled:!c,onChange:be=>Io(Ne=>({...Ne,[e.root]:be.target.checked})),className:"h-4 w-4 shrink-0 accent-[rgb(var(--primary-rgb))]"})]})]})}}):null,xd=Os(jt.reduce((e,i)=>Math.max(e,i.injectedAt??0),0),O),om=()=>x?t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("button",{type:"button",onClick:()=>Tl(e=>{const i=!e;return At(Bi,i),i}),className:"group flex w-full items-center gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":bs,children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:t.jsx(Qs,{size:14})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-[12px] font-semibold text-foreground",children:o("rightSidebar.branchAuditTitle")}),t.jsx("span",{className:"block truncate text-[11px] text-muted-foreground",children:Ei})]}),t.jsx("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${bs?"rotate-90":""}`,children:t.jsx(Hs,{size:13})})]}),bs&&t.jsxs("div",{className:"mt-2 rounded-lg border border-border/10 bg-surface/60 p-2",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 text-[11px] text-muted-foreground",children:[o("rightSidebar.changeAuditScopeLabel"),": ",Ei]}),am]}),Ze&&t.jsx("div",{className:"mb-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:Ze}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[rn.map(e=>t.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${qe===e.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[t.jsxs("button",{type:"button",onClick:()=>qh(e),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:e.repoLabel}),t.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[11px] text-muted-foreground",children:[e.diff.hunks?.length??0," hunk"]})]}),t.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[11px] text-muted-foreground",children:[t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.diff.currentBranch??"HEAD"}),t.jsx("span",{className:"text-muted-foreground/60",children:"→"}),t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.diff.baseRef??e.diff.baseBranch}),t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:o("rightSidebar.branchAuditViewDiff")})]}),Os(e.createdAt,O)&&t.jsx("div",{className:"mt-1 truncate text-[11px] text-muted-foreground/70",children:Os(e.createdAt,O)})]}),t.jsx("button",{type:"button",onClick:()=>Vh(e.key),className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:o("common.delete"),"aria-label":o("common.delete"),children:t.jsx(co,{size:12})})]},e.key)),es.length>0?es.slice(0,Math.max(0,8-rn.length)).map(e=>t.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${qe===e.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[t.jsxs("button",{type:"button",onClick:()=>Yh(e.key),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:e.repoLabel}),t.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[11px] text-muted-foreground",children:[e.records.length," hunk"]})]}),t.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[11px] text-muted-foreground",children:[t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.branchName??"HEAD"}),t.jsx("span",{className:"text-muted-foreground/60",children:"→"}),t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.baseRef}),e.diffFingerprint&&t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.diffFingerprint})]}),Os(e.latestInjectedAt,O)&&t.jsx("div",{className:"mt-1 truncate text-[11px] text-muted-foreground/70",children:o("rightSidebar.branchAuditGeneratedAt",{time:Os(e.latestInjectedAt,O)??""})})]}),t.jsx("button",{type:"button",onClick:()=>{Oh(e)},className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:o("rightSidebar.branchAuditClearTitle"),"aria-label":o("rightSidebar.branchAuditClearTitle"),children:t.jsx(co,{size:12})})]},e.key)):rn.length===0?t.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:o("rightSidebar.branchAuditEmpty")}):null]})]})]}):null,im=()=>nr&&x&&Rn?t.jsxs("div",{className:Ka?"overflow-visible":"overflow-hidden",children:[om(),t.jsxs("button",{type:"button",onClick:()=>{ot||lh(e=>{const i=!e;return i&&Se&&!Rn&&!fn&&ai(Se),i})},"aria-expanded":Ka,className:`group flex w-full items-center gap-2 px-1 pb-1 pt-4 text-left transition ${ot?"cursor-default":"rounded-lg hover:bg-surface-2 active:scale-[0.99]"}`,children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:t.jsx(vr,{size:14})}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-foreground",children:o("rightSidebar.gitQuickActions")}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[t.jsxs("span",{className:`inline-flex items-center justify-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${jn.staged>0?"bg-accent/10 text-accent":"bg-surface-2 text-muted-foreground"}`,children:[fn&&t.jsx(wt,{size:10,className:"animate-spin"}),jn.staged>0?o("rightSidebar.stagedCount",{count:jn.staged}):o("rightSidebar.noStagedChangesShort")]}),!ot&&t.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${Ka?"rotate-90":""}`,children:t.jsx(Hs,{size:13})})]})]}),Ka&&t.jsxs("div",{className:"space-y-0",children:[_t.length>1&&t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsx("div",{className:"mb-2 flex items-center justify-between gap-2",children:t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.gitRepositorySectionTitle")}),t.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:Nh})]})}),t.jsx(ns,{label:o("rightSidebar.gitRepositoryLabel"),value:Se??"",options:_t,placeholder:o("rightSidebar.gitRepositoryPlaceholder"),searchPlaceholder:o("rightSidebar.gitRepositorySearchPlaceholder"),emptyText:o("rightSidebar.gitRepositoryEmpty"),disabled:!!ze,onChange:e=>{md(e||null)}}),Je&&t.jsx("div",{className:"mt-2 rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[11px] text-[color:var(--warning)]",children:o("rightSidebar.selectRepositoryForGitActions")})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.branchSectionTitle")}),t.jsx("div",{className:"mt-0.5 h-4 truncate text-[11px] leading-4 text-muted-foreground",children:_n!==_c?_c:null})]}),t.jsxs("button",{type:"button",onClick:()=>{tm()},disabled:!Fh,className:`relative inline-flex h-8 shrink-0 items-center justify-center rounded-md px-3 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${Ri?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:o("rightSidebar.switchBranch"),children:[t.jsx("span",{className:ze?.action==="switch-branch"||Ri?"opacity-0":"",children:o("rightSidebar.switchBranch")}),ze?.action==="switch-branch"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),Ri&&ze?.action!=="switch-branch"&&t.jsx("span",{className:"absolute",children:"✓"})]})]}),t.jsx(ns,{label:o("rightSidebar.currentBranchLabel"),value:_n,options:$h,placeholder:o("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:o("rightSidebar.switchBranchSearchPlaceholder"),emptyText:o("rightSidebar.switchNoBranches"),disabled:!!ze,onChange:ha})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.commitSectionTitle")}),t.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:Je?o("rightSidebar.selectRepositoryForGitActions"):jn.staged>0?o("rightSidebar.commitReadyHint",{count:jn.staged}):o("rightSidebar.commitNeedsStaged")})]}),t.jsxs("button",{type:"button",onClick:()=>{gd()},disabled:!!ze||Je||jn.staged===0||!fa.trim(),className:`relative inline-flex h-8 shrink-0 items-center justify-center rounded-md px-3 text-[12px] font-medium transition active:scale-95 ${ji?"bg-accent/10 text-accent disabled:bg-accent/10 disabled:text-accent":"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-surface-2 disabled:text-muted-foreground"} disabled:cursor-not-allowed`,title:Je?o("rightSidebar.selectRepositoryForGitActions"):jn.staged===0?o("rightSidebar.commitNeedsStaged"):o("rightSidebar.commitChanges"),children:[t.jsx("span",{className:ze?.action==="commit"||ji?"opacity-0":"",children:o("rightSidebar.commitChanges")}),ze?.action==="commit"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),ji&&ze?.action!=="commit"&&t.jsx("span",{className:"absolute",children:"✓"})]})]}),t.jsx("input",{value:fa,onChange:e=>zl(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&(e.preventDefault(),gd())},placeholder:o("rightSidebar.commitMessagePlaceholder"),disabled:!!ze,className:"w-full min-h-10 rounded-md border border-transparent bg-surface-2 px-3 py-2 text-[13px] placeholder:text-[13px] text-foreground outline-none transition placeholder:text-muted-foreground/70 focus:border-primary focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-60",maxLength:300})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("button",{type:"button",onClick:()=>ms(e=>!e),className:"group flex w-full items-center justify-between gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":zr,children:[t.jsx("span",{className:"min-w-0 text-[12px] font-medium text-foreground",children:o("rightSidebar.recentCommitsTitle")}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[Ot&&t.jsx(wt,{size:12,className:"animate-spin text-muted-foreground"}),t.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${zr?"rotate-90":""}`,children:t.jsx(Hs,{size:13})})]})]}),zr&&t.jsxs("div",{className:"mt-2 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[t.jsx(ss,{size:12,className:"shrink-0"}),t.jsx("input",{value:ps,onChange:e=>hr(e.target.value),placeholder:o("rightSidebar.recentCommitsSearchPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1}),ps&&t.jsx("button",{type:"button",onClick:()=>hr(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":o("rightSidebar.clearSearch"),children:t.jsx(Yt,{size:12})})]}),t.jsxs("div",{className:"max-h-56 space-y-1 overflow-y-auto overscroll-contain pr-1",onScroll:Eh,children:[Q.length>0?Q.map(e=>{const[i,...c]=e.split(/\s+/),w=c.join(" ")||e;return t.jsxs("button",{type:"button",onClick:()=>{Xh(e)},className:"flex w-full min-w-0 items-start gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-left font-mono text-[10px] transition hover:bg-surface-elevated active:scale-[0.99]",title:w,children:[t.jsx("span",{className:"shrink-0 text-[color:var(--diff-hunk-accent)]",children:i}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",title:w,children:w}),on[i]&&t.jsx("span",{className:`shrink-0 rounded px-1 font-sans text-[10px] ${on[i]==="ahead"?"bg-accent/10 text-accent":on[i]==="behind"?"bg-surface-2 text-[color:var(--warning)]":"text-muted-foreground"}`,children:o(on[i]==="ahead"?"rightSidebar.commitAhead":on[i]==="behind"?"rightSidebar.commitBehind":"rightSidebar.commitSynced")}),mt===i&&t.jsx(wt,{size:11,className:"shrink-0 animate-spin text-muted-foreground"})]},e)}):Ot?t.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-2 text-center text-[11px] text-muted-foreground",children:o("common.loading")}):$o?null:t.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:o("rightSidebar.recentCommitsEmpty")}),sa&&t.jsx("div",{className:"flex justify-center rounded-md bg-surface-2 px-2 py-2 text-muted-foreground",children:t.jsx(wt,{size:12,className:"animate-spin"})}),Ao&&!sa&&Q.length>0&&t.jsx("button",{type:"button",onClick:()=>{Ns({reset:!1})},className:"w-full rounded-md bg-surface-2 px-2 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:o("rightSidebar.recentCommitsLoadMore")})]})]}),sn&&t.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:sn}),$o&&t.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:$o})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.pushSectionTitle")}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{nm()},disabled:!Ih,className:`relative inline-flex h-8 min-w-[3.25rem] items-center justify-center rounded-md px-3 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${Ci?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:o("rightSidebar.pullChanges"),children:[t.jsx("span",{className:ze?.action==="pull"||Ci?"opacity-0":"",children:o("rightSidebar.pullChanges")}),ze?.action==="pull"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),Ci&&ze?.action!=="pull"&&t.jsx("span",{className:"absolute",children:"✓"})]}),t.jsxs("button",{type:"button",onClick:()=>{rm()},disabled:!Dh,className:`relative inline-flex h-8 min-w-[3.25rem] items-center justify-center rounded-md px-3 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${Ni?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:o("rightSidebar.pushChanges"),children:[t.jsx("span",{className:ze?.action==="push"||Ni?"opacity-0":"",children:o("rightSidebar.pushChanges")}),ze?.action==="push"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),Ni&&ze?.action!=="push"&&t.jsx("span",{className:"absolute",children:"✓"})]})]})]}),t.jsxs("div",{className:`mb-2 flex min-w-0 items-center justify-between gap-2 rounded-md px-2 py-1.5 text-[11px] ${qc.className}`,title:he?.upstream??void 0,children:[t.jsx("span",{className:"truncate font-medium",children:qc.text}),t.jsx("span",{className:"w-[6.5rem] shrink-0 truncate text-right text-[10px] opacity-75",children:he?.upstream??""})]}),t.jsxs("div",{className:`grid gap-1.5 ${Wc?"grid-cols-2":"grid-cols-1"}`,children:[Wc&&t.jsx(ns,{label:o("rightSidebar.pushRemoteLabel"),value:hn,options:zc,placeholder:o("rightSidebar.pushRemotePlaceholder"),searchPlaceholder:o("rightSidebar.pushRemoteSearchPlaceholder"),emptyText:o("rightSidebar.pushNoRemotes"),disabled:!!ze,onChange:ma}),t.jsx(ns,{label:o("rightSidebar.pushBranchLabel"),value:mn,options:Ah,placeholder:o("rightSidebar.pushBranchPlaceholder",{branch:he?.branch??"HEAD"}),searchPlaceholder:o("rightSidebar.pushBranchSearchPlaceholder"),emptyText:o("rightSidebar.pushNoBranches"),disabled:!!ze,onChange:pa})]})]})]})]}):null,lm=a.useCallback(e=>{const i=pt(e,x);if(!i)return[];const c=Yi(e),w=[];return e.canStage&&w.push({key:"stage-file",label:o("rightSidebar.stageFile"),onClick:()=>{vt({action:"stage-file",cwd:i,paths:[e.path]},o("rightSidebar.stageFile"),c)}}),e.canUnstage&&w.push({key:"unstage-file",label:o("rightSidebar.unstageFile"),onClick:()=>{vt({action:"unstage-file",cwd:i,paths:[e.path]},o("rightSidebar.unstageFile"),c)}}),e.canStash&&w.push({key:"stash-file",label:o("rightSidebar.stashFile"),onClick:()=>{vt({action:"stash-file",cwd:i,paths:[e.path]},o("rightSidebar.stashFile"),c)}}),e.canRestoreWorktree&&w.push({key:"restore-worktree-file",label:o("rightSidebar.restoreFile"),destructive:!0,onClick:()=>un({kind:"restore",file:e,phrase:""})}),w},[x,vt,o]),cm=a.useCallback(()=>{if(p){y?.();return}Mr(0),Lr.current?.slideTo(0),Er(!1),St(null)},[y,p]),vd=a.useCallback(e=>{if(re(""),Ut(e),st(null),St(null),q(null),oe){p&&y?.(),Mr(0),Lr.current?.slideTo(0),Er(!1);return}},[oe,y,p,st,Ut]);a.useEffect(()=>{const e=i=>{const c=i.detail,w=c?.path;if(typeof w!="string"||!w.startsWith("/"))return;re(""),St(null),Jt(null);const v=!!(x&&(w===x||w.startsWith(`${x}/`)));if(c.kind==="file"){const S=io(w);Ss(w),typeof c.line=="number"&&Number.isSafeInteger(c.line)&&c.line>0&&Jt(c.line),Ut(v?null:S),q(j=>({path:w,nonce:(j?.nonce??0)+1}));return}st(null),v?(Ut(null),q(S=>({path:w,nonce:(S?.nonce??0)+1}))):(q(null),Ut(w)),oe&&(p&&y?.(),Mr(0),Lr.current?.slideTo(0),Er(!1))};return window.addEventListener(_d,e),()=>window.removeEventListener(_d,e)},[Ss,oe,y,p,x,st,Ut]),a.useEffect(()=>{r||(Pt(!1),Xt(!1))},[r]),a.useEffect(()=>{if(!Lt&&!kr)return;const e=i=>{i instanceof globalThis.KeyboardEvent&&i.key!=="Escape"||i instanceof globalThis.MouseEvent&&i.target instanceof Node&&($n.current?.contains(i.target)||ra.current?.contains(i.target))||(Pt(!1),Xt(!1))};return window.addEventListener("mousedown",e),window.addEventListener("keydown",e),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",e)}},[kr,Lt]);const wd=t.jsxs("div",{"data-local-layer":"file-explorer-menu-host",className:"sticky top-0 z-20 bg-surface/95 px-2.5 py-1.5 backdrop-blur",children:[t.jsxs("div",{className:"flex min-h-9 min-w-0 items-center gap-1.5",children:[t.jsx("button",{type:"button",onClick:jh,disabled:!Aa,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":o("rightSidebar.parentFolder"),title:o("rightSidebar.parentFolder"),children:t.jsx(Au,{size:14})}),t.jsx("button",{type:"button",onClick:$c,disabled:!x||On===x,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":o("rightSidebar.backToProjectRoot"),title:o("rightSidebar.backToProjectRoot"),children:t.jsx(Bd,{size:14})}),t.jsx("button",{type:"button",onClick:Rh,disabled:!de,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":o("rightSidebar.refreshFiles"),title:Wl?o("rightSidebar.fileWatchUnavailable",{message:Wl}):o("rightSidebar.refreshFiles"),children:t.jsx(uo,{size:13})}),t.jsx("div",{className:"min-w-0 flex-1 px-1",title:de??void 0,children:t.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-[12px] font-medium text-foreground",children:[t.jsx("span",{className:"truncate",children:kh}),ya==="modified"&&t.jsx("span",{className:"inline-flex shrink-0 text-primary",title:o("fileTree.sortedByModified"),"aria-label":o("fileTree.sortedByModified"),children:t.jsx(Od,{size:11})})]})}),t.jsx("button",{type:"button",onClick:()=>de&&Gt(de,Ft??void 0),disabled:!de,...de&&Ft?di(Ma(de),Ft):{},className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition disabled:cursor-not-allowed disabled:opacity-35 active:scale-95 ${Ft&&(ke===Ft||Qe===Ft)?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary hover:bg-primary/20"}`,"aria-label":o(Ft&&Qe===Ft?"rightSidebar.copied":Ft&&ke===Ft?"rightSidebar.inserted":"rightSidebar.insertCurrentFolder"),title:o("rightSidebar.insertCurrentFolder"),children:Ft&&(ke===Ft||Qe===Ft)?t.jsx(go,{size:13}):t.jsx(bo,{size:13})}),t.jsxs("button",{type:"button",disabled:!de||!fh||Jo,"aria-pressed":bn,"aria-label":o(bn?"rightSidebar.showGitIgnoredFiles":"rightSidebar.hideGitIgnoredFiles"),title:o(bn?"rightSidebar.showGitIgnoredFiles":"rightSidebar.hideGitIgnoredFiles"),onClick:()=>{if(!de||Jo)return;const e=de;ic(!0),Qo(null),hh(e,!bn).catch(()=>{const i=Y.getState();(i.explorerRoot??i.rootPath)===e&&Qo(o("rightSidebar.gitIgnoreSaveFailed"))}).finally(()=>ic(!1))},className:`inline-flex h-7 shrink-0 items-center gap-1 rounded-md px-1.5 text-[11px] font-medium transition active:scale-95 disabled:opacity-40 ${bn?"bg-primary/15 text-primary hover:bg-primary/20":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[Jo?t.jsx(wt,{size:13,className:"animate-spin"}):t.jsx(Cp,{size:13}),t.jsx("span",{children:"Git ignore"})]}),t.jsxs("div",{ref:ra,className:"relative shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>{Pt(!1),Xt(e=>!e)},className:`inline-flex h-7 w-7 items-center justify-center rounded-md transition active:scale-95 ${kr?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,"aria-expanded":kr,"aria-haspopup":"menu","aria-label":o("sidebar.moreActions"),title:o("sidebar.moreActions"),children:t.jsx(po,{size:14})}),kr&&t.jsxs("div",{role:"menu","data-local-layer":"file-explorer-menu",className:"absolute right-0 top-[calc(100%+4px)] z-30 w-48 overflow-hidden rounded-xl border border-border/15 bg-surface p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",children:[t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xt(!1),Ch()},disabled:!mi,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition disabled:opacity-40 ${Rs?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[Rs?t.jsx(Ti,{size:14}):t.jsx(Xa,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(Rs?"rightSidebar.unpinCurrentFolder":"rightSidebar.pinCurrentFolder")})]}),t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xt(!1),dh()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${qo?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[qo?t.jsx(kp,{size:14}):t.jsx(nl,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(qo?"rightSidebar.hideHiddenFiles":"rightSidebar.showHiddenFiles")})]}),t.jsxs("button",{type:"button",role:"menuitem",disabled:!de,onClick:()=>{de&&(Xt(!1),uh(de,ya==="modified"?"name":"modified"))},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2 disabled:opacity-40",children:[ya==="modified"?t.jsx(sp,{size:14}):t.jsx(Od,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(ya==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]})]})]}),lc&&t.jsx("p",{role:"alert",className:"px-1 py-1 text-[11px] text-destructive",children:lc}),x&&(La.length>0||Sh)&&t.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1 pb-0.5 text-[11px]",children:[t.jsx("span",{className:"shrink-0 px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:o("rightSidebar.pinnedFolders")}),t.jsxs("button",{type:"button",onClick:$c,className:`inline-flex max-w-[9rem] shrink-0 items-center gap-1 rounded-md px-2 py-0.5 font-medium transition active:scale-95 ${de===x?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:x,children:[t.jsx(Bd,{size:10,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:tt})]}),La.map(e=>{const i=e.path,c=e.kind==="file",w=c?nt===i:de===i;return t.jsxs("span",{className:`group inline-flex max-w-[12rem] shrink-0 items-center rounded-md transition ${w?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:i,children:[t.jsxs("button",{type:"button",onClick:()=>c?Ss(i):Ut(i),className:"inline-flex min-w-0 items-center gap-1 px-2 py-0.5 font-medium active:scale-95",children:[c?t.jsx(sl,{size:10,className:"shrink-0"}):t.jsx(Xa,{size:10,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:yt(i)})]}),t.jsx("button",{type:"button",onClick:()=>pn(i),className:"mr-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":o("rightSidebar.unpinFolder",{name:yt(i)}),title:o("rightSidebar.unpinFolder",{name:yt(i)}),children:t.jsx(Yt,{size:9})})]},i)})]}),t.jsx("span",{"data-local-layer":"file-explorer-divider",className:"pointer-events-none absolute inset-x-0 bottom-0 z-10 h-px bg-border/15","aria-hidden":"true"})]}),Mi=a.useMemo(()=>{if(Fn===null)return null;const e=typeof navigator>"u"?void 0:navigator.language,i=Math.max(0,Math.floor((Uo-Fn)/1e3)),c=new Intl.RelativeTimeFormat(e,{numeric:"auto"}),[w,v]=i<60?[-i,"second"]:i<3600?[-Math.floor(i/60),"minute"]:i<86400?[-Math.floor(i/3600),"hour"]:[-Math.floor(i/86400),"day"];return c.format(w,v)},[Uo,Fn]),qa="flex min-h-10 w-full items-center gap-2.5 rounded-md px-2.5 text-left text-[12px] text-foreground transition hover:bg-surface-2 focus:bg-surface-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [@media(pointer:coarse)]:min-h-11",yd=x&&!Xn?t.jsxs("button",{type:"button",role:"menuitemcheckbox",tabIndex:-1,onClick:()=>{em(!Vo)},"aria-checked":Vo,title:o("rightSidebar.multiRepoScanTitle"),className:qa,children:[t.jsx(vr,{size:15,className:"shrink-0 text-muted-foreground"}),t.jsx("span",{className:"min-w-0 flex-1",children:o("rightSidebar.multiRepoScan")}),Vo&&t.jsx(go,{size:14,className:"shrink-0 text-primary"})]}):null,kd=x?t.jsxs("div",{className:"inline-flex shrink-0 items-center gap-1.5",children:[Mi?t.jsx("span",{className:"whitespace-nowrap text-[10px] text-muted-foreground",title:o("rightSidebar.gitLastUpdated",{time:Mi}),children:Mi}):null,t.jsx("button",{type:"button",onClick:()=>{Yn()},disabled:pr,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 active:scale-95","aria-label":o("rightSidebar.refreshGit"),title:o("rightSidebar.refreshGit"),children:t.jsx(uo,{size:13,className:pr?"animate-spin":""})})]}):null,dm=pc?o("rightSidebar.changeAuditScopeAll"):wn.length===1?wn[0].relativeRoot==="."?tt:wn[0].relativeRoot||wn[0].name:`${wn.length} repos`,um=e=>x?t.jsxs("div",{role:"none",children:[t.jsx(vu,{menuItem:!0,open:fs,onOpenChange:i=>{Qr(i),i&&e()},showScopePicker:Cn,selectedAll:pc,repos:mh,selectedRoots:sr,onToggleRepo:Uh,onGenerate:()=>{e(),_h()},disabled:!x,inserted:ke===Mc,buttonLabel:o("rightSidebar.changeAuditShort"),insertedLabel:o("rightSidebar.inserted"),title:o("rightSidebar.insertChangeAuditPromptTitle"),ariaLabel:o("rightSidebar.insertChangeAuditPrompt"),scopeTitle:o("rightSidebar.changeAuditScopeLabel"),scopeLabel:dm,allLabel:o("rightSidebar.changeAuditScopeAll"),generateLabel:o("rightSidebar.changeAuditShort"),loading:us,error:!!Jr,statusTitle:Jr??(us?o("rightSidebar.changeAuditLoading"):jt.length>0?`${o("rightSidebar.changeAuditLoaded",{count:jt.length})}${xd?` · ${o("rightSidebar.changeAuditLoadedAt",{time:xd})}`:""}`:void 0)}),jt.length>0&&t.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{e(),Bh()},disabled:us||jt.length===0,className:qa,title:o("rightSidebar.clearChangeAuditTitle"),"aria-label":o("rightSidebar.clearChangeAudit"),children:[t.jsx(co,{size:15,className:"shrink-0 text-muted-foreground"}),t.jsx("span",{children:o("rightSidebar.clearChangeAudit")})]})]}):null,ts=ar??(R?.available&&x&&Ie.size>0&&fe.length<=1?{root:x,label:tt}:null),Sd=e=>t.jsxs(t.Fragment,{children:[ts&&t.jsxs("div",{role:"group","aria-label":o("rightSidebar.gitQuickActions"),children:[t.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{e(),Ga("stage-all",ts.root,ts.label)},disabled:!!ze,className:qa,children:[t.jsx(Um,{size:15,className:"shrink-0 text-muted-foreground"}),o("rightSidebar.stageAll")]}),t.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{e(),Ga("stash-all",ts.root,ts.label)},disabled:!!ze,className:qa,children:[t.jsx(xp,{size:15,className:"shrink-0 text-muted-foreground"}),o("rightSidebar.stashAll")]})]}),ts&&t.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/30"}),um(e),yd&&t.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/30"}),yd]}),Va=t.jsxs("div",{className:"flex h-5 flex-nowrap items-center gap-1 overflow-x-auto whitespace-nowrap text-[10px] font-medium [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [&>*]:shrink-0",children:[R?.available&&R.branch&&t.jsxs("span",{className:"inline-flex min-w-0 max-w-[8rem] items-center gap-0.5 truncate rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",title:R.branch,children:[t.jsx(vr,{size:10,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:R.branch})]}),ft.modified>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-hunk-accent)]",children:[ft.modified,"M"]}),ft.added>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:["+",ft.added]}),ft.deleted>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-delete-strong)]",children:["-",ft.deleted]}),ft.renamed>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[ft.renamed,"R"]}),ft.copied>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[ft.copied,"C"]}),ft.untracked>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[ft.untracked,"U"]}),ft.conflicted>0&&t.jsxs("span",{className:"rounded bg-destructive/10 px-1.5 py-0.5 text-destructive",children:[ft.conflicted,"!"]}),ft.other>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[ft.other,"?"]}),ft.staged>0&&t.jsx("span",{className:"rounded bg-accent/10 px-1.5 py-0.5 text-accent",children:o("rightSidebar.stagedCountShort",{count:ft.staged})})]});return t.jsxs(ap,{side:"right",isOpen:r,drawerWidthPx:s,onClose:l,onOpen:f,push:d,pinned:h,children:[di.popoverNode,t.jsxs("div",{className:`relative shrink-0 border-b border-border/15 bg-surface px-2 pt-2 ${bh?"hidden":""}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"min-w-0 flex-1 px-1",children:t.jsxs("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:[t.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",title:x??void 0,children:tt}),(!oe||_o)&&R?.available&&R.branch&&t.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5 truncate text-[11px] text-muted-foreground",title:R.branch,children:[t.jsx(vr,{size:10,className:"shrink-0"}),t.jsx("span",{className:"max-w-[7rem] truncate",children:R.branch})]})]})}),t.jsx("button",{type:"button",onClick:()=>{const e=!pe;W(e),e?window.requestAnimationFrame(()=>document.querySelector("[data-right-search]")?.focus()):re("")},className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${pe?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":o("rightSidebar.toggleSearch"),title:o("common.search"),children:t.jsx(ss,{size:14})}),t.jsxs("button",{type:"button",role:"switch","aria-checked":Te,onClick:()=>{et(e=>!e),lt(!1)},className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${Te?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":o("rightSidebar.toggleContextDraft"),title:o("rightSidebar.contextDraftTitle"),children:[t.jsx(op,{size:14}),!Te&&ve.trim()&&t.jsx("span",{className:"absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-primary","aria-hidden":"true"})]}),t.jsx("input",{ref:Vl,type:"file",multiple:!0,className:"hidden",onChange:e=>{const i=e.target.files;!i||i.length===0||(js(Array.from(i)),e.target.value="")}}),t.jsx("input",{ref:Yl,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const i=e.target.files?.[0];e.target.value="",i&&vh(i)}}),g&&t.jsx("button",{type:"button",onClick:g,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${h?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":o(h?"sidebar.unpinSidebar":"sidebar.pinSidebar"),title:o(h?"sidebar.unpinSidebar":"sidebar.pinSidebar"),children:h?t.jsx(Ti,{size:14}):t.jsx(Xa,{size:14})}),t.jsxs("div",{ref:$n,className:"relative shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>{Xt(!1),Pt(e=>!e)},className:`relative inline-flex h-8 w-8 items-center justify-center rounded-full transition active:scale-95 ${Lt?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":Lt,"aria-haspopup":"menu","aria-label":o("sidebar.moreActions"),title:o("sidebar.moreActions"),children:t.jsx(po,{size:15})}),Lt&&t.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+4px)] z-30 w-56 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[t.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":Gr,onClick:()=>xc(!Gr),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[t.jsx(Td,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"flex-1",children:o("rightSidebar.showAndroidTab")}),t.jsx("span",{"aria-hidden":"true",className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition ${Gr?"bg-primary":"bg-surface-elevated"}`,children:t.jsx("span",{className:`absolute h-3 w-3 rounded-full bg-background transition-all ${Gr?"left-3.5":"left-0.5"}`})})]}),t.jsx("div",{className:"my-1 h-px bg-border/15",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Pt(!1),Vl.current?.click()},disabled:ga,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2 disabled:opacity-50",children:[ga?t.jsx(wt,{size:14,className:"animate-spin text-muted-foreground"}):t.jsx(Tp,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o("rightSidebar.uploadFiles")})]}),t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Pt(!1),Yl.current?.click()},disabled:ga,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2 disabled:opacity-50",children:[ga?t.jsx(wt,{size:14,className:"animate-spin text-muted-foreground"}):t.jsx(Ep,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o("rightSidebar.insertLocalImage")})]}),g&&t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Pt(!1),g()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${h?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[h?t.jsx(Ti,{size:14}):t.jsx(Xa,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(h?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]}),h&&t.jsxs("div",{className:"mt-1 flex items-center gap-2 border-t border-border/15 px-1.5 pt-1.5",role:"group","aria-label":o("rightSidebar.layoutMode"),children:[t.jsx("div",{className:"shrink-0 pl-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:o("rightSidebar.layoutMode")}),t.jsx("div",{className:"grid min-w-0 flex-1 grid-cols-3 gap-0.5 rounded-lg bg-surface-2 p-0.5",children:[["auto",o("rightSidebar.layoutModeAuto")],["narrow",o("rightSidebar.layoutModeNarrow")],["wide",o("rightSidebar.layoutModeWide")]].map(([e,i])=>{const c=Z===e;return t.jsx("button",{type:"button",role:"menuitemradio","aria-checked":c,onClick:()=>{A(e),Pt(!1)},className:`rounded-md px-1 py-1.5 text-center text-[11px] font-medium transition active:scale-95 ${c?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:i},e)})})]})]})]}),t.jsx("button",{type:"button",onClick:l,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive active:scale-95","aria-label":o("rightSidebar.close"),children:t.jsx(Yt,{size:14})})]}),pe&&t.jsxs("div",{className:"mt-2 space-y-1.5 pb-0.5",children:[t.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-3 py-1.5 text-muted-foreground transition focus-within:bg-surface-elevated",children:[t.jsx(ss,{size:12,className:"shrink-0"}),t.jsx("input",{"data-right-search":!0,type:"search",value:z,onChange:e=>re(e.target.value),placeholder:o(D==="content"?"rightSidebar.searchPlaceholderContent":"rightSidebar.filterChanges"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",enterKeyHint:"search",spellCheck:!1}),t.jsxs("div",{className:`flex shrink-0 items-center gap-0.5 rounded-full bg-surface/70 p-0.5 font-medium ${oe?"text-[11px]":"text-[10px]"}`,children:[t.jsx("button",{type:"button",onClick:()=>fd("name"),"aria-pressed":D==="name",className:`rounded-full px-2 transition active:scale-95 ${oe?"py-1":"py-0.5"} ${D==="name"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:o("rightSidebar.searchModeName")}),t.jsx("button",{type:"button",onClick:()=>fd("content"),"aria-pressed":D==="content",className:`rounded-full px-2 transition active:scale-95 ${oe?"py-1":"py-0.5"} ${D==="content"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:o("rightSidebar.searchModeContent")})]}),z&&t.jsx("button",{type:"button",onClick:()=>re(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":o("rightSidebar.clearSearch"),children:t.jsx(Yt,{size:12})})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("label",{className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg bg-surface-2 px-2.5 py-1.5 text-muted-foreground transition focus-within:bg-surface-elevated",children:[t.jsx(ip,{size:12,className:"shrink-0 text-primary"}),t.jsx("span",{className:"shrink-0 text-[10px] font-medium",children:o("rightSidebar.searchScope")}),t.jsx("input",{"data-search-scope":!0,value:ue,onChange:e=>me(e.target.value),onKeyDown:e=>{e.key==="Enter"&&document.querySelector("[data-right-search]")?.focus()},className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-foreground placeholder:text-muted-foreground",placeholder:o("rightSidebar.searchScopePlaceholder"),"aria-label":o("rightSidebar.searchScope"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),ue!=="."&&t.jsx("button",{type:"button",onClick:()=>me("."),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":o("rightSidebar.resetSearchScope"),children:t.jsx(Yt,{size:11})})]}),t.jsxs("button",{type:"button",onClick:()=>$(e=>!e),"aria-expanded":Ce,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition active:scale-95 ${Ce||ws.length>0||J||Ae||De?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:o("rightSidebar.searchOptions"),"aria-label":o("rightSidebar.searchOptions"),children:[t.jsx(lp,{size:13}),ws.length>0&&t.jsx("span",{className:"absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-[8px] font-bold leading-4 text-primary-foreground",children:ws.length})]})]}),Ce&&t.jsxs("div",{className:"animate-fade-in rounded-xl bg-surface-2 p-2",children:[t.jsxs("label",{className:"flex items-center gap-2 rounded-lg bg-surface px-2.5 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[t.jsx("span",{className:"shrink-0 text-[10px] font-medium",children:o("rightSidebar.searchExclude")}),t.jsx("input",{"data-search-exclude":!0,value:we,onChange:e=>je(e.target.value),className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-foreground placeholder:text-muted-foreground",placeholder:o("rightSidebar.searchExcludePlaceholder"),"aria-label":o("rightSidebar.searchExclude"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),we&&t.jsx("button",{type:"button",onClick:()=>je(""),className:"rounded p-0.5 hover:bg-surface-2 hover:text-foreground","aria-label":o("rightSidebar.clearSearchExclude"),children:t.jsx(Yt,{size:11})})]}),D==="content"&&t.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-1",role:"group","aria-label":o("rightSidebar.contentSearchOptions"),children:[[J,()=>ne(e=>!e),wp,o("rightSidebar.matchCase")],[Ae,()=>Ye(e=>!e),Dp,o("rightSidebar.matchWholeWord")],[De,()=>rt(e=>!e),$p,o("rightSidebar.useRegex")]].map(([e,i,c,w])=>t.jsxs("button",{type:"button",onClick:i,"aria-pressed":e,className:`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] transition ${e?"bg-primary/15 text-primary":"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[t.jsx(c,{size:12}),w]},w))})]})]}),t.jsxs("div",{className:"mt-2 grid gap-0.5 rounded-md bg-surface-2 p-0.5",style:{gridTemplateColumns:`repeat(${(Xn?2:3)+(Gr?1:0)}, minmax(0, 1fr))`},children:[!Xn&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:e=>Ca("git",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="git"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(vr,{size:12}),o("rightSidebar.tabGit")]}),t.jsxs("button",{type:"button",onClick:e=>Ca("diff",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="diff"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(zu,{size:12}),o("rightSidebar.tabChanges"),Ie.size>0?t.jsx("span",{className:"text-[10px] text-accent",children:Ie.size}):null]})]}),t.jsxs("button",{type:"button",onClick:e=>Ca("files",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="files"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(fp,{size:12}),o("rightSidebar.tabFiles")]}),Gr&&t.jsxs("button",{type:"button",onClick:e=>Ca("android",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="android"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(Td,{size:12}),o("rightSidebar.tabAndroid")]})]}),t.jsx("div",{className:"h-2"}),Ul&&t.jsx("div",{className:"pointer-events-none absolute right-3 top-10 z-20 max-w-[72%] rounded-lg bg-destructive/95 px-3 py-2 text-[11px] font-medium text-destructive-foreground shadow-md animate-fade-in",children:Ul})]}),t.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-surface",children:[t.jsx(Ja,{active:ot,mounted:nr,fallback:t.jsx(Ki,{slow:!1}),children:()=>Oe?t.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:t.jsx(qd,{items:zh,diffViewType:zo,inlineMode:cr,viewControls:h?Ms():void 0,renderPathReference:(e,i)=>_a(En(e,Oe.repoRoot??x),o(i==="file"?"rightSidebar.insertThisFile":"fileTree.insertRefTitle")),selectedKey:eh,onSelect:aa,emptyText:o("rightSidebar.noChanges"),mobile:oe,backLabel:o("rightSidebar.backToChangeList"),headerTitle:o("rightSidebar.recentCommitsTitle"),headerMeta:`${Oe.headRef??""}${Oe.commits?.[0]?` · ${Oe.commits[0]}`:""}`,onClose:()=>{Ue(null),aa(null)},closeLabel:o("common.back"),wrap:Tt,onToggleWrap:za,wrapTitle:o("rightSidebar.wrapLongLines"),wrapOnLabel:o("rightSidebar.wrapOn"),wrapOffLabel:o("rightSidebar.wrapOff"),desktopLayout:oe?"stacked":"split",onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa})}):ur?t.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:t.jsx(qd,{items:vi,diffViewType:zo,inlineMode:cr,viewControls:h?Ms():void 0,renderPathReference:(e,i)=>{const c=xe?.comparisonRepos,w=c&&c.length>1?[...c].sort((S,j)=>j.label.length-S.label.length).find(S=>e===S.label||e.startsWith(`${S.label}/`)):void 0,v=w?e===w.label?w.repoRoot:En(e.slice(w.label.length+1),w.repoRoot):En(e,Ls?.repoRoot||x);return _a(v,o(i==="file"?"rightSidebar.insertThisFile":"fileTree.insertRefTitle"))},selectedKey:Do,onSelect:dn,emptyText:o(xe?"rightSidebar.branchAuditDiffEmpty":"rightSidebar.branchAuditEmpty"),mobile:oe,backLabel:o("rightSidebar.backToChangeList"),headerTitle:o(xe?"rightSidebar.branchAuditViewDiff":"rightSidebar.branchAuditTitle"),headerMeta:Ls?`${Ls.repoLabel} · ${Ls.branchName??"HEAD"} → ${Ls.baseRef}`:void 0,onClose:()=>{++It.current,ye(!1),fr(!1),er(null)},closeLabel:o("common.back"),wrap:Tt,onToggleWrap:za,wrapTitle:o("rightSidebar.wrapLongLines"),wrapOnLabel:o("rightSidebar.wrapOn"),wrapOffLabel:o("rightSidebar.wrapOff"),desktopLayout:oe?"stacked":"split",onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa,localOptions:xe?.comparisonRepos?.map(e=>({key:e.repoRoot,label:e.label,checked:e.includeUncommitted??xe.includeUncommitted??!1,disabled:!(e.canIncludeUncommitted??Zn(e.repoRoot,e.head)),onChange:i=>{Si({refresh:!0,repoRoot:e.repoRoot,includeUncommitted:i})}})),onHunkGitAction:xe?.includeUncommitted?Zh:void 0,error:Ze,actionsBusy:I>0,onRefresh:()=>{Si({refresh:!0})},refreshing:ce,refreshLabel:o("rightSidebar.branchAuditRefreshDiff"),refreshTitle:o("rightSidebar.branchAuditRefreshDiff"),walkthroughs:Wh,onWalkthroughNavigate:Gh,initialDetailScrollTop:xe&&qe?hs[qe]:void 0,onDetailScrollPositionChange:Jh,externalSwiperRef:oe?hc:void 0,onMobileSlideChange:oe?Fo:void 0})}):t.jsx("div",{className:"h-full overflow-y-auto overscroll-contain bg-surface pb-6",children:nr&&x&&Rn?t.jsx("div",{className:"px-3",children:im()}):pr?t.jsx(Ki,{slow:nc}):gn?t.jsx(oo,{message:gn,onRetry:()=>{Yn()}}):ju(R)?t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o(x?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")}):R?.available===!1?t.jsx(oo,{message:R.error??o("rightSidebar.gitChangesLoadFailed"),onRetry:()=>{Yn()}}):x?t.jsx(Ki,{slow:nc}):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o(x?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")})})}),t.jsx(Ja,{active:Pr,mounted:rh||Pr,children:()=>oe?t.jsxs(Pu,{className:"h-full min-h-0 w-full",slidesPerView:1,resistanceRatio:.45,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:".swiper-no-swiping",allowTouchMove:!1,touchAngle:75,touchStartPreventDefault:!1,onSwiper:e=>{Lr.current=e,e.slideTo(Fl,0)},onSlideChange:e=>{if(Mr(e.activeIndex),ks.current===e.activeIndex){ks.current=null;return}e.activeIndex===0&&(Er(!1),St(null),y?.())},children:[t.jsx(Zi,{className:"h-full min-h-0",children:t.jsxs("div",{ref:Wn,onScroll:vc,onDragOver:Na,onDragEnter:Na,onDragLeave:kc,onDrop:Sc,className:"h-full overflow-auto overscroll-contain bg-surface relative",children:[Gl&&t.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:t.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:o("rightSidebar.dropToUpload")})}),!z.trim()&&wd,t.jsx(Ud,{rootPath:de??"",onFileSelect:Ss,onPathReference:Gt,getReferenceText:Ma,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onDirectoryRoot:Ac,onSearchFromDirectory:Lc,onDirectoryPinToggle:Pc,onFilePinToggle:Tc,pinnedPaths:kn,selectedFilePath:nt,query:_e,searchRootPath:cc,searchOptions:dc,searchMode:D,onContentMatchSelect:wc,onDirectoryDropFiles:(e,i)=>js(i,e),revealDirectory:M,canOpenInFileBrowser:Kl,onOpenInFileBrowser:yc})]})}),t.jsx(Zi,{className:"h-full min-h-0",children:t.jsx("div",{className:"h-full overflow-hidden bg-surface",children:t.jsx(vl,{filePath:th||Fl===1?nt:null,active:Pr,onInsertReference:Gt,onInsertText:Ir,onInsertFeature:Ir,onReviewReference:Nc,onReferenceCopied:Tr,onClose:cm,onDirectoryLinkOpen:vd,isMobile:!0,lineRange:Sr,onLineRangeChange:St,insertedReferenceKey:ke,copiedReferenceKey:Qe,scrollToLine:An,onScrollToLineHandled:()=>Jt(null),markdownOutlineOpen:B,markdownOutlineCloseSignal:_,onOpenMarkdownOutline:C,onCloseMarkdownOutline:N,markdownImageLightboxOpen:P,markdownImageLightboxCloseSignal:U,onOpenMarkdownImageLightbox:T,onCloseMarkdownImageLightbox:k})})})]}):t.jsxs("div",{className:"flex h-full min-h-0",children:[t.jsxs("div",{ref:Wn,onScroll:vc,onDragOver:Na,onDragEnter:Na,onDragLeave:kc,onDrop:Sc,className:"shrink-0 overflow-auto overscroll-contain bg-surface relative",style:{width:Wo},children:[Gl&&t.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:t.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:o("rightSidebar.dropToUpload")})}),!z.trim()&&wd,t.jsx(Ud,{rootPath:de??"",onFileSelect:Ss,onPathReference:Gt,getReferenceText:Ma,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onDirectoryRoot:Ac,onSearchFromDirectory:Lc,onDirectoryPinToggle:Pc,onFilePinToggle:Tc,pinnedPaths:kn,selectedFilePath:nt,query:_e,searchRootPath:cc,searchOptions:dc,searchMode:D,onContentMatchSelect:wc,onDirectoryDropFiles:(e,i)=>js(i,e),revealDirectory:M,canOpenInFileBrowser:Kl,onOpenInFileBrowser:yc})]}),t.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o("rightSidebar.resizeFileTree"),title:o("rightSidebar.resizeFileTree"),"data-local-layer":"file-preview-separator",className:"group relative z-10 w-2 shrink-0 cursor-col-resize touch-none border-l border-border/15 bg-surface",onPointerDown:ph,onPointerMove:gh,onPointerUp:bc,onPointerCancel:bc,onDoubleClick:()=>{Go(cl),At(zs,cl)},children:t.jsx("span",{className:"absolute left-1/2 top-0 h-full w-px -translate-x-1/2 bg-border/20 transition group-hover:bg-primary/45"})}),t.jsx("div",{className:"min-w-0 flex-1 overflow-hidden bg-surface",children:t.jsx(vl,{filePath:nt,active:Pr,onInsertReference:Gt,onInsertText:Ir,onInsertFeature:Ir,onReviewReference:Nc,onReferenceCopied:Tr,onDirectoryLinkOpen:vd,isMobile:!1,lineRange:Sr,onLineRangeChange:St,insertedReferenceKey:ke,copiedReferenceKey:Qe,scrollToLine:An,onScrollToLineHandled:()=>Jt(null),markdownOutlineOpen:B,markdownOutlineCloseSignal:_,onOpenMarkdownOutline:C,onCloseMarkdownOutline:N,markdownImageLightboxOpen:P,markdownImageLightboxCloseSignal:U,onOpenMarkdownImageLightbox:T,onCloseMarkdownImageLightbox:k})})]})}),t.jsx(Ja,{active:Mt,mounted:sh||Mt,children:()=>oi?t.jsx(cp,{}):oe?t.jsx(el,{mobile:!0,backLabel:o("rightSidebar.backToChangeList"),externalSwiperRef:si,onMobileSlideChange:Fo,groups:Vt.length>0?Zc():[],mode:Ur,onModeChange:Ha,selectedKey:nt,scrollToKey:sd,scrollToKeyNonce:xa.nonce,compact:!1,collapsedDirectoryKeys:Br,onToggleDirectory:id,onSelectFile:e=>{const i=Nn.get(e.key);i&&Ua(wr(i))},renderLeading:ed,renderTrailing:e=>{const i=Nn.get(e.key);return i?Jc(i):null},renderDirectoryTrailing:Qc,renderSubtitle:e=>{const i=Nn.get(e.key);return i?Xc(i):null},listContainerClassName:"termdock-native-select min-h-0 px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",renderListHeader:e=>x&&t.jsxs("div",{className:"px-0 py-0",children:[Va&&t.jsx("div",{className:"mb-2",children:Va}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("div",{className:"min-w-0",children:t.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:o("rightSidebar.allChanges")})}),t.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Vt.length,"/",Ie.size]})]}),t.jsxs(Gd,{actions:Sd,children:[Vc(),e,h&&Ms(),kd]},x),ar&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:ar.label}),ar.branch&&t.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:ar.branch})]}),!ar&&Cn&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[t.jsx(vr,{size:12,className:"shrink-0"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:o("rightSidebar.selectRepositoryForDiff")})]})]}),aiContent:Ia?(e=>od(e)):void 0,emptyContent:oi?null:gn&&Ie.size===0?t.jsx(oo,{message:gn,onRetry:()=>{Yn()}}):Ie.size===0?t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("rightSidebar.noChanges")}):Vt.length===0?t.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:o("rightSidebar.noMatchingChanges")}):null,renderMobileDetailHeader:({slideToList:e})=>t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("button",{type:"button",onClick:e,className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-surface-2 px-3 text-xs font-semibold text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",title:o("rightSidebar.backToChangeList"),children:[t.jsx(Ys,{size:14}),o("rightSidebar.backToChangeList")]}),t.jsxs("div",{className:"ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1.5",children:[h&&Ms(),t.jsxs("button",{type:"button",onClick:za,"aria-pressed":Tt,title:o("rightSidebar.wrapLongLines"),className:`inline-flex h-9 shrink-0 items-center gap-1 rounded-full px-3 text-[11px] font-medium transition active:scale-95 ${Tt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[t.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),t.jsx("span",{children:o(Tt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]}),x&&t.jsx("button",{type:"button",onClick:()=>{Yn()},disabled:pr,"aria-label":o("rightSidebar.refreshGit"),title:o("rightSidebar.refreshGit"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 active:scale-95",children:t.jsx(uo,{size:14,className:pr?"animate-spin":""})})]})]}),detailContainerClassName:"termdock-native-select termdock-diff-stream-scroller min-h-0",files:td,activePane:Mt,wrap:Tt,diffViewType:zo,inlineMode:cr,diffOptions:ud,reloadKey:ls,renderStreamBadge:e=>t.jsx(Ks,{status:e}),onHunkGitAction:hd,onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa,onDetailScroll:Ba}):t.jsx(el,{mobile:!1,desktopLayout:"split",desktopSidePanel:null,desktopListClassName:"w-[320px] min-w-[260px] shrink-0 overflow-y-auto overscroll-contain border-r border-border/15 bg-surface",backLabel:o("rightSidebar.backToChangeList"),groups:Vt.length>0?Zc():[],mode:Ur,onModeChange:Ha,selectedKey:nt,scrollToKey:sd,scrollToKeyNonce:xa.nonce,compact:!0,collapsedDirectoryKeys:Br,onToggleDirectory:id,onSelectFile:e=>{const i=Nn.get(e.key);i&&Ua(wr(i))},renderLeading:ed,renderTrailing:e=>{const i=Nn.get(e.key);return i?Jc(i):null},renderDirectoryTrailing:Qc,renderSubtitle:e=>{const i=Nn.get(e.key);return i?Xc(i):null},aiContent:Ia?(e=>od(e)):void 0,emptyContent:oi?null:gn&&Ie.size===0?t.jsx(oo,{message:gn,onRetry:()=>{Yn()}}):Ie.size===0?t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("rightSidebar.noChanges")}):Vt.length===0?t.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:o("rightSidebar.noMatchingChanges")}):null,renderListHeader:e=>x&&t.jsxs("div",{className:"px-0 py-0",children:[Va&&t.jsx("div",{className:"mb-2",children:Va}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:o("rightSidebar.allChanges")}),t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Vt.length,"/",Ie.size]})})]}),t.jsxs(Gd,{actions:Sd,children:[Vc(),e,Ms(),t.jsxs("button",{type:"button",onClick:za,"aria-pressed":Tt,title:o("rightSidebar.wrapLongLines"),className:`inline-flex h-7 shrink-0 items-center gap-1 rounded-full px-2 text-[10px] font-semibold transition active:scale-95 ${Tt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[t.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),t.jsx("span",{children:o(Tt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]}),kd]},x),ar&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:ar.label}),ar.branch&&t.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:ar.branch})]}),!ar&&Cn&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[t.jsx(vr,{size:12,className:"shrink-0"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:o("rightSidebar.selectRepositoryForDiff")})]})]}),files:td,activePane:Mt,wrap:Tt,diffViewType:Rr,inlineMode:cr,diffOptions:ud,reloadKey:ls,renderStreamBadge:e=>t.jsx(Ks,{status:e}),onHunkGitAction:hd,onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa,onDetailScroll:Ba})}),t.jsx(Ja,{active:Jn,mounted:Oo&&Gr,children:ah?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-[11px] text-muted-foreground",children:[t.jsx("span",{children:o("android.splitDockedHint")}),t.jsx("button",{type:"button",onClick:()=>{Ai.getState().setDock(Pi,null),lo({androidPanel:{docked:null}}).catch(()=>{})},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:o("android.splitClose")})]}):t.jsx(dp,{sessionId:n??null,onCloseTab:()=>xc(!1),onInsertPrompt:e=>Dr("android-deps",e),onInsertFile:yh,onRecordingComplete:wh})})]}),r&&Te&&t.jsx(ig,{value:ve,collapsed:Bt,autoCollapseAfterSend:H,focusRequest:Nt,insertError:os?o("rightSidebar.contextDraftInsertFailed"):null,onChange:e=>{_r(!1),Xe(e)},onCollapsedChange:lt,onAutoCollapseAfterSendChange:ae,onDisable:()=>et(!1),onClear:()=>Xe(""),onInsert:()=>Ec(!1),onInsertAndSend:()=>Ec(!0),labels:{title:o("rightSidebar.contextDraftTitle"),hint:o("rightSidebar.contextDraftHint"),placeholder:o("rightSidebar.contextDraftPlaceholder"),collapse:o("rightSidebar.contextDraftCollapse"),expand:o("rightSidebar.contextDraftExpand"),disable:o("rightSidebar.contextDraftDisable"),clear:o("rightSidebar.contextDraftClear"),insert:o("rightSidebar.contextDraftInsert"),insertAndSend:o("rightSidebar.contextDraftInsertAndSend"),inserted:o("rightSidebar.contextDraftInserted"),sent:o("rightSidebar.contextDraftSent"),send:o("rightSidebar.contextDraftSend"),appended:o("rightSidebar.contextDraftAppended"),resize:o("rightSidebar.contextDraftResize"),autoCollapseAfterSend:o("rightSidebar.contextDraftAutoCollapseAfterSend"),characterCount:e=>o("rightSidebar.contextDraftCharacterCount",{count:e})}}),Th(),bt&&typeof document<"u"&&Fr.createPortal(t.jsx("div",{className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>un(null),children:t.jsxs("div",{className:"fixed inset-x-3 bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto max-w-md rounded-2xl border border-border/20 bg-surface-elevated p-4 shadow-2xl",onClick:e=>e.stopPropagation(),children:[t.jsx("div",{className:"text-sm font-semibold text-foreground",children:bt.kind==="restore"?o("rightSidebar.confirmRestoreTitle"):o("rightSidebar.confirmStashAllTitle")}),t.jsx("div",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:bt.kind==="restore"?o("rightSidebar.confirmRestoreDescription",{path:$u(bt.file.absolutePath,x)}):o("rightSidebar.confirmStashAllDescription")}),bt.kind==="restore"&&t.jsx("input",{value:bt.phrase,onChange:e=>un({...bt,phrase:e.target.value}),placeholder:o("rightSidebar.confirmRestorePlaceholder"),className:"mt-3 w-full rounded-xl border border-border/20 bg-surface-2 px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground",autoFocus:!0}),t.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:()=>un(null),className:"rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:o("common.cancel")}),t.jsx("button",{type:"button",disabled:!!ze||bt.kind==="restore"&&bt.phrase.trim()!==o("rightSidebar.confirmRestorePhrase"),onClick:()=>{if(bt.kind==="restore"){const e=pt(bt.file,x);if(!e)return;vt({action:"restore-worktree-file",cwd:e,paths:[bt.file.path],confirm:{acknowledged:!0,phrase:bt.phrase}},o("rightSidebar.restoreFile"),Yi(bt.file))}else{const e=bt.repoRoot??x;if(!e)return;vt({action:"stash-all",cwd:e},o("rightSidebar.stashAll"),`repo:${e}`)}},className:`rounded-full px-3 py-1.5 text-xs font-semibold disabled:opacity-50 ${bt.kind==="restore"?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-primary text-primary-foreground hover:bg-primary/90"}`,children:o(ze?"rightSidebar.gitActionRunning":"rightSidebar.confirmAction")})]})]})}),document.body)]})}const Bx=Object.freeze(Object.defineProperty({__proto__:null,FilePreview:vl,MarkdownImageLightbox:Uf,MarkdownPreview:Hf,RightSidebar:Nx,__testParseMarkdownListBlock:Wb,buildMarkdownPreviewBlocks:tx,buildMarkdownPreviewRenderResult:$l,collectKnownGitRepoRoots:ff,computeMarkdownImageDisplayBox:jf,getMarkdownHeadingOutline:Of,getMarkdownHeadingPathAtLine:Bf,getNextMarkdownPreviewLineRange:ix,isSvgImageSrc:No,mountRightSidebarRepoPickerOverlay:Qu,replaceGitRepositorySnapshot:Vf,resolveMarkdownLocalLinkTarget:jl,resolveRightSidebarDiffViewType:df,shouldCloseMarkdownImageLightboxDrag:Df,showsGitRepoGroupHeader:dl},Symbol.toStringTag,{value:"Module"}));export{nl as E,Bx as R,kp as a,Bp as c,_x as m};
1678
+ `),truncated:j.some(V=>V.truncated)};if(ee.comparisonRepos=c.map((V,K)=>({...V,head:V.head??j[K].currentBranch??null,includeUncommitted:j[K].includeUncommitted===!0,canIncludeUncommitted:j[K].canIncludeUncommitted})),ee.canIncludeUncommitted=j.every(V=>V.canIncludeUncommitted===!0),ee.includeUncommitted=j.some(V=>V.includeUncommitted===!0),Io(V=>({...V,...Object.fromEntries(ee.comparisonRepos.map(K=>[K.repoRoot,K.includeUncommitted??!1]))})),!i&&(ee.hunks??[]).length===0){Fe(o("rightSidebar.branchAuditDiffEmpty"));return}const be=Date.now(),Ne=(i?qe:null)??["preview",ee.repoRoot??x,ee.baseRef??ee.baseBranch??"",ee.currentBranch??"",ee.headRef??"",ee.diffFingerprint??be].join("\0"),Ve=c.length===1?c[0].label:`${c.length} repos`;er(ee),Pn(V=>[{key:Ne,diff:ee,repoLabel:Ve,createdAt:be},...V.filter(K=>K.key!==Ne)].slice(0,8)),i||nn(V=>V[Ne]===void 0?V:{...V,[Ne]:0}),cn(Ne),dn(V=>{const K=ee.hunks?.[0],ge=K?`${K.filePath}\0${K.hunkHeader}\0${K.hunkIndex}`:null;return i&&V&&(ee.hunks??[]).some($e=>$e.filePath===V.split("\0")[0])?V:ge}),fr(!0)}catch(j){if(!S()||yr(j))return;Fe(j instanceof Error?j.message:"Failed to load branch diff")}finally{S()&&ye(!1)}},[ln,xe,qe,Es,Et,rr,Re,x,o]),qh=a.useCallback(e=>{++It.current,ye(!1),er(e.diff),Fe(null),cn(e.key),dn(e.diff.hunks?.[0]?`${e.diff.hunks[0].filePath}\0${e.diff.hunks[0].hunkHeader}\0${e.diff.hunks[0].hunkIndex}`:null),fr(!0)},[]),Vh=a.useCallback(e=>{Pn(i=>i.filter(c=>c.key!==e)),nn(i=>{if(!(e in i))return i;const c={...i};return delete c[e],c}),qe===e&&(cn(null),er(null),fr(!1))},[qe]),Yh=a.useCallback(e=>{++It.current,ye(!1);const i=es.find(c=>c.key===e);i&&(er(null),Fe(null),cn(e),dn(i.records[0]?.filePath??null),fr(!0))},[es]),Xh=a.useCallback(async e=>{if(!x||!Se)return;const[i]=e.split(/\s+/);if(i){gt(i),tr(null),Ue(null);try{const c=await Im({cwd:x,repoRoot:Se,commit:i,requestSlotId:"right-sidebar-commit-diff"});if(!c.available){tr(c.error??"Commit diff is unavailable");return}Ue(c);const w=c.hunks?.[0];aa(w?`${w.filePath}\0${w.hunkHeader}\0${w.hunkIndex}`:null)}catch(c){tr(c instanceof Error?c.message:"Failed to load commit diff")}finally{gt(null)}}},[Se,x]),Jh=a.useCallback(e=>{if(!xe||!qe)return;const i=Math.max(0,Math.round(e));nn(c=>Math.abs((c[qe]??0)-i)<24?c:{...c,[qe]:i})},[xe,qe]);a.useEffect(()=>{!xe||!qe||Pn(e=>e.map(i=>i.key===qe&&i.diff!==xe?{...i,diff:xe}:i))},[xe,qe]);const rd=!!xe;a.useEffect(()=>{if(!oe||!ur||!rd)return;const e=hc.current;if(!e||e.destroyed)return;e.update(),e.slideTo(1,0);const i=window.requestAnimationFrame(()=>{e.destroyed||(e.update(),e.slideTo(1,0))});return()=>window.cancelAnimationFrame(i)},[ur,rd,oe]);const nd=a.useCallback(e=>{e&&ch(i=>mp(i,e))},[]),sd=xa.key===nt?xa.key:null,Ua=a.useCallback(e=>{const i=Y.getState(),c=jx();Us("select_diff_file",{interactionId:c,path:e,previousSelectedFilePath:i.selectedFilePath,rootPath:i.rootPath,activeGitRepoRoot:le,changedFiles:i.changedFiles.size,gitBundleLoading:i.gitBundleLoading,gitBundleLastLoadedAt:i.gitBundleLastLoadedAt,rightTab:i.rightTab}),st(e),$r("diff"),oe&&e&&gc(1),nd(e),queueMicrotask(()=>{const w=Y.getState();Us("select_diff_file_after",{interactionId:c,requestedPath:e,selectedFilePath:w.selectedFilePath,rootPath:w.rootPath,rightTab:w.rightTab,changedFiles:w.changedFiles.size,activeGitRepoRoot:le})})},[le,oe,nd,st,$r,gc]),ad=a.useCallback(e=>{const i=Array.from(Ie.values()).find(c=>{const w=pt(c,x),v=wr(c);return c.path===e.filePath||v===e.filePath||c.absolutePath===e.filePath||(w?`${w}/${c.path}`===e.filePath:!1)||e.repoRoot&&w===e.repoRoot&&c.path===e.filePath});if(i){Ua(wr(i)),window.setTimeout(()=>Mn(e),90),window.setTimeout(()=>Mn(e),320),window.setTimeout(()=>Mn(e),760);return}Mn(e)},[Ie,x,Ua]),od=a.useCallback(({slideToDetail:e,fullscreen:i,toggleFullscreen:c}={})=>cs.length>0?t.jsx(Du,{walkthroughs:cs,repoRoot:le,fullscreen:i,onToggleFullscreen:c,onNavigate:w=>{oe&&window.requestAnimationFrame(()=>e?.()),ad(w)}}):t.jsxs("div",{className:"rounded-lg border border-border/15 bg-surface px-3 py-6 text-center text-xs text-muted-foreground",children:[t.jsx(Qs,{size:18,className:"mx-auto mb-2 text-muted-foreground/80"}),o("rightSidebar.changeWalkthroughEmpty")]}),[le,cs,ad,oe,o]),Qh=a.useCallback(e=>{e&&lr(i=>{const c=new Set(i);return c.has(e)?c.delete(e):c.add(e),Hi(_i,c),c})},[]),id=a.useCallback(e=>{Or(i=>{const c=new Set(i);return c.has(e)?c.delete(e):c.add(e),Hi(tu,c),c})},[]),Ha=a.useCallback(e=>{jr(e),At(ef,e)},[]);a.useEffect(()=>{Ia||Ur!=="ai"||Ha("tree")},[Ur,Ha,Ia]);const za=a.useCallback(()=>{na(e=>{const i=!e;return At(tf,i),i})},[]),ld=a.useCallback(e=>{is(e),At(rf,e)},[]),{whitespace:cd,context:dd}=gp(),ud=a.useMemo(()=>({algorithm:"histogram",whitespace:cd,context:dd}),[cd,dd]),fd=a.useCallback(e=>{X(e),At(nf,e)},[]),Wa=a.useCallback(async(e,i,c,w)=>{let v=e;for(;v.ok&&v.status==="running";)await new Promise(j=>window.setTimeout(j,1500)),v=await Ld({jobId:v.jobId,cwd:i.cwd,action:i.action});if(!v.ok)throw new Error("Git action status is unavailable");if(v.status==="error")throw new Error(v.error||v.message||"Git action failed");const S={action:i.action,path:w,label:c};return vs(S),window.setTimeout(()=>vs(j=>j?.action===S.action&&j.path===S.path?null:j),1400),v},[]),vt=a.useCallback(async(e,i,c)=>{const w=x;x&&gr.current.delete(x),xt(null),vs(null),xs({action:e.action,path:c});try{const v=await Dm({...e,includeNested:Fs(x)}),S=await Wa(v,e,i,c);if(!Re(w))return!1;const j=x?await Li(x,void 0,{includeNested:Fs(x),cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:Bs(x)}).catch(()=>S.bundle):S.bundle;return Re(w)?(j&&Vn(j,{reloadDiff:!0,cacheOnly:!0}),un(null),!0):!1}catch(v){return vs(null),xt(o("rightSidebar.gitActionFailed",{message:v instanceof Error?v.message:"Unknown error"})),!1}finally{Re(w)&&xs(null)}},[Vn,Re,x,o,Wa]),hd=a.useCallback(async e=>{const i=x;await Pd({...e,includeNested:Fs(x)}),Re(i)&&Dt(x??void 0,{refresh:!0,background:!0})},[Re,Dt,x]),Zh=a.useCallback(async e=>{const i=xe,c=It.current,w=i?.hunks?.find(S=>S.previewRevert?.cwd===e.cwd&&S.previewRevert.path===e.path);if(!i||!w||!e.comparisonBase)throw new Error(o("diffViewer.hunkActionUnavailable"));G(S=>S+1),Fe(null);try{await Pd(e)}catch(S){throw G(j=>j-1),S}if(c!==It.current||!Re(x)){G(S=>S-1);return}const v=S=>{er(j=>{if(!j||c!==It.current)return j;const ie=j.hunks??[],ee=S===void 0?ie.filter(Ne=>!(Ne.previewRevert?.cwd===e.cwd&&Ne.previewRevert.patch===e.patch)):[...ie.filter(Ne=>Ne.filePath!==w.filePath),...S];return{...j,hunks:ee}})};v(),Ad({cwd:e.cwd,repoRoot:e.cwd,base:e.comparisonBase,comparisonBase:e.comparisonBase,filePath:e.path,requestSlotId:`branch-preview-file:${e.cwd}:${e.path}`}).then(S=>{if(c!==It.current||!Re(x))return;if(!S.available||S.truncated)throw new Error(S.error??o("diffViewer.hunkActionUnavailable"));const j=e.path.slice(e.cwd.length+1),ie=w.filePath.slice(0,w.filePath.length-j.length);v((S.hunks??[]).map(ee=>({...ee,filePath:`${ie}${ee.filePath}`,oldPath:ee.oldPath?`${ie}${ee.oldPath}`:ee.oldPath,newPath:ee.newPath?`${ie}${ee.newPath}`:ee.newPath})))}).catch(S=>{c===It.current&&Re(x)&&!yr(S)&&Fe(`${o("diffViewer.hunkActionReverted")} · ${S instanceof Error?S.message:String(S)}`)}).finally(()=>G(S=>S-1))},[xe,Re,x,o]),Ga=a.useCallback((e,i,c)=>{if(i){if(e==="stage-all"){vt({action:"stage-all",cwd:i},o("rightSidebar.stageAll"),`repo:${i}`);return}un({kind:"stash-all",repoRoot:i,repoLabel:c})}},[vt,o]),md=a.useCallback(e=>{Le(e),ha(""),ma(""),pa(""),st(Oc(e)),ot||$r("diff"),e&&Pa(at.get(e))},[Pa,Oc,ot,at,st,Le,$r]),pd=a.useCallback(e=>{const i=new Set([...zt.current.keys(),...xn.current,...gr.current]);for(const c of i)c!==e&&(Ht.current.delete(c),zt.current.get(c)?.abort(),zt.current.delete(c),Ct(`right-sidebar-git-untracked:${c}`),xn.current.delete(c),gr.current.delete(c))},[]),em=a.useCallback(async e=>{const i=x;if(!i||(await Y.getState().setNestedGitScanRoot(i,e),!Re(i)))return;if(e){await Dt(i,{includeNested:!0,discoverOnly:!0,replaceWorkspace:!0,background:!0,reloadDiff:!0});return}pd(i),ha(""),ma(""),pa(""),To(w=>w.filter(v=>v===i));const c=Kt;c&&pt(c,i)!==i&&st(null),await Dt(i,{includeNested:!1,replaceWorkspace:!0,background:!0,reloadDiff:!0})},[pd,Re,Dt,x,st,Kt]),tm=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=_n.trim();!e||e===he?.branch||await vt({action:"switch-branch",cwd:Se,branch:e},o("rightSidebar.switchBranch"))},[he?.branch,Se,Je,vt,_n,o]),gd=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=fa.trim();if(!e)return;await vt({action:"commit",cwd:Se,message:e},o("rightSidebar.commitChanges"))&&zl("")},[Se,fa,Je,vt,o]),rm=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=hn.trim(),i=mn.trim();await vt({action:"push",cwd:Se,...e?{remote:e}:{},...i?{branch:i}:{}},o("rightSidebar.pushChanges"))},[Se,mn,hn,Je,vt,o]),nm=a.useCallback(async()=>{if(!Se||Je){xt(o("rightSidebar.selectRepositoryForGitActions"));return}const e=hn.trim(),i=mn.trim();await vt({action:"pull",cwd:Se,...e?{remote:e}:{},...i?{branch:i}:{}},o("rightSidebar.pullChanges"))},[Se,mn,hn,Je,vt,o]);a.useEffect(()=>{if(!ot||!Se||ze)return;let e=!1;const i={push:o("rightSidebar.pushChanges"),pull:o("rightSidebar.pullChanges"),commit:o("rightSidebar.commitChanges"),"switch-branch":o("rightSidebar.switchBranch"),"stage-all":o("rightSidebar.stageAll"),"stash-all":o("rightSidebar.stashAll")};return(async()=>{for(const c of["push","pull","commit","switch-branch","stage-all","stash-all"]){if(e)return;const w=await Ld({cwd:Se,action:c}).catch(()=>null);if(!w?.ok||w.status!=="running")continue;const v={action:c,cwd:Se},S=i[c]??c;xs({action:c});try{const j=await Wa(w,v,S);if(e||!Re(x))return;const ie=x?await Li(x,void 0,{includeNested:Fs(x),cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:Bs(x)}).catch(()=>j.bundle):j.bundle;ie&&Vn(ie,{reloadDiff:!0,cacheOnly:!0})}catch(j){e||xt(o("rightSidebar.gitActionFailed",{message:j instanceof Error?j.message:"Unknown error"}))}finally{e||xs(null)}return}})(),()=>{e=!0}},[Se,Vn,ot,Re,x,ze,o,Wa]);const ji=Dn?.action==="commit",Ri=Dn?.action==="switch-branch",Ci=Dn?.action==="pull",Ni=Dn?.action==="push",Ka=ot||ih,Ei=Fa?o("rightSidebar.changeAuditScopeAll"):xr.length===1?xr[0].label:`${xr.length} repos`,sm=xr.length>0,bd=Es.length>0,am=x?t.jsx(vu,{open:Lo,onOpenChange:Po,showScopePicker:!0,selectedAll:Fa,repos:qt,selectedRoots:Da,onToggleRepo:Hh,onGenerate:()=>Kh(wi?"regenerate":"generate"),disabled:!sm,generateDisabled:!bd,inserted:ke?.startsWith("context:branch-audit-scope:")??!1,buttonLabel:o(wi?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),insertedLabel:o("rightSidebar.inserted"),title:o("rightSidebar.branchAuditGenerateTitle"),ariaLabel:o("rightSidebar.branchAuditShort"),scopeTitle:o("rightSidebar.changeAuditScopeLabel"),scopeLabel:Ei,allLabel:o("rightSidebar.changeAuditScopeAll"),generateLabel:o(wi?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),onSecondaryAction:()=>{Si()},secondaryDisabled:!bd||ce,secondaryLabel:o("rightSidebar.branchAuditViewDiff"),secondaryTitle:o("rightSidebar.branchAuditViewDiffTitle"),secondaryLoading:ce,loading:Il.size>0,statusTitle:Il.size>0?o("rightSidebar.branchCandidatesLoading"):void 0,extraContent:t.jsx("div",{className:"mb-2 space-y-1.5",children:Gc.length>0&&t.jsx("div",{className:"rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[10px] text-[color:var(--warning)]",children:o("rightSidebar.missingBaseReposSkipped",{repositories:Gc.map(e=>e.label).join(O==="zh"?"、":", ")})})}),renderRepoExtra:e=>{const i=at.get(e.root),c=Zn(e.root,rr[e.root]||i?.context?.branch),w=[],v=new Set,S=(be,Ne)=>{!be||v.has(be)||(v.add(be),w.push({value:be,label:be,meta:Ne}))};S(rr[e.root]||i?.context?.branch,o("rightSidebar.pushCurrentBranchBadge"));for(const be of i?.context?.branches??[])S(be,be===i?.context?.branch?o("rightSidebar.pushCurrentBranchBadge"):o("rightSidebar.localBranch"));for(const be of i?.context?.remoteBranches??[])S(be,o("rightSidebar.remoteBranch"));const j=[],ie=new Set,ee=(be,Ne)=>{!be||ie.has(be)||(ie.add(be),j.push({value:be,label:be,meta:Ne}))};ee(Et[e.root],Et[e.root]?o("rightSidebar.pushUpstreamBadge"):void 0),ee(i?.context?.upstream,i?.context?.upstream?o("rightSidebar.pushUpstreamBadge"):void 0);for(const be of i?.context?.remoteBranches??[])ee(be,"remote");for(const be of i?.context?.branches??[])ee(be,be===i?.context?.branch?o("rightSidebar.pushCurrentBranchBadge"):"local");return t.jsxs("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:[t.jsx(ns,{label:o("rightSidebar.currentBranchLabel"),value:rr[e.root]||i?.context?.branch||"",options:w,placeholder:o("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:o("rightSidebar.switchBranchSearchPlaceholder"),emptyText:o("rightSidebar.switchNoBranches"),onChange:be=>{ia(Ne=>({...Ne,[e.root]:be}))}}),t.jsx(ns,{label:o("rightSidebar.branchAuditBaseLabel"),value:Et[e.root]||"",options:j,placeholder:o("rightSidebar.branchAuditBasePlaceholder"),searchPlaceholder:o("rightSidebar.branchAuditBaseSearchPlaceholder"),emptyText:o("rightSidebar.branchAuditBaseEmpty"),onChange:be=>{la(Ne=>({...Ne,[e.root]:be}))}}),t.jsxs("label",{className:"sm:col-span-2 flex cursor-pointer items-center justify-between gap-3 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-foreground",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block font-medium",children:o("rightSidebar.includeUncommitted")}),t.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:o(c?"rightSidebar.includeUncommittedHint":"rightSidebar.includeUncommittedCurrentBranchOnly")})]}),t.jsx("input",{type:"checkbox",checked:c&&(ln[e.root]??!0),disabled:!c,onChange:be=>Io(Ne=>({...Ne,[e.root]:be.target.checked})),className:"h-4 w-4 shrink-0 accent-[rgb(var(--primary-rgb))]"})]})]})}}):null,xd=Os(jt.reduce((e,i)=>Math.max(e,i.injectedAt??0),0),O),om=()=>x?t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("button",{type:"button",onClick:()=>Tl(e=>{const i=!e;return At(Bi,i),i}),className:"group flex w-full items-center gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":bs,children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:t.jsx(Qs,{size:14})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-[12px] font-semibold text-foreground",children:o("rightSidebar.branchAuditTitle")}),t.jsx("span",{className:"block truncate text-[11px] text-muted-foreground",children:Ei})]}),t.jsx("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${bs?"rotate-90":""}`,children:t.jsx(Hs,{size:13})})]}),bs&&t.jsxs("div",{className:"mt-2 rounded-lg border border-border/10 bg-surface/60 p-2",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 text-[11px] text-muted-foreground",children:[o("rightSidebar.changeAuditScopeLabel"),": ",Ei]}),am]}),Ze&&t.jsx("div",{className:"mb-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:Ze}),t.jsxs("div",{className:"mt-2 space-y-1.5",children:[rn.map(e=>t.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${qe===e.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[t.jsxs("button",{type:"button",onClick:()=>qh(e),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:e.repoLabel}),t.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[11px] text-muted-foreground",children:[e.diff.hunks?.length??0," hunk"]})]}),t.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[11px] text-muted-foreground",children:[t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.diff.currentBranch??"HEAD"}),t.jsx("span",{className:"text-muted-foreground/60",children:"→"}),t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.diff.baseRef??e.diff.baseBranch}),t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:o("rightSidebar.branchAuditViewDiff")})]}),Os(e.createdAt,O)&&t.jsx("div",{className:"mt-1 truncate text-[11px] text-muted-foreground/70",children:Os(e.createdAt,O)})]}),t.jsx("button",{type:"button",onClick:()=>Vh(e.key),className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:o("common.delete"),"aria-label":o("common.delete"),children:t.jsx(co,{size:12})})]},e.key)),es.length>0?es.slice(0,Math.max(0,8-rn.length)).map(e=>t.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${qe===e.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[t.jsxs("button",{type:"button",onClick:()=>Yh(e.key),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:e.repoLabel}),t.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[11px] text-muted-foreground",children:[e.records.length," hunk"]})]}),t.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[11px] text-muted-foreground",children:[t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.branchName??"HEAD"}),t.jsx("span",{className:"text-muted-foreground/60",children:"→"}),t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.baseRef}),e.diffFingerprint&&t.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:e.diffFingerprint})]}),Os(e.latestInjectedAt,O)&&t.jsx("div",{className:"mt-1 truncate text-[11px] text-muted-foreground/70",children:o("rightSidebar.branchAuditGeneratedAt",{time:Os(e.latestInjectedAt,O)??""})})]}),t.jsx("button",{type:"button",onClick:()=>{Oh(e)},className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:o("rightSidebar.branchAuditClearTitle"),"aria-label":o("rightSidebar.branchAuditClearTitle"),children:t.jsx(co,{size:12})})]},e.key)):rn.length===0?t.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:o("rightSidebar.branchAuditEmpty")}):null]})]})]}):null,im=()=>nr&&x&&Rn?t.jsxs("div",{className:Ka?"overflow-visible":"overflow-hidden",children:[om(),t.jsxs("button",{type:"button",onClick:()=>{ot||lh(e=>{const i=!e;return i&&Se&&!Rn&&!fn&&ai(Se),i})},"aria-expanded":Ka,className:`group flex w-full items-center gap-2 px-1 pb-1 pt-4 text-left transition ${ot?"cursor-default":"rounded-lg hover:bg-surface-2 active:scale-[0.99]"}`,children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:t.jsx(vr,{size:14})}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-foreground",children:o("rightSidebar.gitQuickActions")}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[t.jsxs("span",{className:`inline-flex items-center justify-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${jn.staged>0?"bg-accent/10 text-accent":"bg-surface-2 text-muted-foreground"}`,children:[fn&&t.jsx(wt,{size:10,className:"animate-spin"}),jn.staged>0?o("rightSidebar.stagedCount",{count:jn.staged}):o("rightSidebar.noStagedChangesShort")]}),!ot&&t.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${Ka?"rotate-90":""}`,children:t.jsx(Hs,{size:13})})]})]}),Ka&&t.jsxs("div",{className:"space-y-0",children:[_t.length>1&&t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsx("div",{className:"mb-2 flex items-center justify-between gap-2",children:t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.gitRepositorySectionTitle")}),t.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:Nh})]})}),t.jsx(ns,{label:o("rightSidebar.gitRepositoryLabel"),value:Se??"",options:_t,placeholder:o("rightSidebar.gitRepositoryPlaceholder"),searchPlaceholder:o("rightSidebar.gitRepositorySearchPlaceholder"),emptyText:o("rightSidebar.gitRepositoryEmpty"),disabled:!!ze,onChange:e=>{md(e||null)}}),Je&&t.jsx("div",{className:"mt-2 rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[11px] text-[color:var(--warning)]",children:o("rightSidebar.selectRepositoryForGitActions")})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.branchSectionTitle")}),t.jsx("div",{className:"mt-0.5 h-4 truncate text-[11px] leading-4 text-muted-foreground",children:_n!==_c?_c:null})]}),t.jsxs("button",{type:"button",onClick:()=>{tm()},disabled:!Fh,className:`relative inline-flex h-8 shrink-0 items-center justify-center rounded-md px-3 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${Ri?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:o("rightSidebar.switchBranch"),children:[t.jsx("span",{className:ze?.action==="switch-branch"||Ri?"opacity-0":"",children:o("rightSidebar.switchBranch")}),ze?.action==="switch-branch"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),Ri&&ze?.action!=="switch-branch"&&t.jsx("span",{className:"absolute",children:"✓"})]})]}),t.jsx(ns,{label:o("rightSidebar.currentBranchLabel"),value:_n,options:$h,placeholder:o("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:o("rightSidebar.switchBranchSearchPlaceholder"),emptyText:o("rightSidebar.switchNoBranches"),disabled:!!ze,onChange:ha})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.commitSectionTitle")}),t.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:Je?o("rightSidebar.selectRepositoryForGitActions"):jn.staged>0?o("rightSidebar.commitReadyHint",{count:jn.staged}):o("rightSidebar.commitNeedsStaged")})]}),t.jsxs("button",{type:"button",onClick:()=>{gd()},disabled:!!ze||Je||jn.staged===0||!fa.trim(),className:`relative inline-flex h-8 shrink-0 items-center justify-center rounded-md px-3 text-[12px] font-medium transition active:scale-95 ${ji?"bg-accent/10 text-accent disabled:bg-accent/10 disabled:text-accent":"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-surface-2 disabled:text-muted-foreground"} disabled:cursor-not-allowed`,title:Je?o("rightSidebar.selectRepositoryForGitActions"):jn.staged===0?o("rightSidebar.commitNeedsStaged"):o("rightSidebar.commitChanges"),children:[t.jsx("span",{className:ze?.action==="commit"||ji?"opacity-0":"",children:o("rightSidebar.commitChanges")}),ze?.action==="commit"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),ji&&ze?.action!=="commit"&&t.jsx("span",{className:"absolute",children:"✓"})]})]}),t.jsx("input",{value:fa,onChange:e=>zl(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&(e.preventDefault(),gd())},placeholder:o("rightSidebar.commitMessagePlaceholder"),disabled:!!ze,className:"w-full min-h-10 rounded-md border border-transparent bg-surface-2 px-3 py-2 text-[13px] placeholder:text-[13px] text-foreground outline-none transition placeholder:text-muted-foreground/70 focus:border-primary focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-60",maxLength:300})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("button",{type:"button",onClick:()=>ms(e=>!e),className:"group flex w-full items-center justify-between gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":zr,children:[t.jsx("span",{className:"min-w-0 text-[12px] font-medium text-foreground",children:o("rightSidebar.recentCommitsTitle")}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[Ot&&t.jsx(wt,{size:12,className:"animate-spin text-muted-foreground"}),t.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${zr?"rotate-90":""}`,children:t.jsx(Hs,{size:13})})]})]}),zr&&t.jsxs("div",{className:"mt-2 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[t.jsx(ss,{size:12,className:"shrink-0"}),t.jsx("input",{value:ps,onChange:e=>hr(e.target.value),placeholder:o("rightSidebar.recentCommitsSearchPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1}),ps&&t.jsx("button",{type:"button",onClick:()=>hr(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":o("rightSidebar.clearSearch"),children:t.jsx(Yt,{size:12})})]}),t.jsxs("div",{className:"max-h-56 space-y-1 overflow-y-auto overscroll-contain pr-1",onScroll:Eh,children:[Q.length>0?Q.map(e=>{const[i,...c]=e.split(/\s+/),w=c.join(" ")||e;return t.jsxs("button",{type:"button",onClick:()=>{Xh(e)},className:"flex w-full min-w-0 items-start gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-left font-mono text-[10px] transition hover:bg-surface-elevated active:scale-[0.99]",title:w,children:[t.jsx("span",{className:"shrink-0 text-[color:var(--diff-hunk-accent)]",children:i}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",title:w,children:w}),on[i]&&t.jsx("span",{className:`shrink-0 rounded px-1 font-sans text-[10px] ${on[i]==="ahead"?"bg-accent/10 text-accent":on[i]==="behind"?"bg-surface-2 text-[color:var(--warning)]":"text-muted-foreground"}`,children:o(on[i]==="ahead"?"rightSidebar.commitAhead":on[i]==="behind"?"rightSidebar.commitBehind":"rightSidebar.commitSynced")}),mt===i&&t.jsx(wt,{size:11,className:"shrink-0 animate-spin text-muted-foreground"})]},e)}):Ot?t.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-2 text-center text-[11px] text-muted-foreground",children:o("common.loading")}):$o?null:t.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:o("rightSidebar.recentCommitsEmpty")}),sa&&t.jsx("div",{className:"flex justify-center rounded-md bg-surface-2 px-2 py-2 text-muted-foreground",children:t.jsx(wt,{size:12,className:"animate-spin"})}),Ao&&!sa&&Q.length>0&&t.jsx("button",{type:"button",onClick:()=>{Ns({reset:!1})},className:"w-full rounded-md bg-surface-2 px-2 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:o("rightSidebar.recentCommitsLoadMore")})]})]}),sn&&t.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:sn}),$o&&t.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:$o})]}),t.jsxs("div",{className:"border-b border-border/40 px-1 py-4 last:border-b-0",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:o("rightSidebar.pushSectionTitle")}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{nm()},disabled:!Ih,className:`relative inline-flex h-8 min-w-[3.25rem] items-center justify-center rounded-md px-3 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${Ci?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:o("rightSidebar.pullChanges"),children:[t.jsx("span",{className:ze?.action==="pull"||Ci?"opacity-0":"",children:o("rightSidebar.pullChanges")}),ze?.action==="pull"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),Ci&&ze?.action!=="pull"&&t.jsx("span",{className:"absolute",children:"✓"})]}),t.jsxs("button",{type:"button",onClick:()=>{rm()},disabled:!Dh,className:`relative inline-flex h-8 min-w-[3.25rem] items-center justify-center rounded-md px-3 text-[12px] font-medium transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${Ni?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:o("rightSidebar.pushChanges"),children:[t.jsx("span",{className:ze?.action==="push"||Ni?"opacity-0":"",children:o("rightSidebar.pushChanges")}),ze?.action==="push"&&t.jsx(wt,{size:12,className:"absolute animate-spin"}),Ni&&ze?.action!=="push"&&t.jsx("span",{className:"absolute",children:"✓"})]})]})]}),t.jsxs("div",{className:`mb-2 flex min-w-0 items-center justify-between gap-2 rounded-md px-2 py-1.5 text-[11px] ${qc.className}`,title:he?.upstream??void 0,children:[t.jsx("span",{className:"truncate font-medium",children:qc.text}),t.jsx("span",{className:"w-[6.5rem] shrink-0 truncate text-right text-[10px] opacity-75",children:he?.upstream??""})]}),t.jsxs("div",{className:`grid gap-1.5 ${Wc?"grid-cols-2":"grid-cols-1"}`,children:[Wc&&t.jsx(ns,{label:o("rightSidebar.pushRemoteLabel"),value:hn,options:zc,placeholder:o("rightSidebar.pushRemotePlaceholder"),searchPlaceholder:o("rightSidebar.pushRemoteSearchPlaceholder"),emptyText:o("rightSidebar.pushNoRemotes"),disabled:!!ze,onChange:ma}),t.jsx(ns,{label:o("rightSidebar.pushBranchLabel"),value:mn,options:Ah,placeholder:o("rightSidebar.pushBranchPlaceholder",{branch:he?.branch??"HEAD"}),searchPlaceholder:o("rightSidebar.pushBranchSearchPlaceholder"),emptyText:o("rightSidebar.pushNoBranches"),disabled:!!ze,onChange:pa})]})]})]})]}):null,lm=a.useCallback(e=>{const i=pt(e,x);if(!i)return[];const c=Yi(e),w=[];return e.canStage&&w.push({key:"stage-file",label:o("rightSidebar.stageFile"),onClick:()=>{vt({action:"stage-file",cwd:i,paths:[e.path]},o("rightSidebar.stageFile"),c)}}),e.canUnstage&&w.push({key:"unstage-file",label:o("rightSidebar.unstageFile"),onClick:()=>{vt({action:"unstage-file",cwd:i,paths:[e.path]},o("rightSidebar.unstageFile"),c)}}),e.canStash&&w.push({key:"stash-file",label:o("rightSidebar.stashFile"),onClick:()=>{vt({action:"stash-file",cwd:i,paths:[e.path]},o("rightSidebar.stashFile"),c)}}),e.canRestoreWorktree&&w.push({key:"restore-worktree-file",label:o("rightSidebar.restoreFile"),destructive:!0,onClick:()=>un({kind:"restore",file:e,phrase:""})}),w},[x,vt,o]),cm=a.useCallback(()=>{if(p){y?.();return}Mr(0),Lr.current?.slideTo(0),Er(!1),St(null)},[y,p]),vd=a.useCallback(e=>{if(re(""),Ut(e),st(null),St(null),q(null),oe){p&&y?.(),Mr(0),Lr.current?.slideTo(0),Er(!1);return}},[oe,y,p,st,Ut]);a.useEffect(()=>{const e=i=>{const c=i.detail,w=c?.path;if(typeof w!="string"||!w.startsWith("/"))return;re(""),St(null),Jt(null);const v=!!(x&&(w===x||w.startsWith(`${x}/`)));if(c.kind==="file"){const S=io(w);Ss(w),typeof c.line=="number"&&Number.isSafeInteger(c.line)&&c.line>0&&Jt(c.line),Ut(v?null:S),q(j=>({path:w,nonce:(j?.nonce??0)+1}));return}st(null),v?(Ut(null),q(S=>({path:w,nonce:(S?.nonce??0)+1}))):(q(null),Ut(w)),oe&&(p&&y?.(),Mr(0),Lr.current?.slideTo(0),Er(!1))};return window.addEventListener(_d,e),()=>window.removeEventListener(_d,e)},[Ss,oe,y,p,x,st,Ut]),a.useEffect(()=>{r||(Pt(!1),Xt(!1))},[r]),a.useEffect(()=>{if(!Lt&&!kr)return;const e=i=>{i instanceof globalThis.KeyboardEvent&&i.key!=="Escape"||i instanceof globalThis.MouseEvent&&i.target instanceof Node&&($n.current?.contains(i.target)||ra.current?.contains(i.target))||(Pt(!1),Xt(!1))};return window.addEventListener("mousedown",e),window.addEventListener("keydown",e),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",e)}},[kr,Lt]);const wd=t.jsxs("div",{"data-local-layer":"file-explorer-menu-host",className:"sticky top-0 z-20 bg-surface/95 px-2.5 py-1.5 backdrop-blur",children:[t.jsxs("div",{className:"flex min-h-9 min-w-0 items-center gap-1.5",children:[t.jsx("button",{type:"button",onClick:jh,disabled:!Aa,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":o("rightSidebar.parentFolder"),title:o("rightSidebar.parentFolder"),children:t.jsx(Au,{size:14})}),t.jsx("button",{type:"button",onClick:$c,disabled:!x||On===x,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":o("rightSidebar.backToProjectRoot"),title:o("rightSidebar.backToProjectRoot"),children:t.jsx(Bd,{size:14})}),t.jsx("button",{type:"button",onClick:Rh,disabled:!de,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":o("rightSidebar.refreshFiles"),title:Wl?o("rightSidebar.fileWatchUnavailable",{message:Wl}):o("rightSidebar.refreshFiles"),children:t.jsx(uo,{size:13})}),t.jsx("div",{className:"min-w-0 flex-1 px-1",title:de??void 0,children:t.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-[12px] font-medium text-foreground",children:[t.jsx("span",{className:"truncate",children:kh}),ya==="modified"&&t.jsx("span",{className:"inline-flex shrink-0 text-primary",title:o("fileTree.sortedByModified"),"aria-label":o("fileTree.sortedByModified"),children:t.jsx(Od,{size:11})})]})}),t.jsx("button",{type:"button",onClick:()=>de&&Gt(de,Ft??void 0),disabled:!de,...de&&Ft?di(Ma(de),Ft):{},className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition disabled:cursor-not-allowed disabled:opacity-35 active:scale-95 ${Ft&&(ke===Ft||Qe===Ft)?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary hover:bg-primary/20"}`,"aria-label":o(Ft&&Qe===Ft?"rightSidebar.copied":Ft&&ke===Ft?"rightSidebar.inserted":"rightSidebar.insertCurrentFolder"),title:o("rightSidebar.insertCurrentFolder"),children:Ft&&(ke===Ft||Qe===Ft)?t.jsx(go,{size:13}):t.jsx(bo,{size:13})}),t.jsx("button",{type:"button",disabled:!de||!fh||Jo,"aria-pressed":bn,"aria-label":o(bn?"rightSidebar.showGitIgnoredFiles":"rightSidebar.hideGitIgnoredFiles"),title:o(bn?"rightSidebar.showGitIgnoredFiles":"rightSidebar.hideGitIgnoredFiles"),onClick:()=>{if(!de||Jo)return;const e=de;ic(!0),Qo(null),hh(e,!bn).catch(()=>{const i=Y.getState();(i.explorerRoot??i.rootPath)===e&&Qo(o("rightSidebar.gitIgnoreSaveFailed"))}).finally(()=>ic(!1))},className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition active:scale-95 disabled:cursor-not-allowed disabled:opacity-35 ${bn?"bg-surface-2 text-primary hover:bg-surface-elevated":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:Jo?t.jsx(wt,{size:14,className:"animate-spin"}):t.jsx(Cp,{size:14})}),t.jsxs("div",{ref:ra,className:"relative shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>{Pt(!1),Xt(e=>!e)},className:`inline-flex h-7 w-7 items-center justify-center rounded-md transition active:scale-95 ${kr?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,"aria-expanded":kr,"aria-haspopup":"menu","aria-label":o("sidebar.moreActions"),title:o("sidebar.moreActions"),children:t.jsx(po,{size:14})}),kr&&t.jsxs("div",{role:"menu","data-local-layer":"file-explorer-menu",className:"absolute right-0 top-[calc(100%+4px)] z-30 w-48 overflow-hidden rounded-xl border border-border/15 bg-surface p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in",children:[t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xt(!1),Ch()},disabled:!mi,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition disabled:opacity-40 ${Rs?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[Rs?t.jsx(Ti,{size:14}):t.jsx(Xa,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(Rs?"rightSidebar.unpinCurrentFolder":"rightSidebar.pinCurrentFolder")})]}),t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xt(!1),dh()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${qo?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[qo?t.jsx(kp,{size:14}):t.jsx(nl,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(qo?"rightSidebar.hideHiddenFiles":"rightSidebar.showHiddenFiles")})]}),t.jsxs("button",{type:"button",role:"menuitem",disabled:!de,onClick:()=>{de&&(Xt(!1),uh(de,ya==="modified"?"name":"modified"))},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2 disabled:opacity-40",children:[ya==="modified"?t.jsx(sp,{size:14}):t.jsx(Od,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(ya==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]})]})]}),lc&&t.jsx("p",{role:"alert",className:"px-1 py-1 text-[11px] text-destructive",children:lc}),x&&(La.length>0||Sh)&&t.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1 pb-0.5 text-[11px]",children:[t.jsx("span",{className:"shrink-0 px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:o("rightSidebar.pinnedFolders")}),t.jsxs("button",{type:"button",onClick:$c,className:`inline-flex max-w-[9rem] shrink-0 items-center gap-1 rounded-md px-2 py-0.5 font-medium transition active:scale-95 ${de===x?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:x,children:[t.jsx(Bd,{size:10,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:tt})]}),La.map(e=>{const i=e.path,c=e.kind==="file",w=c?nt===i:de===i;return t.jsxs("span",{className:`group inline-flex max-w-[12rem] shrink-0 items-center rounded-md transition ${w?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:i,children:[t.jsxs("button",{type:"button",onClick:()=>c?Ss(i):Ut(i),className:"inline-flex min-w-0 items-center gap-1 px-2 py-0.5 font-medium active:scale-95",children:[c?t.jsx(sl,{size:10,className:"shrink-0"}):t.jsx(Xa,{size:10,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:yt(i)})]}),t.jsx("button",{type:"button",onClick:()=>pn(i),className:"mr-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":o("rightSidebar.unpinFolder",{name:yt(i)}),title:o("rightSidebar.unpinFolder",{name:yt(i)}),children:t.jsx(Yt,{size:9})})]},i)})]}),t.jsx("span",{"data-local-layer":"file-explorer-divider",className:"pointer-events-none absolute inset-x-0 bottom-0 z-10 h-px bg-border/15","aria-hidden":"true"})]}),Mi=a.useMemo(()=>{if(Fn===null)return null;const e=typeof navigator>"u"?void 0:navigator.language,i=Math.max(0,Math.floor((Uo-Fn)/1e3)),c=new Intl.RelativeTimeFormat(e,{numeric:"auto"}),[w,v]=i<60?[-i,"second"]:i<3600?[-Math.floor(i/60),"minute"]:i<86400?[-Math.floor(i/3600),"hour"]:[-Math.floor(i/86400),"day"];return c.format(w,v)},[Uo,Fn]),qa="flex min-h-10 w-full items-center gap-2.5 rounded-md px-2.5 text-left text-[12px] text-foreground transition hover:bg-surface-2 focus:bg-surface-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [@media(pointer:coarse)]:min-h-11",yd=x&&!Xn?t.jsxs("button",{type:"button",role:"menuitemcheckbox",tabIndex:-1,onClick:()=>{em(!Vo)},"aria-checked":Vo,title:o("rightSidebar.multiRepoScanTitle"),className:qa,children:[t.jsx(vr,{size:15,className:"shrink-0 text-muted-foreground"}),t.jsx("span",{className:"min-w-0 flex-1",children:o("rightSidebar.multiRepoScan")}),Vo&&t.jsx(go,{size:14,className:"shrink-0 text-primary"})]}):null,kd=x?t.jsxs("div",{className:"inline-flex shrink-0 items-center gap-1.5",children:[Mi?t.jsx("span",{className:"whitespace-nowrap text-[10px] text-muted-foreground",title:o("rightSidebar.gitLastUpdated",{time:Mi}),children:Mi}):null,t.jsx("button",{type:"button",onClick:()=>{Yn()},disabled:pr,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 active:scale-95","aria-label":o("rightSidebar.refreshGit"),title:o("rightSidebar.refreshGit"),children:t.jsx(uo,{size:13,className:pr?"animate-spin":""})})]}):null,dm=pc?o("rightSidebar.changeAuditScopeAll"):wn.length===1?wn[0].relativeRoot==="."?tt:wn[0].relativeRoot||wn[0].name:`${wn.length} repos`,um=e=>x?t.jsxs("div",{role:"none",children:[t.jsx(vu,{menuItem:!0,open:fs,onOpenChange:i=>{Qr(i),i&&e()},showScopePicker:Cn,selectedAll:pc,repos:mh,selectedRoots:sr,onToggleRepo:Uh,onGenerate:()=>{e(),_h()},disabled:!x,inserted:ke===Mc,buttonLabel:o("rightSidebar.changeAuditShort"),insertedLabel:o("rightSidebar.inserted"),title:o("rightSidebar.insertChangeAuditPromptTitle"),ariaLabel:o("rightSidebar.insertChangeAuditPrompt"),scopeTitle:o("rightSidebar.changeAuditScopeLabel"),scopeLabel:dm,allLabel:o("rightSidebar.changeAuditScopeAll"),generateLabel:o("rightSidebar.changeAuditShort"),loading:us,error:!!Jr,statusTitle:Jr??(us?o("rightSidebar.changeAuditLoading"):jt.length>0?`${o("rightSidebar.changeAuditLoaded",{count:jt.length})}${xd?` · ${o("rightSidebar.changeAuditLoadedAt",{time:xd})}`:""}`:void 0)}),jt.length>0&&t.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{e(),Bh()},disabled:us||jt.length===0,className:qa,title:o("rightSidebar.clearChangeAuditTitle"),"aria-label":o("rightSidebar.clearChangeAudit"),children:[t.jsx(co,{size:15,className:"shrink-0 text-muted-foreground"}),t.jsx("span",{children:o("rightSidebar.clearChangeAudit")})]})]}):null,ts=ar??(R?.available&&x&&Ie.size>0&&fe.length<=1?{root:x,label:tt}:null),Sd=e=>t.jsxs(t.Fragment,{children:[ts&&t.jsxs("div",{role:"group","aria-label":o("rightSidebar.gitQuickActions"),children:[t.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{e(),Ga("stage-all",ts.root,ts.label)},disabled:!!ze,className:qa,children:[t.jsx(Um,{size:15,className:"shrink-0 text-muted-foreground"}),o("rightSidebar.stageAll")]}),t.jsxs("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:()=>{e(),Ga("stash-all",ts.root,ts.label)},disabled:!!ze,className:qa,children:[t.jsx(xp,{size:15,className:"shrink-0 text-muted-foreground"}),o("rightSidebar.stashAll")]})]}),ts&&t.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/30"}),um(e),yd&&t.jsx("div",{role:"separator",className:"mx-2 my-1 h-px bg-border/30"}),yd]}),Va=t.jsxs("div",{className:"flex h-5 flex-nowrap items-center gap-1 overflow-x-auto whitespace-nowrap text-[10px] font-medium [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [&>*]:shrink-0",children:[R?.available&&R.branch&&t.jsxs("span",{className:"inline-flex min-w-0 max-w-[8rem] items-center gap-0.5 truncate rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",title:R.branch,children:[t.jsx(vr,{size:10,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:R.branch})]}),ft.modified>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-hunk-accent)]",children:[ft.modified,"M"]}),ft.added>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:["+",ft.added]}),ft.deleted>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-delete-strong)]",children:["-",ft.deleted]}),ft.renamed>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[ft.renamed,"R"]}),ft.copied>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[ft.copied,"C"]}),ft.untracked>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[ft.untracked,"U"]}),ft.conflicted>0&&t.jsxs("span",{className:"rounded bg-destructive/10 px-1.5 py-0.5 text-destructive",children:[ft.conflicted,"!"]}),ft.other>0&&t.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[ft.other,"?"]}),ft.staged>0&&t.jsx("span",{className:"rounded bg-accent/10 px-1.5 py-0.5 text-accent",children:o("rightSidebar.stagedCountShort",{count:ft.staged})})]});return t.jsxs(ap,{side:"right",isOpen:r,drawerWidthPx:s,onClose:l,onOpen:f,push:d,pinned:h,children:[di.popoverNode,t.jsxs("div",{className:`relative shrink-0 border-b border-border/15 bg-surface px-2 pt-2 ${bh?"hidden":""}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"min-w-0 flex-1 px-1",children:t.jsxs("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:[t.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",title:x??void 0,children:tt}),(!oe||_o)&&R?.available&&R.branch&&t.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5 truncate text-[11px] text-muted-foreground",title:R.branch,children:[t.jsx(vr,{size:10,className:"shrink-0"}),t.jsx("span",{className:"max-w-[7rem] truncate",children:R.branch})]})]})}),t.jsx("button",{type:"button",onClick:()=>{const e=!pe;W(e),e?window.requestAnimationFrame(()=>document.querySelector("[data-right-search]")?.focus()):re("")},className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${pe?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":o("rightSidebar.toggleSearch"),title:o("common.search"),children:t.jsx(ss,{size:14})}),t.jsxs("button",{type:"button",role:"switch","aria-checked":Te,onClick:()=>{et(e=>!e),lt(!1)},className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${Te?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":o("rightSidebar.toggleContextDraft"),title:o("rightSidebar.contextDraftTitle"),children:[t.jsx(op,{size:14}),!Te&&ve.trim()&&t.jsx("span",{className:"absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-primary","aria-hidden":"true"})]}),t.jsx("input",{ref:Vl,type:"file",multiple:!0,className:"hidden",onChange:e=>{const i=e.target.files;!i||i.length===0||(js(Array.from(i)),e.target.value="")}}),t.jsx("input",{ref:Yl,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const i=e.target.files?.[0];e.target.value="",i&&vh(i)}}),g&&t.jsx("button",{type:"button",onClick:g,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${h?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":o(h?"sidebar.unpinSidebar":"sidebar.pinSidebar"),title:o(h?"sidebar.unpinSidebar":"sidebar.pinSidebar"),children:h?t.jsx(Ti,{size:14}):t.jsx(Xa,{size:14})}),t.jsxs("div",{ref:$n,className:"relative shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>{Xt(!1),Pt(e=>!e)},className:`relative inline-flex h-8 w-8 items-center justify-center rounded-full transition active:scale-95 ${Lt?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":Lt,"aria-haspopup":"menu","aria-label":o("sidebar.moreActions"),title:o("sidebar.moreActions"),children:t.jsx(po,{size:15})}),Lt&&t.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+4px)] z-30 w-56 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in",children:[t.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":Gr,onClick:()=>xc(!Gr),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2",children:[t.jsx(Td,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"flex-1",children:o("rightSidebar.showAndroidTab")}),t.jsx("span",{"aria-hidden":"true",className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition ${Gr?"bg-primary":"bg-surface-elevated"}`,children:t.jsx("span",{className:`absolute h-3 w-3 rounded-full bg-background transition-all ${Gr?"left-3.5":"left-0.5"}`})})]}),t.jsx("div",{className:"my-1 h-px bg-border/15",role:"separator"}),t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Pt(!1),Vl.current?.click()},disabled:ga,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2 disabled:opacity-50",children:[ga?t.jsx(wt,{size:14,className:"animate-spin text-muted-foreground"}):t.jsx(Tp,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o("rightSidebar.uploadFiles")})]}),t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Pt(!1),Yl.current?.click()},disabled:ga,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-foreground transition hover:bg-surface-2 disabled:opacity-50",children:[ga?t.jsx(wt,{size:14,className:"animate-spin text-muted-foreground"}):t.jsx(Ep,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o("rightSidebar.insertLocalImage")})]}),g&&t.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Pt(!1),g()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${h?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[h?t.jsx(Ti,{size:14}):t.jsx(Xa,{size:14,className:"text-muted-foreground"}),t.jsx("span",{children:o(h?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]}),h&&t.jsxs("div",{className:"mt-1 flex items-center gap-2 border-t border-border/15 px-1.5 pt-1.5",role:"group","aria-label":o("rightSidebar.layoutMode"),children:[t.jsx("div",{className:"shrink-0 pl-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:o("rightSidebar.layoutMode")}),t.jsx("div",{className:"grid min-w-0 flex-1 grid-cols-3 gap-0.5 rounded-lg bg-surface-2 p-0.5",children:[["auto",o("rightSidebar.layoutModeAuto")],["narrow",o("rightSidebar.layoutModeNarrow")],["wide",o("rightSidebar.layoutModeWide")]].map(([e,i])=>{const c=Z===e;return t.jsx("button",{type:"button",role:"menuitemradio","aria-checked":c,onClick:()=>{A(e),Pt(!1)},className:`rounded-md px-1 py-1.5 text-center text-[11px] font-medium transition active:scale-95 ${c?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:i},e)})})]})]})]}),t.jsx("button",{type:"button",onClick:l,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive active:scale-95","aria-label":o("rightSidebar.close"),children:t.jsx(Yt,{size:14})})]}),pe&&t.jsxs("div",{className:"mt-2 space-y-1.5 pb-0.5",children:[t.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-surface-2 px-3 py-1.5 text-muted-foreground transition focus-within:bg-surface-elevated",children:[t.jsx(ss,{size:12,className:"shrink-0"}),t.jsx("input",{"data-right-search":!0,type:"search",value:z,onChange:e=>re(e.target.value),placeholder:o(D==="content"?"rightSidebar.searchPlaceholderContent":"rightSidebar.filterChanges"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",enterKeyHint:"search",spellCheck:!1}),t.jsxs("div",{className:`flex shrink-0 items-center gap-0.5 rounded-full bg-surface/70 p-0.5 font-medium ${oe?"text-[11px]":"text-[10px]"}`,children:[t.jsx("button",{type:"button",onClick:()=>fd("name"),"aria-pressed":D==="name",className:`rounded-full px-2 transition active:scale-95 ${oe?"py-1":"py-0.5"} ${D==="name"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:o("rightSidebar.searchModeName")}),t.jsx("button",{type:"button",onClick:()=>fd("content"),"aria-pressed":D==="content",className:`rounded-full px-2 transition active:scale-95 ${oe?"py-1":"py-0.5"} ${D==="content"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:o("rightSidebar.searchModeContent")})]}),z&&t.jsx("button",{type:"button",onClick:()=>re(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":o("rightSidebar.clearSearch"),children:t.jsx(Yt,{size:12})})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("label",{className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg bg-surface-2 px-2.5 py-1.5 text-muted-foreground transition focus-within:bg-surface-elevated",children:[t.jsx(ip,{size:12,className:"shrink-0 text-primary"}),t.jsx("span",{className:"shrink-0 text-[10px] font-medium",children:o("rightSidebar.searchScope")}),t.jsx("input",{"data-search-scope":!0,value:ue,onChange:e=>me(e.target.value),onKeyDown:e=>{e.key==="Enter"&&document.querySelector("[data-right-search]")?.focus()},className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-foreground placeholder:text-muted-foreground",placeholder:o("rightSidebar.searchScopePlaceholder"),"aria-label":o("rightSidebar.searchScope"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),ue!=="."&&t.jsx("button",{type:"button",onClick:()=>me("."),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":o("rightSidebar.resetSearchScope"),children:t.jsx(Yt,{size:11})})]}),t.jsxs("button",{type:"button",onClick:()=>$(e=>!e),"aria-expanded":Ce,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition active:scale-95 ${Ce||ws.length>0||J||Ae||De?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:o("rightSidebar.searchOptions"),"aria-label":o("rightSidebar.searchOptions"),children:[t.jsx(lp,{size:13}),ws.length>0&&t.jsx("span",{className:"absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-[8px] font-bold leading-4 text-primary-foreground",children:ws.length})]})]}),Ce&&t.jsxs("div",{className:"animate-fade-in rounded-xl bg-surface-2 p-2",children:[t.jsxs("label",{className:"flex items-center gap-2 rounded-lg bg-surface px-2.5 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[t.jsx("span",{className:"shrink-0 text-[10px] font-medium",children:o("rightSidebar.searchExclude")}),t.jsx("input",{"data-search-exclude":!0,value:we,onChange:e=>je(e.target.value),className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-foreground placeholder:text-muted-foreground",placeholder:o("rightSidebar.searchExcludePlaceholder"),"aria-label":o("rightSidebar.searchExclude"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),we&&t.jsx("button",{type:"button",onClick:()=>je(""),className:"rounded p-0.5 hover:bg-surface-2 hover:text-foreground","aria-label":o("rightSidebar.clearSearchExclude"),children:t.jsx(Yt,{size:11})})]}),D==="content"&&t.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-1",role:"group","aria-label":o("rightSidebar.contentSearchOptions"),children:[[J,()=>ne(e=>!e),wp,o("rightSidebar.matchCase")],[Ae,()=>Ye(e=>!e),Dp,o("rightSidebar.matchWholeWord")],[De,()=>rt(e=>!e),$p,o("rightSidebar.useRegex")]].map(([e,i,c,w])=>t.jsxs("button",{type:"button",onClick:i,"aria-pressed":e,className:`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] transition ${e?"bg-primary/15 text-primary":"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[t.jsx(c,{size:12}),w]},w))})]})]}),t.jsxs("div",{className:"mt-2 grid gap-0.5 rounded-md bg-surface-2 p-0.5",style:{gridTemplateColumns:`repeat(${(Xn?2:3)+(Gr?1:0)}, minmax(0, 1fr))`},children:[!Xn&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:e=>Ca("git",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="git"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(vr,{size:12}),o("rightSidebar.tabGit")]}),t.jsxs("button",{type:"button",onClick:e=>Ca("diff",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="diff"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(zu,{size:12}),o("rightSidebar.tabChanges"),Ie.size>0?t.jsx("span",{className:"text-[10px] text-accent",children:Ie.size}):null]})]}),t.jsxs("button",{type:"button",onClick:e=>Ca("files",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="files"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(fp,{size:12}),o("rightSidebar.tabFiles")]}),Gr&&t.jsxs("button",{type:"button",onClick:e=>Ca("android",e),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${Wt==="android"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[t.jsx(Td,{size:12}),o("rightSidebar.tabAndroid")]})]}),t.jsx("div",{className:"h-2"}),Ul&&t.jsx("div",{className:"pointer-events-none absolute right-3 top-10 z-20 max-w-[72%] rounded-lg bg-destructive/95 px-3 py-2 text-[11px] font-medium text-destructive-foreground shadow-md animate-fade-in",children:Ul})]}),t.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-surface",children:[t.jsx(Ja,{active:ot,mounted:nr,fallback:t.jsx(Ki,{slow:!1}),children:()=>Oe?t.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:t.jsx(qd,{items:zh,diffViewType:zo,inlineMode:cr,viewControls:h?Ms():void 0,renderPathReference:(e,i)=>_a(En(e,Oe.repoRoot??x),o(i==="file"?"rightSidebar.insertThisFile":"fileTree.insertRefTitle")),selectedKey:eh,onSelect:aa,emptyText:o("rightSidebar.noChanges"),mobile:oe,backLabel:o("rightSidebar.backToChangeList"),headerTitle:o("rightSidebar.recentCommitsTitle"),headerMeta:`${Oe.headRef??""}${Oe.commits?.[0]?` · ${Oe.commits[0]}`:""}`,onClose:()=>{Ue(null),aa(null)},closeLabel:o("common.back"),wrap:Tt,onToggleWrap:za,wrapTitle:o("rightSidebar.wrapLongLines"),wrapOnLabel:o("rightSidebar.wrapOn"),wrapOffLabel:o("rightSidebar.wrapOff"),desktopLayout:oe?"stacked":"split",onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa})}):ur?t.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:t.jsx(qd,{items:vi,diffViewType:zo,inlineMode:cr,viewControls:h?Ms():void 0,renderPathReference:(e,i)=>{const c=xe?.comparisonRepos,w=c&&c.length>1?[...c].sort((S,j)=>j.label.length-S.label.length).find(S=>e===S.label||e.startsWith(`${S.label}/`)):void 0,v=w?e===w.label?w.repoRoot:En(e.slice(w.label.length+1),w.repoRoot):En(e,Ls?.repoRoot||x);return _a(v,o(i==="file"?"rightSidebar.insertThisFile":"fileTree.insertRefTitle"))},selectedKey:Do,onSelect:dn,emptyText:o(xe?"rightSidebar.branchAuditDiffEmpty":"rightSidebar.branchAuditEmpty"),mobile:oe,backLabel:o("rightSidebar.backToChangeList"),headerTitle:o(xe?"rightSidebar.branchAuditViewDiff":"rightSidebar.branchAuditTitle"),headerMeta:Ls?`${Ls.repoLabel} · ${Ls.branchName??"HEAD"} → ${Ls.baseRef}`:void 0,onClose:()=>{++It.current,ye(!1),fr(!1),er(null)},closeLabel:o("common.back"),wrap:Tt,onToggleWrap:za,wrapTitle:o("rightSidebar.wrapLongLines"),wrapOnLabel:o("rightSidebar.wrapOn"),wrapOffLabel:o("rightSidebar.wrapOff"),desktopLayout:oe?"stacked":"split",onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa,localOptions:xe?.comparisonRepos?.map(e=>({key:e.repoRoot,label:e.label,checked:e.includeUncommitted??xe.includeUncommitted??!1,disabled:!(e.canIncludeUncommitted??Zn(e.repoRoot,e.head)),onChange:i=>{Si({refresh:!0,repoRoot:e.repoRoot,includeUncommitted:i})}})),onHunkGitAction:xe?.includeUncommitted?Zh:void 0,error:Ze,actionsBusy:I>0,onRefresh:()=>{Si({refresh:!0})},refreshing:ce,refreshLabel:o("rightSidebar.branchAuditRefreshDiff"),refreshTitle:o("rightSidebar.branchAuditRefreshDiff"),walkthroughs:Wh,onWalkthroughNavigate:Gh,initialDetailScrollTop:xe&&qe?hs[qe]:void 0,onDetailScrollPositionChange:Jh,externalSwiperRef:oe?hc:void 0,onMobileSlideChange:oe?Fo:void 0})}):t.jsx("div",{className:"h-full overflow-y-auto overscroll-contain bg-surface pb-6",children:nr&&x&&Rn?t.jsx("div",{className:"px-3",children:im()}):pr?t.jsx(Ki,{slow:nc}):gn?t.jsx(oo,{message:gn,onRetry:()=>{Yn()}}):ju(R)?t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o(x?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")}):R?.available===!1?t.jsx(oo,{message:R.error??o("rightSidebar.gitChangesLoadFailed"),onRetry:()=>{Yn()}}):x?t.jsx(Ki,{slow:nc}):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o(x?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")})})}),t.jsx(Ja,{active:Pr,mounted:rh||Pr,children:()=>oe?t.jsxs(Pu,{className:"h-full min-h-0 w-full",slidesPerView:1,resistanceRatio:.45,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:".swiper-no-swiping",allowTouchMove:!1,touchAngle:75,touchStartPreventDefault:!1,onSwiper:e=>{Lr.current=e,e.slideTo(Fl,0)},onSlideChange:e=>{if(Mr(e.activeIndex),ks.current===e.activeIndex){ks.current=null;return}e.activeIndex===0&&(Er(!1),St(null),y?.())},children:[t.jsx(Zi,{className:"h-full min-h-0",children:t.jsxs("div",{ref:Wn,onScroll:vc,onDragOver:Na,onDragEnter:Na,onDragLeave:kc,onDrop:Sc,className:"h-full overflow-auto overscroll-contain bg-surface relative",children:[Gl&&t.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:t.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:o("rightSidebar.dropToUpload")})}),!z.trim()&&wd,t.jsx(Ud,{rootPath:de??"",onFileSelect:Ss,onPathReference:Gt,getReferenceText:Ma,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onDirectoryRoot:Ac,onSearchFromDirectory:Lc,onDirectoryPinToggle:Pc,onFilePinToggle:Tc,pinnedPaths:kn,selectedFilePath:nt,query:_e,searchRootPath:cc,searchOptions:dc,searchMode:D,onContentMatchSelect:wc,onDirectoryDropFiles:(e,i)=>js(i,e),revealDirectory:M,canOpenInFileBrowser:Kl,onOpenInFileBrowser:yc})]})}),t.jsx(Zi,{className:"h-full min-h-0",children:t.jsx("div",{className:"h-full overflow-hidden bg-surface",children:t.jsx(vl,{filePath:th||Fl===1?nt:null,active:Pr,onInsertReference:Gt,onInsertText:Ir,onInsertFeature:Ir,onReviewReference:Nc,onReferenceCopied:Tr,onClose:cm,onDirectoryLinkOpen:vd,isMobile:!0,lineRange:Sr,onLineRangeChange:St,insertedReferenceKey:ke,copiedReferenceKey:Qe,scrollToLine:An,onScrollToLineHandled:()=>Jt(null),markdownOutlineOpen:B,markdownOutlineCloseSignal:_,onOpenMarkdownOutline:C,onCloseMarkdownOutline:N,markdownImageLightboxOpen:P,markdownImageLightboxCloseSignal:U,onOpenMarkdownImageLightbox:T,onCloseMarkdownImageLightbox:k})})})]}):t.jsxs("div",{className:"flex h-full min-h-0",children:[t.jsxs("div",{ref:Wn,onScroll:vc,onDragOver:Na,onDragEnter:Na,onDragLeave:kc,onDrop:Sc,className:"shrink-0 overflow-auto overscroll-contain bg-surface relative",style:{width:Wo},children:[Gl&&t.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:t.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:o("rightSidebar.dropToUpload")})}),!z.trim()&&wd,t.jsx(Ud,{rootPath:de??"",onFileSelect:Ss,onPathReference:Gt,getReferenceText:Ma,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onDirectoryRoot:Ac,onSearchFromDirectory:Lc,onDirectoryPinToggle:Pc,onFilePinToggle:Tc,pinnedPaths:kn,selectedFilePath:nt,query:_e,searchRootPath:cc,searchOptions:dc,searchMode:D,onContentMatchSelect:wc,onDirectoryDropFiles:(e,i)=>js(i,e),revealDirectory:M,canOpenInFileBrowser:Kl,onOpenInFileBrowser:yc})]}),t.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o("rightSidebar.resizeFileTree"),title:o("rightSidebar.resizeFileTree"),"data-local-layer":"file-preview-separator",className:"group relative z-10 w-2 shrink-0 cursor-col-resize touch-none border-l border-border/15 bg-surface",onPointerDown:ph,onPointerMove:gh,onPointerUp:bc,onPointerCancel:bc,onDoubleClick:()=>{Go(cl),At(zs,cl)},children:t.jsx("span",{className:"absolute left-1/2 top-0 h-full w-px -translate-x-1/2 bg-border/20 transition group-hover:bg-primary/45"})}),t.jsx("div",{className:"min-w-0 flex-1 overflow-hidden bg-surface",children:t.jsx(vl,{filePath:nt,active:Pr,onInsertReference:Gt,onInsertText:Ir,onInsertFeature:Ir,onReviewReference:Nc,onReferenceCopied:Tr,onDirectoryLinkOpen:vd,isMobile:!1,lineRange:Sr,onLineRangeChange:St,insertedReferenceKey:ke,copiedReferenceKey:Qe,scrollToLine:An,onScrollToLineHandled:()=>Jt(null),markdownOutlineOpen:B,markdownOutlineCloseSignal:_,onOpenMarkdownOutline:C,onCloseMarkdownOutline:N,markdownImageLightboxOpen:P,markdownImageLightboxCloseSignal:U,onOpenMarkdownImageLightbox:T,onCloseMarkdownImageLightbox:k})})]})}),t.jsx(Ja,{active:Mt,mounted:sh||Mt,children:()=>oi?t.jsx(cp,{}):oe?t.jsx(el,{mobile:!0,backLabel:o("rightSidebar.backToChangeList"),externalSwiperRef:si,onMobileSlideChange:Fo,groups:Vt.length>0?Zc():[],mode:Ur,onModeChange:Ha,selectedKey:nt,scrollToKey:sd,scrollToKeyNonce:xa.nonce,compact:!1,collapsedDirectoryKeys:Br,onToggleDirectory:id,onSelectFile:e=>{const i=Nn.get(e.key);i&&Ua(wr(i))},renderLeading:ed,renderTrailing:e=>{const i=Nn.get(e.key);return i?Jc(i):null},renderDirectoryTrailing:Qc,renderSubtitle:e=>{const i=Nn.get(e.key);return i?Xc(i):null},listContainerClassName:"termdock-native-select min-h-0 px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",renderListHeader:e=>x&&t.jsxs("div",{className:"px-0 py-0",children:[Va&&t.jsx("div",{className:"mb-2",children:Va}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("div",{className:"min-w-0",children:t.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:o("rightSidebar.allChanges")})}),t.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Vt.length,"/",Ie.size]})]}),t.jsxs(Gd,{actions:Sd,children:[Vc(),e,h&&Ms(),kd]},x),ar&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:ar.label}),ar.branch&&t.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:ar.branch})]}),!ar&&Cn&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[t.jsx(vr,{size:12,className:"shrink-0"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:o("rightSidebar.selectRepositoryForDiff")})]})]}),aiContent:Ia?(e=>od(e)):void 0,emptyContent:oi?null:gn&&Ie.size===0?t.jsx(oo,{message:gn,onRetry:()=>{Yn()}}):Ie.size===0?t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("rightSidebar.noChanges")}):Vt.length===0?t.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:o("rightSidebar.noMatchingChanges")}):null,renderMobileDetailHeader:({slideToList:e})=>t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("button",{type:"button",onClick:e,className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-surface-2 px-3 text-xs font-semibold text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",title:o("rightSidebar.backToChangeList"),children:[t.jsx(Ys,{size:14}),o("rightSidebar.backToChangeList")]}),t.jsxs("div",{className:"ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1.5",children:[h&&Ms(),t.jsxs("button",{type:"button",onClick:za,"aria-pressed":Tt,title:o("rightSidebar.wrapLongLines"),className:`inline-flex h-9 shrink-0 items-center gap-1 rounded-full px-3 text-[11px] font-medium transition active:scale-95 ${Tt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[t.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),t.jsx("span",{children:o(Tt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]}),x&&t.jsx("button",{type:"button",onClick:()=>{Yn()},disabled:pr,"aria-label":o("rightSidebar.refreshGit"),title:o("rightSidebar.refreshGit"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 active:scale-95",children:t.jsx(uo,{size:14,className:pr?"animate-spin":""})})]})]}),detailContainerClassName:"termdock-native-select termdock-diff-stream-scroller min-h-0",files:td,activePane:Mt,wrap:Tt,diffViewType:zo,inlineMode:cr,diffOptions:ud,reloadKey:ls,renderStreamBadge:e=>t.jsx(Ks,{status:e}),onHunkGitAction:hd,onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa,onDetailScroll:Ba}):t.jsx(el,{mobile:!1,desktopLayout:"split",desktopSidePanel:null,desktopListClassName:"w-[320px] min-w-[260px] shrink-0 overflow-y-auto overscroll-contain border-r border-border/15 bg-surface",backLabel:o("rightSidebar.backToChangeList"),groups:Vt.length>0?Zc():[],mode:Ur,onModeChange:Ha,selectedKey:nt,scrollToKey:sd,scrollToKeyNonce:xa.nonce,compact:!0,collapsedDirectoryKeys:Br,onToggleDirectory:id,onSelectFile:e=>{const i=Nn.get(e.key);i&&Ua(wr(i))},renderLeading:ed,renderTrailing:e=>{const i=Nn.get(e.key);return i?Jc(i):null},renderDirectoryTrailing:Qc,renderSubtitle:e=>{const i=Nn.get(e.key);return i?Xc(i):null},aiContent:Ia?(e=>od(e)):void 0,emptyContent:oi?null:gn&&Ie.size===0?t.jsx(oo,{message:gn,onRetry:()=>{Yn()}}):Ie.size===0?t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("rightSidebar.noChanges")}):Vt.length===0?t.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:o("rightSidebar.noMatchingChanges")}):null,renderListHeader:e=>x&&t.jsxs("div",{className:"px-0 py-0",children:[Va&&t.jsx("div",{className:"mb-2",children:Va}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:o("rightSidebar.allChanges")}),t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Vt.length,"/",Ie.size]})})]}),t.jsxs(Gd,{actions:Sd,children:[Vc(),e,Ms(),t.jsxs("button",{type:"button",onClick:za,"aria-pressed":Tt,title:o("rightSidebar.wrapLongLines"),className:`inline-flex h-7 shrink-0 items-center gap-1 rounded-full px-2 text-[10px] font-semibold transition active:scale-95 ${Tt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[t.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),t.jsx("span",{children:o(Tt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]}),kd]},x),ar&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:ar.label}),ar.branch&&t.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:ar.branch})]}),!ar&&Cn&&t.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[t.jsx(vr,{size:12,className:"shrink-0"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:o("rightSidebar.selectRepositoryForDiff")})]})]}),files:td,activePane:Mt,wrap:Tt,diffViewType:Rr,inlineMode:cr,diffOptions:ud,reloadKey:ls,renderStreamBadge:e=>t.jsx(Ks,{status:e}),onHunkGitAction:hd,onInsertDiffReference:Dr,onReferenceCopied:Tr,insertedReferenceKey:ke,copiedReferenceKey:Qe,onClearAuditRecord:Oa,onDetailScroll:Ba})}),t.jsx(Ja,{active:Jn,mounted:Oo&&Gr,children:ah?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-[11px] text-muted-foreground",children:[t.jsx("span",{children:o("android.splitDockedHint")}),t.jsx("button",{type:"button",onClick:()=>{Ai.getState().setDock(Pi,null),lo({androidPanel:{docked:null}}).catch(()=>{})},className:"rounded bg-surface-2 px-2 py-1 text-foreground",children:o("android.splitClose")})]}):t.jsx(dp,{sessionId:n??null,onCloseTab:()=>xc(!1),onInsertPrompt:e=>Dr("android-deps",e),onInsertFile:yh,onRecordingComplete:wh})})]}),r&&Te&&t.jsx(ig,{value:ve,collapsed:Bt,autoCollapseAfterSend:H,focusRequest:Nt,insertError:os?o("rightSidebar.contextDraftInsertFailed"):null,onChange:e=>{_r(!1),Xe(e)},onCollapsedChange:lt,onAutoCollapseAfterSendChange:ae,onDisable:()=>et(!1),onClear:()=>Xe(""),onInsert:()=>Ec(!1),onInsertAndSend:()=>Ec(!0),labels:{title:o("rightSidebar.contextDraftTitle"),hint:o("rightSidebar.contextDraftHint"),placeholder:o("rightSidebar.contextDraftPlaceholder"),collapse:o("rightSidebar.contextDraftCollapse"),expand:o("rightSidebar.contextDraftExpand"),disable:o("rightSidebar.contextDraftDisable"),clear:o("rightSidebar.contextDraftClear"),insert:o("rightSidebar.contextDraftInsert"),insertAndSend:o("rightSidebar.contextDraftInsertAndSend"),inserted:o("rightSidebar.contextDraftInserted"),sent:o("rightSidebar.contextDraftSent"),send:o("rightSidebar.contextDraftSend"),appended:o("rightSidebar.contextDraftAppended"),resize:o("rightSidebar.contextDraftResize"),autoCollapseAfterSend:o("rightSidebar.contextDraftAutoCollapseAfterSend"),characterCount:e=>o("rightSidebar.contextDraftCharacterCount",{count:e})}}),Th(),bt&&typeof document<"u"&&Fr.createPortal(t.jsx("div",{className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>un(null),children:t.jsxs("div",{className:"fixed inset-x-3 bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] z-modal-panel mx-auto max-w-md rounded-2xl border border-border/20 bg-surface-elevated p-4 shadow-2xl",onClick:e=>e.stopPropagation(),children:[t.jsx("div",{className:"text-sm font-semibold text-foreground",children:bt.kind==="restore"?o("rightSidebar.confirmRestoreTitle"):o("rightSidebar.confirmStashAllTitle")}),t.jsx("div",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:bt.kind==="restore"?o("rightSidebar.confirmRestoreDescription",{path:$u(bt.file.absolutePath,x)}):o("rightSidebar.confirmStashAllDescription")}),bt.kind==="restore"&&t.jsx("input",{value:bt.phrase,onChange:e=>un({...bt,phrase:e.target.value}),placeholder:o("rightSidebar.confirmRestorePlaceholder"),className:"mt-3 w-full rounded-xl border border-border/20 bg-surface-2 px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground",autoFocus:!0}),t.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:()=>un(null),className:"rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:o("common.cancel")}),t.jsx("button",{type:"button",disabled:!!ze||bt.kind==="restore"&&bt.phrase.trim()!==o("rightSidebar.confirmRestorePhrase"),onClick:()=>{if(bt.kind==="restore"){const e=pt(bt.file,x);if(!e)return;vt({action:"restore-worktree-file",cwd:e,paths:[bt.file.path],confirm:{acknowledged:!0,phrase:bt.phrase}},o("rightSidebar.restoreFile"),Yi(bt.file))}else{const e=bt.repoRoot??x;if(!e)return;vt({action:"stash-all",cwd:e},o("rightSidebar.stashAll"),`repo:${e}`)}},className:`rounded-full px-3 py-1.5 text-xs font-semibold disabled:opacity-50 ${bt.kind==="restore"?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-primary text-primary-foreground hover:bg-primary/90"}`,children:o(ze?"rightSidebar.gitActionRunning":"rightSidebar.confirmAction")})]})]})}),document.body)]})}const Bx=Object.freeze(Object.defineProperty({__proto__:null,FilePreview:vl,MarkdownImageLightbox:Uf,MarkdownPreview:Hf,RightSidebar:Nx,__testParseMarkdownListBlock:Wb,buildMarkdownPreviewBlocks:tx,buildMarkdownPreviewRenderResult:$l,collectKnownGitRepoRoots:ff,computeMarkdownImageDisplayBox:jf,getMarkdownHeadingOutline:Of,getMarkdownHeadingPathAtLine:Bf,getNextMarkdownPreviewLineRange:ix,isSvgImageSrc:No,mountRightSidebarRepoPickerOverlay:Qu,replaceGitRepositorySnapshot:Vf,resolveMarkdownLocalLinkTarget:jl,resolveRightSidebarDiffViewType:df,shouldCloseMarkdownImageLightboxDrag:Df,showsGitRepoGroupHeader:dl},Symbol.toStringTag,{value:"Module"}));export{nl as E,Bx as R,kp as a,Bp as c,_x as m};