@jingyi0605/codingns 0.7.4 → 0.8.1

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 (599) hide show
  1. package/README.md +6 -0
  2. package/bin/codingns.mjs +747 -28
  3. package/bin/office-mcp-server.mjs +620 -0
  4. package/dist/public/assets/{AdaptiveButlerPage-CgBX49t-.js → AdaptiveButlerPage-b7s6F_sd.js} +1 -1
  5. package/dist/public/assets/{App-tXOqoHNl.js → App-B0q8uDA-.js} +3 -3
  6. package/dist/public/assets/{BootstrapPage-DoRMz87R.js → BootstrapPage-jFfl7KNK.js} +1 -1
  7. package/dist/public/assets/{ConversationPage-DXR6Hp4O.js → ConversationPage-sj_rn4q0.js} +6 -6
  8. package/dist/public/assets/{DesktopDetachPreviewPage-Cyk-ZYCk.js → DesktopDetachPreviewPage-C5c88SOX.js} +1 -1
  9. package/dist/public/assets/{DesktopWindowPage-DNVNK3hs.js → DesktopWindowPage-BdKUZrKG.js} +1 -1
  10. package/dist/public/assets/FileContextPanel-lM5mBcfn.js +1 -0
  11. package/dist/public/assets/{GitSidebar-Cr3Z9OUI.js → GitSidebar-CmXAhyjo.js} +2 -2
  12. package/dist/public/assets/{MobileCreateSessionSheet-DMW0V6GJ.js → MobileCreateSessionSheet-CceV0-AH.js} +1 -1
  13. package/dist/public/assets/{MobileTopHeaderFrame-CkdnZ_MU.js → MobileTopHeaderFrame-_I0t7cC_.js} +1 -1
  14. package/dist/public/assets/{MobileWorkspaceSwitcherHeader-KIbqBYJN.js → MobileWorkspaceSwitcherHeader-DhaM9fgx.js} +1 -1
  15. package/dist/public/assets/{RelayConnectEntryPage-DIRBH3hw.js → RelayConnectEntryPage-CMtDWyGS.js} +1 -1
  16. package/dist/public/assets/{ServerSettingsModal-C-9RxdWP.js → ServerSettingsModal-Rkgn3jft.js} +1 -1
  17. package/dist/public/assets/{SessionIndexPage-bRlIydRA.js → SessionIndexPage-BOumP3ij.js} +1 -1
  18. package/dist/public/assets/{SettingsPage-CMEt4ua9.js → SettingsPage-vx_c-00-.js} +2 -2
  19. package/dist/public/assets/{TerminalManagerPanel-2bi9wVhT.js → TerminalManagerPanel-D9JHCS6d.js} +1 -1
  20. package/dist/public/assets/{TerminalPage-DayZz2Tf.js → TerminalPage-CBIKHI33.js} +1 -1
  21. package/dist/public/assets/{TerminalRuntimeFallbackModal-DgwYcp-Y.js → TerminalRuntimeFallbackModal-W5NjqFEz.js} +1 -1
  22. package/dist/public/assets/{ToolFilesPage-YvnP_FXW.js → ToolFilesPage-DWtpaN_7.js} +1 -1
  23. package/dist/public/assets/{ToolGitPage-GMcQKtV9.js → ToolGitPage-MpGXsw4_.js} +1 -1
  24. package/dist/public/assets/{ToolProcessesPage-DFIQ7BCd.js → ToolProcessesPage-B1jHQKhZ.js} +1 -1
  25. package/dist/public/assets/{ToolsHomePage-CSilFzXR.js → ToolsHomePage-CJrn8ZFl.js} +1 -1
  26. package/dist/public/assets/{WorkbenchLandingPage-1VtToSz9.js → WorkbenchLandingPage-CJQ1V5U-.js} +1 -1
  27. package/dist/public/assets/WorkbenchLayout-D48i71PU.js +244 -0
  28. package/dist/public/assets/{WorkbenchModal-BWXYSXmC.js → WorkbenchModal-BYNuMIoV.js} +1 -1
  29. package/dist/public/assets/WorkbenchShellRoute-B4XB8SwG.css +1 -0
  30. package/dist/public/assets/WorkbenchShellRoute-CGKjy4J-.js +1 -0
  31. package/dist/public/assets/{WorkspaceDebugDetailPage-Ux8_Q7la.js → WorkspaceDebugDetailPage-DCAYgays.js} +1 -1
  32. package/dist/public/assets/{WorkspaceDetailPage-B402p99m.js → WorkspaceDetailPage-D5v-nUIi.js} +1 -1
  33. package/dist/public/assets/{WorkspaceHomePage-D2pob6HI.js → WorkspaceHomePage-I5G1p5SR.js} +1 -1
  34. package/dist/public/assets/{client-runtime-manager-C5D76ewj.js → client-runtime-manager-CdJP7nUp.js} +1 -1
  35. package/dist/public/assets/file-tree-icon-BFwaPxKs.js +590 -0
  36. package/dist/public/assets/index-CjewzOUG.js +42 -0
  37. package/dist/public/assets/index-VVxfF0s5.css +1 -0
  38. package/dist/public/assets/{login-direct-candidate-resolver-wXSaB0i7.js → login-direct-candidate-resolver-C-mo698r.js} +1 -1
  39. package/dist/public/assets/{model-switch-api-CPtou49j.js → model-switch-api-Br0ivfe5.js} +1 -1
  40. package/dist/public/assets/{preferences-service-CdaK7zA8.js → preferences-service-CnaTvZq2.js} +1 -1
  41. package/dist/public/assets/{realtime-client-BjQazYsK.js → realtime-client-BlQRqVmm.js} +1 -1
  42. package/dist/public/assets/{relay-entry-BwE5nw0l.js → relay-entry-D7OgZZN-.js} +1 -1
  43. package/dist/public/assets/{terminal-runtime-meta-C-Lbyx2i.js → terminal-runtime-meta-BCtAYB0E.js} +1 -1
  44. package/dist/public/assets/{useRegisteredDebugTemplates-BM7-c-gx.js → useRegisteredDebugTemplates-CXmxu69X.js} +1 -1
  45. package/dist/public/index.html +2 -2
  46. package/dist/server/config/env.d.ts +3 -0
  47. package/dist/server/config/env.js +67 -1
  48. package/dist/server/config/env.js.map +1 -1
  49. package/dist/server/config/opencode-base-url-resolver.d.ts +3 -2
  50. package/dist/server/config/opencode-base-url-resolver.js +64 -24
  51. package/dist/server/config/opencode-base-url-resolver.js.map +1 -1
  52. package/dist/server/main.js +2 -0
  53. package/dist/server/main.js.map +1 -1
  54. package/dist/server/middlewares/auth-guard.js +4 -0
  55. package/dist/server/middlewares/auth-guard.js.map +1 -1
  56. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +169 -1
  57. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +206 -4
  58. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  59. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +297 -2
  60. package/dist/server/modules/assistant-capability/assistant-capability-service.js +873 -3
  61. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  62. package/dist/server/modules/auth/auth-service.d.ts +21 -1
  63. package/dist/server/modules/auth/auth-service.js +64 -0
  64. package/dist/server/modules/auth/auth-service.js.map +1 -1
  65. package/dist/server/modules/browser-runtime/browser-profile-service.d.ts +26 -0
  66. package/dist/server/modules/browser-runtime/browser-profile-service.js +85 -0
  67. package/dist/server/modules/browser-runtime/browser-profile-service.js.map +1 -0
  68. package/dist/server/modules/browser-runtime/browser-runtime-controller.d.ts +70 -0
  69. package/dist/server/modules/browser-runtime/browser-runtime-controller.js +84 -0
  70. package/dist/server/modules/browser-runtime/browser-runtime-controller.js.map +1 -0
  71. package/dist/server/modules/browser-runtime/browser-runtime-service.d.ts +59 -0
  72. package/dist/server/modules/browser-runtime/browser-runtime-service.js +255 -0
  73. package/dist/server/modules/browser-runtime/browser-runtime-service.js.map +1 -0
  74. package/dist/server/modules/browser-runtime/browser-task-execution-support.d.ts +65 -0
  75. package/dist/server/modules/browser-runtime/browser-task-execution-support.js +432 -0
  76. package/dist/server/modules/browser-runtime/browser-task-execution-support.js.map +1 -0
  77. package/dist/server/modules/browser-runtime/browser-task-executor-registry.d.ts +7 -0
  78. package/dist/server/modules/browser-runtime/browser-task-executor-registry.js +21 -0
  79. package/dist/server/modules/browser-runtime/browser-task-executor-registry.js.map +1 -0
  80. package/dist/server/modules/browser-runtime/browser-task-executor.d.ts +55 -0
  81. package/dist/server/modules/browser-runtime/browser-task-executor.js +2 -0
  82. package/dist/server/modules/browser-runtime/browser-task-executor.js.map +1 -0
  83. package/dist/server/modules/browser-runtime/browser-task-payload.d.ts +33 -0
  84. package/dist/server/modules/browser-runtime/browser-task-payload.js +55 -0
  85. package/dist/server/modules/browser-runtime/browser-task-payload.js.map +1 -0
  86. package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.d.ts +19 -0
  87. package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js +219 -0
  88. package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js.map +1 -0
  89. package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.d.ts +15 -0
  90. package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.js +33 -0
  91. package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.js.map +1 -0
  92. package/dist/server/modules/browser-runtime/playwright-browser-executor.d.ts +16 -0
  93. package/dist/server/modules/browser-runtime/playwright-browser-executor.js +272 -0
  94. package/dist/server/modules/browser-runtime/playwright-browser-executor.js.map +1 -0
  95. package/dist/server/modules/butler/butler-auth-service.js +4 -0
  96. package/dist/server/modules/butler/butler-auth-service.js.map +1 -1
  97. package/dist/server/modules/butler/butler-inbox-instruction-adapter.js +1 -0
  98. package/dist/server/modules/butler/butler-inbox-instruction-adapter.js.map +1 -1
  99. package/dist/server/modules/butler/butler-session-summary-service.d.ts +1 -0
  100. package/dist/server/modules/butler/butler-session-summary-service.js +5 -3
  101. package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
  102. package/dist/server/modules/butler/butler-workspace-context.js +23 -0
  103. package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
  104. package/dist/server/modules/debug-target/debug-target-service.d.ts +2 -0
  105. package/dist/server/modules/debug-target/debug-target-service.js +14 -0
  106. package/dist/server/modules/debug-target/debug-target-service.js.map +1 -1
  107. package/dist/server/modules/document-runtime/document-docx-fallback-renderer.py +139 -0
  108. package/dist/server/modules/document-runtime/document-export-executor.d.ts +50 -0
  109. package/dist/server/modules/document-runtime/document-export-executor.js +827 -0
  110. package/dist/server/modules/document-runtime/document-export-executor.js.map +1 -0
  111. package/dist/server/modules/document-runtime/document-runtime-controller.d.ts +127 -0
  112. package/dist/server/modules/document-runtime/document-runtime-controller.js +131 -0
  113. package/dist/server/modules/document-runtime/document-runtime-controller.js.map +1 -0
  114. package/dist/server/modules/document-runtime/document-runtime-service.d.ts +125 -0
  115. package/dist/server/modules/document-runtime/document-runtime-service.js +706 -0
  116. package/dist/server/modules/document-runtime/document-runtime-service.js.map +1 -0
  117. package/dist/server/modules/git/git-command-helper-process.js +0 -18
  118. package/dist/server/modules/git/git-command-helper-process.js.map +1 -1
  119. package/dist/server/modules/git/git-command-runner.js +0 -18
  120. package/dist/server/modules/git/git-command-runner.js.map +1 -1
  121. package/dist/server/modules/office/office-controller.d.ts +77 -0
  122. package/dist/server/modules/office/office-controller.js +174 -0
  123. package/dist/server/modules/office/office-controller.js.map +1 -0
  124. package/dist/server/modules/office/office-preview-link-service.d.ts +27 -0
  125. package/dist/server/modules/office/office-preview-link-service.js +121 -0
  126. package/dist/server/modules/office/office-preview-link-service.js.map +1 -0
  127. package/dist/server/modules/office/office-service.d.ts +67 -0
  128. package/dist/server/modules/office/office-service.js +359 -0
  129. package/dist/server/modules/office/office-service.js.map +1 -0
  130. package/dist/server/modules/opencli/opencli-bridge-skill-service.js +38 -14
  131. package/dist/server/modules/opencli/opencli-bridge-skill-service.js.map +1 -1
  132. package/dist/server/modules/opencli/opencli-install-discovery.d.ts +4 -0
  133. package/dist/server/modules/opencli/opencli-install-discovery.js +94 -0
  134. package/dist/server/modules/opencli/opencli-install-discovery.js.map +1 -1
  135. package/dist/server/modules/opencli/opencli-runtime-builder.js +29 -0
  136. package/dist/server/modules/opencli/opencli-runtime-builder.js.map +1 -1
  137. package/dist/server/modules/opencli/opencli-runtime-guard.d.ts +2 -0
  138. package/dist/server/modules/opencli/opencli-runtime-guard.js +5 -0
  139. package/dist/server/modules/opencli/opencli-runtime-guard.js.map +1 -0
  140. package/dist/server/modules/ops-runtime/ops-runtime-controller.d.ts +70 -0
  141. package/dist/server/modules/ops-runtime/ops-runtime-controller.js +83 -0
  142. package/dist/server/modules/ops-runtime/ops-runtime-controller.js.map +1 -0
  143. package/dist/server/modules/ops-runtime/ops-runtime-service.d.ts +80 -0
  144. package/dist/server/modules/ops-runtime/ops-runtime-service.js +327 -0
  145. package/dist/server/modules/ops-runtime/ops-runtime-service.js.map +1 -0
  146. package/dist/server/modules/ops-runtime/ssh-ops-executor.d.ts +41 -0
  147. package/dist/server/modules/ops-runtime/ssh-ops-executor.js +478 -0
  148. package/dist/server/modules/ops-runtime/ssh-ops-executor.js.map +1 -0
  149. package/dist/server/modules/presentation/presentation-controller.d.ts +22 -0
  150. package/dist/server/modules/presentation/presentation-controller.js +59 -0
  151. package/dist/server/modules/presentation/presentation-controller.js.map +1 -0
  152. package/dist/server/modules/presentation/presentation-export-task-service.d.ts +24 -0
  153. package/dist/server/modules/presentation/presentation-export-task-service.js +137 -0
  154. package/dist/server/modules/presentation/presentation-export-task-service.js.map +1 -0
  155. package/dist/server/modules/presentation/presentation-export-types.d.ts +12 -0
  156. package/dist/server/modules/presentation/presentation-export-types.js +2 -0
  157. package/dist/server/modules/presentation/presentation-export-types.js.map +1 -0
  158. package/dist/server/modules/presentation/presentation-pdf-export-service.d.ts +20 -0
  159. package/dist/server/modules/presentation/presentation-pdf-export-service.js +29 -0
  160. package/dist/server/modules/presentation/presentation-pdf-export-service.js.map +1 -0
  161. package/dist/server/modules/presentation/presentation-pptx-export-service.d.ts +20 -0
  162. package/dist/server/modules/presentation/presentation-pptx-export-service.js +64 -0
  163. package/dist/server/modules/presentation/presentation-pptx-export-service.js.map +1 -0
  164. package/dist/server/modules/presentation/presentation-renderer.d.ts +21 -0
  165. package/dist/server/modules/presentation/presentation-renderer.js +208 -0
  166. package/dist/server/modules/presentation/presentation-renderer.js.map +1 -0
  167. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js +3 -3
  168. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js.map +1 -1
  169. package/dist/server/modules/relay-tunnel/relay-tunnel-service.js +6 -1
  170. package/dist/server/modules/relay-tunnel/relay-tunnel-service.js.map +1 -1
  171. package/dist/server/modules/sessions/codex-app-server-helper-process.js +2 -1
  172. package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
  173. package/dist/server/modules/sessions/session-controller.d.ts +1 -0
  174. package/dist/server/modules/sessions/session-controller.js +59 -4
  175. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  176. package/dist/server/modules/sessions/session-history-service.js +17 -5
  177. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  178. package/dist/server/modules/sessions/session-live-runtime-service.d.ts +5 -1
  179. package/dist/server/modules/sessions/session-live-runtime-service.js +129 -8
  180. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  181. package/dist/server/modules/sessions/session-provider-config-service.d.ts +25 -1
  182. package/dist/server/modules/sessions/session-provider-config-service.js +54 -5
  183. package/dist/server/modules/sessions/session-provider-config-service.js.map +1 -1
  184. package/dist/server/modules/sessions/workspace-office-mcp-config.d.ts +14 -0
  185. package/dist/server/modules/sessions/workspace-office-mcp-config.js +54 -0
  186. package/dist/server/modules/sessions/workspace-office-mcp-config.js.map +1 -0
  187. package/dist/server/modules/sessions/workspace-session-auth-service.d.ts +27 -0
  188. package/dist/server/modules/sessions/workspace-session-auth-service.js +109 -0
  189. package/dist/server/modules/sessions/workspace-session-auth-service.js.map +1 -0
  190. package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +51 -0
  191. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +341 -0
  192. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -0
  193. package/dist/server/modules/skills/assistant-runtime-skill-catalog.js +5 -0
  194. package/dist/server/modules/skills/assistant-runtime-skill-catalog.js.map +1 -1
  195. package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/SKILL.md +67 -0
  196. package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/agents/openai.yaml +4 -0
  197. package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/references/cli-workflow.md +133 -0
  198. package/dist/server/modules/skills/skill-controller.d.ts +7 -0
  199. package/dist/server/modules/skills/skill-controller.js +7 -0
  200. package/dist/server/modules/skills/skill-controller.js.map +1 -1
  201. package/dist/server/modules/skills/skill-manager-service.d.ts +61 -0
  202. package/dist/server/modules/skills/skill-manager-service.js +218 -0
  203. package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
  204. package/dist/server/modules/skills/skill-name-policy.js +2 -1
  205. package/dist/server/modules/skills/skill-name-policy.js.map +1 -1
  206. package/dist/server/modules/tasks/task-helper-client.d.ts +1 -0
  207. package/dist/server/modules/tasks/task-helper-client.js +45 -9
  208. package/dist/server/modules/tasks/task-helper-client.js.map +1 -1
  209. package/dist/server/modules/tasks/task-types.d.ts +5 -0
  210. package/dist/server/modules/tasks/task-types.js +6 -1
  211. package/dist/server/modules/tasks/task-types.js.map +1 -1
  212. package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js +2 -1
  213. package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js.map +1 -1
  214. package/dist/server/modules/terminal/runtime/node-pty-loader.d.ts +5 -0
  215. package/dist/server/modules/terminal/runtime/node-pty-loader.js +68 -0
  216. package/dist/server/modules/terminal/runtime/node-pty-loader.js.map +1 -0
  217. package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js +2 -1
  218. package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js.map +1 -1
  219. package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js +6 -9
  220. package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js.map +1 -1
  221. package/dist/server/modules/terminal/runtime/pty-runtime-manager.js +6 -9
  222. package/dist/server/modules/terminal/runtime/pty-runtime-manager.js.map +1 -1
  223. package/dist/server/routes/assistant.d.ts +2 -1
  224. package/dist/server/routes/assistant.js +20 -1
  225. package/dist/server/routes/assistant.js.map +1 -1
  226. package/dist/server/routes/browser-runtime.d.ts +3 -0
  227. package/dist/server/routes/browser-runtime.js +14 -0
  228. package/dist/server/routes/browser-runtime.js.map +1 -0
  229. package/dist/server/routes/document-runtime.d.ts +3 -0
  230. package/dist/server/routes/document-runtime.js +18 -0
  231. package/dist/server/routes/document-runtime.js.map +1 -0
  232. package/dist/server/routes/office.d.ts +3 -0
  233. package/dist/server/routes/office.js +16 -0
  234. package/dist/server/routes/office.js.map +1 -0
  235. package/dist/server/routes/ops-runtime.d.ts +3 -0
  236. package/dist/server/routes/ops-runtime.js +13 -0
  237. package/dist/server/routes/ops-runtime.js.map +1 -0
  238. package/dist/server/routes/presentation.d.ts +3 -0
  239. package/dist/server/routes/presentation.js +5 -0
  240. package/dist/server/routes/presentation.js.map +1 -0
  241. package/dist/server/routes/skills.js +1 -0
  242. package/dist/server/routes/skills.js.map +1 -1
  243. package/dist/server/server/create-server.d.ts +36 -0
  244. package/dist/server/server/create-server.js +215 -4
  245. package/dist/server/server/create-server.js.map +1 -1
  246. package/dist/server/server/release-manifest-sync.d.ts +1 -0
  247. package/dist/server/server/release-manifest-sync.js +2 -2
  248. package/dist/server/server/release-manifest-sync.js.map +1 -1
  249. package/dist/server/server/start-host.js +1 -1
  250. package/dist/server/server/start-host.js.map +1 -1
  251. package/dist/server/shared/http/error-handler.js +53 -19
  252. package/dist/server/shared/http/error-handler.js.map +1 -1
  253. package/dist/server/shared/utils/install-console-timestamp-prefix.d.ts +1 -0
  254. package/dist/server/shared/utils/install-console-timestamp-prefix.js +28 -0
  255. package/dist/server/shared/utils/install-console-timestamp-prefix.js.map +1 -0
  256. package/dist/server/storage/repositories/auth-token-repository.js +22 -6
  257. package/dist/server/storage/repositories/auth-token-repository.js.map +1 -1
  258. package/dist/server/storage/repositories/browser-profile-repository.d.ts +18 -0
  259. package/dist/server/storage/repositories/browser-profile-repository.js +134 -0
  260. package/dist/server/storage/repositories/browser-profile-repository.js.map +1 -0
  261. package/dist/server/storage/repositories/document-comment-repository.d.ts +10 -0
  262. package/dist/server/storage/repositories/document-comment-repository.js +118 -0
  263. package/dist/server/storage/repositories/document-comment-repository.js.map +1 -0
  264. package/dist/server/storage/repositories/document-repository.d.ts +16 -0
  265. package/dist/server/storage/repositories/document-repository.js +109 -0
  266. package/dist/server/storage/repositories/document-repository.js.map +1 -0
  267. package/dist/server/storage/repositories/document-revision-repository.d.ts +10 -0
  268. package/dist/server/storage/repositories/document-revision-repository.js +79 -0
  269. package/dist/server/storage/repositories/document-revision-repository.js.map +1 -0
  270. package/dist/server/storage/repositories/document-template-repository.d.ts +13 -0
  271. package/dist/server/storage/repositories/document-template-repository.js +244 -0
  272. package/dist/server/storage/repositories/document-template-repository.js.map +1 -0
  273. package/dist/server/storage/repositories/office-approval-repository.d.ts +11 -0
  274. package/dist/server/storage/repositories/office-approval-repository.js +109 -0
  275. package/dist/server/storage/repositories/office-approval-repository.js.map +1 -0
  276. package/dist/server/storage/repositories/office-artifact-repository.d.ts +10 -0
  277. package/dist/server/storage/repositories/office-artifact-repository.js +89 -0
  278. package/dist/server/storage/repositories/office-artifact-repository.js.map +1 -0
  279. package/dist/server/storage/repositories/office-audit-event-repository.d.ts +8 -0
  280. package/dist/server/storage/repositories/office-audit-event-repository.js +54 -0
  281. package/dist/server/storage/repositories/office-audit-event-repository.js.map +1 -0
  282. package/dist/server/storage/repositories/office-connector-repository.d.ts +10 -0
  283. package/dist/server/storage/repositories/office-connector-repository.js +97 -0
  284. package/dist/server/storage/repositories/office-connector-repository.js.map +1 -0
  285. package/dist/server/storage/repositories/office-receipt-repository.d.ts +8 -0
  286. package/dist/server/storage/repositories/office-receipt-repository.js +48 -0
  287. package/dist/server/storage/repositories/office-receipt-repository.js.map +1 -0
  288. package/dist/server/storage/repositories/office-rollback-record-repository.d.ts +8 -0
  289. package/dist/server/storage/repositories/office-rollback-record-repository.js +60 -0
  290. package/dist/server/storage/repositories/office-rollback-record-repository.js.map +1 -0
  291. package/dist/server/storage/repositories/office-task-repository.d.ts +19 -0
  292. package/dist/server/storage/repositories/office-task-repository.js +199 -0
  293. package/dist/server/storage/repositories/office-task-repository.js.map +1 -0
  294. package/dist/server/storage/repositories/office-task-step-repository.d.ts +10 -0
  295. package/dist/server/storage/repositories/office-task-step-repository.js +110 -0
  296. package/dist/server/storage/repositories/office-task-step-repository.js.map +1 -0
  297. package/dist/server/storage/repositories/ops-target-repository.d.ts +16 -0
  298. package/dist/server/storage/repositories/ops-target-repository.js +119 -0
  299. package/dist/server/storage/repositories/ops-target-repository.js.map +1 -0
  300. package/dist/server/storage/repositories/session-binding-repository.d.ts +4 -0
  301. package/dist/server/storage/repositories/session-binding-repository.js +70 -69
  302. package/dist/server/storage/repositories/session-binding-repository.js.map +1 -1
  303. package/dist/server/storage/repositories/session-changed-file-repository.d.ts +6 -0
  304. package/dist/server/storage/repositories/session-changed-file-repository.js +44 -43
  305. package/dist/server/storage/repositories/session-changed-file-repository.js.map +1 -1
  306. package/dist/server/storage/repositories/session-fork-repository.d.ts +2 -0
  307. package/dist/server/storage/repositories/session-fork-repository.js +42 -41
  308. package/dist/server/storage/repositories/session-fork-repository.js.map +1 -1
  309. package/dist/server/storage/repositories/session-index-repository.d.ts +5 -0
  310. package/dist/server/storage/repositories/session-index-repository.js +153 -152
  311. package/dist/server/storage/repositories/session-index-repository.js.map +1 -1
  312. package/dist/server/storage/repositories/session-message-attachment-repository.d.ts +7 -0
  313. package/dist/server/storage/repositories/session-message-attachment-repository.js +91 -90
  314. package/dist/server/storage/repositories/session-message-attachment-repository.js.map +1 -1
  315. package/dist/server/storage/repositories/session-message-origin-repository.d.ts +2 -0
  316. package/dist/server/storage/repositories/session-message-origin-repository.js +25 -24
  317. package/dist/server/storage/repositories/session-message-origin-repository.js.map +1 -1
  318. package/dist/server/storage/repositories/session-state-repository.d.ts +2 -0
  319. package/dist/server/storage/repositories/session-state-repository.js +35 -34
  320. package/dist/server/storage/repositories/session-state-repository.js.map +1 -1
  321. package/dist/server/storage/repositories/session-status-snapshot-repository.d.ts +2 -0
  322. package/dist/server/storage/repositories/session-status-snapshot-repository.js +25 -24
  323. package/dist/server/storage/repositories/session-status-snapshot-repository.js.map +1 -1
  324. package/dist/server/storage/sqlite/client.js +123 -1
  325. package/dist/server/storage/sqlite/client.js.map +1 -1
  326. package/dist/server/storage/sqlite/schema.sql +300 -1
  327. package/dist/server/types/domain.d.ts +205 -1
  328. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +3 -2
  329. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +26 -19
  330. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -1
  331. package/package.json +17 -8
  332. package/scripts/postinstall.mjs +159 -7
  333. package/vendor/node-pty-fork/LICENSE +69 -0
  334. package/vendor/node-pty-fork/README.md +91 -0
  335. package/vendor/node-pty-fork/binding.gyp +117 -0
  336. package/vendor/node-pty-fork/deps/.editorconfig +2 -0
  337. package/vendor/node-pty-fork/deps/winpty/.drone.yml +17 -0
  338. package/vendor/node-pty-fork/deps/winpty/.gitattributes +19 -0
  339. package/vendor/node-pty-fork/deps/winpty/LICENSE +21 -0
  340. package/vendor/node-pty-fork/deps/winpty/Makefile +166 -0
  341. package/vendor/node-pty-fork/deps/winpty/README.md +151 -0
  342. package/vendor/node-pty-fork/deps/winpty/RELEASES.md +280 -0
  343. package/vendor/node-pty-fork/deps/winpty/VERSION.txt +1 -0
  344. package/vendor/node-pty-fork/deps/winpty/configure +167 -0
  345. package/vendor/node-pty-fork/deps/winpty/misc/BufferResizeTests.cc +90 -0
  346. package/vendor/node-pty-fork/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
  347. package/vendor/node-pty-fork/deps/winpty/misc/ClearConsole.cc +72 -0
  348. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.cc +117 -0
  349. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.ps1 +116 -0
  350. package/vendor/node-pty-fork/deps/winpty/misc/ConoutMode.cc +113 -0
  351. package/vendor/node-pty-fork/deps/winpty/misc/DebugClient.py +42 -0
  352. package/vendor/node-pty-fork/deps/winpty/misc/DebugServer.py +63 -0
  353. package/vendor/node-pty-fork/deps/winpty/misc/DumpLines.py +5 -0
  354. package/vendor/node-pty-fork/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
  355. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
  356. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
  357. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
  358. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
  359. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
  360. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
  361. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
  362. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
  363. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
  364. package/vendor/node-pty-fork/deps/winpty/misc/FontSurvey.cc +100 -0
  365. package/vendor/node-pty-fork/deps/winpty/misc/FormatChar.h +21 -0
  366. package/vendor/node-pty-fork/deps/winpty/misc/FreezePerfTest.cc +62 -0
  367. package/vendor/node-pty-fork/deps/winpty/misc/GetCh.cc +20 -0
  368. package/vendor/node-pty-fork/deps/winpty/misc/GetConsolePos.cc +41 -0
  369. package/vendor/node-pty-fork/deps/winpty/misc/GetFont.cc +261 -0
  370. package/vendor/node-pty-fork/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
  371. package/vendor/node-pty-fork/deps/winpty/misc/IsNewConsole.cc +87 -0
  372. package/vendor/node-pty-fork/deps/winpty/misc/MouseInputNotes.txt +90 -0
  373. package/vendor/node-pty-fork/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
  374. package/vendor/node-pty-fork/deps/winpty/misc/Notes.txt +219 -0
  375. package/vendor/node-pty-fork/deps/winpty/misc/OSVersion.cc +27 -0
  376. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
  377. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest.cc +671 -0
  378. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
  379. package/vendor/node-pty-fork/deps/winpty/misc/SelectAllTest.cc +45 -0
  380. package/vendor/node-pty-fork/deps/winpty/misc/SetBufferSize.cc +32 -0
  381. package/vendor/node-pty-fork/deps/winpty/misc/SetCursorPos.cc +10 -0
  382. package/vendor/node-pty-fork/deps/winpty/misc/SetFont.cc +145 -0
  383. package/vendor/node-pty-fork/deps/winpty/misc/SetWindowRect.cc +36 -0
  384. package/vendor/node-pty-fork/deps/winpty/misc/ShowArgv.cc +12 -0
  385. package/vendor/node-pty-fork/deps/winpty/misc/ShowConsoleInput.cc +40 -0
  386. package/vendor/node-pty-fork/deps/winpty/misc/Spew.py +5 -0
  387. package/vendor/node-pty-fork/deps/winpty/misc/TestUtil.cc +172 -0
  388. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
  389. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
  390. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
  391. package/vendor/node-pty-fork/deps/winpty/misc/UnixEcho.cc +89 -0
  392. package/vendor/node-pty-fork/deps/winpty/misc/Utf16Echo.cc +46 -0
  393. package/vendor/node-pty-fork/deps/winpty/misc/VeryLargeRead.cc +122 -0
  394. package/vendor/node-pty-fork/deps/winpty/misc/VkEscapeTest.cc +56 -0
  395. package/vendor/node-pty-fork/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
  396. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest1.cc +57 -0
  397. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest2.cc +30 -0
  398. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo1.cc +26 -0
  399. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo2.cc +19 -0
  400. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test1.cc +46 -0
  401. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test2.cc +70 -0
  402. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test3.cc +78 -0
  403. package/vendor/node-pty-fork/deps/winpty/misc/Win32Write1.cc +44 -0
  404. package/vendor/node-pty-fork/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
  405. package/vendor/node-pty-fork/deps/winpty/misc/WriteConsole.cc +106 -0
  406. package/vendor/node-pty-fork/deps/winpty/misc/build32.sh +9 -0
  407. package/vendor/node-pty-fork/deps/winpty/misc/build64.sh +9 -0
  408. package/vendor/node-pty-fork/deps/winpty/misc/color-test.sh +212 -0
  409. package/vendor/node-pty-fork/deps/winpty/misc/font-notes.txt +300 -0
  410. package/vendor/node-pty-fork/deps/winpty/misc/winbug-15048.cc +201 -0
  411. package/vendor/node-pty-fork/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
  412. package/vendor/node-pty-fork/deps/winpty/ship/common_ship.py +53 -0
  413. package/vendor/node-pty-fork/deps/winpty/ship/make_msvc_package.py +165 -0
  414. package/vendor/node-pty-fork/deps/winpty/ship/ship.py +108 -0
  415. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.cc +605 -0
  416. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.h +103 -0
  417. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
  418. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
  419. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.cc +632 -0
  420. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.h +28 -0
  421. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.cc +852 -0
  422. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.h +109 -0
  423. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
  424. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
  425. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.cc +152 -0
  426. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.h +41 -0
  427. package/vendor/node-pty-fork/deps/winpty/src/agent/Coord.h +87 -0
  428. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.cc +239 -0
  429. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.h +32 -0
  430. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
  431. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.h +28 -0
  432. package/vendor/node-pty-fork/deps/winpty/src/agent/DsrSender.h +30 -0
  433. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.cc +99 -0
  434. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.h +47 -0
  435. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.cc +246 -0
  436. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.h +114 -0
  437. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
  438. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
  439. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.cc +378 -0
  440. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.h +125 -0
  441. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.cc +699 -0
  442. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.h +103 -0
  443. package/vendor/node-pty-fork/deps/winpty/src/agent/SimplePool.h +75 -0
  444. package/vendor/node-pty-fork/deps/winpty/src/agent/SmallRect.h +143 -0
  445. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.cc +535 -0
  446. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.h +69 -0
  447. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
  448. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
  449. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.cc +107 -0
  450. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.h +67 -0
  451. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
  452. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
  453. package/vendor/node-pty-fork/deps/winpty/src/agent/main.cc +114 -0
  454. package/vendor/node-pty-fork/deps/winpty/src/agent/subdir.mk +61 -0
  455. package/vendor/node-pty-fork/deps/winpty/src/configurations.gypi +60 -0
  456. package/vendor/node-pty-fork/deps/winpty/src/debugserver/DebugServer.cc +117 -0
  457. package/vendor/node-pty-fork/deps/winpty/src/debugserver/subdir.mk +41 -0
  458. package/vendor/node-pty-fork/deps/winpty/src/include/winpty.h +242 -0
  459. package/vendor/node-pty-fork/deps/winpty/src/include/winpty_constants.h +131 -0
  460. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
  461. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
  462. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
  463. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
  464. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/subdir.mk +46 -0
  465. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/winpty.cc +970 -0
  466. package/vendor/node-pty-fork/deps/winpty/src/shared/AgentMsg.h +38 -0
  467. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
  468. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
  469. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.cc +103 -0
  470. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.h +102 -0
  471. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.cc +187 -0
  472. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.h +38 -0
  473. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.cc +138 -0
  474. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.h +55 -0
  475. package/vendor/node-pty-fork/deps/winpty/src/shared/GetCommitHash.bat +13 -0
  476. package/vendor/node-pty-fork/deps/winpty/src/shared/Mutex.h +54 -0
  477. package/vendor/node-pty-fork/deps/winpty/src/shared/OsModule.h +63 -0
  478. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.cc +36 -0
  479. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.h +45 -0
  480. package/vendor/node-pty-fork/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
  481. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilder.h +227 -0
  482. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
  483. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.cc +55 -0
  484. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.h +80 -0
  485. package/vendor/node-pty-fork/deps/winpty/src/shared/TimeMeasurement.h +63 -0
  486. package/vendor/node-pty-fork/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
  487. package/vendor/node-pty-fork/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
  488. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
  489. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.h +104 -0
  490. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.cc +252 -0
  491. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.h +29 -0
  492. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.cc +55 -0
  493. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.h +64 -0
  494. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.cc +57 -0
  495. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.h +43 -0
  496. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.cc +42 -0
  497. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.h +27 -0
  498. package/vendor/node-pty-fork/deps/winpty/src/shared/winpty_snprintf.h +99 -0
  499. package/vendor/node-pty-fork/deps/winpty/src/subdir.mk +5 -0
  500. package/vendor/node-pty-fork/deps/winpty/src/tests/subdir.mk +28 -0
  501. package/vendor/node-pty-fork/deps/winpty/src/tests/trivial_test.cc +158 -0
  502. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
  503. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
  504. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
  505. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
  506. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.cc +86 -0
  507. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.h +31 -0
  508. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
  509. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
  510. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/main.cc +729 -0
  511. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/subdir.mk +41 -0
  512. package/vendor/node-pty-fork/deps/winpty/src/winpty.gyp +206 -0
  513. package/vendor/node-pty-fork/deps/winpty/vcbuild.bat +83 -0
  514. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js +20 -0
  515. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js.map +1 -0
  516. package/vendor/node-pty-fork/lib/eventEmitter2.js +47 -0
  517. package/vendor/node-pty-fork/lib/eventEmitter2.js.map +1 -0
  518. package/vendor/node-pty-fork/lib/eventEmitter2.test.js +30 -0
  519. package/vendor/node-pty-fork/lib/eventEmitter2.test.js.map +1 -0
  520. package/vendor/node-pty-fork/lib/index.js +51 -0
  521. package/vendor/node-pty-fork/lib/index.js.map +1 -0
  522. package/vendor/node-pty-fork/lib/interfaces.js +7 -0
  523. package/vendor/node-pty-fork/lib/interfaces.js.map +1 -0
  524. package/vendor/node-pty-fork/lib/shared/conout.js +11 -0
  525. package/vendor/node-pty-fork/lib/shared/conout.js.map +1 -0
  526. package/vendor/node-pty-fork/lib/terminal.js +190 -0
  527. package/vendor/node-pty-fork/lib/terminal.js.map +1 -0
  528. package/vendor/node-pty-fork/lib/terminal.test.js +139 -0
  529. package/vendor/node-pty-fork/lib/terminal.test.js.map +1 -0
  530. package/vendor/node-pty-fork/lib/testUtils.test.js +28 -0
  531. package/vendor/node-pty-fork/lib/testUtils.test.js.map +1 -0
  532. package/vendor/node-pty-fork/lib/types.js +7 -0
  533. package/vendor/node-pty-fork/lib/types.js.map +1 -0
  534. package/vendor/node-pty-fork/lib/unixTerminal.js +304 -0
  535. package/vendor/node-pty-fork/lib/unixTerminal.js.map +1 -0
  536. package/vendor/node-pty-fork/lib/unixTerminal.test.js +330 -0
  537. package/vendor/node-pty-fork/lib/unixTerminal.test.js.map +1 -0
  538. package/vendor/node-pty-fork/lib/utils.js +17 -0
  539. package/vendor/node-pty-fork/lib/utils.js.map +1 -0
  540. package/vendor/node-pty-fork/lib/windowsConoutConnection.js +122 -0
  541. package/vendor/node-pty-fork/lib/windowsConoutConnection.js.map +1 -0
  542. package/vendor/node-pty-fork/lib/windowsPtyAgent.js +324 -0
  543. package/vendor/node-pty-fork/lib/windowsPtyAgent.js.map +1 -0
  544. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js +90 -0
  545. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js.map +1 -0
  546. package/vendor/node-pty-fork/lib/windowsTerminal.js +201 -0
  547. package/vendor/node-pty-fork/lib/windowsTerminal.js.map +1 -0
  548. package/vendor/node-pty-fork/lib/windowsTerminal.test.js +203 -0
  549. package/vendor/node-pty-fork/lib/windowsTerminal.test.js.map +1 -0
  550. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js +22 -0
  551. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js.map +1 -0
  552. package/vendor/node-pty-fork/package.json +35 -0
  553. package/vendor/node-pty-fork/scripts/apply-patches.mjs +341 -0
  554. package/vendor/node-pty-fork/scripts/fetch-upstream.mjs +41 -0
  555. package/vendor/node-pty-fork/scripts/install-smoke.cjs +59 -0
  556. package/vendor/node-pty-fork/scripts/smoke-load.cjs +10 -0
  557. package/vendor/node-pty-fork/scripts/sync-upstream.mjs +29 -0
  558. package/vendor/node-pty-fork/scripts/verify-runtime.cjs +54 -0
  559. package/vendor/node-pty-fork/scripts/verify-runtime.test.cjs +22 -0
  560. package/vendor/node-pty-fork/scripts/verify-tarball.cjs +80 -0
  561. package/vendor/node-pty-fork/src/conpty_console_list_agent.ts +19 -0
  562. package/vendor/node-pty-fork/src/eventEmitter2.test.ts +30 -0
  563. package/vendor/node-pty-fork/src/eventEmitter2.ts +48 -0
  564. package/vendor/node-pty-fork/src/index.ts +51 -0
  565. package/vendor/node-pty-fork/src/interfaces.ts +129 -0
  566. package/vendor/node-pty-fork/src/native.d.ts +56 -0
  567. package/vendor/node-pty-fork/src/shared/conout.ts +15 -0
  568. package/vendor/node-pty-fork/src/terminal.test.ts +119 -0
  569. package/vendor/node-pty-fork/src/terminal.ts +211 -0
  570. package/vendor/node-pty-fork/src/testUtils.test.ts +23 -0
  571. package/vendor/node-pty-fork/src/tsconfig.json +22 -0
  572. package/vendor/node-pty-fork/src/types.ts +15 -0
  573. package/vendor/node-pty-fork/src/unix/pty.cc +826 -0
  574. package/vendor/node-pty-fork/src/unix/spawn-helper.cc +23 -0
  575. package/vendor/node-pty-fork/src/unixTerminal.test.ts +335 -0
  576. package/vendor/node-pty-fork/src/unixTerminal.ts +320 -0
  577. package/vendor/node-pty-fork/src/utils.ts +9 -0
  578. package/vendor/node-pty-fork/src/win/conpty.cc +500 -0
  579. package/vendor/node-pty-fork/src/win/conpty_console_list.cc +43 -0
  580. package/vendor/node-pty-fork/src/win/path_util.cc +73 -0
  581. package/vendor/node-pty-fork/src/win/path_util.h +22 -0
  582. package/vendor/node-pty-fork/src/win/winpty.cc +322 -0
  583. package/vendor/node-pty-fork/src/windowsConoutConnection.ts +79 -0
  584. package/vendor/node-pty-fork/src/windowsPtyAgent.test.ts +94 -0
  585. package/vendor/node-pty-fork/src/windowsPtyAgent.ts +323 -0
  586. package/vendor/node-pty-fork/src/windowsTerminal.test.ts +214 -0
  587. package/vendor/node-pty-fork/src/windowsTerminal.ts +208 -0
  588. package/vendor/node-pty-fork/src/worker/conoutSocketWorker.ts +22 -0
  589. package/vendor/node-pty-fork/typings/node-pty.d.ts +203 -0
  590. package/dist/public/assets/FileContextPanel-xGTYDclT.js +0 -1
  591. package/dist/public/assets/WorkbenchLayout-DScHaza9.js +0 -244
  592. package/dist/public/assets/WorkbenchShellRoute-DN6LdrqC.js +0 -1
  593. package/dist/public/assets/WorkbenchShellRoute-DhQo_0vu.css +0 -1
  594. package/dist/public/assets/file-tree-icon-lfU9Ag77.js +0 -3
  595. package/dist/public/assets/index-CFYXCsyx.css +0 -1
  596. package/dist/public/assets/index-NGxWr8Ix.js +0 -42
  597. package/dist/server/modules/channels/wechat-claw-client.d.ts +0 -51
  598. package/dist/server/modules/channels/wechat-claw-client.js +0 -245
  599. package/dist/server/modules/channels/wechat-claw-client.js.map +0 -1
@@ -1 +1 @@
1
- import{b as d,j as e}from"./index-NGxWr8Ix.js";function c(){return d.useEffect(()=>{const t=document.documentElement.style.background,s=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=t,document.body.style.background=s}},[]),e.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:e.jsxs("section",{className:"desktop-detach-preview-card",children:[e.jsx("header",{className:"desktop-detach-preview-bar",children:e.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),e.jsx("div",{className:"desktop-detach-preview-body",children:e.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}export{c as DesktopDetachPreviewPage};
1
+ import{b as d,j as e}from"./index-CjewzOUG.js";function c(){return d.useEffect(()=>{const t=document.documentElement.style.background,s=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=t,document.body.style.background=s}},[]),e.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:e.jsxs("section",{className:"desktop-detach-preview-card",children:[e.jsx("header",{className:"desktop-detach-preview-bar",children:e.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),e.jsx("div",{className:"desktop-detach-preview-body",children:e.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}export{c as DesktopDetachPreviewPage};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js"])))=>i.map(i=>d[i]);
2
- import{b as a,m as E,_ as y,j as t,t as c}from"./index-NGxWr8Ix.js";import{u as q,g as O}from"./model-switch-api-CPtou49j.js";import{FileContextPanel as F}from"./FileContextPanel-xGTYDclT.js";import{GitSidebar as C}from"./GitSidebar-Cr3Z9OUI.js";import{TerminalManagerPanel as P}from"./TerminalManagerPanel-2bi9wVhT.js";import{TerminalPage as _}from"./TerminalPage-DayZz2Tf.js";import{r as $,W as U,m as W}from"./WorkbenchLayout-DScHaza9.js";import{c as z,u as A,e as H,N as K}from"./App-tXOqoHNl.js";import"./WorkbenchModal-BWXYSXmC.js";import"./file-tree-icon-lfU9Ag77.js";import"./terminal-runtime-meta-C-Lbyx2i.js";import"./TerminalRuntimeFallbackModal-DgwYcp-Y.js";import"./MobileWorkspaceSwitcherHeader-KIbqBYJN.js";import"./MobileTopHeaderFrame-CkdnZ_MU.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-BwE5nw0l.js";function V(n){return{navigationGroups:n,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function B(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function J(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function Q(n,u){return{navigationGroups:u,currentWorkspaceId:n,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function x(n){return n.kind==="files"?c("shell.filesEntry"):n.kind==="git"?c("shell.gitEntry"):n.kind==="processes"?c("shell.terminalManagerEntry"):n.kind==="terminals"?c("shell.terminalsEntry"):n.kind}function M(n,u){var s;return n.workspaceName??(n.workspaceId?((s=u.find(d=>d.workspace.id===n.workspaceId))==null?void 0:s.workspace.name)??null:null)}function X(n,u){const s=M(n,u),d=x(n);return s?`CodingNS - ${d}(${s})`:`CodingNS - ${d}`}function we(){const{windowId:n}=z(),u=A(),s=H(),d=$(s),h=q(i=>i.sessionDisplaySortMode),[e,b]=a.useState(null),[N,w]=a.useState(!0),[T,v]=a.useState(null),[o,k]=a.useState([]),[r,S]=a.useState(null);a.useEffect(()=>{let i=!1;async function l(){if(!n){b(null),w(!1),v(c("desktopWindow.invalidWindowId"));return}w(!0),v(null);const p=await s.bridge.getWindowDescriptor(n),g=p.ok?p.value??null:s.windows.getDescriptor(n);if(!i){if(!g){b(null),w(!1),v(p.detail??c("desktopWindow.loadDescriptorFailed"));return}s.windows.registerDescriptor(g),s.windows.markWindowOpen(g.windowId),b(g),w(!1)}}return l(),()=>{i=!0}},[s,n]),a.useEffect(()=>{if(!(e!=null&&e.workspaceId)){k([]);return}let i=!1;async function l(){try{const p=await O();if(i)return;k(W(p,h))}catch{if(i)return;k([])}}return l(),()=>{i=!0}},[e==null?void 0:e.workspaceId,h]),a.useEffect(()=>{if(!e){S(null);return}const i=new U({onConnectionChange:()=>{},onSnapshot:l=>{k(W(l,h))},onUnauthorized:()=>{E.clear(),u(`/login?returnTo=${encodeURIComponent(`/desktop-window/${e.windowId}`)}`,{replace:!0})}});return S(i),i.start(),()=>{i.close(),S(null)}},[e,u,h]),a.useEffect(()=>{if(!s.isDesktop||!s.bridge.supported||!e||e.mode!=="external")return;const i=X(e,o);document.title=i,y(async()=>{const{getCurrentWindow:l}=await import("./window-BVUB8gMK.js").then(p=>p.w);return{getCurrentWindow:l}},__vite__mapDeps([0,1])).then(({getCurrentWindow:l})=>l().setTitle(i)).catch(()=>{})},[e,o,s.bridge.supported,s.isDesktop]);const D=a.useMemo(()=>r?{navigationGroups:o,subscribeFileTree:r.subscribeFileTree.bind(r),requestFileTreeRefresh:r.requestFileTreeRefresh.bind(r),addFileTreeSnapshotListener:r.addFileTreeSnapshotListener.bind(r),subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:V(o),[o,r]),I=a.useMemo(()=>r?{subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:B(),[r]),R=a.useMemo(()=>r?{subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:J(),[r]),G=a.useMemo(()=>r?{navigationGroups:o,currentWorkspaceId:(e==null?void 0:e.workspaceId)??null,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:Q((e==null?void 0:e.workspaceId)??null,o),[e==null?void 0:e.workspaceId,o,r]);if(!s.isDesktop)return t.jsx(K,{to:"/",replace:!0});if(N)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("common.loading")})});if(T)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:T})});if(!e)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.loadDescriptorFailed")})});let m=null;if(e.kind==="files"?m=t.jsx(F,{sessionId:e.sessionId,workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:D}):e.kind==="git"?m=t.jsx(C,{workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:I}):e.kind==="processes"?m=t.jsx(P,{currentWorkspaceId:e.workspaceId,navigationGroups:o,externalWindowMode:!0,workbenchShellOverrides:R}):e.kind==="terminals"&&(m=t.jsx(_,{externalWindowMode:!0,externalWindowWorkspaceId:e.workspaceId,workbenchShellOverrides:G})),!m)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.unsupportedKind",{kind:e.kind})})});const f=x(e),j=M(e,o),L=e.mode==="external"&&e.kind==="processes";return t.jsxs("main",{className:"desktop-window-page",children:[L?t.jsx("header",{className:"desktop-window-drag-header","data-window-kind":e.kind,"data-window-drag-handle":"desktop-window-drag-header","data-tauri-drag-region":d,"aria-label":f,children:t.jsxs("div",{className:"desktop-window-drag-header-copy","data-tauri-drag-region":d,children:[t.jsx("span",{className:"desktop-window-drag-header-tag","data-tauri-drag-region":d,children:f}),t.jsx("strong",{"data-tauri-drag-region":d,children:j??f})]})}):null,t.jsx("div",{className:"desktop-window-body","data-window-kind":e.kind,"aria-label":f,children:m})]})}export{we as DesktopWindowPage};
2
+ import{b as a,m as E,_ as y,j as t,t as c}from"./index-CjewzOUG.js";import{u as q,g as O}from"./model-switch-api-Br0ivfe5.js";import{FileContextPanel as F}from"./FileContextPanel-lM5mBcfn.js";import{GitSidebar as C}from"./GitSidebar-CmXAhyjo.js";import{TerminalManagerPanel as P}from"./TerminalManagerPanel-D9JHCS6d.js";import{TerminalPage as _}from"./TerminalPage-CBIKHI33.js";import{r as $,W as U,m as W}from"./WorkbenchLayout-D48i71PU.js";import{c as z,u as A,e as H,N as K}from"./App-B0q8uDA-.js";import"./WorkbenchModal-BYNuMIoV.js";import"./file-tree-icon-BFwaPxKs.js";import"./terminal-runtime-meta-BCtAYB0E.js";import"./TerminalRuntimeFallbackModal-W5NjqFEz.js";import"./MobileWorkspaceSwitcherHeader-DhaM9fgx.js";import"./MobileTopHeaderFrame-_I0t7cC_.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-D7OgZZN-.js";function V(n){return{navigationGroups:n,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function B(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function J(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function Q(n,u){return{navigationGroups:u,currentWorkspaceId:n,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function x(n){return n.kind==="files"?c("shell.filesEntry"):n.kind==="git"?c("shell.gitEntry"):n.kind==="processes"?c("shell.terminalManagerEntry"):n.kind==="terminals"?c("shell.terminalsEntry"):n.kind}function M(n,u){var s;return n.workspaceName??(n.workspaceId?((s=u.find(d=>d.workspace.id===n.workspaceId))==null?void 0:s.workspace.name)??null:null)}function X(n,u){const s=M(n,u),d=x(n);return s?`CodingNS - ${d}(${s})`:`CodingNS - ${d}`}function we(){const{windowId:n}=z(),u=A(),s=H(),d=$(s),h=q(i=>i.sessionDisplaySortMode),[e,b]=a.useState(null),[N,w]=a.useState(!0),[T,v]=a.useState(null),[o,k]=a.useState([]),[r,S]=a.useState(null);a.useEffect(()=>{let i=!1;async function l(){if(!n){b(null),w(!1),v(c("desktopWindow.invalidWindowId"));return}w(!0),v(null);const p=await s.bridge.getWindowDescriptor(n),g=p.ok?p.value??null:s.windows.getDescriptor(n);if(!i){if(!g){b(null),w(!1),v(p.detail??c("desktopWindow.loadDescriptorFailed"));return}s.windows.registerDescriptor(g),s.windows.markWindowOpen(g.windowId),b(g),w(!1)}}return l(),()=>{i=!0}},[s,n]),a.useEffect(()=>{if(!(e!=null&&e.workspaceId)){k([]);return}let i=!1;async function l(){try{const p=await O();if(i)return;k(W(p,h))}catch{if(i)return;k([])}}return l(),()=>{i=!0}},[e==null?void 0:e.workspaceId,h]),a.useEffect(()=>{if(!e){S(null);return}const i=new U({onConnectionChange:()=>{},onSnapshot:l=>{k(W(l,h))},onUnauthorized:()=>{E.clear(),u(`/login?returnTo=${encodeURIComponent(`/desktop-window/${e.windowId}`)}`,{replace:!0})}});return S(i),i.start(),()=>{i.close(),S(null)}},[e,u,h]),a.useEffect(()=>{if(!s.isDesktop||!s.bridge.supported||!e||e.mode!=="external")return;const i=X(e,o);document.title=i,y(async()=>{const{getCurrentWindow:l}=await import("./window-BVUB8gMK.js").then(p=>p.w);return{getCurrentWindow:l}},__vite__mapDeps([0,1])).then(({getCurrentWindow:l})=>l().setTitle(i)).catch(()=>{})},[e,o,s.bridge.supported,s.isDesktop]);const D=a.useMemo(()=>r?{navigationGroups:o,subscribeFileTree:r.subscribeFileTree.bind(r),requestFileTreeRefresh:r.requestFileTreeRefresh.bind(r),addFileTreeSnapshotListener:r.addFileTreeSnapshotListener.bind(r),subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:V(o),[o,r]),I=a.useMemo(()=>r?{subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:B(),[r]),R=a.useMemo(()=>r?{subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:J(),[r]),G=a.useMemo(()=>r?{navigationGroups:o,currentWorkspaceId:(e==null?void 0:e.workspaceId)??null,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:Q((e==null?void 0:e.workspaceId)??null,o),[e==null?void 0:e.workspaceId,o,r]);if(!s.isDesktop)return t.jsx(K,{to:"/",replace:!0});if(N)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("common.loading")})});if(T)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:T})});if(!e)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.loadDescriptorFailed")})});let m=null;if(e.kind==="files"?m=t.jsx(F,{sessionId:e.sessionId,workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:D}):e.kind==="git"?m=t.jsx(C,{workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:I}):e.kind==="processes"?m=t.jsx(P,{currentWorkspaceId:e.workspaceId,navigationGroups:o,externalWindowMode:!0,workbenchShellOverrides:R}):e.kind==="terminals"&&(m=t.jsx(_,{externalWindowMode:!0,externalWindowWorkspaceId:e.workspaceId,workbenchShellOverrides:G})),!m)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.unsupportedKind",{kind:e.kind})})});const f=x(e),j=M(e,o),L=e.mode==="external"&&e.kind==="processes";return t.jsxs("main",{className:"desktop-window-page",children:[L?t.jsx("header",{className:"desktop-window-drag-header","data-window-kind":e.kind,"data-window-drag-handle":"desktop-window-drag-header","data-tauri-drag-region":d,"aria-label":f,children:t.jsxs("div",{className:"desktop-window-drag-header-copy","data-tauri-drag-region":d,children:[t.jsx("span",{className:"desktop-window-drag-header-tag","data-tauri-drag-region":d,children:f}),t.jsx("strong",{"data-tauri-drag-region":d,children:j??f})]})}):null,t.jsx("div",{className:"desktop-window-body","data-window-kind":e.kind,"aria-label":f,children:m})]})}export{we as DesktopWindowPage};
@@ -0,0 +1 @@
1
+ import{b as c,j as i,t as r,A as In}from"./index-CjewzOUG.js";import{f as ei,e as Ri,g as _i}from"./App-B0q8uDA-.js";import{ar as Ti,u as Fi,h as Ai,v as Li}from"./model-switch-api-Br0ivfe5.js";import{bl as Bi,bm as ti,b as nn,w as ft,bn as Wi,u as $i,a7 as Re,bo as Oi,bp as gt,bq as Ke,br as Hi,bs as zi,bt as Ui,bu as Vi}from"./WorkbenchLayout-D48i71PU.js";import{W as $n}from"./WorkbenchModal-BYNuMIoV.js";import{r as Rt,a as _t,F as Ki}from"./file-tree-icon-BFwaPxKs.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-D7OgZZN-.js";const Gi=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),Xi=["._"];function ut(t){return t.split(/[/\\]/).filter(Boolean).pop()??t}function qi(t){const n=t.trim().toLowerCase();return n?Gi.has(n)||Xi.some(l=>n.startsWith(l)):!1}function Tt(t,n,l){return l?[...t]:t.filter(o=>!qi(n(o)))}function Nt(t,n){return Tt(t,l=>l.name,n)}function Yi(t,n){return n?t:Object.entries(t).reduce((l,[o,m])=>(l[o]=Nt(m,!1),l),{})}async function Et(t,n){const[l,o]=await Promise.all([Bi(n),Ti(t)]);return Zi(l.changes,o.items)}function Zi(t,n){const l=new Set(n.map(o=>kt(o.path)));return t.filter(o=>l.has(kt(o.path))||o.oldPath!==null&&l.has(kt(o.oldPath)))}function Ji(t){const n=On("","");for(const l of t){const o=kt(l.path),m=o.split("/").filter(Boolean);let h=n;m.forEach((b,x)=>{const j=m.slice(0,x+1).join("/");if(x===m.length-1){h.children.set(`file:${j}`,{kind:"file",name:b,path:o,change:l});return}const T=`directory:${j}`,M=h.children.get(T);if(M&&M.kind==="directory"){h=M;return}const Q=On(b,j);h.children.set(T,Q),h=Q})}return ai(ii([...n.children.values()]))}function ni(t,n){const l=t.oldPath?`${t.oldPath} -> ${t.path}`:t.path;return ln(t)?`${l} ${n}`:l}function ln(t){return t.status==="D"||t.stagedStatus==="D"||t.worktreeStatus==="D"}function Dt(t){return t.split("/").filter(Boolean).pop()??t}function kt(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function On(t,n){return{kind:"directory",name:t,path:n,children:new Map}}function ii(t){return[...t].sort((n,l)=>n.kind!==l.kind?n.kind==="directory"?-1:1:n.name.localeCompare(l.name,"zh-CN")).map(n=>n.kind==="directory"?{kind:"directory",name:n.name,path:n.path,children:ii([...n.children.values()])}:n)}function ai(t){return t.map(n=>{var b;if(n.kind!=="directory")return n;const l=ai(n.children);let o=n.name,m=n.path,h=l;for(;h.length===1&&((b=h[0])==null?void 0:b.kind)==="directory";){const x=h[0];o=`${o}/${x.name}`,m=x.path,h=x.children}return{kind:"directory",name:o,path:m,children:h}})}const Qi=450,Ii=60*1e3,Hn=20,zn=16;function ea({sessionId:t,workspaceId:n,showSystemFiles:l,selectedPath:o,refreshVersion:m,onCountChange:h,onSelectFile:b,onOpenFile:x}){const[j,T]=c.useState("tree"),[M,Q]=c.useState([]),[me,K]=c.useState(!0),[pe,be]=c.useState(!1),[G,ht]=c.useState([]),D=c.useRef(null),At=ti(),{showToast:je}=ei();c.useEffect(()=>{const p=nn(Pt(n,t),Ii);T("tree"),Q(p??[]),K(p===null),be(!1),ht([]),D.current=null},[t,n]),c.useEffect(()=>{let p=!1;async function S(){K(!0);try{const v=await Et(t,n);p||(Q(v),ft(Pt(n,t),v))}catch(v){p||je({title:It(v,r("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{p||K(!1)}}return S(),()=>{p=!0}},[m,t,je,n]);async function Se(){K(!0);try{const p=await Et(t,n);Q(p),ft(Pt(n,t),p)}catch(p){je({title:It(p,r("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{K(!1)}}async function E(){if(R.length!==0){be(!0);try{await Wi(n,R.map(S=>S.path));const p=await Et(t,n);Q(p),ft(Pt(n,t),p),je({title:r("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(p){je({title:It(p,r("git.stageFailed")),tone:"error"})}finally{be(!1)}}}function F(p){ht(S=>S.includes(p)?S.filter(v=>v!==p):[...S,p])}function X(p){const S=Date.now(),v=D.current;return D.current={filePath:p,timestamp:S},(v==null?void 0:v.filePath)===p&&S-v.timestamp<=Qi}async function $(p,S){if(S&&X(p)){await x(p),D.current=null;return}S||(D.current=null),await b(p)}const ie=c.useMemo(()=>Tt(M,p=>Dt(p.path),l),[M,l]),R=ie.filter(p=>!p.staged),_e=Ji(ie),ae=new Set(G);return c.useEffect(()=>{h==null||h(ie.length)},[h,ie.length]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"file-panel-session-toolbar",children:[i.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":r("conversation.filePanelSessionViewLabel"),children:[i.jsx("button",{className:j==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":j==="tree",onClick:()=>T("tree"),children:r("conversation.filePanelSessionTreeView")}),i.jsx("button",{className:j==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":j==="list",onClick:()=>T("list"),children:r("conversation.filePanelSessionListView")})]}),i.jsxs("div",{className:"file-panel-session-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Se(),disabled:me||pe,children:r("conversation.filePanelRefresh")}),i.jsx("button",{className:"primary-button",type:"button",onClick:()=>void E(),disabled:pe||R.length===0,children:r("conversation.filePanelSessionStageAll")})]})]}),i.jsxs("div",{className:"file-panel-session-summary",children:[i.jsx("span",{children:`${r("conversation.filePanelSessionSummary")} ${ie.length}`}),i.jsx("span",{children:`${r("conversation.filePanelSessionUnstagedSummary")} ${R.length}`})]}),i.jsx("div",{ref:At,className:"file-tree","data-scrollbar-autohide":"true",children:me?i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelSessionLoading")}):ie.length===0?i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelSessionEmpty")}):j==="tree"?li({nodes:_e,depth:0,collapsedPathSet:ae,selectedPath:o,onToggleTreePath:F,onFileClick:$}):ta({items:ie,selectedPath:o,onFileClick:$})})]})}function li({nodes:t,depth:n,collapsedPathSet:l,selectedPath:o,onToggleTreePath:m,onFileClick:h}){return t.map(b=>{if(b.kind==="directory"){const x=!l.has(b.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":x,style:{paddingInlineStart:`${Hn+n*zn}px`},onClick:()=>m(b.path),children:[i.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:x?"v":">"}),i.jsx("span",{className:"file-tree-label",children:b.name})]}),x?i.jsx("div",{className:"file-tree-children",children:li({nodes:b.children,depth:n+1,collapsedPathSet:l,selectedPath:o,onToggleTreePath:m,onFileClick:h})}):null]},`session-directory:${b.path}`)}return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":o===b.change.path,"data-kind":"file",style:{paddingInlineStart:`${Hn+n*zn}px`},onClick:()=>void h(b.change.path,!ln(b.change)),children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(b.name),"aria-hidden":"true",children:Rt(b.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:b.name}),i.jsx("span",{className:"file-tree-path",children:ni(b.change,r("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":b.change.status,children:b.change.status}),i.jsx("span",{className:"file-session-badge subtle",children:b.change.staged?r("git.stagedLabel"):r("git.workingTreeLabel")})]})]})},`session-file:${b.path}`)})}function ta({items:t,selectedPath:n,onFileClick:l}){return t.map(o=>i.jsx("div",{className:"file-session-list-item",children:i.jsxs("button",{className:"file-session-list-button",type:"button","data-active":n===o.path,onClick:()=>void l(o.path,!ln(o)),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(Dt(o.path)),"aria-hidden":"true",children:Rt(Dt(o.path))}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:Dt(o.path)}),i.jsx("span",{className:"file-tree-path",children:ni(o,r("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":o.status,children:o.status}),i.jsx("span",{className:"file-session-badge subtle",children:o.staged?r("git.stagedLabel"):r("git.workingTreeLabel")})]})]})},`session-list:${o.path}`))}function Pt(t,n){return`file-panel.session-changes.${t}.${n}`}function It(t,n){return t instanceof In?t.message:typeof t=="object"&&t&&"message"in t?String(t.message??n):n}const g="",na=450,ne=8,Ct=4,ia=176,aa=120,la=300*1e3,sa=60*1e3,Un=1600,ra=220,oa=20,ca=16;function el({className:t,sessionId:n,workspaceId:l,hideHeading:o=!1,hideTabs:m=!1,externalRevealRequest:h=null,externalWindowMode:b=!1,workbenchShellOverrides:x}){var Ln,Bn;const j=$i(),{navigationGroups:T,subscribeFileTree:M,requestFileTreeRefresh:Q,addFileTreeSnapshotListener:me,subscribeGitSnapshot:K,requestGitRefresh:pe,addGitSnapshotListener:be}={...j,...x},[G,ht]=c.useState({}),[D,At]=c.useState([]),[je,Se]=c.useState([]),[E,F]=c.useState(g),[X,$]=c.useState([]),[ie,R]=c.useState(null),[_e,ae]=c.useState(!1),[p,S]=c.useState(!1),[v,mt]=c.useState(!1),[Xe,qe]=c.useState(!1),[A,Ye]=c.useState(""),[Lt,q]=c.useState(null),[pt,bt]=c.useState(!1),[we,Ze]=c.useState(null),[O,Je]=c.useState("workspace"),[rn,Ne]=c.useState(0),[on,Bt]=c.useState(0),[Qe,I]=c.useState(!1),[Ie,L]=c.useState(!1),[le,H]=c.useState(null),[ve,Te]=c.useState(null),[B,Fe]=c.useState(null),[P,Wt]=c.useState(null),[w,et]=c.useState(null),[$t,Ae]=c.useState(""),[cn,un]=c.useState([]),[ee,Ot]=c.useState(!1),[hi,ye]=c.useState(null),fn=c.useId(),se=c.useRef({}),Y=c.useRef({}),_=c.useRef([]),te=c.useRef(g),tt=c.useRef(!1),nt=c.useRef(null),mi=ti(),dn=c.useRef(null),hn=c.useRef(null),Ht=c.useRef(null),mn=c.useRef(null),pn=c.useRef(null),xe=c.useRef(0),re=c.useRef(new Map),{showToast:C}=ei(),it=Ri(),z=Fi(e=>e.showSystemFiles),Le=!!(n!=null&&n.trim()),bn=o&&it.isMobile;c.useEffect(()=>{Re("file_panel.props",{sessionId:n,workspaceId:l,externalWindowMode:b})},[b,n,l]),c.useEffect(()=>{te.current=E},[E]);function zt(e){Bt(e),!(!l||!n)&&ft(Yn(l,n),e)}async function vn(){if(!l||!n){zt(0);return}const e=await Et(n,l),a=Tt(e,s=>ut(s.path),z).length;zt(a)}function Ee(e){ht(a=>{const s=typeof e=="function"?e(a):e;return se.current=s,s})}function Be(e){At(a=>{const s=typeof e=="function"?e(a):e;return _.current=s,s})}c.useEffect(()=>{var f,d;if(Gt(),!l){Gt(),tt.current=!1,se.current={},Y.current={},_.current=[],te.current=g,Ee({}),Be([]),Se([]),F(g),qe(!1),Ye(""),q(null),bt(!1),ae(!1),Ot(!1),ye(null),$([]),R(null),H(null),Te(null),Fe(null),et(null),Ae("");return}tt.current=!0;const e=nn(qn(l),la);Re("file_panel.workspace_snapshot",{workspaceId:l,cached:!!e,cachedRootItems:((d=(f=e==null?void 0:e.treeCache)==null?void 0:f[g])==null?void 0:d.length)??0,cachedDirectoryCount:Object.keys((e==null?void 0:e.treeCache)??{}).length});const a=Ea((e==null?void 0:e.activeDirectoryPath)??g,(e==null?void 0:e.treeCache)??{}),s=Xn((e==null?void 0:e.expandedDirectories)??[],a),u=wt((e==null?void 0:e.treeCache)??{},a,s);se.current=u,Y.current=Zn((e==null?void 0:e.treeRevisionByPath)??{},u),_.current=s,te.current=a,Ee(u),Be(s),Se([]),F(a),ae(!1),S(!1),qe(!1),Ye(""),q(null),bt(!1),queueMicrotask(()=>{tt.current=!1})},[l]),c.useEffect(()=>{if(!h||h.workspaceId!==l)return;const e=()=>{if(pn.current===h.requestId)return;pn.current=h.requestId,Je("workspace"),(h.openViewer?ze(h.filePath):ce(h.filePath)).catch(s=>{C({title:J(s,r("conversation.filePanelOpenFailed")),tone:"error"})})};if(tt.current){queueMicrotask(e);return}e()},[h,ze,ce,C,l]),c.useEffect(()=>{if(l)return me(e=>{e.workspaceId===l&&(Y.current={...Y.current,[e.path]:typeof e.revision=="string"?e.revision:null},Ee(a=>({...a,[e.path]:e.items})),e.path===g&&ae(!1),Se(a=>a.filter(s=>s!==e.path)),Sn(e.path,e.items))})},[me,l]),c.useEffect(()=>()=>{Gt()},[]),c.useEffect(()=>{l&&M(l,tn(_.current,te.current),{knownRevisionByPath:Y.current})},[E,D,M,l]),c.useEffect(()=>{$([]),R(null),Ze(null),ye(null),Ne(0),I(!1),L(!1),H(null),Te(null),Fe(null),et(null),Ae(""),nt.current=null,xe.current+=1},[n]),c.useEffect(()=>{!Le&&O==="session"&&Je("workspace")},[O,Le]),c.useEffect(()=>{m&&O!=="workspace"&&Je("workspace")},[O,m]),c.useEffect(()=>{if(!Qe&&!Ie&&!le)return;function e(s){var y,N,fe;if(!(s.target instanceof Node))return;const u=((y=dn.current)==null?void 0:y.contains(s.target))??!1,f=((N=hn.current)==null?void 0:N.contains(s.target))??!1,d=((fe=Ht.current)==null?void 0:fe.contains(s.target))??!1;!u&&!f&&!d&&(I(!1),L(!1),H(null),Te(null))}function a(s){s.key==="Escape"&&(I(!1),L(!1),H(null),Te(null))}return document.addEventListener("pointerdown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",a)}},[Qe,Ie,le]),c.useLayoutEffect(()=>{if(!le||typeof window>"u"){Te(null);return}const e=le;function a(){const u=Ht.current;if(!u)return;const f=u.getBoundingClientRect();Te(va({x:e.positionX,y:e.positionY},{width:f.width||ia,height:f.height||u.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}a();const s=window.requestAnimationFrame(a);return window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[le]),c.useEffect(()=>{if(!l)return;const e=Xn(D,E),a=wt(G,E,e);ft(qn(l),{treeCache:a,treeRevisionByPath:Zn(Y.current,a),expandedDirectories:e,activeDirectoryPath:E})},[E,D,G,l]),c.useEffect(()=>{if(tt.current)return;const e=wt(G,E,D);ka(G,e)||Ee(e)},[E,D,G]),c.useEffect(()=>{let e=!1;const a=(l==null?void 0:l.trim())??null;async function s(f){if(!a)return;const d=Nt(se.current[g]??[],z),y=(f==null?void 0:f.silent)!==!0&&d.length===0;y&&ae(!0),Re("file_panel.load_root_tree.start",{sessionId:n,workspaceId:a,silent:(f==null?void 0:f.silent)===!0,cachedRootItems:d.length});try{const N=await Kt(g,{force:!0});e||(Re("file_panel.load_root_tree.end",{sessionId:n,workspaceId:a,itemCount:N.length}),Ee(fe=>({...wt(fe,te.current,_.current),[g]:N})))}catch(N){!e&&!Jn(N)&&C({title:J(N,r("conversation.filePanelLoadFailed")),tone:"error"})}finally{!e&&y&&ae(!1)}}if(Nt(se.current[g]??[],z).length>0){const f=window.setTimeout(()=>{a&&(M(a,tn(_.current,te.current),{knownRevisionByPath:Y.current}),s({silent:!0}))},1500);return()=>{e=!0,window.clearTimeout(f)}}return s(),()=>{e=!0}},[n,z,C,l]),c.useEffect(()=>{if(!l||!n){Bt(0);return}const e=nn(Yn(l,n),sa);Re("file_panel.session_change_count.snapshot",{sessionId:n,workspaceId:l,cached:e!==null,cachedCount:e}),Bt(e??0);let a=!1;return vn().catch(()=>{}),()=>{a=!0}},[n,rn,z,l]),c.useEffect(()=>{if(!l){un([]);return}const e=l.trim();K(e),pe(e)},[l,K,pe]),c.useEffect(()=>{if(!l)return;const e=l.trim();return be(a=>{var s;a.workspaceId===e&&un(((s=a.status)==null?void 0:s.changes)??[])})},[be,l]);const vt=c.useMemo(()=>Tt(cn,e=>ut(e.path),z),[cn,z]),W=c.useMemo(()=>{const e=new Map,a=new Set;for(const s of vt){const u=s.path.replace(/\\/g,"/"),f=s.worktreeStatus??s.stagedStatus??s.status;e.set(u,f);const d=u.split("/");for(let y=1;y<d.length;y++)a.add(d.slice(0,y).join("/"))}return{statusByPath:e,changedDirs:a}},[vt]),De=c.useMemo(()=>Yi(G,z),[z,G]),ke=c.useMemo(()=>Lt===null?null:Nt(Lt,z),[Lt,z]),We=De[g]??[],oe=Xe&&ke!==null,yt=c.useMemo(()=>ee?an(We,De,W.statusByPath,W.changedDirs):We,[W.changedDirs,W.statusByPath,We,ee,De]),pi=c.useMemo(()=>oe?(ke??[]).map(e=>V(e.path,e.kind)):si(yt,De,D,ee,W.statusByPath,W.changedDirs),[D,W.changedDirs,W.statusByPath,oe,ee,ke,De,yt]),$e=((Ln=T.find(e=>e.workspace.id===l))==null?void 0:Ln.workspace)??null,k=Gn(X),Ut=(k==null?void 0:k.path)??null,ge=(k==null?void 0:k.kind)==="file"?k.path:null,xt=c.useMemo(()=>new Set(X.map(e=>e.path)),[X]),at=c.useMemo(()=>St(X),[X]),Vt=!!($e!=null&&$e.path&&X.length===1&&Ut),yn=X.length===1&&(k==null?void 0:k.kind)==="file",xn=at.length>0,Me=at.length>0,lt=!!(P!=null&&P.items.length&&l),gn=!!l&&X.length===1&&k!==null,Pn=!!((ge?he(ge):E)&&D.length),Cn=P?P.mode==="copy"?r("conversation.filePanelClipboardCopyReady",{count:P.items.length}):r("conversation.filePanelClipboardCutReady",{count:P.items.length}):null,U=w?Pa(w):null;async function jn(e,a=!1){if(!l)return[];if(!a){const s=se.current[e];if(s)return s}e===g?ae(!0):Se(s=>Mt(s,e));try{const s=await Kt(e,{force:a});return Ee(u=>({...u,[e]:s})),s}catch(s){throw Jn(s)||C({title:J(s,r("conversation.filePanelLoadFailed")),tone:"error"}),s}finally{e===g?ae(!1):Se(s=>s.filter(u=>u!==e))}}async function Pe(e){if(!l)return;const a=(e==null?void 0:e.activeDirectoryPath)??te.current,s=(e==null?void 0:e.expandedDirectories)??_.current,u=Da(se.current,a,s);Re("file_panel.refresh_tree_cache.start",{sessionId:n,workspaceId:l,targetDirectories:u});const d=(await Promise.all(u.map(async y=>{const N=await Kt(y,{force:!0});return[y,N]}))).reduce((y,[N,fe])=>(y[N]=fe,y),{});Re("file_panel.refresh_tree_cache.end",{sessionId:n,workspaceId:l,targetDirectories:u,directoryCount:Object.keys(d).length}),Ee(d)}async function Kt(e,a){if(!l)return[];if(!(a!=null&&a.force)){const d=se.current[e];if(d)return d}const s=tn(Mt(_.current,e),e||te.current);M(l,s,{knownRevisionByPath:Y.current}),Q(l,[e],{knownRevisionByPath:Y.current});const u=bi(e,Un,{allowCached:(a==null?void 0:a.force)!==!0}),f=Ma(ra).then(async()=>{if(!l)return[];const y=(await Ui(l,e||void 0)).items;return Y.current={...Y.current,[e]:null},Sn(e,y),y});try{return await Promise.race([u,f])}catch(d){if(!fi(d))throw d;return await f}}function bi(e,a=Un,s){const u=se.current[e];return(s==null?void 0:s.allowCached)!==!1&&u?Promise.resolve(u):new Promise((f,d)=>{const y=window.setTimeout(()=>{vi(e,y),d(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${e}`))},a),N=re.current.get(e)??[];re.current.set(e,[...N,{resolve:f,reject:d,timerId:y}])})}function Sn(e,a){const s=re.current.get(e)??[];s.length!==0&&(re.current.delete(e),s.forEach(u=>{window.clearTimeout(u.timerId),u.resolve(a)}))}function vi(e,a){const u=(re.current.get(e)??[]).filter(f=>f.timerId!==a);if(u.length===0){re.current.delete(e);return}re.current.set(e,u)}function Gt(){for(const[e,a]of re.current.entries())a.forEach(s=>{window.clearTimeout(s.timerId),s.reject(new Error(`FILE_TREE_ABORTED:${e}`))});re.current.clear()}function Oe(e){$([e]),R(e.path)}function st(e){F(e.kind==="directory"?e.path:he(e.path))}function yi(e){const a=da(pi,ie,e);$(a),R(e.path),st(e)}function xi(e){const a=fa(X,e),s=Gn(a);$(a),R(e.path),s&&st(s)}function wn(e){Oe(e),st(e)}function He(e,a){if(a!=null&&a.shiftKey){yi(e);return}if(jt(a)){xi(e);return}wn(e)}async function rt(e,a=!1){const s=dt(e,a);if(!s.length){F(g);return}Be(u=>ui(u,s)),F(s[s.length-1]??g);for(const u of s)try{await jn(u)}catch{return}}async function ce(e){const a=V(e,"file");Oe(a),st(a),await rt(e)}async function ze(e){Ze(e),ye(null),nt.current=null,xe.current+=1,ce(e);const a=xe.current,s=e.replace(/\\/g,"/"),u=W.statusByPath.get(s);if(l&&u&&u!=="?"&&u!=="D")try{const f=await Oi(l,e,!1);xe.current===a&&ye(f.content||null)}catch{xe.current===a&&ye(null)}}function Nn(e){const a=Date.now(),s=nt.current;return nt.current={filePath:e,timestamp:a},(s==null?void 0:s.filePath)===e&&a-s.timestamp<=na}function Ce(){nt.current=null}async function gi(e,a){const s=V(e,"file");if(a!=null&&a.shiftKey||jt(a)){Ce(),He(s,a);return}if(Nn(e)){await ze(e);return}He(s,a),await rt(e)}function En(){qe(!1),Ye(""),q(null),Ce()}async function Pi(e,a){const s=V(e.path,e.kind);if(a!=null&&a.shiftKey||jt(a)){Ce(),He(s,a);return}if(e.kind==="directory"){En(),He(s,a),await Dn(e.path);return}if(Nn(e.path)){En(),await ze(e.path);return}await ce(e.path)}async function Dn(e){if(Oe(V(e,"directory")),F(e),!_.current.includes(e))try{await jn(e),Be(a=>Mt(a,e))}catch{}}async function kn(e){if(Oe(V(e,"directory")),F(e),_.current.includes(e)){Mn(e);return}await Dn(e)}function Mn(e){Be(a=>a.filter(s=>s!==e&&!s.startsWith(`${e}/`))),F(he(e)),$([]),R(null)}async function Rn(){if(!l)return;const e=l;try{if(pe(e),await Pe(),ge&&await rt(ge),oe&&A.trim()){const a=await Ke(e,A.trim());q(a.items)}if(Le&&n)if(O==="session")Ne(a=>a+1);else try{await vn()}catch(a){C({title:J(a,r("conversation.filePanelSessionLoadFailed")),tone:"error"})}}catch(a){C({title:J(a,r("conversation.filePanelLoadFailed")),tone:"error"})}}async function Ci(e){if(e==null||e.preventDefault(),!l||!A.trim()){q(null);return}bt(!0);try{const a=await Ke(l,A.trim());q(a.items)}catch(a){C({title:J(a,r("conversation.filePanelSearchFailed")),tone:"error"})}finally{bt(!1)}}function _n(){if(Xe){qe(!1),Ye(""),q(null);return}qe(!0)}function Z(e){L(!1),e()}function Tn(){var e;(e=mn.current)==null||e.click()}async function ji(e){var d;const a=((d=e.target.files)==null?void 0:d[0])??null;if(e.target.value="",!a||!l)return;const s=ua(a.name);if(!s){C({title:r("conversation.filePanelUploadFailed"),tone:"error"});return}const u=Vn(E,k),f=Kn(u,s);mt(!0);try{const y=await Ca(a);await Hi({workspaceId:l,path:f,contentBase64:y}),await Pe(),await ce(f),C({title:r("conversation.filePanelUploadSuccess",{name:s}),tone:"success"})}catch(y){C({title:J(y,r("conversation.filePanelUploadFailed")),tone:"error"})}finally{mt(!1)}}async function Xt(e=ge){if(!(!l||!e)){mt(!0);try{const a=await zi(l,e),s=ja(a.contentBase64);Sa(a.fileName,new Blob([s],{type:"application/octet-stream"})),C({title:r("conversation.filePanelDownloadSuccess",{name:a.fileName}),tone:"success"})}catch(a){C({title:J(a,r("conversation.filePanelDownloadFailed")),tone:"error"})}finally{mt(!1)}}}function Fn(){const e=ge?he(ge):E;!e||!_.current.includes(e)||Mn(e)}function qt(){et(null),Ae("")}function Yt(){p||qt()}function Ue(e,a=Vn(E,k)){if(!l)return;const s=a,u=s?`${s}/`:"";I(!1),L(!1),H(null),et({mode:e,baseDirectory:s}),Ae(u)}function Zt(e=k){!l||!e||(I(!1),L(!1),H(null),et({mode:"rename",target:e}),Ae(e.path))}async function Si(e){if(e==null||e.preventDefault(),!l||!w)return;const a=($t??"").trim();if(a){if(w.mode==="rename"&&Ge(w.target.path)===Ge(a)){Yt();return}S(!0);try{if(w.mode==="rename"){const s=w.target.path,u=V(a,w.target.kind),f=we?ci(we,s,a):null;if(await gt({workspaceId:l,opType:"rename",srcPath:s,dstPath:a}),P&&Wt({...P,items:ga(P.items,s,a)}),qt(),Ce(),await Pe(),w.target.kind==="directory"?(await rt(a,!0),Oe(u),F(a)):await ce(a),f!==we&&(xe.current+=1,Ze(f),ye(null)),oe&&A.trim()){const d=await Ke(l,A.trim());q(d.items)}Ne(d=>d+1),C({title:r("conversation.filePanelRenameSuccess",{name:ut(a)||a}),tone:"success"});return}if(await gt({workspaceId:l,opType:w.mode,dstPath:a,content:w.mode==="create_file"?"":void 0}),qt(),await Pe(),w.mode==="create_directory"?(await rt(a,!0),Oe(V(a,"directory")),F(a)):await ce(a),oe&&A.trim()){const s=await Ke(l,A.trim());q(s.items)}Ne(s=>s+1)}catch(s){C({title:J(s,r("conversation.filePanelMutateFailed")),tone:"error"})}finally{S(!1)}}}function ue(e,a=at){var u;if(a.length===0)return;const s=St(a);Wt({mode:e,items:s}),$(s),R(((u=s[s.length-1])==null?void 0:u.path)??null),C({title:e==="copy"?r("conversation.filePanelCopySelectionSuccess",{count:s.length}):r("conversation.filePanelCutSelectionSuccess",{count:s.length}),tone:"success"}),H(null)}async function ot(e=pa(k,E)){if(!l||!P||!P.items.length)return;const a=e??g,s=P.items.map(u=>({source:u,destinationPath:Kn(a,ut(u.path)||u.path)}));S(!0);try{for(const d of s)P.mode==="cut"&&Ge(d.source.path)===Ge(d.destinationPath)||await gt({workspaceId:l,opType:P.mode==="copy"?"copy":"move",srcPath:d.source.path,dstPath:d.destinationPath});const u=s.map(d=>V(d.destinationPath,d.source.kind)),f=u[u.length-1]??null;if(P.mode==="cut"&&Wt(null),$(u),R((f==null?void 0:f.path)??null),f&&st(f),Ce(),await Pe({activeDirectoryPath:(f==null?void 0:f.kind)==="directory"?f.path:f?he(f.path):te.current,expandedDirectories:_.current}),oe&&A.trim()){const d=await Ke(l,A.trim());q(d.items)}Ne(d=>d+1),C({title:r("conversation.filePanelPasteSuccess",{count:u.length}),tone:"success"}),H(null)}catch(u){await Pe().catch(()=>{}),C({title:J(u,r("conversation.filePanelPasteFailed")),tone:"error"})}finally{S(!1)}}function Jt(e=at){!e.length||p||(Fe(St(e)),H(null))}async function wi(){var a,s;if(!l||!(B!=null&&B.length))return;const e=St(B);S(!0);try{for(const d of e)await gt({workspaceId:l,opType:"delete",srcPath:d.path});const u=ba(E,e),f=_.current.filter(d=>!e.some(y=>y.kind==="directory"&&Ft(y.path,d)));if(we&&e.some(d=>Ft(d.path,we))&&(xe.current+=1,Ze(null),ye(null)),Fe(null),$([]),R(null),te.current=u,_.current=f,F(u),Be(f),Ce(),await Pe({activeDirectoryPath:u,expandedDirectories:f}),oe&&A.trim()){const d=await Ke(l,A.trim());q(d.items)}Ne(d=>d+1),C({title:e.length===1?r("conversation.filePanelDeleteSuccess",{name:ut(((a=e[0])==null?void 0:a.path)??"")||((s=e[0])==null?void 0:s.path)||""}):r("conversation.filePanelDeleteSelectionSuccess",{count:e.length}),tone:"success"})}catch(u){C({title:J(u,r("conversation.filePanelMutateFailed")),tone:"error"})}finally{S(!1)}}async function Ve(e,a=k){const s=($e==null?void 0:$e.path)??"",u=(a==null?void 0:a.path)??null;if(u===null||!s){I(!1);return}try{const f=xa(s),d=e==="absolute"?ya(s,u,f):Ge(u,f);await wa(d,it),C({title:e==="absolute"?r("conversation.filePanelCopyAbsolutePathSuccess"):r("conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(f){C({title:f instanceof Error?f.message:r("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{I(!1),H(null)}}function Ni(e,a,s){return[{id:`open-${e.path}`,label:e.kind==="directory"?D.includes(e.path)?r("conversation.filePanelCollapseDirectory"):r("conversation.filePanelExpandDirectory"):r("conversation.filePanelOpenFile"),onSelect:()=>{if(e.kind==="directory"){kn(e.path);return}ze(e.path)}},{id:`download-${e.path}`,label:r("conversation.filePanelDownload"),disabled:e.kind!=="file"||v,onSelect:()=>{Xt(e.kind==="file"?e.path:null)}},{id:`create-file-${e.path}`,label:r("conversation.filePanelNewFile"),disabled:!l||p||v,onSelect:()=>{Ue("create_file",s)}},{id:`create-directory-${e.path}`,label:r("conversation.filePanelNewDirectory"),disabled:!l||p||v,onSelect:()=>{Ue("create_directory",s)}},{id:`rename-${e.path}`,label:r("conversation.filePanelRenameMove"),disabled:a.length!==1||p||v,onSelect:()=>Zt(e)},{id:`copy-${e.path}`,label:r("conversation.filePanelCopy"),disabled:a.length===0,onSelect:()=>ue("copy",a)},{id:`cut-${e.path}`,label:r("conversation.filePanelCut"),disabled:a.length===0,onSelect:()=>ue("cut",a)},{id:`paste-${e.path}`,label:r("conversation.filePanelPaste"),disabled:!lt,onSelect:()=>{ot(s)}},{id:`copy-relative-${e.path}`,label:r("conversation.filePanelCopyRelativePath"),onSelect:()=>{Ve("relative",e)}},{id:`copy-absolute-${e.path}`,label:r("conversation.filePanelCopyAbsolutePath"),onSelect:()=>{Ve("absolute",e)}},{id:`delete-${e.path}`,label:r("conversation.filePanelDelete"),disabled:a.length===0||p||v,onSelect:()=>Jt(a)}]}async function An(e,a){if(it.isMobile)return;e.preventDefault();const s=V(a.path,a.kind),u=xt.has(s.path)?at:[s],f=s.kind==="directory"?s.path:he(s.path);xt.has(s.path)||wn(s);const d=Ni(s,u,f);if(it.isDesktop){await Vi(d);return}it.isWeb&&(I(!1),L(!1),H({positionX:e.clientX,positionY:e.clientY,items:d}))}c.useEffect(()=>{if(O!=="workspace")return;function e(a){if(!ha(a)||a.altKey||a.shiftKey||ma(a.target))return;const s=a.key.toLowerCase();if(s==="c"&&Me){a.preventDefault(),ue("copy");return}if(s==="x"&&Me){a.preventDefault(),ue("cut");return}s==="v"&&lt&&(a.preventDefault(),ot())}return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[O,Me,lt,ue,ot]);function Qt(e,a){return i.jsx(i.Fragment,{children:e.map(s=>{const u=V(s.path,s.kind),f=s.kind==="directory",d=f&&D.includes(s.path),y=f&&je.includes(s.path),N=De[s.path]??[],fe=ee?an(N,De,W.statusByPath,W.changedDirs):N,Di=xt.has(s.path),ki=Ut===s.path,ct=W.statusByPath.get(s.path.replace(/\\/g,"/")),Wn=f&&W.changedDirs.has(s.path.replace(/\\/g,"/")),Mi=(P==null?void 0:P.mode)==="cut"&&P.items.some(de=>de.path===s.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-active":ki,"data-selected":Di,"data-cut-pending":Mi||void 0,"data-kind":s.kind,"aria-expanded":f?d:void 0,style:{paddingInlineStart:`${oa+a*ca}px`},onClick:de=>{if(f){if(de.shiftKey||jt(de)){Ce(),He(u,de);return}Ce(),He(u,de),kn(s.path);return}gi(s.path,de)},onContextMenu:de=>{An(de,s)},children:[i.jsx("span",{className:`file-tree-chevron${f?"":" is-hidden"}`,"aria-hidden":"true",children:d?"v":">"}),f?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(s.name),"aria-hidden":"true",children:Rt(s.name)}),i.jsx("span",{className:"file-tree-label","data-status":ct??void 0,"data-has-changes":Wn||void 0,children:s.name}),!f&&ct?i.jsx("span",{className:"git-status-badge","data-status":ct,"aria-label":ct,children:ct}):null,f&&Wn?i.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,y?i.jsx("span",{className:"file-tree-meta",children:r("common.loading")}):null]}),f&&d?i.jsx("div",{className:"file-tree-children",children:y&&!N.length?i.jsx("p",{className:"file-tree-empty",children:r("common.loading")}):fe.length?Qt(fe,a+1):i.jsx("p",{className:"file-tree-empty",children:r("conversation.filePanelEmptyDirectory")})}):null]},`${s.kind}-${s.path}`)})})}function Ei(e){return i.jsx(i.Fragment,{children:e.map(a=>{const s=a.kind==="directory",u=xt.has(a.path),f=Ut===a.path;return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":f,"data-selected":u,"data-kind":a.kind,onClick:d=>{Pi(a,d)},onContextMenu:d=>{An(d,a)},children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),s?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(a.name),"aria-hidden":"true",children:Rt(a.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:a.name}),i.jsx("span",{className:"file-tree-path",children:a.path})]})]})},`search-${a.kind}-${a.path}`)})})}return i.jsx("section",{className:["conversation-panel","surface-card","file-panel",t].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ki,{workspaceId:l,filePath:we,open:we!==null,onClose:()=>{xe.current+=1,Ze(null),ye(null)},onSaved:async e=>{await Pe(),await ce(e),Ne(a=>a+1)},diffContent:hi}),o?null:i.jsx("div",{className:"file-panel-heading-row",children:i.jsx("h2",{className:"file-panel-heading",children:r("conversation.filePanelTitle")})}),m?null:i.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":r("conversation.filePanelTitle"),children:[i.jsx("button",{className:O==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":O==="workspace",onClick:()=>Je("workspace"),children:r("conversation.filePanelWorkspaceTab")}),i.jsxs("button",{className:O==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":O==="session",onClick:()=>{Le&&Je("session")},disabled:!Le,children:[r("conversation.filePanelSessionTab"),i.jsx("span",{className:"file-panel-tab-badge","aria-label":`${r("conversation.filePanelSessionTab")} ${on}`,children:on})]})]}),O==="workspace"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:mn,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:e=>void ji(e)}),bn?i.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":r("conversation.filePanelTitle"),children:i.jsxs("div",{className:"file-mobile-action-shell",ref:hn,children:[i.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":r("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":Ie,"data-active":Ie,onClick:()=>{I(!1),L(e=>!e)},children:[i.jsx("span",{children:r("conversation.filePanelActionsMenu")}),i.jsx(Ua,{})]}),Ie?i.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":r("conversation.filePanelActionsMenu"),children:[i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>ue("copy")),disabled:!Me,children:r("conversation.filePanelCopy")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>ue("cut")),disabled:!Me,children:r("conversation.filePanelCut")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>ot()),disabled:!lt||p||v,children:r("conversation.filePanelPaste")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),_n()},children:Xe?r("conversation.filePanelHideSearch"):r("conversation.filePanelShowSearch")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Ot(e=>!e)},disabled:vt.length===0,children:ee?r("conversation.filePanelShowAll"):r("conversation.filePanelFilterChanges")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(Rn),disabled:_e||p||pt,children:r("conversation.filePanelRefresh")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Fn()},disabled:!Pn,children:r("conversation.filePanelCollapseCurrent")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Tn()},disabled:p||v,children:r("conversation.filePanelUpload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(Xt),disabled:!yn||v,children:r("conversation.filePanelDownload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(Zt),disabled:!gn||p||v,children:r("conversation.filePanelRenameMove")}),i.jsx("button",{className:"file-mobile-action-menu-item danger",type:"button",role:"menuitem",onClick:()=>Z(Jt),disabled:!xn||p||v,children:r("conversation.filePanelDelete")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ue("create_file")),disabled:p||v,children:r("conversation.filePanelNewFile")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ue("create_directory")),disabled:p||v,children:r("conversation.filePanelNewDirectory")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ve("absolute")),disabled:!Vt,children:r("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ve("relative")),disabled:!Vt,children:r("conversation.filePanelCopyRelativePath")})]}):null]})}):i.jsxs("div",{className:"file-panel-toolbar","aria-label":r("conversation.filePanelTitle"),children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCopy"),"aria-label":r("conversation.filePanelCopy"),onClick:()=>ue("copy"),disabled:!Me,children:i.jsx(Fa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCut"),"aria-label":r("conversation.filePanelCut"),onClick:()=>ue("cut"),disabled:!Me,children:i.jsx(Aa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelPaste"),"aria-label":r("conversation.filePanelPaste"),onClick:()=>void ot(),disabled:!lt||p||v,children:i.jsx(La,{})}),i.jsxs("div",{className:"file-toolbar-menu-shell",ref:dn,children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCopyPath"),"aria-label":r("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":Qe,"data-active":Qe,onClick:()=>{L(!1),I(e=>!e)},disabled:!Vt,children:i.jsx(Ta,{})}),Qe?i.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ve("absolute"),children:r("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ve("relative"),children:r("conversation.filePanelCopyRelativePath")})]}):null]}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCollapseCurrent"),"aria-label":r("conversation.filePanelCollapseCurrent"),onClick:Fn,disabled:!Pn,children:i.jsx(Ra,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelRefresh"),"aria-label":r("conversation.filePanelRefresh"),onClick:()=>void Rn(),disabled:_e||p||pt,children:i.jsx(_a,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelSearchButton"),"aria-label":r("conversation.filePanelSearchButton"),"data-active":Xe,onClick:_n,disabled:_e,children:i.jsx(Qn,{})}),vt.length>0?i.jsx("button",{className:"file-toolbar-button",type:"button",title:ee?r("conversation.filePanelShowAll"):r("conversation.filePanelFilterChanges"),"aria-label":ee?r("conversation.filePanelShowAll"):r("conversation.filePanelFilterChanges"),"data-active":ee,onClick:()=>Ot(e=>!e),children:i.jsx(Va,{})}):null,i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelUpload"),"aria-label":r("conversation.filePanelUpload"),onClick:Tn,disabled:p||v,children:i.jsx(Wa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelDownload"),"aria-label":r("conversation.filePanelDownload"),onClick:()=>void Xt(),disabled:!yn||v,children:i.jsx($a,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelRenameMove"),"aria-label":r("conversation.filePanelRenameMove"),onClick:()=>Zt(),disabled:!gn||p||v,children:i.jsx(za,{})}),i.jsx("button",{className:"file-toolbar-button danger",type:"button",title:r("conversation.filePanelDelete"),"aria-label":r("conversation.filePanelDelete"),onClick:()=>Jt(),disabled:!xn||p||v,children:i.jsx(Oa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelNewFile"),"aria-label":r("conversation.filePanelNewFile"),onClick:()=>void Ue("create_file"),disabled:p||v,children:i.jsx(Ba,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelNewDirectory"),"aria-label":r("conversation.filePanelNewDirectory"),onClick:()=>void Ue("create_directory"),disabled:p||v,children:i.jsx(Ha,{})})]}),le&&typeof document<"u"?_i.createPortal(i.jsx("div",{className:"file-web-context-menu",ref:Ht,role:"menu","aria-label":r("conversation.filePanelActionsMenu"),style:{left:`${(ve==null?void 0:ve.left)??Math.max(8,le.positionX)}px`,top:`${(ve==null?void 0:ve.top)??Math.max(8,le.positionY)}px`,maxHeight:ve?`${ve.maxHeight}px`:void 0},children:le.items.map(e=>i.jsx("button",{className:["file-web-context-menu-item",e.label===r("conversation.filePanelDelete")?"danger":""].filter(Boolean).join(" "),type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{H(null),e.onSelect()},children:e.label},e.id))}),document.body):null,Cn?i.jsx("p",{className:"file-panel-clipboard-status","data-mode":P==null?void 0:P.mode,children:Cn}):null,Xe?i.jsxs("form",{className:"file-toolbar-search",onSubmit:e=>void Ci(e),children:[i.jsx("input",{value:A,onChange:e=>Ye(e.target.value),placeholder:r("conversation.filePanelSearchPlaceholder")}),bn?i.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":r("conversation.filePanelSearchButton"),disabled:pt,children:r("conversation.filePanelSearchButton")}):i.jsx("button",{className:"file-toolbar-button",type:"submit",title:r("conversation.filePanelSearchButton"),"aria-label":r("conversation.filePanelSearchButton"),disabled:pt,children:i.jsx(Qn,{})})]}):null,i.jsx("div",{ref:mi,className:"file-tree","data-search-mode":oe,"data-scrollbar-autohide":"true",children:_e&&We.length===0?i.jsx("p",{className:"file-tree-status status-text",children:r("common.loading")}):oe?ke!=null&&ke.length?Ei(ke):i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelSearchEmpty")}):ee?yt.length?Qt(yt,0):i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelNoChanges")}):We.length?Qt(We,0):i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelEmptyDirectory")})}),i.jsx($n,{open:w!==null,title:(U==null?void 0:U.title)??"",description:U==null?void 0:U.description,onClose:Yt,children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:e=>void Si(e),children:[i.jsx(Ai,{label:r("conversation.filePanelPathFieldLabel"),htmlFor:fn,description:(w==null?void 0:w.mode)==="rename"?w.target.path:(w==null?void 0:w.baseDirectory)||void 0,children:i.jsx("input",{id:fn,type:"text",value:$t??"",placeholder:r("conversation.filePanelPathFieldPlaceholder"),autoFocus:!0,onChange:e=>Ae(e.target.value)})}),i.jsxs(Li,{children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:p,onClick:Yt,children:r("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:p||!($t??"").trim(),children:p?(U==null?void 0:U.pendingLabel)??r("common.loading"):(U==null?void 0:U.submitLabel)??r("common.save")})]})]})}),i.jsxs($n,{open:B!==null,title:r("conversation.filePanelDeleteConfirmTitle"),description:r("conversation.filePanelDeleteConfirmDescription"),onClose:()=>{p||Fe(null)},children:[i.jsx("p",{className:"workbench-section-empty",children:B!=null&&B.length?B.length===1?((Bn=B[0])==null?void 0:Bn.kind)==="directory"?r("conversation.filePanelDeleteDirectoryConfirm",{path:B[0].path}):r("conversation.filePanelDeleteFileConfirm",{path:B[0].path}):r("conversation.filePanelDeleteSelectionConfirm",{count:B.length}):""}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:p,onClick:()=>Fe(null),children:r("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:p,onClick:()=>{wi()},children:p?r("conversation.filePanelDeleting"):r("conversation.filePanelDelete")})]})]})]}):Le&&n?i.jsx(ea,{sessionId:n,workspaceId:l,showSystemFiles:z,selectedPath:ge,refreshVersion:rn,onCountChange:zt,onSelectFile:ce,onOpenFile:ze}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:r("conversation.filePanelSessionNoSession")})})]}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:r("conversation.filePanelNoWorkspace")})})})}function he(t){return t.includes("/")?t.split("/").slice(0,-1).join("/"):g}function dt(t,n=!1){const l=t.split("/").filter(Boolean),o=n?l.length:l.length-1,m=[];for(let h=0;h<o;h+=1)m.push(l.slice(0,h+1).join("/"));return m}function Vn(t,n){return t||((n==null?void 0:n.kind)==="directory"?n.path:n!=null&&n.path?he(n.path):g)}function Kn(t,n){return t?`${t}/${n}`:n}function ua(t){var n;return((n=t.split(/[/\\]/).pop())==null?void 0:n.trim())??""}function V(t,n){return{path:t,kind:n}}function Gn(t){return t[t.length-1]??null}function fa(t,n){return t.findIndex(o=>o.path===n.path)>=0?t.filter(o=>o.path!==n.path):[...t,n]}function da(t,n,l){const o=t.findIndex(x=>x.path===l.path);if(o<0)return[l];const m=n?t.findIndex(x=>x.path===n):o;if(m<0)return[l];const h=Math.min(m,o),b=Math.max(m,o);return t.slice(h,b+1)}function jt(t){return!!(t!=null&&t.ctrlKey||t!=null&&t.metaKey)}function ha(t){return t.ctrlKey||t.metaKey}function ma(t){if(!(t instanceof HTMLElement))return!1;const n=t.tagName.toLowerCase();return n==="input"||n==="textarea"||n==="select"||t.isContentEditable}function St(t){const n=[...new Map(t.map(o=>[o.path,o])).values()].sort((o,m)=>o.path.localeCompare(m.path)),l=[];for(const o of n)l.some(m=>m.kind==="directory"&&Ft(m.path,o.path))||l.push(o);return l}function pa(t,n){return(t==null?void 0:t.kind)==="directory"?t.path:t!=null&&t.path?he(t.path):n}function ba(t,n){let l=t;for(;l&&n.some(o=>o.kind==="directory"&&Ft(o.path,l));)l=he(l);return l}function si(t,n,l,o,m,h){const b=[];for(const x of t){if(b.push(V(x.path,x.kind)),x.kind!=="directory"||!l.includes(x.path))continue;const j=n[x.path]??[],T=o?an(j,n,m,h):j;b.push(...si(T,n,l,o,m,h))}return b}function va(t,n,l){const o=Math.max(0,l.width),m=Math.max(0,l.height),h=Math.max(0,m-ne*2),b=Math.max(0,o-ne*2),x=Math.min(Math.max(n.width,0),b),j=Math.max(0,m-t.y-Ct-ne),T=Math.max(0,t.y-Ct-ne),M=j<n.height&&T>j,me=en(Math.max(M?T:j,aa),0,h),K=Math.min(Math.max(n.height,0),me),pe=M?t.y-Ct-K:t.y+Ct,be=Math.max(ne,m-ne-K),G=Math.max(ne,o-ne-x);return{top:en(pe,ne,be),left:en(t.x,ne,G),maxHeight:Math.max(0,me)}}function en(t,n,l){return!Number.isFinite(t)||l<n?n:Math.min(Math.max(t,n),l)}function Ge(t,n="posix"){return t?ri(t,n):"."}function ya(t,n,l){const o=ri(t,l),m=Ge(n,l).replace(/^\.[/\\]?/,"");if(!m)return o;const h=oi(l),b=m.replace(/^[/\\]+/,"");return b?o.endsWith("/")||o.endsWith("\\")?`${o}${b}`:`${o}${h}${b}`:o}function xa(t){return/^[a-zA-Z]:[\\/]/.test(t)||t.includes("\\")?"windows":"posix"}function ri(t,n){return t&&(oi(n)==="\\"?t.replace(/\//g,"\\"):t.replace(/\\/g,"/"))}function oi(t){return t==="windows"?"\\":"/"}function Ft(t,n){return n===t||n.startsWith(`${t}/`)}function ci(t,n,l){return t===n?l:t.startsWith(`${n}/`)?`${l}${t.slice(n.length)}`:t}function ga(t,n,l){return t.map(o=>({...o,path:ci(o.path,n,l)}))}function Pa(t){return t.mode==="create_file"?{title:r("conversation.filePanelNewFile"),description:r("conversation.filePanelCreateFileDescription"),submitLabel:r("conversation.filePanelCreateFileSubmit"),pendingLabel:r("conversation.filePanelCreatingFile")}:t.mode==="create_directory"?{title:r("conversation.filePanelNewDirectory"),description:r("conversation.filePanelCreateDirectoryDescription"),submitLabel:r("conversation.filePanelCreateDirectorySubmit"),pendingLabel:r("conversation.filePanelCreatingDirectory")}:{title:r("conversation.filePanelRenameMove"),description:r("conversation.filePanelRenameDescription"),submitLabel:r("conversation.filePanelRenameSubmit"),pendingLabel:r("conversation.filePanelRenaming")}}async function Ca(t){const n=await t.arrayBuffer(),l=new Uint8Array(n),o=32768;let m="";for(let h=0;h<l.length;h+=o){const b=l.subarray(h,h+o);m+=String.fromCharCode(...b)}return btoa(m)}function ja(t){const n=atob(t),l=new Uint8Array(n.length);for(let o=0;o<n.length;o+=1)l[o]=n.charCodeAt(o);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}function Sa(t,n){if(typeof document>"u")throw new Error(r("conversation.filePanelDownloadFailed"));const l=window.URL.createObjectURL(n),o=document.createElement("a");o.href=l,o.download=t,document.body.append(o),o.click(),o.remove(),window.URL.revokeObjectURL(l)}async function wa(t,n){var l;if(!(n.isDesktop&&(await n.bridge.writeClipboardText(t)).ok)){if(typeof navigator<"u"&&((l=navigator.clipboard)!=null&&l.writeText))try{await navigator.clipboard.writeText(t);return}catch{}if(!Na(t))throw new Error(r("conversation.filePanelCopyPathFailed"))}}function Na(t){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.left="-9999px",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(n)}}function Ea(t,n){return t&&dt(t,!0).every(m=>m in n)?t:g}function Xn(t,n){if(!n)return[];const l=dt(n,!0);return t.filter(o=>l.includes(o))}function wt(t,n,l){const o=sn(n,l);return Object.entries(t).reduce((m,[h,b])=>(o.has(h)&&(m[h]=b),m),{})}function Da(t,n,l){const m=[...sn(n,l)].filter(h=>h===g||h in t);return m.length?m:[g]}function sn(t,n){const l=new Set([g]),o=ui(n,dt(t,!0));for(const m of o){l.add(m);for(const h of dt(m,!0))l.add(h)}return l}function ka(t,n){const l=Object.keys(t),o=Object.keys(n);return l.length!==o.length?!1:l.every(m=>t[m]===n[m])}function Mt(t,n){return t.includes(n)?t:[...t,n]}function ui(t,n){return n.reduce((l,o)=>Mt(l,o),t)}function qn(t){return`file-panel.workspace-tree.${t}`}function Yn(t,n){return`file-panel.session-change-count.${t}.${n}`}function Zn(t,n){return Object.fromEntries(Object.keys(n).map(l=>[l,t[l]??null]))}function tn(t,n){return[...sn(n,t)]}function J(t,n){return t instanceof In?t.message:n}function fi(t){return t instanceof Error&&t.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")}function Jn(t){return fi(t)||t instanceof Error&&t.message.startsWith("FILE_TREE_ABORTED:")}function Ma(t){return new Promise(n=>{window.setTimeout(n,t)})}function Ra(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function _a(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function Qn(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M11.2 10.1l3 3-1.1 1.1-3-3a5 5 0 1 1 1.1-1.1zM6.8 10.3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",fill:"currentColor"})})}function Ta(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3.5 4.3h5.2v1.4H4.9v5.4H3.5zm3.8-2.1h5.2v9.5H7.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Fa(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M5 2.5h7.5v9H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M3.5 5H2.4V13.5H10V12.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Aa(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4.2 4.2a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm0 5.4a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm1-3.2 6.6 5.6M5.2 9.6l6.6-5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}function La(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 3.5h8v10H4zM6 2.2h4v2H6z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M6 7.2h4M6 9.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Ba(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Wa(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $a(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 8.5 2.5 2.5 2.5-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oa(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 4.5h9M6.2 2.5h3.6l.6 1.4H13v1.2H3V3.9h2.6zM5.2 5.7v6.1m2.8-6.1v6.1m2.8-6.1v6.1M4.4 13.5h7.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ha(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function za(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.2 11.9h2.2l5.9-5.9-2.2-2.2-5.9 5.9zM8.3 3.8l2.2 2.2M2.8 13.2h10.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ua(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function Va(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M1.5 2h13l-5 6v5l-3 1.5V8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function an(t,n,l,o){const m=[];for(const h of t){const b=h.path.replace(/\\/g,"/");h.kind==="file"?l.has(b)&&m.push(h):di(b,n,l,o)&&m.push(h)}return m}function di(t,n,l,o,m){const h=m??new Set;if(h.has(t))return!1;h.add(t);const b=n[t];if(!b)return o.has(t);for(const x of b){const j=x.path.replace(/\\/g,"/");if(x.kind==="file"){if(l.has(j))return!0}else if(di(j,n,l,o,h))return!0}return!1}export{el as FileContextPanel};
@@ -1,6 +1,6 @@
1
- import{b as l,t as n,j as e,A as qn}from"./index-NGxWr8Ix.js";import{u as ki,e as Gi,f as $i,g as Rn}from"./App-tXOqoHNl.js";import{u as Ui,a7 as ut,b as Hn,bu as wn,w as Bi,bv as Vi,bw as Wi,bl as zi,bx as Pn,by as Ki,bz as Ii,bo as Xi,bA as qi,bn as Yi,bB as Zi,bm as Yn,bC as Ji,bt as Qi,bD as An,Z as es,c as ts,bE as ns,bF as is,bG as ss}from"./WorkbenchLayout-DScHaza9.js";import{S as as,y as rs,z as os,e as ls}from"./model-switch-api-CPtou49j.js";import{F as cs,r as Wt,a as zt}from"./file-tree-icon-lfU9Ag77.js";import{W as Oe}from"./WorkbenchModal-BWXYSXmC.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-BwE5nw0l.js";const Ot=56,Dn=28,kt=72,dt=8,Ln=960,_n=60*1e3,Fn=20,On=9,kn=9,Gt=68,O=12,mt=8,Kt=260,us=120,$t=6e4,ht={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function Fs({className:a,workspaceId:i,panelActive:u=!0,externalWindowMode:h=!1,workbenchShellOverrides:g}){const j=ki(),f=Gi(),x=Ui(),{subscribeGitSnapshot:b,requestGitRefresh:v,addGitSnapshotListener:R,requestNavigationRefresh:S,selectWorkspace:T,upsertNavigationSession:p}={...x,...g},[o,m]=l.useState(null),[y,H]=l.useState(null),[C,M]=l.useState([]),[F,P]=l.useState(0),[X,se]=l.useState(null),[be,pt]=l.useState(!1),[U,xe]=l.useState(null),[ae,q]=l.useState(null),[ye,je]=l.useState(""),[$e,B]=l.useState(!1),[N,A]=l.useState(!1),[ai,Zt]=l.useState([]),[te,Jt]=l.useState(!0),[ne,z]=l.useState(!1),[k,ri]=l.useState(()=>typeof window<"u"?window.innerWidth<=Ln:!1),[bt,V]=l.useState([]),[Ce,K]=l.useState(null),[Ne,re]=l.useState("unstaged"),[ve,Y]=l.useState(null),[oe,Z]=l.useState(null),[oi,xt]=l.useState(!1),[li,yt]=l.useState(null),[ci,Ue]=l.useState(!1),[Qt,Be]=l.useState(null),[_,Se]=l.useState(null),[en,Te]=l.useState(null),[ui,Me]=l.useState(!1),[Ee,le]=l.useState(null),[ie,jt]=l.useState(!1),[di,ce]=l.useState(!1),[Ve,Ct]=l.useState("push"),[We,ze]=l.useState([]),[mi,Ke]=l.useState(!1),[Ie,Xe]=l.useState(new Set),[hi,ue]=l.useState(new Map),[qe,tn]=l.useState({}),[gi,de]=l.useState(!1),[Ye,nn]=l.useState(null),[D,J]=l.useState(ht),[sn,an]=l.useState("generic"),[rn,Ze]=l.useState(null),[G,Nt]=l.useState(null),[$,vt]=l.useState(null),[on,ln]=l.useState(Ot),[St,Tt]=l.useState(!1),[cn,Re]=l.useState(null),[fi,He]=l.useState(null),un=l.useRef(null),dn=l.useRef(null),mn=l.useRef(null),hn=l.useRef(null),gn=l.useRef(null),fn=l.useRef(null),Mt=l.useRef(null),we=l.useRef(new Map),Je=l.useRef(new Map),Pe=l.useRef(0),pn=l.useRef(u),bn=l.useRef(u),Qe=l.useRef(null),{showToast:E}=$i(),xn=f.isDesktop&&!k;l.useEffect(()=>{ut("git_sidebar.props",{workspaceId:i,externalWindowMode:h})},[h,i]),l.useEffect(()=>{bn.current=u},[u]),l.useEffect(()=>{Zt([]),Jt(!0),P(0),se(null),pt(!1),q(null),je(""),z(!1),V([]),K(null),re("unstaged"),Y(null),Z(null),xt(!1),yt(null),Ue(!1),Be(null),Se(null),Te(null),Me(!1),le(null),jt(!1),ce(!1),Ct("push"),ze([]),Xe(new Set),ue(new Map),tn({}),de(!1),nn(null),J(ht),an("generic"),Ze(null),Nt(null),vt(null),Tt(!1),ln(Ot),Re(null),He(null),Je.current.clear(),we.current.clear()},[i]),l.useEffect(()=>{function t(){ri(window.innerWidth<=Ln)}return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),l.useEffect(()=>{if(!St)return;const t=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function r(d){vn(d.clientY)}function c(){Tt(!1)}return window.addEventListener("pointermove",r),window.addEventListener("pointerup",c),()=>{document.body.style.cursor=t,document.body.style.userSelect=s,window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",c)}},[St]),l.useEffect(()=>{var c,d;if(!(i!=null&&i.trim())){Qe.current=null,m(null),H(null),M([]),P(0),se(null),xe(null),B(!1);return}const t=i.trim(),s=Hn(ke(t),_n),r=Bt(s);if(ut("git_sidebar.snapshot",{workspaceId:t,cached:r,cachedHistoryCount:((c=s==null?void 0:s.history)==null?void 0:c.length)??0,cachedChangedCount:((d=s==null?void 0:s.status)==null?void 0:d.changes.length)??0}),r&&s){Et(s,t),B(!1);return}Qe.current=null,wn(ke(t)),m(null),H(null),M([]),P(0),se(null),xe(null),B(!0)},[i]),l.useEffect(()=>{if(i!=null&&i.trim())return R(t=>{var s,r,c;t.workspaceId===i.trim()&&(ut("git_sidebar.snapshot_received",{workspaceId:t.workspaceId,changedCount:((s=t.status)==null?void 0:s.changes.length)??0,historyCount:t.history.length,branchCount:(((r=t.branches)==null?void 0:r.local.length)??0)+(((c=t.branches)==null?void 0:c.remote.length)??0)}),Et(t,t.workspaceId),B(!1))})},[R,i]),l.useEffect(()=>{if(!(i!=null&&i.trim()))return;const t=i.trim(),s=Hn(ke(t),_n),r=Bt(s)?(s==null?void 0:s.revision)??null:null;b(t,{knownRevision:r}),bn.current&&I()},[v,b,i]),l.useEffect(()=>{const t=pn.current;pn.current=u,i!=null&&i.trim()&&!t&&u&&v(i.trim(),{knownRevision:y})},[u,v,y,i]),l.useEffect(()=>{const t=i==null?void 0:i.trim();if(!t||Qe.current!==t)return;const s={revision:y,status:o,history:C,historyTotalCount:F,historyNextCursor:X,branches:U};if(!Bt(s)){wn(ke(t));return}Bi(ke(t),s)},[U,C,X,F,y,o,i]),l.useEffect(()=>{if(!o||!ae)return;o.changes.find(s=>s.path===ae)||q(null)},[ae,o]),l.useEffect(()=>{bs(hn.current)},[ye]),l.useEffect(()=>{k||(V([]),K(null),Y(null),Ze(null))},[k]),l.useEffect(()=>{if(!o){V([]);return}const t=new Set(o.changes.map(s=>s.path));V(s=>s.filter(r=>t.has(r)))},[o]);function pi(){const t=mn.current;if(!t)return;t.querySelectorAll(".git-tree-shell").forEach(r=>{r.scrollTop=0})}function Et(t,s){Qe.current=(s==null?void 0:s.trim())??(i==null?void 0:i.trim())??null,H(typeof t.revision=="string"?t.revision:null),m(t.status),M(Array.isArray(t.history)?t.history:[]),P(typeof t.historyTotalCount=="number"?t.historyTotalCount:0),se(typeof t.historyNextCursor=="string"?t.historyNextCursor:null),xe(t.branches??null)}function I(t){i!=null&&i.trim()&&(B(!0),ut("git_sidebar.refresh_requested",{workspaceId:i.trim(),resetTreeScroll:!1}),v(i.trim(),{knownRevision:y}))}async function Rt(t){if(!(i!=null&&i.trim()))return;const s=i.trim();B(!0);try{const[r,c,d]=await Promise.all([zi(s),Pn(s,Fn,null),Ki(s)]);Et({status:r,history:c.items,historyTotalCount:c.totalCount,historyNextCursor:c.nextCursor,branches:d}),v(s),t!=null&&t.resetTreeScroll&&requestAnimationFrame(()=>{pi()})}catch(r){E({title:L(r,n("git.panelLoadFailed")),tone:"error"})}finally{B(!1)}}async function et(){if(!(!i||!X||be)){pt(!0);try{const t=await Pn(i,Fn,X);M(s=>{const r=new Set(s.map(d=>d.commitHash)),c=t.items.filter(d=>!r.has(d.commitHash));return[...s,...c]}),P(t.totalCount),se(t.nextCursor)}catch(t){E({title:L(t,n("git.panelLoadFailed")),tone:"error"})}finally{pt(!1)}}}function bi(t){if(!te||be||!X)return;const s=t.currentTarget;s.scrollHeight-s.scrollTop-s.clientHeight<=40&&et()}async function xi(){if(i){A(!0);try{const t=await Wi(i,"ai");je(t.validation.normalizedDraft.subject||t.draft.subject)}catch(t){E({title:L(t,n("git.draftFailed")),tone:"error"})}finally{A(!1)}}}async function tt(t,s){if(i&&t.length){A(!0);try{const r=s?await qi(i,t):await Yi(i,t);m(r),q(t[t.length-1]??null),V(c=>c.filter(d=>!t.includes(d))),K(null),I()}catch(r){B(!1),E({title:L(r,n("git.stageFailed")),tone:"error"})}finally{A(!1)}}}async function Ht(t){if(i&&t.length){A(!0);try{const s=await Ji(i,t);m(s),t.includes(ae??"")&&q(null),V(r=>r.filter(c=>!t.includes(c))),K(null),I()}catch(s){B(!1),E({title:L(s,n("git.discardFailed")),tone:"error"})}finally{A(!1)}}}async function yi(){if(!(!i||!ye.trim())){A(!0);try{await Ii(i,gs(ye)),E({title:n("git.commitSuccess"),tone:"success"}),je(""),q(null),I()}catch(t){E({title:L(t,n("git.commitFailed")),tone:"error"})}finally{A(!1)}}}async function ji(){if(i!=null&&i.trim()){A(!0),B(!0);try{const t=await Vi(i.trim());m(t),M([]),P(0),se(null),xe(null),E({title:n("git.initSuccess"),tone:"success"}),I()}catch(t){E({title:L(t,n("git.initFailed")),tone:"error"})}finally{A(!1),B(!1)}}}async function wt(){const t=i==null?void 0:i.trim();if(!t)return[];const s=await ns(t);return(i==null?void 0:i.trim())!==t?[]:(ze(s),s)}async function nt(t){const s=await wt(),r=gt(s,t);if(!r){E({title:n("git.noRemotes"),tone:"error"});return}const c=qe[r.name]??null;nn(r.name),an(vs(s,r.name)),J(Cs((c==null?void 0:c.auth)??null,(c==null?void 0:c.rememberOnHost)??!1)),de(!0)}async function Ci(){if(i!=null&&i.trim()){Ke(!0);try{const t=await wt();if(t.length===0){E({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){await nt(t[0].name);return}Ct("auth"),Xe(new Set),ue(new Map),ce(!0)}catch(t){E({title:L(t,n("git.remoteFailed")),tone:"error"})}finally{Ke(!1)}}}function Ni(){const t=Ye==null?void 0:Ye.trim();if(!t){de(!1);return}const s=Ns(D),r=sn==="github"?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder");if(D.authMode==="basic"){if(!D.username.trim()){E({title:n("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!D.password){E({title:r,tone:"error"});return}}if(D.authMode==="token"&&!D.token){E({title:n("shell.cloneTokenPlaceholder"),tone:"error"});return}tn(c=>{if(!s){const{[t]:d,...w}=c;return w}return{...c,[t]:{auth:s,rememberOnHost:D.rememberOnHost}}}),de(!1),E({title:s?n("git.remoteAuthSaved"):n("git.remoteAuthCleared"),description:s&&D.rememberOnHost?n("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function yn(){if(i){Ke(!0);try{const t=await wt();if(t.length===0){E({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){jn([t[0].name]);return}Ct("push"),Xe(new Set),ue(new Map),ce(!0)}catch(t){E({title:L(t,n("git.remoteFailed")),tone:"error"})}finally{Ke(!1)}}}async function jn(t){if(!i||t.length===0)return;A(!0),ue(new Map);const s=new Map;let r=!1;try{for(const c of t){const d=qe[c]??null;try{const w=await An(i,"push",c,d==null?void 0:d.auth,(d==null?void 0:d.rememberOnHost)??!1);s.set(c,{ok:!0,summary:w.summary}),d!=null&&d.rememberOnHost&&d.auth&&ze(Oi=>Oi.map(Ft=>Ft.name===c?{...Ft,credentialConfigured:!0}:Ft))}catch(w){if(r=!0,s.set(c,{ok:!1,summary:L(w,n("git.remoteFailed"))}),ue(new Map(s)),Kn(w)){nt(c);return}}}ue(s),I(),r||(E({title:n("git.pushAllSuccess",{count:String(t.length)}),tone:"success"}),ce(!1))}finally{A(!1)}}async function Pt(t){if(i){if(t==="push"){z(!1),yn();return}A(!0);try{const s=In(We),r=s?qe[s]??null:null,c=await An(i,t,void 0,r==null?void 0:r.auth,(r==null?void 0:r.rememberOnHost)??!1);E({title:c.summary,tone:"success"}),s&&(r!=null&&r.rememberOnHost)&&r.auth&&ze(d=>d.map(w=>w.name===s?{...w,credentialConfigured:!0}:w)),z(!1),I()}catch(s){if(Kn(s)){nt(In(We));return}E({title:L(s,n("git.remoteFailed")),tone:"error"})}finally{A(!1)}}}async function me(){if(i){A(!0);try{const t=await Zi(i);je(t.commitSubject??""),E({title:t.summary||n("git.undoLastCommitSuccess"),tone:"success"}),z(!1),I()}catch(t){E({title:L(t,n("git.undoLastCommitFailed")),tone:"error"})}finally{A(!1)}}}async function vi(t){if(i){A(!0);try{const s=await is(i,t,!1);xe(s),z(!1),I()}catch(s){E({title:L(s,n("git.branchFailed")),tone:"error"})}finally{A(!1)}}}async function At(t){const s=i==null?void 0:i.trim();if(!s)throw new Error(n("git.panelLoadFailed"));const r=Je.current.get(t);if(r)return r;const c=await ss(s,t);return Je.current.set(t,c),c}async function Ae(t){Z(null),Y(null),yt(t),Be(null);const s=Je.current.get(t)??null;if(Se(s),Ue(!s),s)return;const r=Pe.current+1;Pe.current=r;try{const c=await At(t);if(Pe.current!==r)return;Se(c)}catch(c){if(Pe.current!==r)return;Be(L(c,n("git.commitDetailLoadFailed"))),Se(null)}finally{Pe.current===r&&Ue(!1)}}function Si(){yt(null),Ue(!1),Be(null),Se(null)}async function De(t){try{const s=await At(t);await W(s.versionLabel,n("git.copyCommitVersionSuccess"))}catch(s){E({title:L(s,n("git.commitDetailLoadFailed")),tone:"error"})}}function Le(t){Z(null),Y(null),Te(t),le(null),Me(!0)}function Ti(t){var r;const s=((r=C[0])==null?void 0:r.commitHash)===t.commitHash&&t.commitKind==="local";return[{id:`view-changes:${t.commitHash}`,label:n("git.viewCommitChanges"),onSelect:()=>void Ae(t.commitHash)},{id:`copy-hash:${t.commitHash}`,label:n("git.copyCommitHash"),onSelect:()=>void W(t.commitHash,n("git.copyCommitHashSuccess"))},{id:`copy-message:${t.commitHash}`,label:n("git.copyCommitMessage"),onSelect:()=>void W(pe(t),n("git.copyCommitMessageSuccess"))},{id:`copy-version:${t.commitHash}`,label:n("git.copyCommitVersion"),onSelect:()=>void De(t.commitHash)},{id:`explain:${t.commitHash}`,label:n("git.explainCommitAction"),onSelect:()=>Le(t.commitHash)},...s?[{id:`undo:${t.commitHash}`,label:n("git.undoLastCommit"),disabled:N,onSelect:()=>void me()}]:[]]}async function Cn(t){Z(null),Y(null),await Qi(Ti(t))}async function Mi(){var t,s;if(!(!i||!en||!Ee||ie)){jt(!0);try{const r=await At(en),c=await rs({workspaceId:i,provider:Ee,content:ps(r),clientRequestId:((s=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:s.call(t))??`git-explain-${Date.now()}-${Math.random().toString(16).slice(2)}`,permissionMode:es()}),d=c.session??await os(c.sessionId);p(d),S(),T(d.workspaceId),j(ts(d.workspaceId,d.sessionId)),Me(!1),Te(null),le(null),E({title:n("git.explainCommitStarted"),tone:"success"})}catch(r){E({title:L(r,n("git.explainCommitFailed")),tone:"error"})}finally{jt(!1)}}}function it(t){Zt(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t])}const Ei=450;function Nn(t){const s=Date.now(),r=un.current;return un.current={filePath:t,timestamp:s},(r==null?void 0:r.filePath)===t&&s-r.timestamp<=Ei}async function st(t,s){if(s.binary){E({title:n("git.binaryDiff"),tone:"info"});return}if(s.status==="A"||s.status==="?")He(null),Re(t);else if(i)try{const r=await Xi(i,t,s.staged);He(r.content),Re(t)}catch{He(null),Re(t)}}function at(t){q(t),K(null),V(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t])}function vn(t){const s=dn.current;if(!s||!Number.isFinite(t))return;const r=s.getBoundingClientRect(),c=r.height-dt;if(!Number.isFinite(r.top)||!Number.isFinite(r.height)||c<=0)return;const d=(t-r.top-dt/2)/c*100;if(!Number.isFinite(d))return;const w=Math.max(Dn,Math.min(kt,Math.round(d)));ln(w)}function Ri(t){t.preventDefault(),vn(t.clientY),Tt(!0)}const _e=(o==null?void 0:o.changes)??[],Q=_e.filter(t=>It(t,"staged")),he=_e.filter(t=>It(t,"unstaged")),Sn=Wn(Q,"staged"),Tn=Wn(he,"unstaged"),rt=new Set(ai),ot=new Set(bt),ge=zn(bt,_e,"staged"),fe=zn(bt,_e,"unstaged"),Dt=_e.length===0&&((o==null?void 0:o.snapshot.ahead)??0)>0,Hi=Q.length>0&&ye.trim().length>0,lt=(U==null?void 0:U.currentBranch)??(o==null?void 0:o.snapshot.branch)??n("common.unknown"),ct=gt(We,Ye),Fe=sn==="github",wi=Fe?n("git.remoteAuthDescriptionGithub"):n("git.remoteAuthDescription"),Pi=Fe?n("git.remoteAuthGithubPatLabel"):n("shell.clonePasswordLabel"),Ai=Fe?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder"),Di=Fe?n("git.remoteAuthGithubUsernamePlaceholder"):n("shell.cloneUsernamePlaceholder"),Lt=Number.isFinite(on)?on:Ot,Li=te?`minmax(120px, ${Lt}fr) ${dt}px minmax(140px, ${100-Lt}fr)`:`minmax(120px, 1fr) ${dt}px auto`,_i=ys(o);l.useEffect(()=>{Ce==="staged"&&ge.length===0&&K(null),Ce==="unstaged"&&fe.length===0&&K(null)},[Ce,ge.length,fe.length]),l.useEffect(()=>{if(!k)return;const t=he.length>0?"unstaged":Q.length>0?"staged":"history";re(s=>s==="unstaged"&&he.length>0||s==="staged"&&Q.length>0?s:t)},[k,Q.length,he.length]),l.useEffect(()=>{ve&&(C.some(t=>t.commitHash===ve)||Y(null))},[C,ve]),l.useEffect(()=>{oe&&(C.some(t=>t.commitHash===oe)||Z(null))},[oe,C]),l.useEffect(()=>{k&&Ne!=="history"&&ne&&z(!1)},[k,ne,Ne]),l.useLayoutEffect(()=>{if(k||!ne){Nt(null);return}function t(){const r=gn.current,c=fn.current;!r||!c||typeof window>"u"||Nt(Xn(r.getBoundingClientRect(),{width:c.getBoundingClientRect().width||Kt,height:c.getBoundingClientRect().height||c.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}t();const s=window.requestAnimationFrame(t);return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[N,U==null?void 0:U.local.length,lt,k,ne]);const ee=ve??oe;l.useLayoutEffect(()=>{if(!ee){vt(null);return}const t=ee;function s(){const c=we.current.get(t)??null,d=Mt.current;!c||!d||typeof window>"u"||vt(Xn(c.getBoundingClientRect(),{width:d.getBoundingClientRect().width||Kt,height:d.getBoundingClientRect().height||d.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}s();const r=window.requestAnimationFrame(s);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.cancelAnimationFrame(r),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[ee,C.length]),l.useEffect(()=>{if(!ee||typeof document>"u")return;const t=ee;function s(r){const c=r.target;if(!(c instanceof Node))return;const d=we.current.get(t)??null,w=Mt.current;d!=null&&d.contains(c)||w!=null&&w.contains(c)||(Y(null),Z(null))}return document.addEventListener("pointerdown",s),()=>{document.removeEventListener("pointerdown",s)}},[ee]);async function W(t,s){var r;try{if(f.isDesktop&&(await f.bridge.writeClipboardText(t)).ok){E({title:s,tone:"success"});return}if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText)){await navigator.clipboard.writeText(t),E({title:s,tone:"success"});return}if(fs(t)){E({title:s,tone:"success"});return}}catch{E({title:n("common.copyContentFailed"),tone:"error"})}}async function Mn(t,s){typeof window<"u"&&!window.confirm(n("git.discardConfirm",{path:s}))||await Ht(t)}function En(t){const s=(t==null?void 0:t.desktopFloating)===!0&&!k,r=s?{top:(G==null?void 0:G.top)??O,left:(G==null?void 0:G.left)??O,maxHeight:G==null?void 0:G.maxHeight,transformOrigin:(G==null?void 0:G.transformOrigin)??"top right"}:void 0,c=e.jsxs("div",{ref:s?fn:void 0,className:"git-operations-menu","data-floating":s?"true":"false",style:r,children:[e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.currentBranch")}),e.jsx("strong",{className:"git-menu-branch",children:lt})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.remoteAuthStatusLabel")}),e.jsxs("div",{className:"git-menu-branch-list",children:[e.jsx("strong",{className:"git-menu-branch",children:n("git.remoteAuthManageHint")}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||mi,onClick:()=>void Ci(),children:e.jsx("span",{children:n("git.remoteAuthAction")})})]})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.branchTitle")}),e.jsx("div",{className:"git-menu-branch-list",children:U==null?void 0:U.local.map(d=>e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||d.current,onClick:()=>void vi(d.name),children:e.jsx("span",{children:d.current?`${n("git.switchBranch")} ${d.name}`:`${n("git.switchBranchTo")} ${d.name}`})},d.name))})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>{z(!1),xt(!0)},children:e.jsx("span",{children:n("git.viewAllVersions")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("fetch"),children:e.jsx("span",{children:n("git.fetch")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("pull"),children:e.jsx("span",{children:n("git.pull")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("push"),children:e.jsx("span",{children:n("git.push")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void me(),children:e.jsx("span",{children:n("git.undoLastCommit")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||$e,onClick:()=>void Rt({resetTreeScroll:!0}),children:e.jsx("span",{children:n("git.refresh")})})]})]});return s?typeof document>"u"?null:Rn.createPortal(c,document.body):c}function _t(t,s){if(s){we.current.set(t,s);return}we.current.delete(t)}function Fi(){var r;if(!ee||typeof document>"u")return null;const t=C.find(c=>c.commitHash===ee);if(!t)return null;const s=((r=C[0])==null?void 0:r.commitHash)===t.commitHash&&t.commitKind==="local";return Rn.createPortal(e.jsx("div",{ref:Mt,className:"git-history-entry-menu","data-floating":"true",style:{top:($==null?void 0:$.top)??O,left:($==null?void 0:$.left)??O,maxHeight:$==null?void 0:$.maxHeight,transformOrigin:($==null?void 0:$.transformOrigin)??"top right"},children:e.jsx(ms,{item:t,canUndo:s,actioning:N,onViewCommitChanges:c=>void Ae(c),onCopyCommitHash:c=>void W(c,n("git.copyCommitHashSuccess")),onCopyCommitMessage:c=>void W(pe(c),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:c=>void De(c),onExplainCommitChange:c=>void Le(c),onUndoLastCommit:()=>void me()})}),document.body)}return o&&!_i?e.jsx("section",{className:["conversation-panel","surface-card","git-sidebar",a].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:e.jsxs("section",{className:"git-card git-scaffold-section git-disabled-state",children:[e.jsxs("div",{className:"git-disabled-copy",children:[e.jsx("h3",{children:n("git.uninitializedTitle")}),e.jsx("p",{children:n("git.uninitializedDescription")})]}),e.jsx("div",{className:"git-primary-actions",children:e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>void ji(),disabled:N||$e||!i,children:N?n("git.initInProgress"):n("git.initRepository")})})]})}):e.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",a].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[e.jsxs("section",{className:"git-card git-scaffold-section",children:[e.jsxs("div",{className:"git-editor-row",children:[e.jsx("textarea",{ref:hn,rows:1,value:ye,onChange:t=>je(ti(t.target.value)),onKeyDown:t=>{t.key==="Enter"&&t.preventDefault()},placeholder:n("git.commitSubjectPlaceholder")}),e.jsx("button",{className:"git-icon-button",type:"button","aria-label":n("git.generateDraft"),title:n("git.generateDraft"),onClick:()=>void xi(),disabled:N||$e,children:e.jsx(Ms,{})})]}),e.jsxs("div",{className:"git-primary-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Rt({resetTreeScroll:!0}),disabled:N||$e||!i,children:n("git.refreshNow")}),e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Dt){yn();return}yi()},disabled:N||!Dt&&!Hi,children:Dt?n("git.pushNow"):n("git.commitNow")})]})]}),k?e.jsxs("div",{className:"git-mobile-sections",children:[e.jsx(Ut,{title:n("git.stagedChangesTitle"),count:Q.length,expanded:Ne==="staged",onToggle:()=>re("staged"),children:e.jsx($n,{title:n("git.stagedChangesTitle"),nodes:Sn,collapsedTreePathSet:rt,onToggleTreePath:it,onToggleMobileSelection:at,selectedMobilePathSet:ot,selectedTargets:ge,actioning:N,variant:"staged",swipeRowState:rn,onSwipeRowChange:Ze,onStageToggle:tt,onDiscardWithConfirm:Mn,onClearSelectedTargets:()=>V(t=>t.filter(s=>!ge.includes(s))),onPreviewFile:st})}),e.jsx(Ut,{title:n("git.changesTitle"),count:he.length,expanded:Ne==="unstaged",onToggle:()=>re("unstaged"),children:e.jsx($n,{title:n("git.changesTitle"),nodes:Tn,collapsedTreePathSet:rt,onToggleTreePath:it,onToggleMobileSelection:at,selectedMobilePathSet:ot,selectedTargets:fe,actioning:N,variant:"unstaged",swipeRowState:rn,onSwipeRowChange:Ze,onStageToggle:tt,onDiscardWithConfirm:Mn,onClearSelectedTargets:()=>V(t=>t.filter(s=>!fe.includes(s))),onPreviewFile:st})}),e.jsxs(Ut,{title:n("git.recentVersionsTitle"),count:F,expanded:Ne==="history",onToggle:()=>re("history"),trailingContent:e.jsx("span",{className:"badge",children:lt}),headerAction:e.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":n("git.operationMenu"),title:n("git.operationMenu"),"aria-expanded":ne,onClick:()=>{re("history"),z(t=>!t)},disabled:N,children:e.jsx(Ge,{})}),children:[ne?e.jsx("div",{className:"git-mobile-operations-shell",children:En()}):null,e.jsx(ds,{history:C,historyLoadingMore:be,hasMore:!!X,actioning:N,openCommitHash:ve,onMenuTriggerRef:_t,onToggleMenu:t=>Y(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()})]})]}):e.jsxs("div",{ref:dn,className:"git-content-split",style:{gridTemplateRows:Li},children:[e.jsx("section",{className:"git-card git-tree-panel",children:e.jsxs("div",{ref:mn,className:"git-tree-panel-body",children:[Q.length>0?e.jsx(Gn,{title:n("git.stagedChangesTitle"),count:Q.length,nodes:Sn,selectedPath:ae,collapsedTreePathSet:rt,onToggleTreePath:it,onSelectFile:q,onPreviewFile:(t,s)=>{Nn(t)&&st(t,s)},onToggleMobileSelection:at,onStageToggle:tt,onDiscard:Ht,actioning:N,variant:"staged",isMobileViewport:k,selectedMobilePathSet:ot,selectedTargets:ge,mobileActionMenuOpen:Ce==="staged",onToggleMobileActionMenu:()=>K(t=>t==="staged"?null:"staged"),onClearSelectedTargets:()=>V(t=>t.filter(s=>!ge.includes(s)))}):null,e.jsx(Gn,{title:n("git.changesTitle"),count:he.length,nodes:Tn,selectedPath:ae,collapsedTreePathSet:rt,onToggleTreePath:it,onSelectFile:q,onPreviewFile:(t,s)=>{Nn(t)&&st(t,s)},onToggleMobileSelection:at,onStageToggle:tt,onDiscard:Ht,actioning:N,variant:"unstaged",isMobileViewport:k,selectedMobilePathSet:ot,selectedTargets:fe,mobileActionMenuOpen:Ce==="unstaged",onToggleMobileActionMenu:()=>K(t=>t==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>V(t=>t.filter(s=>!fe.includes(s)))})]})}),e.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":n("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Dn,"aria-valuemax":kt,"aria-valuenow":te?Lt:kt,"data-dragging":St,onPointerDown:Ri,children:e.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),e.jsxs("section",{className:"git-card git-history-section",children:[e.jsxs("div",{className:"git-history-topbar",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":te,"aria-label":te?n("git.collapseRecentVersions"):n("git.expandRecentVersions"),onClick:()=>Jt(t=>!t),children:[e.jsxs("span",{className:"git-section-toggle-main",children:[e.jsx(ft,{expanded:te}),e.jsx("span",{children:n("git.recentVersionsTitle")})]}),e.jsx("span",{className:"workbench-section-counter",children:F})]}),e.jsxs("div",{className:"git-history-actions",children:[e.jsx("span",{className:"badge",children:lt}),e.jsx("button",{className:"git-icon-button",type:"button",ref:gn,"aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:()=>z(t=>!t),disabled:N,children:e.jsx(Ge,{})}),ne?En({desktopFloating:!0}):null]})]}),te?e.jsx(Bn,{history:C,historyLoadingMore:be,hasMore:!!X,actioning:N,openCommitHash:oe,useNativeContextMenu:xn,onMenuTriggerRef:_t,onScroll:bi,onToggleMenu:t=>{if(xn){const s=C.find(r=>r.commitHash===t);s&&Cn(s);return}Z(s=>s===t?null:t)},onOpenContextMenu:t=>void Cn(t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()}):null]})]}),e.jsxs(Oe,{open:di,title:Ve==="push"?n("git.selectRemoteTitle"):n("git.remoteAuthManageTitle"),description:Ve==="push"?n("git.selectRemoteDesc"):n("git.remoteAuthManageDescription"),onClose:()=>{N||ce(!1)},children:[e.jsx("div",{className:"git-remote-select-list",children:We.map(t=>{const s=Ie.has(t.name),r=hi.get(t.name),c=Ss(t,qe[t.name]??null);return e.jsxs("div",{className:"git-remote-item",children:[Ve==="push"?e.jsxs("label",{className:"git-remote-item-selector",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:N,onChange:()=>{Xe(d=>{const w=new Set(d);return w.has(t.name)?w.delete(t.name):w.add(t.name),w})}}),e.jsxs("span",{className:"git-remote-item-body",children:[e.jsx("span",{className:"git-remote-name",children:t.name}),e.jsx("span",{className:"git-remote-url",children:t.pushUrl}),r&&e.jsx("span",{className:`git-remote-result ${r.ok?"ok":"err"}`,children:r.summary})]})]}):e.jsx("div",{className:"git-remote-item-selector git-remote-item-selector-static",children:e.jsxs("span",{className:"git-remote-item-body",children:[e.jsx("span",{className:"git-remote-name",children:t.name}),e.jsx("span",{className:"git-remote-url",children:t.pushUrl}),r&&e.jsx("span",{className:`git-remote-result ${r.ok?"ok":"err"}`,children:r.summary})]})}),e.jsxs("div",{className:"git-remote-item-meta",children:[e.jsx("span",{className:`git-remote-credential-badge ${c.kind}`,children:c.label}),e.jsx("button",{className:"secondary-button git-remote-inline-action",type:"button",disabled:N,onClick:()=>void nt(t.name),children:n("git.remoteAuthAction")})]})]},t.name)})}),e.jsxs("div",{className:"git-remote-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>ce(!1),children:n("common.close")}),Ve==="push"?e.jsx("button",{className:"primary-button",type:"button",disabled:N||Ie.size===0,onClick:()=>void jn(Array.from(Ie)),children:N?n("git.pushing"):n("git.pushSelected",{count:String(Ie.size)})}):null]})]}),e.jsxs(Oe,{open:gi,title:n("git.remoteAuthTitle"),description:wi,onClose:()=>{N||de(!1)},children:[ct?e.jsxs("div",{className:"git-remote-auth-target",children:[e.jsx("strong",{children:ct.name}),e.jsx("span",{children:ct.pushUrl||ct.fetchUrl})]}):null,e.jsxs("div",{className:"workbench-clone-form",children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneAuthModeLabel")}),e.jsxs("select",{value:D.authMode,disabled:N,onChange:t=>J(s=>({...s,authMode:t.target.value})),children:[e.jsx("option",{value:"none",children:n("shell.cloneAuthModeNone")}),e.jsx("option",{value:"basic",children:n("shell.cloneAuthModeBasic")}),e.jsx("option",{value:"token",children:n("shell.cloneAuthModeToken")})]})]}),D.authMode==="basic"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneUsernameLabel")}),e.jsx("input",{type:"text",value:D.username,placeholder:Di,autoComplete:"username",onChange:t=>J(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:Pi}),e.jsx("input",{type:"password",value:D.password,placeholder:Ai,autoComplete:"current-password",onChange:t=>J(s=>({...s,password:t.target.value}))})]})]}):null,D.authMode==="token"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneUsernameLabel")}),e.jsx("input",{type:"text",value:D.username,placeholder:n("shell.cloneTokenUsernamePlaceholder"),autoComplete:"username",onChange:t=>J(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneTokenLabel")}),e.jsx("input",{type:"password",value:D.token,placeholder:n("shell.cloneTokenPlaceholder"),autoComplete:"current-password",onChange:t=>J(s=>({...s,token:t.target.value}))})]})]}):null,Fe?e.jsx("p",{className:"git-remote-auth-hint",children:n("git.remoteAuthGithubPatHint")}):null,D.authMode!=="none"?e.jsxs("label",{className:"settings-checkbox git-remote-auth-remember-toggle",children:[e.jsx("input",{type:"checkbox",checked:D.rememberOnHost,onChange:t=>J(s=>({...s,rememberOnHost:t.target.checked}))}),e.jsx("span",{children:n("git.remoteAuthRemember")})]}):null,e.jsx("p",{className:"git-remote-auth-hint",children:n("git.remoteAuthSessionHint")})]}),e.jsxs("div",{className:"git-remote-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>de(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:N,onClick:Ni,children:n("git.remoteAuthSave")})]})]}),e.jsx(Oe,{open:oi,title:n("git.viewAllVersions"),description:n("git.viewAllVersionsDescription",{count:String(F)}),onClose:()=>xt(!1),children:e.jsx(Bn,{history:C,historyLoadingMore:be,hasMore:!!X,actioning:N,openCommitHash:oe,className:"git-history-modal-list",onMenuTriggerRef:_t,onToggleMenu:t=>Z(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()})}),e.jsx(Oe,{open:li!==null,className:"git-commit-detail-modal",title:(_==null?void 0:_.subject)||n("git.commitDetailTitle"),description:_?n("git.commitDetailDescription",{hash:_.shortHash}):n("git.commitDetailLoading"),onClose:Si,children:ci?e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailLoading")})}):Qt?e.jsx("div",{className:"git-commit-detail-state is-error",children:e.jsx("p",{children:Qt})}):_?e.jsxs("div",{className:"git-commit-detail-shell",children:[e.jsxs("div",{className:"git-commit-detail-meta-grid",children:[e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitVersionLabel")}),e.jsx("strong",{children:_.versionLabel})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitHashLabel")}),e.jsx("strong",{children:_.commitHash})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitAuthorLabel")}),e.jsx("strong",{children:_.authorName})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitTimeLabel")}),e.jsx("strong",{children:xs(_.authoredAt)})]})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsx("div",{className:"git-commit-detail-section-header",children:e.jsx("h3",{children:n("git.commitMessageLabel")})}),e.jsx("pre",{className:"git-commit-detail-message",children:pe(_)})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsxs("div",{className:"git-commit-detail-section-header",children:[e.jsx("h3",{children:n("git.changedFilesTitle")}),e.jsx("span",{className:"workbench-section-counter",children:_.changedFiles.length})]}),e.jsx("div",{className:"git-commit-detail-file-list",children:_.changedFiles.map(t=>e.jsxs("div",{className:"git-commit-detail-file-item",children:[e.jsx("span",{className:"git-commit-detail-file-status","data-status":t.status,children:t.status}),e.jsxs("div",{className:"git-commit-detail-file-copy",children:[e.jsx("strong",{children:t.path}),t.oldPath?e.jsx("span",{children:n("git.renamedFromLabel",{path:t.oldPath})}):null]})]},`${t.status}:${t.oldPath??""}:${t.path}`))})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsxs("div",{className:"git-commit-detail-section-header",children:[e.jsx("h3",{children:n("git.commitDiffLabel")}),_.diffTruncated?e.jsx("span",{className:"git-commit-detail-truncated",children:n("git.diffTruncated")}):null]}),e.jsx("pre",{className:"git-commit-detail-diff",children:_.diffContent||n("git.emptyDiff")})]})]}):e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailEmpty")})})}),e.jsx(Oe,{open:ui,className:"git-explain-provider-modal",title:n("git.explainCommitTitle"),description:n("git.explainCommitDescription"),onClose:()=>{ie||(Me(!1),Te(null),le(null))},children:e.jsxs("div",{className:"git-explain-provider-shell",children:[e.jsx(as,{workspaceId:i,selectedProvider:Ee,pendingProvider:ie?Ee:null,disabled:ie,onSelect:t=>le(t)}),e.jsxs("div",{className:"git-explain-provider-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:ie,onClick:()=>{Me(!1),Te(null),le(null)},children:n("common.cancel")}),e.jsx("button",{type:"button",className:"primary-button",disabled:!Ee||ie,onClick:()=>void Mi(),children:ie?n("conversation.sendingState"):n("git.startExplainCommit")})]})]})}),e.jsx(cs,{workspaceId:i,filePath:cn,open:cn!==null,onClose:()=>{Re(null),He(null)},onSaved:async()=>{await Rt({resetTreeScroll:!0})},diffContent:fi}),Fi()]})}function Gn({title:a,count:i,nodes:u,selectedPath:h,collapsedTreePathSet:g,onToggleTreePath:j,onSelectFile:f,onPreviewFile:x,onToggleMobileSelection:b,onStageToggle:v,onDiscard:R,actioning:S,variant:T,isMobileViewport:p,selectedMobilePathSet:o,selectedTargets:m,mobileActionMenuOpen:y,onToggleMobileActionMenu:H,onClearSelectedTargets:C}){const M=Yn(),F=Yt(u),P=T==="staged"?n("git.unstageAll"):n("git.stageAll");return e.jsxs("section",{className:"git-tree-group","data-variant":T,children:[e.jsxs("div",{className:"git-section-header git-tree-group-header",children:[e.jsx("h3",{children:a}),e.jsxs("div",{className:"git-tree-group-actions",children:[e.jsx("span",{className:"workbench-section-counter",children:i}),!p&&F.length>0?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":P,title:P,onClick:()=>void v(F,T==="staged"),disabled:S,children:e.jsx(Xt,{staged:T==="staged"})}),T==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":n("git.discardAll"),title:n("git.discardAll"),onClick:()=>void R(F),disabled:S,children:e.jsx(qt,{})}):null]}):null,p&&m.length>0?e.jsx("button",{className:"git-icon-button",type:"button","aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:H,disabled:S,children:e.jsx(Ge,{})}):null]}),p&&y?e.jsxs("div",{className:"git-selection-menu",children:[e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.selectedFiles")}),e.jsx("strong",{className:"git-menu-branch",children:m.length})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void v(m,T==="staged"),children:e.jsx("span",{children:T==="staged"?n("git.unstage"):n("git.stage")})}),T==="unstaged"?e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void R(m),children:e.jsx("span",{children:n("git.discard")})}):null,e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:C,children:e.jsx("span",{children:n("git.clearSelection")})})]})]}):null]}),e.jsx("div",{ref:M,className:"git-tree-shell",role:"tree","aria-label":a,"data-scrollbar-autohide":"true",children:u.length?Jn({nodes:u,depth:0,collapsedTreePathSet:g,selectedPath:h,onToggleTreePath:j,onSelectFile:f,onPreviewFile:x,onToggleMobileSelection:b,onStageToggle:v,onDiscard:R,actioning:S,variant:T,isMobileViewport:p,selectedMobilePathSet:o}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Ut({title:a,count:i,expanded:u,onToggle:h,trailingContent:g,headerAction:j,children:f}){return e.jsxs("section",{className:"git-mobile-section","data-expanded":u,children:[e.jsxs("div",{className:"git-mobile-section-header",children:[e.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":u,onClick:h,children:[e.jsxs("span",{className:"git-mobile-section-toggle-main",children:[e.jsx(ft,{expanded:u}),e.jsx("h3",{children:a})]}),e.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[g,e.jsx("span",{className:"workbench-section-counter",children:i})]})]}),j?e.jsx("div",{className:"git-mobile-section-header-action",children:j}):null]}),u?e.jsx("div",{className:"git-mobile-section-body",children:f}):null]})}function $n({title:a,nodes:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,selectedTargets:f,actioning:x,variant:b,swipeRowState:v,onSwipeRowChange:R,onStageToggle:S,onDiscardWithConfirm:T,onClearSelectedTargets:p,onPreviewFile:o}){return e.jsxs("div",{className:"git-mobile-record-shell",children:[f.length>0?e.jsxs("div",{className:"git-mobile-selection-toolbar",children:[e.jsxs("span",{className:"git-mobile-selection-count",children:[n("git.selectedFiles")," ",f.length]}),e.jsxs("div",{className:"git-mobile-selection-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:x,onClick:()=>void S(f,b==="staged"),children:b==="staged"?n("git.unstage"):n("git.stage")}),b==="unstaged"?e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:x,onClick:()=>void T(f,`${f.length}`),children:n("git.discard")}):null,e.jsx("button",{type:"button",className:"secondary-button",disabled:x,onClick:p,children:n("git.clearSelection")})]})]}):null,e.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":a,children:i.length?Zn({nodes:i,depth:0,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:x,variant:b,swipeRowState:v,onSwipeRowChange:R,onStageToggle:S,onDiscardWithConfirm:T,onPreviewFile:o}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Zn({nodes:a,depth:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:f,variant:x,swipeRowState:b,onSwipeRowChange:v,onStageToggle:R,onDiscardWithConfirm:S,onPreviewFile:T}){return a.map(p=>{if(p.kind==="directory"){const y=!u.has(p.path),H=Yt(p.children),C=`directory:${p.path}`;return e.jsxs("div",{className:"git-mobile-record-branch",children:[e.jsx(Un,{rowKey:C,openState:(b==null?void 0:b.path)===C?b.direction:null,onOpenStateChange:M=>v(M?{path:C,direction:M}:null),trailingActions:H.length>0?[{label:x==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void R(H,x==="staged")},...x==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S(H,p.path)}]:[]]:null,children:e.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${On+i*kn}px`},onClick:()=>h(p.path),children:[e.jsxs("span",{className:"git-mobile-record-leading",children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":y,children:e.jsx(ft,{expanded:y})}),e.jsx("span",{className:"git-mobile-record-title",children:p.name})]}),e.jsx("span",{className:"git-mobile-record-meta",children:H.length})]})}),y?e.jsx("div",{className:"git-mobile-record-children",role:"group",children:Zn({nodes:p.children,depth:i+1,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:f,variant:x,swipeRowState:b,onSwipeRowChange:v,onStageToggle:R,onDiscardWithConfirm:S,onPreviewFile:T})}):null]},C)}const o=`file:${p.path}`,m=j.has(p.path);return e.jsx(Un,{rowKey:o,openState:(b==null?void 0:b.path)===o?b.direction:null,onOpenStateChange:y=>v(y?{path:o,direction:y}:null),trailingActions:[{label:n("git.preview"),tone:"neutral",onPress:()=>T(p.change.path,p.change)},{label:x==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void R([p.change.path],x==="staged")},...x==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S([p.change.path],p.path)}]:[]],children:e.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":m,style:{paddingInlineStart:`${On+i*kn}px`},children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${p.name}`,onChange:()=>g(p.change.path)}),e.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>g(p.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(p.name),"aria-hidden":"true",children:Wt(p.name)}),e.jsxs("span",{className:"git-mobile-record-copy",children:[e.jsx("span",{className:"git-mobile-record-title",children:p.name}),e.jsx("span",{className:"git-mobile-record-path",children:p.path})]}),e.jsx("span",{className:"git-status-badge","data-status":p.status,children:p.status})]})]})},o)})}function Un({rowKey:a,openState:i,onOpenStateChange:u,trailingActions:h,children:g}){const j=ls(),f=l.useRef(null),[x,b]=l.useState(0),v=((h==null?void 0:h.length)??0)*Gt;l.useEffect(()=>{i||b(0)},[i,a]);const R=x!==0?x:i==="trailing"?-v:0;function S(m){var y,H;m.button===0&&(f.current={pointerId:m.pointerId,startX:m.clientX},(H=(y=m.currentTarget).setPointerCapture)==null||H.call(y,m.pointerId))}function T(m){const y=f.current;if(!y||y.pointerId!==m.pointerId)return;const H=v>0?v+10:0,C=Math.max(-H,Math.min(0,m.clientX-y.startX));b(C)}function p(m){var H,C;const y=f.current;if(!(!y||y.pointerId!==m.pointerId)){if((C=(H=m.currentTarget).releasePointerCapture)==null||C.call(H,m.pointerId),f.current=null,x<=-44&&(h!=null&&h.length)){j.trigger("gesture"),u("trailing"),b(0);return}u(null),b(0)}}function o(m){var H,C;const y=f.current;!y||y.pointerId!==m.pointerId||((C=(H=m.currentTarget).releasePointerCapture)==null||C.call(H,m.pointerId),f.current=null,b(0))}return e.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":i??"closed","data-dragging":x!==0,children:[h==null?void 0:h.map((m,y)=>e.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":m.tone,style:{right:y*Gt,width:Gt},onClick:()=>{j.trigger(m.tone==="danger"?"warning":"action"),u(null),m.onPress()},children:m.label},`trailing-${y}`)),e.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${R}px)`},onPointerDown:S,onPointerMove:T,onPointerUp:p,onPointerCancel:o,children:g})]})}function ds({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:g,onMenuTriggerRef:j,onToggleMenu:f,onViewCommitChanges:x,onCopyCommitHash:b,onCopyCommitMessage:v,onCopyCommitVersion:R,onExplainCommitChange:S,onUndoLastCommit:T,onLoadMore:p}){return a.length?e.jsxs("div",{className:"git-mobile-history-list",children:[a.map(o=>e.jsx("article",{className:"git-mobile-history-entry","data-kind":o.commitKind,children:e.jsxs("div",{className:"git-mobile-history-entry-main",children:[e.jsx("span",{className:"git-history-marker","data-kind":o.commitKind,"aria-hidden":"true"}),e.jsxs("div",{className:"git-mobile-history-copy",children:[e.jsxs("div",{className:"git-history-title-row",children:[e.jsx("strong",{title:o.subject,children:o.subject}),e.jsx("span",{className:"git-history-kind-badge","data-kind":o.commitKind,children:ni(o.commitKind)})]}),o.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:o.refs.map(m=>e.jsx("span",{className:"git-history-ref-pill","data-kind":m.kind,"data-remote-index":String(ii(m.remoteName)),children:m.name},`${o.commitHash}:${m.kind}:${m.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:o.commitHash.slice(0,8)}),e.jsx("span",{children:o.authorName}),e.jsx("time",{dateTime:o.authoredAt,children:si(o.authoredAt)})]})]}),e.jsx("button",{type:"button",className:"git-icon-button",ref:m=>j(o.commitHash,m),"aria-label":n("git.historyItemMenu"),onClick:()=>f(o.commitHash),children:e.jsx(Ge,{})})]})},o.commitHash)),u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:p,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"git-tree-status",children:n("git.noHistory")})}function Bn({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:g,className:j,useNativeContextMenu:f=!1,onMenuTriggerRef:x,onScroll:b,onToggleMenu:v,onOpenContextMenu:R,onViewCommitChanges:S,onCopyCommitHash:T,onCopyCommitMessage:p,onCopyCommitVersion:o,onExplainCommitChange:m,onUndoLastCommit:y,onLoadMore:H}){const C=Yn();return a.length?e.jsxs("div",{ref:C,className:["git-history-list",j].filter(Boolean).join(" "),onScroll:b,"data-scrollbar-autohide":"true",children:[a.map(M=>{const F=g===M.commitHash;return e.jsxs("article",{className:"git-history-entry","data-kind":M.commitKind,"data-menu-open":F?"true":"false",onContextMenu:P=>{!f||!R||(P.preventDefault(),P.stopPropagation(),R(M))},children:[e.jsx("span",{className:"git-history-marker","data-kind":M.commitKind,"aria-hidden":"true"}),e.jsxs("div",{className:"git-history-body",children:[e.jsxs("div",{className:"git-history-title-row",children:[e.jsx("strong",{title:M.subject,children:M.subject}),e.jsxs("div",{className:"git-history-title-actions",children:[e.jsx("span",{className:"git-history-kind-badge","data-kind":M.commitKind,children:ni(M.commitKind)}),f?null:e.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:P=>x(M.commitHash,P),"aria-label":n("git.historyItemMenu"),onClick:()=>{v(M.commitHash)},children:e.jsx(Ge,{})})]})]}),M.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:M.refs.map(P=>e.jsx("span",{className:"git-history-ref-pill","data-kind":P.kind,"data-remote-index":String(ii(P.remoteName)),children:P.name},`${M.commitHash}:${P.kind}:${P.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:M.commitHash.slice(0,8)}),e.jsx("span",{children:M.authorName}),e.jsx("time",{dateTime:M.authoredAt,children:si(M.authoredAt)})]})]})]},M.commitHash)}),i?e.jsxs("p",{className:"git-history-loading",children:[n("git.refreshNow"),"..."]}):null,u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:H,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"status-text",children:n("git.noHistory")})}function ms({item:a,canUndo:i,actioning:u,onViewCommitChanges:h,onCopyCommitHash:g,onCopyCommitMessage:j,onCopyCommitVersion:f,onExplainCommitChange:x,onUndoLastCommit:b}){return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>h(a.commitHash),children:e.jsx("span",{children:n("git.viewCommitChanges")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>g(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitHash")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>j(a),children:e.jsx("span",{children:n("git.copyCommitMessage")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>f(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitVersion")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>x(a.commitHash),children:e.jsx("span",{children:n("git.explainCommitAction")})}),i?e.jsx("button",{type:"button",className:"git-menu-item",disabled:u,onClick:b,children:e.jsx("span",{children:n("git.undoLastCommit")})}):null]})}function Jn({nodes:a,depth:i,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:g,onSelectFile:j,onPreviewFile:f,onToggleMobileSelection:x,onStageToggle:b,onDiscard:v,actioning:R,variant:S,isMobileViewport:T,selectedMobilePathSet:p}){return a.map(o=>{if(o.kind==="directory"){const H=!u.has(o.path),C=Yt(o.children),M=`${S==="staged"?n("git.unstage"):n("git.stage")} ${o.path}`,F=`${n("git.discard")} ${o.path}`;return e.jsxs("div",{className:"git-tree-node",children:[e.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":H,children:[e.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+i*8}px`},onClick:()=>g(o.path),children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":H,children:e.jsx(ft,{expanded:H})}),e.jsx("span",{className:"git-tree-label git-tree-label-directory",children:o.name})]}),!T&&C.length>0?e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":M,title:M,onClick:()=>void b(C,S==="staged"),disabled:R,children:e.jsx(Xt,{staged:S==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":F,title:F,onClick:()=>void v(C),disabled:R,children:e.jsx(qt,{})}):null]}):null]}),H?e.jsx("div",{className:"git-tree-children",role:"group",children:Jn({nodes:o.children,depth:i+1,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:g,onSelectFile:j,onPreviewFile:f,onToggleMobileSelection:x,onStageToggle:b,onDiscard:v,actioning:R,variant:S,isMobileViewport:T,selectedMobilePathSet:p})}):null]},`directory:${o.path}`)}const m=p.has(o.path),y=T?m:h===o.path;return T?e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":y,"data-mobile":"true",children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${o.name}`,onChange:()=>x(o.change.path)}),e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":y,"data-mobile":"true",style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>x(o.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(o.name),"aria-hidden":"true",children:Wt(o.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:o.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":o.status,children:o.status})})]})]},`file:${o.path}`):e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":y,children:[e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":y,style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>{j(o.change.path),f&&f(o.change.path,o.change)},children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(o.name),"aria-hidden":"true",children:Wt(o.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:o.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":o.status,children:o.status})})]}),e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":o.variant==="staged"?n("git.unstage"):n("git.stage"),title:o.variant==="staged"?n("git.unstage"):n("git.stage"),onClick:()=>void b([o.change.path],o.variant==="staged"),disabled:R,children:e.jsx(Xt,{staged:o.variant==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":n("git.discard"),title:n("git.discard"),onClick:()=>void v([o.change.path]),disabled:R,children:e.jsx(qt,{})}):null]})]},`file:${o.path}`)})}function Vn(a,i){return{kind:"directory",name:a,path:i,children:new Map}}function Wn(a,i){const u=Vn("","");for(const h of a){const g=h.path.replace(/\\/g,"/"),j=g.split("/").filter(Boolean);let f=u;j.forEach((x,b)=>{const v=j.slice(0,b+1).join("/");if(b===j.length-1){f.children.set(`file:${v}`,{kind:"file",name:x,path:g,change:h,status:hs(h,i),variant:i});return}const R=`directory:${v}`,S=f.children.get(R);if(S&&S.kind==="directory"){f=S;return}const T=Vn(x,v);f.children.set(R,T),f=T})}return ei(Qn([...u.children.values()]))}function Qn(a){return[...a].sort((i,u)=>i.kind!==u.kind?i.kind==="directory"?-1:1:i.name.localeCompare(u.name,"zh-CN")).map(i=>i.kind==="directory"?{kind:"directory",name:i.name,path:i.path,children:Qn([...i.children.values()])}:i)}function ei(a){return a.map(i=>{var f;if(i.kind!=="directory")return i;const u=ei(i.children);let h=i.name,g=i.path,j=u;for(;j.length===1&&((f=j[0])==null?void 0:f.kind)==="directory";){const x=j[0];h=`${h}/${x.name}`,g=x.path,j=x.children}return{kind:"directory",name:h,path:g,children:j}})}function zn(a,i,u){const h=new Set(a);return i.filter(g=>It(g,u)&&h.has(g.path)).map(g=>g.path)}function Yt(a){const i=[],u=new Set;function h(g){if(g.kind==="file"){u.has(g.path)||(u.add(g.path),i.push(g.path));return}g.children.forEach(h)}return a.forEach(h),i}function It(a,i){return i==="staged"?!!a.stagedStatus:!!a.worktreeStatus}function hs(a,i){return i==="staged"?a.stagedStatus??a.status:a.worktreeStatus??a.status}function gs(a){return{subject:ti(a).trim(),body:null,footer:null,source:"manual"}}function ti(a){return a.replace(/[\r\n]+/g," ")}function fs(a){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const i=document.createElement("textarea");i.value=a,i.setAttribute("readonly","true"),i.style.position="fixed",i.style.top="-9999px",i.style.left="-9999px",i.style.opacity="0",document.body.appendChild(i),i.focus(),i.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(i)}}function pe(a){const i=a.subject.trim(),u=a.body.trim();return u?`${i}
1
+ import{b as l,t as n,j as e,A as qn}from"./index-CjewzOUG.js";import{u as ki,e as Gi,f as $i,g as Hn}from"./App-B0q8uDA-.js";import{u as Ui,a7 as ut,b as Rn,bv as wn,w as Bi,bw as Vi,bx as Wi,bl as zi,by as Pn,bz as Ki,bA as Ii,bo as Xi,bB as qi,bn as Yi,bC as Zi,bm as Yn,bD as Ji,bu as Qi,bE as An,Z as es,c as ts,bF as ns,bG as is,bH as ss}from"./WorkbenchLayout-D48i71PU.js";import{S as as,y as rs,z as os,e as ls}from"./model-switch-api-Br0ivfe5.js";import{F as cs,r as Wt,a as zt}from"./file-tree-icon-BFwaPxKs.js";import{W as Oe}from"./WorkbenchModal-BYNuMIoV.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-D7OgZZN-.js";const Ot=56,Dn=28,kt=72,dt=8,Ln=960,_n=60*1e3,Fn=20,On=9,kn=9,Gt=68,O=12,mt=8,Kt=260,us=120,$t=6e4,ht={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function Fs({className:a,workspaceId:i,panelActive:u=!0,externalWindowMode:h=!1,workbenchShellOverrides:g}){const j=ki(),f=Gi(),x=Ui(),{subscribeGitSnapshot:b,requestGitRefresh:v,addGitSnapshotListener:H,requestNavigationRefresh:S,selectWorkspace:T,upsertNavigationSession:p}={...x,...g},[o,m]=l.useState(null),[y,R]=l.useState(null),[C,M]=l.useState([]),[F,P]=l.useState(0),[X,se]=l.useState(null),[be,pt]=l.useState(!1),[U,xe]=l.useState(null),[ae,q]=l.useState(null),[ye,je]=l.useState(""),[$e,B]=l.useState(!1),[N,A]=l.useState(!1),[ai,Zt]=l.useState([]),[te,Jt]=l.useState(!0),[ne,z]=l.useState(!1),[k,ri]=l.useState(()=>typeof window<"u"?window.innerWidth<=Ln:!1),[bt,V]=l.useState([]),[Ce,K]=l.useState(null),[Ne,re]=l.useState("unstaged"),[ve,Y]=l.useState(null),[oe,Z]=l.useState(null),[oi,xt]=l.useState(!1),[li,yt]=l.useState(null),[ci,Ue]=l.useState(!1),[Qt,Be]=l.useState(null),[_,Se]=l.useState(null),[en,Te]=l.useState(null),[ui,Me]=l.useState(!1),[Ee,le]=l.useState(null),[ie,jt]=l.useState(!1),[di,ce]=l.useState(!1),[Ve,Ct]=l.useState("push"),[We,ze]=l.useState([]),[mi,Ke]=l.useState(!1),[Ie,Xe]=l.useState(new Set),[hi,ue]=l.useState(new Map),[qe,tn]=l.useState({}),[gi,de]=l.useState(!1),[Ye,nn]=l.useState(null),[D,J]=l.useState(ht),[sn,an]=l.useState("generic"),[rn,Ze]=l.useState(null),[G,Nt]=l.useState(null),[$,vt]=l.useState(null),[on,ln]=l.useState(Ot),[St,Tt]=l.useState(!1),[cn,He]=l.useState(null),[fi,Re]=l.useState(null),un=l.useRef(null),dn=l.useRef(null),mn=l.useRef(null),hn=l.useRef(null),gn=l.useRef(null),fn=l.useRef(null),Mt=l.useRef(null),we=l.useRef(new Map),Je=l.useRef(new Map),Pe=l.useRef(0),pn=l.useRef(u),bn=l.useRef(u),Qe=l.useRef(null),{showToast:E}=$i(),xn=f.isDesktop&&!k;l.useEffect(()=>{ut("git_sidebar.props",{workspaceId:i,externalWindowMode:h})},[h,i]),l.useEffect(()=>{bn.current=u},[u]),l.useEffect(()=>{Zt([]),Jt(!0),P(0),se(null),pt(!1),q(null),je(""),z(!1),V([]),K(null),re("unstaged"),Y(null),Z(null),xt(!1),yt(null),Ue(!1),Be(null),Se(null),Te(null),Me(!1),le(null),jt(!1),ce(!1),Ct("push"),ze([]),Xe(new Set),ue(new Map),tn({}),de(!1),nn(null),J(ht),an("generic"),Ze(null),Nt(null),vt(null),Tt(!1),ln(Ot),He(null),Re(null),Je.current.clear(),we.current.clear()},[i]),l.useEffect(()=>{function t(){ri(window.innerWidth<=Ln)}return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),l.useEffect(()=>{if(!St)return;const t=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function r(d){vn(d.clientY)}function c(){Tt(!1)}return window.addEventListener("pointermove",r),window.addEventListener("pointerup",c),()=>{document.body.style.cursor=t,document.body.style.userSelect=s,window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",c)}},[St]),l.useEffect(()=>{var c,d;if(!(i!=null&&i.trim())){Qe.current=null,m(null),R(null),M([]),P(0),se(null),xe(null),B(!1);return}const t=i.trim(),s=Rn(ke(t),_n),r=Bt(s);if(ut("git_sidebar.snapshot",{workspaceId:t,cached:r,cachedHistoryCount:((c=s==null?void 0:s.history)==null?void 0:c.length)??0,cachedChangedCount:((d=s==null?void 0:s.status)==null?void 0:d.changes.length)??0}),r&&s){Et(s,t),B(!1);return}Qe.current=null,wn(ke(t)),m(null),R(null),M([]),P(0),se(null),xe(null),B(!0)},[i]),l.useEffect(()=>{if(i!=null&&i.trim())return H(t=>{var s,r,c;t.workspaceId===i.trim()&&(ut("git_sidebar.snapshot_received",{workspaceId:t.workspaceId,changedCount:((s=t.status)==null?void 0:s.changes.length)??0,historyCount:t.history.length,branchCount:(((r=t.branches)==null?void 0:r.local.length)??0)+(((c=t.branches)==null?void 0:c.remote.length)??0)}),Et(t,t.workspaceId),B(!1))})},[H,i]),l.useEffect(()=>{if(!(i!=null&&i.trim()))return;const t=i.trim(),s=Rn(ke(t),_n),r=Bt(s)?(s==null?void 0:s.revision)??null:null;b(t,{knownRevision:r}),bn.current&&I()},[v,b,i]),l.useEffect(()=>{const t=pn.current;pn.current=u,i!=null&&i.trim()&&!t&&u&&v(i.trim(),{knownRevision:y})},[u,v,y,i]),l.useEffect(()=>{const t=i==null?void 0:i.trim();if(!t||Qe.current!==t)return;const s={revision:y,status:o,history:C,historyTotalCount:F,historyNextCursor:X,branches:U};if(!Bt(s)){wn(ke(t));return}Bi(ke(t),s)},[U,C,X,F,y,o,i]),l.useEffect(()=>{if(!o||!ae)return;o.changes.find(s=>s.path===ae)||q(null)},[ae,o]),l.useEffect(()=>{bs(hn.current)},[ye]),l.useEffect(()=>{k||(V([]),K(null),Y(null),Ze(null))},[k]),l.useEffect(()=>{if(!o){V([]);return}const t=new Set(o.changes.map(s=>s.path));V(s=>s.filter(r=>t.has(r)))},[o]);function pi(){const t=mn.current;if(!t)return;t.querySelectorAll(".git-tree-shell").forEach(r=>{r.scrollTop=0})}function Et(t,s){Qe.current=(s==null?void 0:s.trim())??(i==null?void 0:i.trim())??null,R(typeof t.revision=="string"?t.revision:null),m(t.status),M(Array.isArray(t.history)?t.history:[]),P(typeof t.historyTotalCount=="number"?t.historyTotalCount:0),se(typeof t.historyNextCursor=="string"?t.historyNextCursor:null),xe(t.branches??null)}function I(t){i!=null&&i.trim()&&(B(!0),ut("git_sidebar.refresh_requested",{workspaceId:i.trim(),resetTreeScroll:!1}),v(i.trim(),{knownRevision:y}))}async function Ht(t){if(!(i!=null&&i.trim()))return;const s=i.trim();B(!0);try{const[r,c,d]=await Promise.all([zi(s),Pn(s,Fn,null),Ki(s)]);Et({status:r,history:c.items,historyTotalCount:c.totalCount,historyNextCursor:c.nextCursor,branches:d}),v(s),t!=null&&t.resetTreeScroll&&requestAnimationFrame(()=>{pi()})}catch(r){E({title:L(r,n("git.panelLoadFailed")),tone:"error"})}finally{B(!1)}}async function et(){if(!(!i||!X||be)){pt(!0);try{const t=await Pn(i,Fn,X);M(s=>{const r=new Set(s.map(d=>d.commitHash)),c=t.items.filter(d=>!r.has(d.commitHash));return[...s,...c]}),P(t.totalCount),se(t.nextCursor)}catch(t){E({title:L(t,n("git.panelLoadFailed")),tone:"error"})}finally{pt(!1)}}}function bi(t){if(!te||be||!X)return;const s=t.currentTarget;s.scrollHeight-s.scrollTop-s.clientHeight<=40&&et()}async function xi(){if(i){A(!0);try{const t=await Wi(i,"ai");je(t.validation.normalizedDraft.subject||t.draft.subject)}catch(t){E({title:L(t,n("git.draftFailed")),tone:"error"})}finally{A(!1)}}}async function tt(t,s){if(i&&t.length){A(!0);try{const r=s?await qi(i,t):await Yi(i,t);m(r),q(t[t.length-1]??null),V(c=>c.filter(d=>!t.includes(d))),K(null),I()}catch(r){B(!1),E({title:L(r,n("git.stageFailed")),tone:"error"})}finally{A(!1)}}}async function Rt(t){if(i&&t.length){A(!0);try{const s=await Ji(i,t);m(s),t.includes(ae??"")&&q(null),V(r=>r.filter(c=>!t.includes(c))),K(null),I()}catch(s){B(!1),E({title:L(s,n("git.discardFailed")),tone:"error"})}finally{A(!1)}}}async function yi(){if(!(!i||!ye.trim())){A(!0);try{await Ii(i,gs(ye)),E({title:n("git.commitSuccess"),tone:"success"}),je(""),q(null),I()}catch(t){E({title:L(t,n("git.commitFailed")),tone:"error"})}finally{A(!1)}}}async function ji(){if(i!=null&&i.trim()){A(!0),B(!0);try{const t=await Vi(i.trim());m(t),M([]),P(0),se(null),xe(null),E({title:n("git.initSuccess"),tone:"success"}),I()}catch(t){E({title:L(t,n("git.initFailed")),tone:"error"})}finally{A(!1),B(!1)}}}async function wt(){const t=i==null?void 0:i.trim();if(!t)return[];const s=await ns(t);return(i==null?void 0:i.trim())!==t?[]:(ze(s),s)}async function nt(t){const s=await wt(),r=gt(s,t);if(!r){E({title:n("git.noRemotes"),tone:"error"});return}const c=qe[r.name]??null;nn(r.name),an(vs(s,r.name)),J(Cs((c==null?void 0:c.auth)??null,(c==null?void 0:c.rememberOnHost)??!1)),de(!0)}async function Ci(){if(i!=null&&i.trim()){Ke(!0);try{const t=await wt();if(t.length===0){E({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){await nt(t[0].name);return}Ct("auth"),Xe(new Set),ue(new Map),ce(!0)}catch(t){E({title:L(t,n("git.remoteFailed")),tone:"error"})}finally{Ke(!1)}}}function Ni(){const t=Ye==null?void 0:Ye.trim();if(!t){de(!1);return}const s=Ns(D),r=sn==="github"?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder");if(D.authMode==="basic"){if(!D.username.trim()){E({title:n("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!D.password){E({title:r,tone:"error"});return}}if(D.authMode==="token"&&!D.token){E({title:n("shell.cloneTokenPlaceholder"),tone:"error"});return}tn(c=>{if(!s){const{[t]:d,...w}=c;return w}return{...c,[t]:{auth:s,rememberOnHost:D.rememberOnHost}}}),de(!1),E({title:s?n("git.remoteAuthSaved"):n("git.remoteAuthCleared"),description:s&&D.rememberOnHost?n("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function yn(){if(i){Ke(!0);try{const t=await wt();if(t.length===0){E({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){jn([t[0].name]);return}Ct("push"),Xe(new Set),ue(new Map),ce(!0)}catch(t){E({title:L(t,n("git.remoteFailed")),tone:"error"})}finally{Ke(!1)}}}async function jn(t){if(!i||t.length===0)return;A(!0),ue(new Map);const s=new Map;let r=!1;try{for(const c of t){const d=qe[c]??null;try{const w=await An(i,"push",c,d==null?void 0:d.auth,(d==null?void 0:d.rememberOnHost)??!1);s.set(c,{ok:!0,summary:w.summary}),d!=null&&d.rememberOnHost&&d.auth&&ze(Oi=>Oi.map(Ft=>Ft.name===c?{...Ft,credentialConfigured:!0}:Ft))}catch(w){if(r=!0,s.set(c,{ok:!1,summary:L(w,n("git.remoteFailed"))}),ue(new Map(s)),Kn(w)){nt(c);return}}}ue(s),I(),r||(E({title:n("git.pushAllSuccess",{count:String(t.length)}),tone:"success"}),ce(!1))}finally{A(!1)}}async function Pt(t){if(i){if(t==="push"){z(!1),yn();return}A(!0);try{const s=In(We),r=s?qe[s]??null:null,c=await An(i,t,void 0,r==null?void 0:r.auth,(r==null?void 0:r.rememberOnHost)??!1);E({title:c.summary,tone:"success"}),s&&(r!=null&&r.rememberOnHost)&&r.auth&&ze(d=>d.map(w=>w.name===s?{...w,credentialConfigured:!0}:w)),z(!1),I()}catch(s){if(Kn(s)){nt(In(We));return}E({title:L(s,n("git.remoteFailed")),tone:"error"})}finally{A(!1)}}}async function me(){if(i){A(!0);try{const t=await Zi(i);je(t.commitSubject??""),E({title:t.summary||n("git.undoLastCommitSuccess"),tone:"success"}),z(!1),I()}catch(t){E({title:L(t,n("git.undoLastCommitFailed")),tone:"error"})}finally{A(!1)}}}async function vi(t){if(i){A(!0);try{const s=await is(i,t,!1);xe(s),z(!1),I()}catch(s){E({title:L(s,n("git.branchFailed")),tone:"error"})}finally{A(!1)}}}async function At(t){const s=i==null?void 0:i.trim();if(!s)throw new Error(n("git.panelLoadFailed"));const r=Je.current.get(t);if(r)return r;const c=await ss(s,t);return Je.current.set(t,c),c}async function Ae(t){Z(null),Y(null),yt(t),Be(null);const s=Je.current.get(t)??null;if(Se(s),Ue(!s),s)return;const r=Pe.current+1;Pe.current=r;try{const c=await At(t);if(Pe.current!==r)return;Se(c)}catch(c){if(Pe.current!==r)return;Be(L(c,n("git.commitDetailLoadFailed"))),Se(null)}finally{Pe.current===r&&Ue(!1)}}function Si(){yt(null),Ue(!1),Be(null),Se(null)}async function De(t){try{const s=await At(t);await W(s.versionLabel,n("git.copyCommitVersionSuccess"))}catch(s){E({title:L(s,n("git.commitDetailLoadFailed")),tone:"error"})}}function Le(t){Z(null),Y(null),Te(t),le(null),Me(!0)}function Ti(t){var r;const s=((r=C[0])==null?void 0:r.commitHash)===t.commitHash&&t.commitKind==="local";return[{id:`view-changes:${t.commitHash}`,label:n("git.viewCommitChanges"),onSelect:()=>void Ae(t.commitHash)},{id:`copy-hash:${t.commitHash}`,label:n("git.copyCommitHash"),onSelect:()=>void W(t.commitHash,n("git.copyCommitHashSuccess"))},{id:`copy-message:${t.commitHash}`,label:n("git.copyCommitMessage"),onSelect:()=>void W(pe(t),n("git.copyCommitMessageSuccess"))},{id:`copy-version:${t.commitHash}`,label:n("git.copyCommitVersion"),onSelect:()=>void De(t.commitHash)},{id:`explain:${t.commitHash}`,label:n("git.explainCommitAction"),onSelect:()=>Le(t.commitHash)},...s?[{id:`undo:${t.commitHash}`,label:n("git.undoLastCommit"),disabled:N,onSelect:()=>void me()}]:[]]}async function Cn(t){Z(null),Y(null),await Qi(Ti(t))}async function Mi(){var t,s;if(!(!i||!en||!Ee||ie)){jt(!0);try{const r=await At(en),c=await rs({workspaceId:i,provider:Ee,content:ps(r),clientRequestId:((s=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:s.call(t))??`git-explain-${Date.now()}-${Math.random().toString(16).slice(2)}`,permissionMode:es()}),d=c.session??await os(c.sessionId);p(d),S(),T(d.workspaceId),j(ts(d.workspaceId,d.sessionId)),Me(!1),Te(null),le(null),E({title:n("git.explainCommitStarted"),tone:"success"})}catch(r){E({title:L(r,n("git.explainCommitFailed")),tone:"error"})}finally{jt(!1)}}}function it(t){Zt(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t])}const Ei=450;function Nn(t){const s=Date.now(),r=un.current;return un.current={filePath:t,timestamp:s},(r==null?void 0:r.filePath)===t&&s-r.timestamp<=Ei}async function st(t,s){if(s.binary){E({title:n("git.binaryDiff"),tone:"info"});return}if(s.status==="A"||s.status==="?")Re(null),He(t);else if(i)try{const r=await Xi(i,t,s.staged);Re(r.content),He(t)}catch{Re(null),He(t)}}function at(t){q(t),K(null),V(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t])}function vn(t){const s=dn.current;if(!s||!Number.isFinite(t))return;const r=s.getBoundingClientRect(),c=r.height-dt;if(!Number.isFinite(r.top)||!Number.isFinite(r.height)||c<=0)return;const d=(t-r.top-dt/2)/c*100;if(!Number.isFinite(d))return;const w=Math.max(Dn,Math.min(kt,Math.round(d)));ln(w)}function Hi(t){t.preventDefault(),vn(t.clientY),Tt(!0)}const _e=(o==null?void 0:o.changes)??[],Q=_e.filter(t=>It(t,"staged")),he=_e.filter(t=>It(t,"unstaged")),Sn=Wn(Q,"staged"),Tn=Wn(he,"unstaged"),rt=new Set(ai),ot=new Set(bt),ge=zn(bt,_e,"staged"),fe=zn(bt,_e,"unstaged"),Dt=_e.length===0&&((o==null?void 0:o.snapshot.ahead)??0)>0,Ri=Q.length>0&&ye.trim().length>0,lt=(U==null?void 0:U.currentBranch)??(o==null?void 0:o.snapshot.branch)??n("common.unknown"),ct=gt(We,Ye),Fe=sn==="github",wi=Fe?n("git.remoteAuthDescriptionGithub"):n("git.remoteAuthDescription"),Pi=Fe?n("git.remoteAuthGithubPatLabel"):n("shell.clonePasswordLabel"),Ai=Fe?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder"),Di=Fe?n("git.remoteAuthGithubUsernamePlaceholder"):n("shell.cloneUsernamePlaceholder"),Lt=Number.isFinite(on)?on:Ot,Li=te?`minmax(120px, ${Lt}fr) ${dt}px minmax(140px, ${100-Lt}fr)`:`minmax(120px, 1fr) ${dt}px auto`,_i=ys(o);l.useEffect(()=>{Ce==="staged"&&ge.length===0&&K(null),Ce==="unstaged"&&fe.length===0&&K(null)},[Ce,ge.length,fe.length]),l.useEffect(()=>{if(!k)return;const t=he.length>0?"unstaged":Q.length>0?"staged":"history";re(s=>s==="unstaged"&&he.length>0||s==="staged"&&Q.length>0?s:t)},[k,Q.length,he.length]),l.useEffect(()=>{ve&&(C.some(t=>t.commitHash===ve)||Y(null))},[C,ve]),l.useEffect(()=>{oe&&(C.some(t=>t.commitHash===oe)||Z(null))},[oe,C]),l.useEffect(()=>{k&&Ne!=="history"&&ne&&z(!1)},[k,ne,Ne]),l.useLayoutEffect(()=>{if(k||!ne){Nt(null);return}function t(){const r=gn.current,c=fn.current;!r||!c||typeof window>"u"||Nt(Xn(r.getBoundingClientRect(),{width:c.getBoundingClientRect().width||Kt,height:c.getBoundingClientRect().height||c.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}t();const s=window.requestAnimationFrame(t);return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[N,U==null?void 0:U.local.length,lt,k,ne]);const ee=ve??oe;l.useLayoutEffect(()=>{if(!ee){vt(null);return}const t=ee;function s(){const c=we.current.get(t)??null,d=Mt.current;!c||!d||typeof window>"u"||vt(Xn(c.getBoundingClientRect(),{width:d.getBoundingClientRect().width||Kt,height:d.getBoundingClientRect().height||d.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}s();const r=window.requestAnimationFrame(s);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.cancelAnimationFrame(r),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[ee,C.length]),l.useEffect(()=>{if(!ee||typeof document>"u")return;const t=ee;function s(r){const c=r.target;if(!(c instanceof Node))return;const d=we.current.get(t)??null,w=Mt.current;d!=null&&d.contains(c)||w!=null&&w.contains(c)||(Y(null),Z(null))}return document.addEventListener("pointerdown",s),()=>{document.removeEventListener("pointerdown",s)}},[ee]);async function W(t,s){var r;try{if(f.isDesktop&&(await f.bridge.writeClipboardText(t)).ok){E({title:s,tone:"success"});return}if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText)){await navigator.clipboard.writeText(t),E({title:s,tone:"success"});return}if(fs(t)){E({title:s,tone:"success"});return}}catch{E({title:n("common.copyContentFailed"),tone:"error"})}}async function Mn(t,s){typeof window<"u"&&!window.confirm(n("git.discardConfirm",{path:s}))||await Rt(t)}function En(t){const s=(t==null?void 0:t.desktopFloating)===!0&&!k,r=s?{top:(G==null?void 0:G.top)??O,left:(G==null?void 0:G.left)??O,maxHeight:G==null?void 0:G.maxHeight,transformOrigin:(G==null?void 0:G.transformOrigin)??"top right"}:void 0,c=e.jsxs("div",{ref:s?fn:void 0,className:"git-operations-menu","data-floating":s?"true":"false",style:r,children:[e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.currentBranch")}),e.jsx("strong",{className:"git-menu-branch",children:lt})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.remoteAuthStatusLabel")}),e.jsxs("div",{className:"git-menu-branch-list",children:[e.jsx("strong",{className:"git-menu-branch",children:n("git.remoteAuthManageHint")}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||mi,onClick:()=>void Ci(),children:e.jsx("span",{children:n("git.remoteAuthAction")})})]})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.branchTitle")}),e.jsx("div",{className:"git-menu-branch-list",children:U==null?void 0:U.local.map(d=>e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||d.current,onClick:()=>void vi(d.name),children:e.jsx("span",{children:d.current?`${n("git.switchBranch")} ${d.name}`:`${n("git.switchBranchTo")} ${d.name}`})},d.name))})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>{z(!1),xt(!0)},children:e.jsx("span",{children:n("git.viewAllVersions")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("fetch"),children:e.jsx("span",{children:n("git.fetch")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("pull"),children:e.jsx("span",{children:n("git.pull")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("push"),children:e.jsx("span",{children:n("git.push")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void me(),children:e.jsx("span",{children:n("git.undoLastCommit")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||$e,onClick:()=>void Ht({resetTreeScroll:!0}),children:e.jsx("span",{children:n("git.refresh")})})]})]});return s?typeof document>"u"?null:Hn.createPortal(c,document.body):c}function _t(t,s){if(s){we.current.set(t,s);return}we.current.delete(t)}function Fi(){var r;if(!ee||typeof document>"u")return null;const t=C.find(c=>c.commitHash===ee);if(!t)return null;const s=((r=C[0])==null?void 0:r.commitHash)===t.commitHash&&t.commitKind==="local";return Hn.createPortal(e.jsx("div",{ref:Mt,className:"git-history-entry-menu","data-floating":"true",style:{top:($==null?void 0:$.top)??O,left:($==null?void 0:$.left)??O,maxHeight:$==null?void 0:$.maxHeight,transformOrigin:($==null?void 0:$.transformOrigin)??"top right"},children:e.jsx(ms,{item:t,canUndo:s,actioning:N,onViewCommitChanges:c=>void Ae(c),onCopyCommitHash:c=>void W(c,n("git.copyCommitHashSuccess")),onCopyCommitMessage:c=>void W(pe(c),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:c=>void De(c),onExplainCommitChange:c=>void Le(c),onUndoLastCommit:()=>void me()})}),document.body)}return o&&!_i?e.jsx("section",{className:["conversation-panel","surface-card","git-sidebar",a].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:e.jsxs("section",{className:"git-card git-scaffold-section git-disabled-state",children:[e.jsxs("div",{className:"git-disabled-copy",children:[e.jsx("h3",{children:n("git.uninitializedTitle")}),e.jsx("p",{children:n("git.uninitializedDescription")})]}),e.jsx("div",{className:"git-primary-actions",children:e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>void ji(),disabled:N||$e||!i,children:N?n("git.initInProgress"):n("git.initRepository")})})]})}):e.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",a].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[e.jsxs("section",{className:"git-card git-scaffold-section",children:[e.jsxs("div",{className:"git-editor-row",children:[e.jsx("textarea",{ref:hn,rows:1,value:ye,onChange:t=>je(ti(t.target.value)),onKeyDown:t=>{t.key==="Enter"&&t.preventDefault()},placeholder:n("git.commitSubjectPlaceholder")}),e.jsx("button",{className:"git-icon-button",type:"button","aria-label":n("git.generateDraft"),title:n("git.generateDraft"),onClick:()=>void xi(),disabled:N||$e,children:e.jsx(Ms,{})})]}),e.jsxs("div",{className:"git-primary-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Ht({resetTreeScroll:!0}),disabled:N||$e||!i,children:n("git.refreshNow")}),e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Dt){yn();return}yi()},disabled:N||!Dt&&!Ri,children:Dt?n("git.pushNow"):n("git.commitNow")})]})]}),k?e.jsxs("div",{className:"git-mobile-sections",children:[e.jsx(Ut,{title:n("git.stagedChangesTitle"),count:Q.length,expanded:Ne==="staged",onToggle:()=>re("staged"),children:e.jsx($n,{title:n("git.stagedChangesTitle"),nodes:Sn,collapsedTreePathSet:rt,onToggleTreePath:it,onToggleMobileSelection:at,selectedMobilePathSet:ot,selectedTargets:ge,actioning:N,variant:"staged",swipeRowState:rn,onSwipeRowChange:Ze,onStageToggle:tt,onDiscardWithConfirm:Mn,onClearSelectedTargets:()=>V(t=>t.filter(s=>!ge.includes(s))),onPreviewFile:st})}),e.jsx(Ut,{title:n("git.changesTitle"),count:he.length,expanded:Ne==="unstaged",onToggle:()=>re("unstaged"),children:e.jsx($n,{title:n("git.changesTitle"),nodes:Tn,collapsedTreePathSet:rt,onToggleTreePath:it,onToggleMobileSelection:at,selectedMobilePathSet:ot,selectedTargets:fe,actioning:N,variant:"unstaged",swipeRowState:rn,onSwipeRowChange:Ze,onStageToggle:tt,onDiscardWithConfirm:Mn,onClearSelectedTargets:()=>V(t=>t.filter(s=>!fe.includes(s))),onPreviewFile:st})}),e.jsxs(Ut,{title:n("git.recentVersionsTitle"),count:F,expanded:Ne==="history",onToggle:()=>re("history"),trailingContent:e.jsx("span",{className:"badge",children:lt}),headerAction:e.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":n("git.operationMenu"),title:n("git.operationMenu"),"aria-expanded":ne,onClick:()=>{re("history"),z(t=>!t)},disabled:N,children:e.jsx(Ge,{})}),children:[ne?e.jsx("div",{className:"git-mobile-operations-shell",children:En()}):null,e.jsx(ds,{history:C,historyLoadingMore:be,hasMore:!!X,actioning:N,openCommitHash:ve,onMenuTriggerRef:_t,onToggleMenu:t=>Y(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()})]})]}):e.jsxs("div",{ref:dn,className:"git-content-split",style:{gridTemplateRows:Li},children:[e.jsx("section",{className:"git-card git-tree-panel",children:e.jsxs("div",{ref:mn,className:"git-tree-panel-body",children:[Q.length>0?e.jsx(Gn,{title:n("git.stagedChangesTitle"),count:Q.length,nodes:Sn,selectedPath:ae,collapsedTreePathSet:rt,onToggleTreePath:it,onSelectFile:q,onPreviewFile:(t,s)=>{Nn(t)&&st(t,s)},onToggleMobileSelection:at,onStageToggle:tt,onDiscard:Rt,actioning:N,variant:"staged",isMobileViewport:k,selectedMobilePathSet:ot,selectedTargets:ge,mobileActionMenuOpen:Ce==="staged",onToggleMobileActionMenu:()=>K(t=>t==="staged"?null:"staged"),onClearSelectedTargets:()=>V(t=>t.filter(s=>!ge.includes(s)))}):null,e.jsx(Gn,{title:n("git.changesTitle"),count:he.length,nodes:Tn,selectedPath:ae,collapsedTreePathSet:rt,onToggleTreePath:it,onSelectFile:q,onPreviewFile:(t,s)=>{Nn(t)&&st(t,s)},onToggleMobileSelection:at,onStageToggle:tt,onDiscard:Rt,actioning:N,variant:"unstaged",isMobileViewport:k,selectedMobilePathSet:ot,selectedTargets:fe,mobileActionMenuOpen:Ce==="unstaged",onToggleMobileActionMenu:()=>K(t=>t==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>V(t=>t.filter(s=>!fe.includes(s)))})]})}),e.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":n("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Dn,"aria-valuemax":kt,"aria-valuenow":te?Lt:kt,"data-dragging":St,onPointerDown:Hi,children:e.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),e.jsxs("section",{className:"git-card git-history-section",children:[e.jsxs("div",{className:"git-history-topbar",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":te,"aria-label":te?n("git.collapseRecentVersions"):n("git.expandRecentVersions"),onClick:()=>Jt(t=>!t),children:[e.jsxs("span",{className:"git-section-toggle-main",children:[e.jsx(ft,{expanded:te}),e.jsx("span",{children:n("git.recentVersionsTitle")})]}),e.jsx("span",{className:"workbench-section-counter",children:F})]}),e.jsxs("div",{className:"git-history-actions",children:[e.jsx("span",{className:"badge",children:lt}),e.jsx("button",{className:"git-icon-button",type:"button",ref:gn,"aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:()=>z(t=>!t),disabled:N,children:e.jsx(Ge,{})}),ne?En({desktopFloating:!0}):null]})]}),te?e.jsx(Bn,{history:C,historyLoadingMore:be,hasMore:!!X,actioning:N,openCommitHash:oe,useNativeContextMenu:xn,onMenuTriggerRef:_t,onScroll:bi,onToggleMenu:t=>{if(xn){const s=C.find(r=>r.commitHash===t);s&&Cn(s);return}Z(s=>s===t?null:t)},onOpenContextMenu:t=>void Cn(t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()}):null]})]}),e.jsxs(Oe,{open:di,title:Ve==="push"?n("git.selectRemoteTitle"):n("git.remoteAuthManageTitle"),description:Ve==="push"?n("git.selectRemoteDesc"):n("git.remoteAuthManageDescription"),onClose:()=>{N||ce(!1)},children:[e.jsx("div",{className:"git-remote-select-list",children:We.map(t=>{const s=Ie.has(t.name),r=hi.get(t.name),c=Ss(t,qe[t.name]??null);return e.jsxs("div",{className:"git-remote-item",children:[Ve==="push"?e.jsxs("label",{className:"git-remote-item-selector",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:N,onChange:()=>{Xe(d=>{const w=new Set(d);return w.has(t.name)?w.delete(t.name):w.add(t.name),w})}}),e.jsxs("span",{className:"git-remote-item-body",children:[e.jsx("span",{className:"git-remote-name",children:t.name}),e.jsx("span",{className:"git-remote-url",children:t.pushUrl}),r&&e.jsx("span",{className:`git-remote-result ${r.ok?"ok":"err"}`,children:r.summary})]})]}):e.jsx("div",{className:"git-remote-item-selector git-remote-item-selector-static",children:e.jsxs("span",{className:"git-remote-item-body",children:[e.jsx("span",{className:"git-remote-name",children:t.name}),e.jsx("span",{className:"git-remote-url",children:t.pushUrl}),r&&e.jsx("span",{className:`git-remote-result ${r.ok?"ok":"err"}`,children:r.summary})]})}),e.jsxs("div",{className:"git-remote-item-meta",children:[e.jsx("span",{className:`git-remote-credential-badge ${c.kind}`,children:c.label}),e.jsx("button",{className:"secondary-button git-remote-inline-action",type:"button",disabled:N,onClick:()=>void nt(t.name),children:n("git.remoteAuthAction")})]})]},t.name)})}),e.jsxs("div",{className:"git-remote-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>ce(!1),children:n("common.close")}),Ve==="push"?e.jsx("button",{className:"primary-button",type:"button",disabled:N||Ie.size===0,onClick:()=>void jn(Array.from(Ie)),children:N?n("git.pushing"):n("git.pushSelected",{count:String(Ie.size)})}):null]})]}),e.jsxs(Oe,{open:gi,title:n("git.remoteAuthTitle"),description:wi,onClose:()=>{N||de(!1)},children:[ct?e.jsxs("div",{className:"git-remote-auth-target",children:[e.jsx("strong",{children:ct.name}),e.jsx("span",{children:ct.pushUrl||ct.fetchUrl})]}):null,e.jsxs("div",{className:"workbench-clone-form",children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneAuthModeLabel")}),e.jsxs("select",{value:D.authMode,disabled:N,onChange:t=>J(s=>({...s,authMode:t.target.value})),children:[e.jsx("option",{value:"none",children:n("shell.cloneAuthModeNone")}),e.jsx("option",{value:"basic",children:n("shell.cloneAuthModeBasic")}),e.jsx("option",{value:"token",children:n("shell.cloneAuthModeToken")})]})]}),D.authMode==="basic"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneUsernameLabel")}),e.jsx("input",{type:"text",value:D.username,placeholder:Di,autoComplete:"username",onChange:t=>J(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:Pi}),e.jsx("input",{type:"password",value:D.password,placeholder:Ai,autoComplete:"current-password",onChange:t=>J(s=>({...s,password:t.target.value}))})]})]}):null,D.authMode==="token"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneUsernameLabel")}),e.jsx("input",{type:"text",value:D.username,placeholder:n("shell.cloneTokenUsernamePlaceholder"),autoComplete:"username",onChange:t=>J(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneTokenLabel")}),e.jsx("input",{type:"password",value:D.token,placeholder:n("shell.cloneTokenPlaceholder"),autoComplete:"current-password",onChange:t=>J(s=>({...s,token:t.target.value}))})]})]}):null,Fe?e.jsx("p",{className:"git-remote-auth-hint",children:n("git.remoteAuthGithubPatHint")}):null,D.authMode!=="none"?e.jsxs("label",{className:"settings-checkbox git-remote-auth-remember-toggle",children:[e.jsx("input",{type:"checkbox",checked:D.rememberOnHost,onChange:t=>J(s=>({...s,rememberOnHost:t.target.checked}))}),e.jsx("span",{children:n("git.remoteAuthRemember")})]}):null,e.jsx("p",{className:"git-remote-auth-hint",children:n("git.remoteAuthSessionHint")})]}),e.jsxs("div",{className:"git-remote-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>de(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:N,onClick:Ni,children:n("git.remoteAuthSave")})]})]}),e.jsx(Oe,{open:oi,title:n("git.viewAllVersions"),description:n("git.viewAllVersionsDescription",{count:String(F)}),onClose:()=>xt(!1),children:e.jsx(Bn,{history:C,historyLoadingMore:be,hasMore:!!X,actioning:N,openCommitHash:oe,className:"git-history-modal-list",onMenuTriggerRef:_t,onToggleMenu:t=>Z(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()})}),e.jsx(Oe,{open:li!==null,className:"git-commit-detail-modal",title:(_==null?void 0:_.subject)||n("git.commitDetailTitle"),description:_?n("git.commitDetailDescription",{hash:_.shortHash}):n("git.commitDetailLoading"),onClose:Si,children:ci?e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailLoading")})}):Qt?e.jsx("div",{className:"git-commit-detail-state is-error",children:e.jsx("p",{children:Qt})}):_?e.jsxs("div",{className:"git-commit-detail-shell",children:[e.jsxs("div",{className:"git-commit-detail-meta-grid",children:[e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitVersionLabel")}),e.jsx("strong",{children:_.versionLabel})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitHashLabel")}),e.jsx("strong",{children:_.commitHash})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitAuthorLabel")}),e.jsx("strong",{children:_.authorName})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitTimeLabel")}),e.jsx("strong",{children:xs(_.authoredAt)})]})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsx("div",{className:"git-commit-detail-section-header",children:e.jsx("h3",{children:n("git.commitMessageLabel")})}),e.jsx("pre",{className:"git-commit-detail-message",children:pe(_)})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsxs("div",{className:"git-commit-detail-section-header",children:[e.jsx("h3",{children:n("git.changedFilesTitle")}),e.jsx("span",{className:"workbench-section-counter",children:_.changedFiles.length})]}),e.jsx("div",{className:"git-commit-detail-file-list",children:_.changedFiles.map(t=>e.jsxs("div",{className:"git-commit-detail-file-item",children:[e.jsx("span",{className:"git-commit-detail-file-status","data-status":t.status,children:t.status}),e.jsxs("div",{className:"git-commit-detail-file-copy",children:[e.jsx("strong",{children:t.path}),t.oldPath?e.jsx("span",{children:n("git.renamedFromLabel",{path:t.oldPath})}):null]})]},`${t.status}:${t.oldPath??""}:${t.path}`))})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsxs("div",{className:"git-commit-detail-section-header",children:[e.jsx("h3",{children:n("git.commitDiffLabel")}),_.diffTruncated?e.jsx("span",{className:"git-commit-detail-truncated",children:n("git.diffTruncated")}):null]}),e.jsx("pre",{className:"git-commit-detail-diff",children:_.diffContent||n("git.emptyDiff")})]})]}):e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailEmpty")})})}),e.jsx(Oe,{open:ui,className:"git-explain-provider-modal",title:n("git.explainCommitTitle"),description:n("git.explainCommitDescription"),onClose:()=>{ie||(Me(!1),Te(null),le(null))},children:e.jsxs("div",{className:"git-explain-provider-shell",children:[e.jsx(as,{workspaceId:i,selectedProvider:Ee,pendingProvider:ie?Ee:null,disabled:ie,onSelect:t=>le(t)}),e.jsxs("div",{className:"git-explain-provider-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:ie,onClick:()=>{Me(!1),Te(null),le(null)},children:n("common.cancel")}),e.jsx("button",{type:"button",className:"primary-button",disabled:!Ee||ie,onClick:()=>void Mi(),children:ie?n("conversation.sendingState"):n("git.startExplainCommit")})]})]})}),e.jsx(cs,{workspaceId:i,filePath:cn,open:cn!==null,onClose:()=>{He(null),Re(null)},onSaved:async()=>{await Ht({resetTreeScroll:!0})},diffContent:fi}),Fi()]})}function Gn({title:a,count:i,nodes:u,selectedPath:h,collapsedTreePathSet:g,onToggleTreePath:j,onSelectFile:f,onPreviewFile:x,onToggleMobileSelection:b,onStageToggle:v,onDiscard:H,actioning:S,variant:T,isMobileViewport:p,selectedMobilePathSet:o,selectedTargets:m,mobileActionMenuOpen:y,onToggleMobileActionMenu:R,onClearSelectedTargets:C}){const M=Yn(),F=Yt(u),P=T==="staged"?n("git.unstageAll"):n("git.stageAll");return e.jsxs("section",{className:"git-tree-group","data-variant":T,children:[e.jsxs("div",{className:"git-section-header git-tree-group-header",children:[e.jsx("h3",{children:a}),e.jsxs("div",{className:"git-tree-group-actions",children:[e.jsx("span",{className:"workbench-section-counter",children:i}),!p&&F.length>0?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":P,title:P,onClick:()=>void v(F,T==="staged"),disabled:S,children:e.jsx(Xt,{staged:T==="staged"})}),T==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":n("git.discardAll"),title:n("git.discardAll"),onClick:()=>void H(F),disabled:S,children:e.jsx(qt,{})}):null]}):null,p&&m.length>0?e.jsx("button",{className:"git-icon-button",type:"button","aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:R,disabled:S,children:e.jsx(Ge,{})}):null]}),p&&y?e.jsxs("div",{className:"git-selection-menu",children:[e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.selectedFiles")}),e.jsx("strong",{className:"git-menu-branch",children:m.length})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void v(m,T==="staged"),children:e.jsx("span",{children:T==="staged"?n("git.unstage"):n("git.stage")})}),T==="unstaged"?e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void H(m),children:e.jsx("span",{children:n("git.discard")})}):null,e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:C,children:e.jsx("span",{children:n("git.clearSelection")})})]})]}):null]}),e.jsx("div",{ref:M,className:"git-tree-shell",role:"tree","aria-label":a,"data-scrollbar-autohide":"true",children:u.length?Jn({nodes:u,depth:0,collapsedTreePathSet:g,selectedPath:h,onToggleTreePath:j,onSelectFile:f,onPreviewFile:x,onToggleMobileSelection:b,onStageToggle:v,onDiscard:H,actioning:S,variant:T,isMobileViewport:p,selectedMobilePathSet:o}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Ut({title:a,count:i,expanded:u,onToggle:h,trailingContent:g,headerAction:j,children:f}){return e.jsxs("section",{className:"git-mobile-section","data-expanded":u,children:[e.jsxs("div",{className:"git-mobile-section-header",children:[e.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":u,onClick:h,children:[e.jsxs("span",{className:"git-mobile-section-toggle-main",children:[e.jsx(ft,{expanded:u}),e.jsx("h3",{children:a})]}),e.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[g,e.jsx("span",{className:"workbench-section-counter",children:i})]})]}),j?e.jsx("div",{className:"git-mobile-section-header-action",children:j}):null]}),u?e.jsx("div",{className:"git-mobile-section-body",children:f}):null]})}function $n({title:a,nodes:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,selectedTargets:f,actioning:x,variant:b,swipeRowState:v,onSwipeRowChange:H,onStageToggle:S,onDiscardWithConfirm:T,onClearSelectedTargets:p,onPreviewFile:o}){return e.jsxs("div",{className:"git-mobile-record-shell",children:[f.length>0?e.jsxs("div",{className:"git-mobile-selection-toolbar",children:[e.jsxs("span",{className:"git-mobile-selection-count",children:[n("git.selectedFiles")," ",f.length]}),e.jsxs("div",{className:"git-mobile-selection-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:x,onClick:()=>void S(f,b==="staged"),children:b==="staged"?n("git.unstage"):n("git.stage")}),b==="unstaged"?e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:x,onClick:()=>void T(f,`${f.length}`),children:n("git.discard")}):null,e.jsx("button",{type:"button",className:"secondary-button",disabled:x,onClick:p,children:n("git.clearSelection")})]})]}):null,e.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":a,children:i.length?Zn({nodes:i,depth:0,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:x,variant:b,swipeRowState:v,onSwipeRowChange:H,onStageToggle:S,onDiscardWithConfirm:T,onPreviewFile:o}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Zn({nodes:a,depth:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:f,variant:x,swipeRowState:b,onSwipeRowChange:v,onStageToggle:H,onDiscardWithConfirm:S,onPreviewFile:T}){return a.map(p=>{if(p.kind==="directory"){const y=!u.has(p.path),R=Yt(p.children),C=`directory:${p.path}`;return e.jsxs("div",{className:"git-mobile-record-branch",children:[e.jsx(Un,{rowKey:C,openState:(b==null?void 0:b.path)===C?b.direction:null,onOpenStateChange:M=>v(M?{path:C,direction:M}:null),trailingActions:R.length>0?[{label:x==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void H(R,x==="staged")},...x==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S(R,p.path)}]:[]]:null,children:e.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${On+i*kn}px`},onClick:()=>h(p.path),children:[e.jsxs("span",{className:"git-mobile-record-leading",children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":y,children:e.jsx(ft,{expanded:y})}),e.jsx("span",{className:"git-mobile-record-title",children:p.name})]}),e.jsx("span",{className:"git-mobile-record-meta",children:R.length})]})}),y?e.jsx("div",{className:"git-mobile-record-children",role:"group",children:Zn({nodes:p.children,depth:i+1,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:f,variant:x,swipeRowState:b,onSwipeRowChange:v,onStageToggle:H,onDiscardWithConfirm:S,onPreviewFile:T})}):null]},C)}const o=`file:${p.path}`,m=j.has(p.path);return e.jsx(Un,{rowKey:o,openState:(b==null?void 0:b.path)===o?b.direction:null,onOpenStateChange:y=>v(y?{path:o,direction:y}:null),trailingActions:[{label:n("git.preview"),tone:"neutral",onPress:()=>T(p.change.path,p.change)},{label:x==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void H([p.change.path],x==="staged")},...x==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S([p.change.path],p.path)}]:[]],children:e.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":m,style:{paddingInlineStart:`${On+i*kn}px`},children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${p.name}`,onChange:()=>g(p.change.path)}),e.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>g(p.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(p.name),"aria-hidden":"true",children:Wt(p.name)}),e.jsxs("span",{className:"git-mobile-record-copy",children:[e.jsx("span",{className:"git-mobile-record-title",children:p.name}),e.jsx("span",{className:"git-mobile-record-path",children:p.path})]}),e.jsx("span",{className:"git-status-badge","data-status":p.status,children:p.status})]})]})},o)})}function Un({rowKey:a,openState:i,onOpenStateChange:u,trailingActions:h,children:g}){const j=ls(),f=l.useRef(null),[x,b]=l.useState(0),v=((h==null?void 0:h.length)??0)*Gt;l.useEffect(()=>{i||b(0)},[i,a]);const H=x!==0?x:i==="trailing"?-v:0;function S(m){var y,R;m.button===0&&(f.current={pointerId:m.pointerId,startX:m.clientX},(R=(y=m.currentTarget).setPointerCapture)==null||R.call(y,m.pointerId))}function T(m){const y=f.current;if(!y||y.pointerId!==m.pointerId)return;const R=v>0?v+10:0,C=Math.max(-R,Math.min(0,m.clientX-y.startX));b(C)}function p(m){var R,C;const y=f.current;if(!(!y||y.pointerId!==m.pointerId)){if((C=(R=m.currentTarget).releasePointerCapture)==null||C.call(R,m.pointerId),f.current=null,x<=-44&&(h!=null&&h.length)){j.trigger("gesture"),u("trailing"),b(0);return}u(null),b(0)}}function o(m){var R,C;const y=f.current;!y||y.pointerId!==m.pointerId||((C=(R=m.currentTarget).releasePointerCapture)==null||C.call(R,m.pointerId),f.current=null,b(0))}return e.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":i??"closed","data-dragging":x!==0,children:[h==null?void 0:h.map((m,y)=>e.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":m.tone,style:{right:y*Gt,width:Gt},onClick:()=>{j.trigger(m.tone==="danger"?"warning":"action"),u(null),m.onPress()},children:m.label},`trailing-${y}`)),e.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${H}px)`},onPointerDown:S,onPointerMove:T,onPointerUp:p,onPointerCancel:o,children:g})]})}function ds({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:g,onMenuTriggerRef:j,onToggleMenu:f,onViewCommitChanges:x,onCopyCommitHash:b,onCopyCommitMessage:v,onCopyCommitVersion:H,onExplainCommitChange:S,onUndoLastCommit:T,onLoadMore:p}){return a.length?e.jsxs("div",{className:"git-mobile-history-list",children:[a.map(o=>e.jsx("article",{className:"git-mobile-history-entry","data-kind":o.commitKind,children:e.jsxs("div",{className:"git-mobile-history-entry-main",children:[e.jsx("span",{className:"git-history-marker","data-kind":o.commitKind,"aria-hidden":"true"}),e.jsxs("div",{className:"git-mobile-history-copy",children:[e.jsxs("div",{className:"git-history-title-row",children:[e.jsx("strong",{title:o.subject,children:o.subject}),e.jsx("span",{className:"git-history-kind-badge","data-kind":o.commitKind,children:ni(o.commitKind)})]}),o.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:o.refs.map(m=>e.jsx("span",{className:"git-history-ref-pill","data-kind":m.kind,"data-remote-index":String(ii(m.remoteName)),children:m.name},`${o.commitHash}:${m.kind}:${m.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:o.commitHash.slice(0,8)}),e.jsx("span",{children:o.authorName}),e.jsx("time",{dateTime:o.authoredAt,children:si(o.authoredAt)})]})]}),e.jsx("button",{type:"button",className:"git-icon-button",ref:m=>j(o.commitHash,m),"aria-label":n("git.historyItemMenu"),onClick:()=>f(o.commitHash),children:e.jsx(Ge,{})})]})},o.commitHash)),u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:p,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"git-tree-status",children:n("git.noHistory")})}function Bn({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:g,className:j,useNativeContextMenu:f=!1,onMenuTriggerRef:x,onScroll:b,onToggleMenu:v,onOpenContextMenu:H,onViewCommitChanges:S,onCopyCommitHash:T,onCopyCommitMessage:p,onCopyCommitVersion:o,onExplainCommitChange:m,onUndoLastCommit:y,onLoadMore:R}){const C=Yn();return a.length?e.jsxs("div",{ref:C,className:["git-history-list",j].filter(Boolean).join(" "),onScroll:b,"data-scrollbar-autohide":"true",children:[a.map(M=>{const F=g===M.commitHash;return e.jsxs("article",{className:"git-history-entry","data-kind":M.commitKind,"data-menu-open":F?"true":"false",onContextMenu:P=>{!f||!H||(P.preventDefault(),P.stopPropagation(),H(M))},children:[e.jsx("span",{className:"git-history-marker","data-kind":M.commitKind,"aria-hidden":"true"}),e.jsxs("div",{className:"git-history-body",children:[e.jsxs("div",{className:"git-history-title-row",children:[e.jsx("strong",{title:M.subject,children:M.subject}),e.jsxs("div",{className:"git-history-title-actions",children:[e.jsx("span",{className:"git-history-kind-badge","data-kind":M.commitKind,children:ni(M.commitKind)}),f?null:e.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:P=>x(M.commitHash,P),"aria-label":n("git.historyItemMenu"),onClick:()=>{v(M.commitHash)},children:e.jsx(Ge,{})})]})]}),M.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:M.refs.map(P=>e.jsx("span",{className:"git-history-ref-pill","data-kind":P.kind,"data-remote-index":String(ii(P.remoteName)),children:P.name},`${M.commitHash}:${P.kind}:${P.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:M.commitHash.slice(0,8)}),e.jsx("span",{children:M.authorName}),e.jsx("time",{dateTime:M.authoredAt,children:si(M.authoredAt)})]})]})]},M.commitHash)}),i?e.jsxs("p",{className:"git-history-loading",children:[n("git.refreshNow"),"..."]}):null,u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:R,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"status-text",children:n("git.noHistory")})}function ms({item:a,canUndo:i,actioning:u,onViewCommitChanges:h,onCopyCommitHash:g,onCopyCommitMessage:j,onCopyCommitVersion:f,onExplainCommitChange:x,onUndoLastCommit:b}){return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>h(a.commitHash),children:e.jsx("span",{children:n("git.viewCommitChanges")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>g(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitHash")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>j(a),children:e.jsx("span",{children:n("git.copyCommitMessage")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>f(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitVersion")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>x(a.commitHash),children:e.jsx("span",{children:n("git.explainCommitAction")})}),i?e.jsx("button",{type:"button",className:"git-menu-item",disabled:u,onClick:b,children:e.jsx("span",{children:n("git.undoLastCommit")})}):null]})}function Jn({nodes:a,depth:i,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:g,onSelectFile:j,onPreviewFile:f,onToggleMobileSelection:x,onStageToggle:b,onDiscard:v,actioning:H,variant:S,isMobileViewport:T,selectedMobilePathSet:p}){return a.map(o=>{if(o.kind==="directory"){const R=!u.has(o.path),C=Yt(o.children),M=`${S==="staged"?n("git.unstage"):n("git.stage")} ${o.path}`,F=`${n("git.discard")} ${o.path}`;return e.jsxs("div",{className:"git-tree-node",children:[e.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":R,children:[e.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+i*8}px`},onClick:()=>g(o.path),children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":R,children:e.jsx(ft,{expanded:R})}),e.jsx("span",{className:"git-tree-label git-tree-label-directory",children:o.name})]}),!T&&C.length>0?e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":M,title:M,onClick:()=>void b(C,S==="staged"),disabled:H,children:e.jsx(Xt,{staged:S==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":F,title:F,onClick:()=>void v(C),disabled:H,children:e.jsx(qt,{})}):null]}):null]}),R?e.jsx("div",{className:"git-tree-children",role:"group",children:Jn({nodes:o.children,depth:i+1,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:g,onSelectFile:j,onPreviewFile:f,onToggleMobileSelection:x,onStageToggle:b,onDiscard:v,actioning:H,variant:S,isMobileViewport:T,selectedMobilePathSet:p})}):null]},`directory:${o.path}`)}const m=p.has(o.path),y=T?m:h===o.path;return T?e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":y,"data-mobile":"true",children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${o.name}`,onChange:()=>x(o.change.path)}),e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":y,"data-mobile":"true",style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>x(o.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(o.name),"aria-hidden":"true",children:Wt(o.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:o.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":o.status,children:o.status})})]})]},`file:${o.path}`):e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":y,children:[e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":y,style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>{j(o.change.path),f&&f(o.change.path,o.change)},children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(o.name),"aria-hidden":"true",children:Wt(o.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:o.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":o.status,children:o.status})})]}),e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":o.variant==="staged"?n("git.unstage"):n("git.stage"),title:o.variant==="staged"?n("git.unstage"):n("git.stage"),onClick:()=>void b([o.change.path],o.variant==="staged"),disabled:H,children:e.jsx(Xt,{staged:o.variant==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":n("git.discard"),title:n("git.discard"),onClick:()=>void v([o.change.path]),disabled:H,children:e.jsx(qt,{})}):null]})]},`file:${o.path}`)})}function Vn(a,i){return{kind:"directory",name:a,path:i,children:new Map}}function Wn(a,i){const u=Vn("","");for(const h of a){const g=h.path.replace(/\\/g,"/"),j=g.split("/").filter(Boolean);let f=u;j.forEach((x,b)=>{const v=j.slice(0,b+1).join("/");if(b===j.length-1){f.children.set(`file:${v}`,{kind:"file",name:x,path:g,change:h,status:hs(h,i),variant:i});return}const H=`directory:${v}`,S=f.children.get(H);if(S&&S.kind==="directory"){f=S;return}const T=Vn(x,v);f.children.set(H,T),f=T})}return ei(Qn([...u.children.values()]))}function Qn(a){return[...a].sort((i,u)=>i.kind!==u.kind?i.kind==="directory"?-1:1:i.name.localeCompare(u.name,"zh-CN")).map(i=>i.kind==="directory"?{kind:"directory",name:i.name,path:i.path,children:Qn([...i.children.values()])}:i)}function ei(a){return a.map(i=>{var f;if(i.kind!=="directory")return i;const u=ei(i.children);let h=i.name,g=i.path,j=u;for(;j.length===1&&((f=j[0])==null?void 0:f.kind)==="directory";){const x=j[0];h=`${h}/${x.name}`,g=x.path,j=x.children}return{kind:"directory",name:h,path:g,children:j}})}function zn(a,i,u){const h=new Set(a);return i.filter(g=>It(g,u)&&h.has(g.path)).map(g=>g.path)}function Yt(a){const i=[],u=new Set;function h(g){if(g.kind==="file"){u.has(g.path)||(u.add(g.path),i.push(g.path));return}g.children.forEach(h)}return a.forEach(h),i}function It(a,i){return i==="staged"?!!a.stagedStatus:!!a.worktreeStatus}function hs(a,i){return i==="staged"?a.stagedStatus??a.status:a.worktreeStatus??a.status}function gs(a){return{subject:ti(a).trim(),body:null,footer:null,source:"manual"}}function ti(a){return a.replace(/[\r\n]+/g," ")}function fs(a){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const i=document.createElement("textarea");i.value=a,i.setAttribute("readonly","true"),i.style.position="fixed",i.style.top="-9999px",i.style.left="-9999px",i.style.opacity="0",document.body.appendChild(i),i.focus(),i.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(i)}}function pe(a){const i=a.subject.trim(),u=a.body.trim();return u?`${i}
2
2
 
3
3
  ${u}`:i}function ps(a){const i=a.changedFiles.map(g=>`- [${g.status}] ${g.path}${g.oldPath?` (from ${g.oldPath})`:""}`).join(`
4
4
  `),u=a.diffContent.length>$t?a.diffContent.slice(0,$t):a.diffContent,h=a.diffContent.length>$t||a.diffTruncated?`
5
5
  注意:diff 内容过长,下面已经截断,只分析可见部分,同时明确指出可能遗漏的区域。`:"";return["请你分析下面这个 Git 提交。","输出要求:","1. 先用 3 到 5 句话说明这次改动的核心目的。","2. 按文件说明关键改动点,不要泛泛而谈。","3. 指出潜在风险、边界情况和可能的回归点。","4. 如果提交信息写得差,给出一条更合适的中文提交说明。","",`版本号:${a.versionLabel}`,`Commit Hash:${a.commitHash}`,`提交标题:${a.subject}`,`提交作者:${a.authorName} <${a.authorEmail}>`,`提交时间:${a.authoredAt}`,"","变更文件:",i||"- 无",h,"","Diff:",u||"(empty diff)"].join(`
6
- `)}function bs(a){if(!a)return;a.style.height="0px";const i=Math.min(Math.max(a.scrollHeight,34),120);a.style.height=`${i}px`,a.style.overflowY=a.scrollHeight>120?"auto":"hidden"}function ni(a){switch(a){case"local":return n("git.historyKindLocal");case"remote":return n("git.historyKindRemote");default:return n("git.historyKindShared")}}function ii(a){if(!a)return 0;let i=0;for(const u of a)i=i*33+u.charCodeAt(0)>>>0;return i%6}function xs(a){const i=Date.parse(a);return Number.isNaN(i)?a:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(i)}function L(a,i){return a instanceof qn?js(a)??a.message:typeof a=="object"&&a&&"message"in a?a.message:i}function ke(a){return`git-sidebar.snapshot.${a}`}function Bt(a){return a?!!(a.status||a.branches||a.history.length>0||a.historyTotalCount>0||a.historyNextCursor||a.revision):!1}function ys(a){return a?a.snapshot.enabled!==!1:!0}function js(a){switch(a.errorCode){case"UNAUTHORIZED":return n("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return n("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return n("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return n("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return n("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return n("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return n("git.errors.invalidTarget");case"NOT_STAGED":return n("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return n("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return n("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return n("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return n("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return n("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return n("git.errors.pushFailed");case"GIT_PULL_FAILED":return n("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return n("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return n("git.errors.commandTimeout");case"GIT_INIT_FAILED":return n("git.errors.initFailed");case"GIT_DISCARD_FAILED":return n("git.discardFailed");case"GIT_UNDO_FAILED":return n("git.undoLastCommitFailed");default:return null}}function Kn(a){return a instanceof qn&&a.errorCode==="GIT_REMOTE_AUTH_FAILED"}function Cs(a,i=!1){return!a||!a.mode||a.mode==="none"?ht:a.mode==="basic"?{authMode:"basic",username:a.username??"",password:a.password??"",token:"",rememberOnHost:i}:a.mode==="token"?{authMode:"token",username:a.username??"",password:"",token:a.token??"",rememberOnHost:i}:ht}function Ns(a){return a.authMode==="none"?null:a.authMode==="basic"?{mode:"basic",username:a.username.trim(),password:a.password}:{mode:"token",username:a.username.trim()||void 0,token:a.token}}function vs(a,i){const u=gt(a,i);if(!u)return"generic";const h=u.pushUrl||u.fetchUrl;return Ts(h)?"github":"generic"}function gt(a,i){return a.find(u=>u.name===i)??a.find(u=>u.name==="origin")??a[0]??null}function In(a){var i;return(i=gt(a))==null?void 0:i.name}function Ss(a,i){return i!=null&&i.auth?{kind:"session",label:n("git.remoteAuthConfiguredInSession")}:a.credentialConfigured?{kind:"host",label:n("git.remoteAuthConfiguredOnHost")}:{kind:"missing",label:n("git.remoteAuthNotConfigured")}}function Ts(a){const i=(a==null?void 0:a.trim().toLowerCase())??"";return i.startsWith("https://github.com/")||i.startsWith("http://github.com/")||i.startsWith("ssh://git@github.com/")||i.startsWith("git@github.com:")}function Xn(a,i,u){const h=Math.max(0,u.width),g=Math.max(0,u.height),j=Math.max(0,g-O*2),f=Math.max(0,h-O*2),x=Math.min(Math.max(i.width||Kt,0),f),b=Math.max(0,g-a.bottom-mt-O),v=Math.max(0,a.top-mt-O),R=b<i.height&&v>b,T=Vt(Math.max(R?v:b,us),0,j),p=Math.min(Math.max(i.height,0),T),o=R?a.top-mt-p:a.bottom+mt,m=Math.max(O,g-O-p),y=Math.max(O,h-O-x);return{top:Vt(o,O,m),left:Vt(a.right-x,O,y),maxHeight:Math.max(0,T),transformOrigin:`${R?"bottom":"top"} right`}}function Vt(a,i,u){return!Number.isFinite(a)||u<i?i:Math.min(Math.max(a,i),u)}function ft({expanded:a}){return e.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:a?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Xt({staged:a}){return a?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M5 12h14"})}):e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M12 5v14"}),e.jsx("path",{d:"M5 12h14"})]})}function qt(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ms(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function Ge(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function si(a){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(a))}catch{return a}}export{Fs as GitSidebar,Xn as resolveGitOperationsMenuPosition};
6
+ `)}function bs(a){if(!a)return;a.style.height="0px";const i=Math.min(Math.max(a.scrollHeight,34),120);a.style.height=`${i}px`,a.style.overflowY=a.scrollHeight>120?"auto":"hidden"}function ni(a){switch(a){case"local":return n("git.historyKindLocal");case"remote":return n("git.historyKindRemote");default:return n("git.historyKindShared")}}function ii(a){if(!a)return 0;let i=0;for(const u of a)i=i*33+u.charCodeAt(0)>>>0;return i%6}function xs(a){const i=Date.parse(a);return Number.isNaN(i)?a:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(i)}function L(a,i){return a instanceof qn?js(a)??a.message:typeof a=="object"&&a&&"message"in a?a.message:i}function ke(a){return`git-sidebar.snapshot.${a}`}function Bt(a){return a?!!(a.status||a.branches||a.history.length>0||a.historyTotalCount>0||a.historyNextCursor||a.revision):!1}function ys(a){return a?a.snapshot.enabled!==!1:!0}function js(a){switch(a.errorCode){case"UNAUTHORIZED":return n("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return n("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return n("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return n("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return n("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return n("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return n("git.errors.invalidTarget");case"NOT_STAGED":return n("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return n("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return n("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return n("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return n("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return n("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return n("git.errors.pushFailed");case"GIT_PULL_FAILED":return n("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return n("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return n("git.errors.commandTimeout");case"GIT_INIT_FAILED":return n("git.errors.initFailed");case"GIT_DISCARD_FAILED":return n("git.discardFailed");case"GIT_UNDO_FAILED":return n("git.undoLastCommitFailed");default:return null}}function Kn(a){return a instanceof qn&&a.errorCode==="GIT_REMOTE_AUTH_FAILED"}function Cs(a,i=!1){return!a||!a.mode||a.mode==="none"?ht:a.mode==="basic"?{authMode:"basic",username:a.username??"",password:a.password??"",token:"",rememberOnHost:i}:a.mode==="token"?{authMode:"token",username:a.username??"",password:"",token:a.token??"",rememberOnHost:i}:ht}function Ns(a){return a.authMode==="none"?null:a.authMode==="basic"?{mode:"basic",username:a.username.trim(),password:a.password}:{mode:"token",username:a.username.trim()||void 0,token:a.token}}function vs(a,i){const u=gt(a,i);if(!u)return"generic";const h=u.pushUrl||u.fetchUrl;return Ts(h)?"github":"generic"}function gt(a,i){return a.find(u=>u.name===i)??a.find(u=>u.name==="origin")??a[0]??null}function In(a){var i;return(i=gt(a))==null?void 0:i.name}function Ss(a,i){return i!=null&&i.auth?{kind:"session",label:n("git.remoteAuthConfiguredInSession")}:a.credentialConfigured?{kind:"host",label:n("git.remoteAuthConfiguredOnHost")}:{kind:"missing",label:n("git.remoteAuthNotConfigured")}}function Ts(a){const i=(a==null?void 0:a.trim().toLowerCase())??"";return i.startsWith("https://github.com/")||i.startsWith("http://github.com/")||i.startsWith("ssh://git@github.com/")||i.startsWith("git@github.com:")}function Xn(a,i,u){const h=Math.max(0,u.width),g=Math.max(0,u.height),j=Math.max(0,g-O*2),f=Math.max(0,h-O*2),x=Math.min(Math.max(i.width||Kt,0),f),b=Math.max(0,g-a.bottom-mt-O),v=Math.max(0,a.top-mt-O),H=b<i.height&&v>b,T=Vt(Math.max(H?v:b,us),0,j),p=Math.min(Math.max(i.height,0),T),o=H?a.top-mt-p:a.bottom+mt,m=Math.max(O,g-O-p),y=Math.max(O,h-O-x);return{top:Vt(o,O,m),left:Vt(a.right-x,O,y),maxHeight:Math.max(0,T),transformOrigin:`${H?"bottom":"top"} right`}}function Vt(a,i,u){return!Number.isFinite(a)||u<i?i:Math.min(Math.max(a,i),u)}function ft({expanded:a}){return e.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:a?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Xt({staged:a}){return a?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M5 12h14"})}):e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M12 5v14"}),e.jsx("path",{d:"M5 12h14"})]})}function qt(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ms(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function Ge(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function si(a){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(a))}catch{return a}}export{Fs as GitSidebar,Xn as resolveGitOperationsMenuPosition};
@@ -1 +1 @@
1
- import{b as c,j as e,t as n}from"./index-NGxWr8Ix.js";import{e as j,M as f,f as p,h as g,i as M,j as S,k as v,S as L}from"./model-switch-api-CPtou49j.js";function E({open:o,workspaces:l,workspaceOptions:t,initialWorkspaceId:d,onClose:b,onSelect:x}){const[a,m]=c.useState(""),[h,u]=c.useState(!1),k=j(),i=c.useMemo(()=>t??l.map(s=>({workspace:s,label:s.name,subtitle:s.path,depth:0,kind:"workspace",meta:null})),[t,l]),w=c.useMemo(()=>i.map(s=>s.workspace.id).join("|"),[i]);if(c.useEffect(()=>{o&&(m(N(i,d)),u(!1))},[d,o,w]),!o)return null;const r=i.find(s=>s.workspace.id===a)??i[0]??null;return e.jsxs(f,{open:o,title:n("shell.createSessionModalTitle"),description:n("shell.createSessionModalDescription"),kind:"form",height:"three-quarter",className:"mobile-create-session-sheet",cardClassName:"mobile-create-session-sheet-card",bodyClassName:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",showHandle:!0,onClose:b,children:[e.jsx(p,{className:"mobile-create-session-section",tone:"accent",children:e.jsxs(g,{label:n("shell.createSessionWorkspaceLabel"),children:[e.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${n("shell.createSessionWorkspaceLabel")} ${(r==null?void 0:r.label)??""}`.trim(),"aria-expanded":h?"true":"false",disabled:i.length===0,onClick:()=>{k.trigger("selection"),u(s=>!s)},children:[e.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[e.jsx("strong",{children:(r==null?void 0:r.label)??n("common.unknown")}),e.jsx("span",{children:(r==null?void 0:r.subtitle)??n("common.unknown")})]}),e.jsx(C,{expanded:h})]}),h?e.jsx(M,{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:i.map(s=>e.jsx(S,{as:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row","data-worktree-kind":s.kind,"data-worktree-depth":s.depth,selected:s.workspace.id===a,trailing:e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:s.workspace.id===a?e.jsx(I,{}):e.jsx(y,{})}),style:{"--mobile-workspace-tree-depth":String(s.depth)},onClick:()=>{s.workspace.id!==a&&k.trigger("selection"),m(s.workspace.id),u(!1)},children:e.jsxs("span",{className:"mobile-create-session-workspace-option-copy",children:[e.jsxs("strong",{children:[s.kind==="worktree"?e.jsx(v,{className:"mobile-workspace-home-worktree-badge",children:n("shell.mobileWorktreeBadge")}):null,s.label]}),e.jsx("span",{children:s.subtitle})]})},s.workspace.id))}):null]})}),e.jsx(p,{className:"mobile-create-session-provider-block",heading:n("shell.createSessionProviderLabel"),children:e.jsx(L,{disabled:!a,workspaceId:a||null,onSelect:s=>{a&&x(a,s)}})})]})}function N(o,l){var t;return l&&o.some(d=>d.workspace.id===l)?l:((t=o[0])==null?void 0:t.workspace.id)??""}function C({expanded:o}){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":o?"true":"false",children:e.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function y(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function I(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}export{E as M};
1
+ import{b as c,j as e,t as n}from"./index-CjewzOUG.js";import{e as j,M as f,f as p,h as g,i as M,j as S,k as v,S as L}from"./model-switch-api-Br0ivfe5.js";function E({open:o,workspaces:l,workspaceOptions:t,initialWorkspaceId:d,onClose:b,onSelect:x}){const[a,m]=c.useState(""),[h,u]=c.useState(!1),k=j(),i=c.useMemo(()=>t??l.map(s=>({workspace:s,label:s.name,subtitle:s.path,depth:0,kind:"workspace",meta:null})),[t,l]),w=c.useMemo(()=>i.map(s=>s.workspace.id).join("|"),[i]);if(c.useEffect(()=>{o&&(m(N(i,d)),u(!1))},[d,o,w]),!o)return null;const r=i.find(s=>s.workspace.id===a)??i[0]??null;return e.jsxs(f,{open:o,title:n("shell.createSessionModalTitle"),description:n("shell.createSessionModalDescription"),kind:"form",height:"three-quarter",className:"mobile-create-session-sheet",cardClassName:"mobile-create-session-sheet-card",bodyClassName:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",showHandle:!0,onClose:b,children:[e.jsx(p,{className:"mobile-create-session-section",tone:"accent",children:e.jsxs(g,{label:n("shell.createSessionWorkspaceLabel"),children:[e.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${n("shell.createSessionWorkspaceLabel")} ${(r==null?void 0:r.label)??""}`.trim(),"aria-expanded":h?"true":"false",disabled:i.length===0,onClick:()=>{k.trigger("selection"),u(s=>!s)},children:[e.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[e.jsx("strong",{children:(r==null?void 0:r.label)??n("common.unknown")}),e.jsx("span",{children:(r==null?void 0:r.subtitle)??n("common.unknown")})]}),e.jsx(C,{expanded:h})]}),h?e.jsx(M,{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:i.map(s=>e.jsx(S,{as:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row","data-worktree-kind":s.kind,"data-worktree-depth":s.depth,selected:s.workspace.id===a,trailing:e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:s.workspace.id===a?e.jsx(I,{}):e.jsx(y,{})}),style:{"--mobile-workspace-tree-depth":String(s.depth)},onClick:()=>{s.workspace.id!==a&&k.trigger("selection"),m(s.workspace.id),u(!1)},children:e.jsxs("span",{className:"mobile-create-session-workspace-option-copy",children:[e.jsxs("strong",{children:[s.kind==="worktree"?e.jsx(v,{className:"mobile-workspace-home-worktree-badge",children:n("shell.mobileWorktreeBadge")}):null,s.label]}),e.jsx("span",{children:s.subtitle})]})},s.workspace.id))}):null]})}),e.jsx(p,{className:"mobile-create-session-provider-block",heading:n("shell.createSessionProviderLabel"),children:e.jsx(L,{disabled:!a,workspaceId:a||null,onSelect:s=>{a&&x(a,s)}})})]})}function N(o,l){var t;return l&&o.some(d=>d.workspace.id===l)?l:((t=o[0])==null?void 0:t.workspace.id)??""}function C({expanded:o}){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":o?"true":"false",children:e.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function y(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function I(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}export{E as M};
@@ -1 +1 @@
1
- import{j as i}from"./index-NGxWr8Ix.js";function m({children:e,className:o,frameRef:r,...a}){return i.jsx("div",{ref:r,className:["mobile-top-header-frame",o].filter(Boolean).join(" "),...a,children:e})}export{m as M};
1
+ import{j as i}from"./index-CjewzOUG.js";function m({children:e,className:o,frameRef:r,...a}){return i.jsx("div",{ref:r,className:["mobile-top-header-frame",o].filter(Boolean).join(" "),...a,children:e})}export{m as M};