@jingyi0605/codingns 0.6.0 → 0.6.5

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 (253) hide show
  1. package/bin/codingns.mjs +240 -2
  2. package/dist/public/assets/AdaptiveButlerPage-CfsUVZKl.js +3 -0
  3. package/dist/public/assets/{App-BZvapsi8.js → App-B9HcTkMT.js} +3 -3
  4. package/dist/public/assets/{BootstrapPage-gHSoa4JN.js → BootstrapPage-BgLdZEKQ.js} +1 -1
  5. package/dist/public/assets/ConversationPage-Cj8go7L0.js +4 -0
  6. package/dist/public/assets/{DesktopDetachPreviewPage-4eMRxiBW.js → DesktopDetachPreviewPage-YCBnyC58.js} +1 -1
  7. package/dist/public/assets/DesktopWindowPage-CrvndE23.js +2 -0
  8. package/dist/public/assets/FileContextPanel-CdC7GGw5.js +1 -0
  9. package/dist/public/assets/GitSidebar-z2SBinQh.js +6 -0
  10. package/dist/public/assets/MobileCreateSessionSheet-Cb2HM-y3.js +1 -0
  11. package/dist/public/assets/{MobileTopHeaderFrame-Bwv8Ovm_.js → MobileTopHeaderFrame-etF2HKlm.js} +1 -1
  12. package/dist/public/assets/MobileWorkspaceSwitcherHeader-CuGJ31kb.js +1 -0
  13. package/dist/public/assets/{RelayConnectEntryPage-D_4YL-YH.js → RelayConnectEntryPage-BB6DbGtP.js} +1 -1
  14. package/dist/public/assets/{ServerSettingsModal-CMSm3BZU.js → ServerSettingsModal-Bl1sacZg.js} +1 -1
  15. package/dist/public/assets/SessionIndexPage-NbF9gJnp.js +1 -0
  16. package/dist/public/assets/SettingsPage-DGsmQpLv.js +1 -0
  17. package/dist/public/assets/TerminalManagerPanel-BOm8Hi_v.js +1 -0
  18. package/dist/public/assets/{TerminalPage-DaooFaJ4.js → TerminalPage-B5JNFU6w.js} +19 -19
  19. package/dist/public/assets/TerminalRuntimeFallbackModal-CM3LRKOJ.js +1 -0
  20. package/dist/public/assets/{ToolFilesPage-CGxBvYG0.js → ToolFilesPage-GSqKQsj_.js} +1 -1
  21. package/dist/public/assets/ToolGitPage-BVFWMMQp.js +1 -0
  22. package/dist/public/assets/ToolProcessesPage-DZ456fYz.js +1 -0
  23. package/dist/public/assets/ToolsHomePage-DsJp0y8A.js +1 -0
  24. package/dist/public/assets/WorkbenchLandingPage-DyPei0e-.js +1 -0
  25. package/dist/public/assets/WorkbenchLayout-DlbgBT3n.js +4 -0
  26. package/dist/public/assets/WorkbenchModal-LNfB69qx.js +1 -0
  27. package/dist/public/assets/WorkbenchShellRoute-BsxumYx5.js +1 -0
  28. package/dist/public/assets/WorkbenchShellRoute-DhQo_0vu.css +1 -0
  29. package/dist/public/assets/WorkspaceDebugDetailPage-CaXj5zVI.js +1 -0
  30. package/dist/public/assets/WorkspaceDetailPage-DOexuuaw.js +1 -0
  31. package/dist/public/assets/WorkspaceHomePage-DkCHNjKD.js +1 -0
  32. package/dist/public/assets/{client-runtime-manager-BZpL17fc.js → client-runtime-manager-6OoYHXGd.js} +1 -1
  33. package/dist/public/assets/{file-tree-icon-Db5LXC8h.js → file-tree-icon-9pt1OStn.js} +1 -1
  34. package/dist/public/assets/index-BwlbvwaA.css +1 -0
  35. package/dist/public/assets/index-DSw-TkQL.js +42 -0
  36. package/dist/public/assets/legna-code-6TqgZ4Ls.png +0 -0
  37. package/dist/public/assets/{login-direct-candidate-resolver-1mxe_Oh8.js → login-direct-candidate-resolver-CLlYtBRq.js} +1 -1
  38. package/dist/public/assets/model-switch-api-C-l8-E1S.js +1 -0
  39. package/dist/public/assets/{preferences-service-DWnzl5a0.js → preferences-service-BCcfYP_d.js} +1 -1
  40. package/dist/public/assets/{relay-entry-C5_Iay0I.js → relay-entry-BmLkMKuq.js} +1 -1
  41. package/dist/public/assets/session-runtime-machine-DgtvREca.js +21 -0
  42. package/dist/public/assets/{terminal-runtime-meta-cdtWVfCm.js → terminal-runtime-meta-0h-75uRy.js} +1 -1
  43. package/dist/public/assets/useRegisteredDebugTemplates-rBVmAqh3.js +1 -0
  44. package/dist/public/index.html +2 -2
  45. package/dist/server/config/env.d.ts +2 -0
  46. package/dist/server/config/env.js +7 -0
  47. package/dist/server/config/env.js.map +1 -1
  48. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +4 -1
  49. package/dist/server/modules/assistant-capability/assistant-capability-service.js +12 -1
  50. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  51. package/dist/server/modules/butler/butler-control-session-service.d.ts +4 -1
  52. package/dist/server/modules/butler/butler-control-session-service.js +17 -1
  53. package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
  54. package/dist/server/modules/butler/butler-profile-service.d.ts +3 -1
  55. package/dist/server/modules/butler/butler-profile-service.js +16 -4
  56. package/dist/server/modules/butler/butler-profile-service.js.map +1 -1
  57. package/dist/server/modules/model-switch/cc-switch-adapter.d.ts +7 -0
  58. package/dist/server/modules/model-switch/cc-switch-adapter.js +17 -0
  59. package/dist/server/modules/model-switch/cc-switch-adapter.js.map +1 -1
  60. package/dist/server/modules/opencli/opencli-bridge-skill-service.d.ts +12 -0
  61. package/dist/server/modules/opencli/opencli-bridge-skill-service.js +124 -0
  62. package/dist/server/modules/opencli/opencli-bridge-skill-service.js.map +1 -0
  63. package/dist/server/modules/opencli/opencli-catalog-service.d.ts +50 -0
  64. package/dist/server/modules/opencli/opencli-catalog-service.js +345 -0
  65. package/dist/server/modules/opencli/opencli-catalog-service.js.map +1 -0
  66. package/dist/server/modules/opencli/opencli-controller.d.ts +13 -0
  67. package/dist/server/modules/opencli/opencli-controller.js +30 -0
  68. package/dist/server/modules/opencli/opencli-controller.js.map +1 -0
  69. package/dist/server/modules/opencli/opencli-health-service.d.ts +28 -0
  70. package/dist/server/modules/opencli/opencli-health-service.js +106 -0
  71. package/dist/server/modules/opencli/opencli-health-service.js.map +1 -0
  72. package/dist/server/modules/opencli/opencli-install-discovery.d.ts +23 -0
  73. package/dist/server/modules/opencli/opencli-install-discovery.js +130 -0
  74. package/dist/server/modules/opencli/opencli-install-discovery.js.map +1 -0
  75. package/dist/server/modules/opencli/opencli-management-service.d.ts +59 -0
  76. package/dist/server/modules/opencli/opencli-management-service.js +152 -0
  77. package/dist/server/modules/opencli/opencli-management-service.js.map +1 -0
  78. package/dist/server/modules/opencli/opencli-runtime-builder.d.ts +11 -0
  79. package/dist/server/modules/opencli/opencli-runtime-builder.js +214 -0
  80. package/dist/server/modules/opencli/opencli-runtime-builder.js.map +1 -0
  81. package/dist/server/modules/opencli/opencli-runtime-layout.d.ts +3 -0
  82. package/dist/server/modules/opencli/opencli-runtime-layout.js +11 -0
  83. package/dist/server/modules/opencli/opencli-runtime-layout.js.map +1 -0
  84. package/dist/server/modules/opencli/opencli-runtime-profile-service.d.ts +29 -0
  85. package/dist/server/modules/opencli/opencli-runtime-profile-service.js +104 -0
  86. package/dist/server/modules/opencli/opencli-runtime-profile-service.js.map +1 -0
  87. package/dist/server/modules/opencli/opencli-runtime-resolver.d.ts +29 -0
  88. package/dist/server/modules/opencli/opencli-runtime-resolver.js +110 -0
  89. package/dist/server/modules/opencli/opencli-runtime-resolver.js.map +1 -0
  90. package/dist/server/modules/opencli/opencli-session-prompt-service.d.ts +11 -0
  91. package/dist/server/modules/opencli/opencli-session-prompt-service.js +66 -0
  92. package/dist/server/modules/opencli/opencli-session-prompt-service.js.map +1 -0
  93. package/dist/server/modules/parallel-sessions/parallel-session-controller.d.ts +4 -0
  94. package/dist/server/modules/parallel-sessions/parallel-session-controller.js +7 -0
  95. package/dist/server/modules/parallel-sessions/parallel-session-controller.js.map +1 -1
  96. package/dist/server/modules/parallel-sessions/parallel-session-group-service.d.ts +6 -1
  97. package/dist/server/modules/parallel-sessions/parallel-session-group-service.js +36 -2
  98. package/dist/server/modules/parallel-sessions/parallel-session-group-service.js.map +1 -1
  99. package/dist/server/modules/provider/opencode-model-options.d.ts +1 -0
  100. package/dist/server/modules/provider/opencode-model-options.js +54 -12
  101. package/dist/server/modules/provider/opencode-model-options.js.map +1 -1
  102. package/dist/server/modules/provider/provider-catalog-service.d.ts +46 -0
  103. package/dist/server/modules/provider/provider-catalog-service.js +249 -0
  104. package/dist/server/modules/provider/provider-catalog-service.js.map +1 -0
  105. package/dist/server/modules/provider/provider-controller.d.ts +20 -2
  106. package/dist/server/modules/provider/provider-controller.js +65 -5
  107. package/dist/server/modules/provider/provider-controller.js.map +1 -1
  108. package/dist/server/modules/provider/provider-disabled.d.ts +8 -0
  109. package/dist/server/modules/provider/provider-disabled.js +45 -0
  110. package/dist/server/modules/provider/provider-disabled.js.map +1 -0
  111. package/dist/server/modules/provider/provider-discovery-helper-client.d.ts +3 -0
  112. package/dist/server/modules/provider/provider-discovery-helper-client.js.map +1 -1
  113. package/dist/server/modules/provider/provider-discovery-helper-process.js +4 -4
  114. package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
  115. package/dist/server/modules/provider/provider-discovery-runtime.d.ts +1 -1
  116. package/dist/server/modules/provider/provider-discovery-runtime.js +17 -9
  117. package/dist/server/modules/provider/provider-discovery-runtime.js.map +1 -1
  118. package/dist/server/modules/sessions/claude-compatible-provider-registry.d.ts +16 -0
  119. package/dist/server/modules/sessions/claude-compatible-provider-registry.js +91 -0
  120. package/dist/server/modules/sessions/claude-compatible-provider-registry.js.map +1 -0
  121. package/dist/server/modules/sessions/claude-runtime-helper-client.d.ts +1 -0
  122. package/dist/server/modules/sessions/claude-runtime-helper-client.js +14 -0
  123. package/dist/server/modules/sessions/claude-runtime-helper-client.js.map +1 -1
  124. package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +1 -0
  125. package/dist/server/modules/sessions/codex-app-server-helper-client.js +10 -0
  126. package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -1
  127. package/dist/server/modules/sessions/provider-session-delete-cli.js +2 -0
  128. package/dist/server/modules/sessions/provider-session-delete-cli.js.map +1 -1
  129. package/dist/server/modules/sessions/session-controller.d.ts +7 -0
  130. package/dist/server/modules/sessions/session-controller.js +22 -0
  131. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  132. package/dist/server/modules/sessions/session-history-service.d.ts +18 -2
  133. package/dist/server/modules/sessions/session-history-service.js +330 -29
  134. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  135. package/dist/server/modules/sessions/session-live-runtime-router-service.js +9 -4
  136. package/dist/server/modules/sessions/session-live-runtime-router-service.js.map +1 -1
  137. package/dist/server/modules/sessions/session-live-runtime-service.d.ts +22 -5
  138. package/dist/server/modules/sessions/session-live-runtime-service.js +350 -122
  139. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  140. package/dist/server/modules/sessions/session-message-attachment-service.js +2 -2
  141. package/dist/server/modules/sessions/session-message-attachment-service.js.map +1 -1
  142. package/dist/server/modules/sessions/session-permission-request-service.d.ts +5 -2
  143. package/dist/server/modules/sessions/session-permission-request-service.js +26 -27
  144. package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
  145. package/dist/server/modules/sessions/session-provider-config-service.d.ts +82 -0
  146. package/dist/server/modules/sessions/session-provider-config-service.js +925 -0
  147. package/dist/server/modules/sessions/session-provider-config-service.js.map +1 -0
  148. package/dist/server/modules/sessions/session-provider-error-mapper.d.ts +2 -0
  149. package/dist/server/modules/sessions/session-provider-error-mapper.js +42 -0
  150. package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
  151. package/dist/server/modules/skills/skill-manager-service.d.ts +5 -0
  152. package/dist/server/modules/skills/skill-manager-service.js +26 -0
  153. package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
  154. package/dist/server/modules/tasks/task-helper-process-handlers.d.ts +1 -0
  155. package/dist/server/modules/tasks/task-helper-process-handlers.js +1 -1
  156. package/dist/server/modules/tasks/task-helper-process-handlers.js.map +1 -1
  157. package/dist/server/routes/opencli.d.ts +3 -0
  158. package/dist/server/routes/opencli.js +7 -0
  159. package/dist/server/routes/opencli.js.map +1 -0
  160. package/dist/server/routes/providers.js +4 -2
  161. package/dist/server/routes/providers.js.map +1 -1
  162. package/dist/server/server/create-server.d.ts +8 -0
  163. package/dist/server/server/create-server.js +48 -12
  164. package/dist/server/server/create-server.js.map +1 -1
  165. package/dist/server/storage/repositories/opencli-catalog-entry-repository.d.ts +9 -0
  166. package/dist/server/storage/repositories/opencli-catalog-entry-repository.js +85 -0
  167. package/dist/server/storage/repositories/opencli-catalog-entry-repository.js.map +1 -0
  168. package/dist/server/storage/repositories/opencli-provider-repository.d.ts +8 -0
  169. package/dist/server/storage/repositories/opencli-provider-repository.js +88 -0
  170. package/dist/server/storage/repositories/opencli-provider-repository.js.map +1 -0
  171. package/dist/server/storage/repositories/opencli-runtime-profile-repository.d.ts +11 -0
  172. package/dist/server/storage/repositories/opencli-runtime-profile-repository.js +127 -0
  173. package/dist/server/storage/repositories/opencli-runtime-profile-repository.js.map +1 -0
  174. package/dist/server/storage/repositories/provider-control-repository.d.ts +9 -0
  175. package/dist/server/storage/repositories/provider-control-repository.js +51 -0
  176. package/dist/server/storage/repositories/provider-control-repository.js.map +1 -0
  177. package/dist/server/storage/repositories/session-binding-repository.js +44 -5
  178. package/dist/server/storage/repositories/session-binding-repository.js.map +1 -1
  179. package/dist/server/storage/repositories/session-index-repository.js +6 -0
  180. package/dist/server/storage/repositories/session-index-repository.js.map +1 -1
  181. package/dist/server/storage/sqlite/client.js +72 -0
  182. package/dist/server/storage/sqlite/client.js.map +1 -1
  183. package/dist/server/storage/sqlite/schema.sql +71 -0
  184. package/dist/server/types/domain.d.ts +56 -0
  185. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +5 -2
  186. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +40 -8
  187. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +1 -1
  188. package/node_modules/@codingns/session-sync-core/dist/index.d.ts +2 -0
  189. package/node_modules/@codingns/session-sync-core/dist/index.js +2 -0
  190. package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -1
  191. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +10 -1
  192. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +110 -35
  193. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
  194. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.d.ts +11 -0
  195. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +105 -0
  196. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +1 -0
  197. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +131 -39
  198. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -1
  199. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.d.ts +9 -0
  200. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js +17 -0
  201. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js.map +1 -0
  202. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.d.ts +8 -1
  203. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +19 -6
  204. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +1 -1
  205. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +1 -0
  206. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +13 -8
  207. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
  208. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +5 -1
  209. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +103 -51
  210. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -1
  211. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +2 -1
  212. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +41 -21
  213. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  214. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +32 -8
  215. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +1 -1
  216. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +15 -0
  217. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +16 -0
  218. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +1 -0
  219. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +167 -10
  220. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -1
  221. package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +2 -0
  222. package/node_modules/@codingns/session-sync-core/dist/types.d.ts +1 -1
  223. package/node_modules/@codingns/session-sync-core/dist/types.js +1 -1
  224. package/node_modules/@codingns/session-sync-core/dist/types.js.map +1 -1
  225. package/package.json +1 -1
  226. package/dist/public/assets/AdaptiveButlerPage-uFwDdN-F.js +0 -3
  227. package/dist/public/assets/ConversationPage-z3sXtKZ7.js +0 -4
  228. package/dist/public/assets/DesktopWindowPage-CZcoGApB.js +0 -2
  229. package/dist/public/assets/FileContextPanel-C3qex8bb.js +0 -1
  230. package/dist/public/assets/GitSidebar-BK6H16XU.js +0 -6
  231. package/dist/public/assets/MobileCreateSessionSheet-BYfbvK8o.js +0 -1
  232. package/dist/public/assets/MobileSheet-Ckug8hTb.js +0 -1
  233. package/dist/public/assets/MobileWorkspaceSwitcherHeader-RqWrBdn2.js +0 -1
  234. package/dist/public/assets/SessionIndexPage-DuK10DL5.js +0 -1
  235. package/dist/public/assets/SettingsPage-fyD-xaHL.js +0 -1
  236. package/dist/public/assets/TerminalManagerPanel-CCLr1Ypk.js +0 -1
  237. package/dist/public/assets/TerminalRuntimeFallbackModal-aUzjEBwP.js +0 -1
  238. package/dist/public/assets/ToolGitPage-C264yjS9.js +0 -1
  239. package/dist/public/assets/ToolProcessesPage-BOP4A1cb.js +0 -1
  240. package/dist/public/assets/ToolsHomePage-CQxGiKQA.js +0 -1
  241. package/dist/public/assets/WorkbenchLandingPage-CvAY68ca.js +0 -1
  242. package/dist/public/assets/WorkbenchLayout-DGm8Tc5M.js +0 -3
  243. package/dist/public/assets/WorkbenchModal-0tPIIhca.js +0 -1
  244. package/dist/public/assets/WorkbenchShellRoute-BF0nHWOk.css +0 -1
  245. package/dist/public/assets/WorkbenchShellRoute-DBBOsJo9.js +0 -1
  246. package/dist/public/assets/WorkspaceDebugDetailPage-CDerFYd2.js +0 -1
  247. package/dist/public/assets/WorkspaceDetailPage-BlJc1CHE.js +0 -1
  248. package/dist/public/assets/WorkspaceHomePage-BUsKJ3lv.js +0 -1
  249. package/dist/public/assets/default-session-permission-mode-DT4SGiwp.js +0 -1
  250. package/dist/public/assets/index-BZLcEHW3.js +0 -42
  251. package/dist/public/assets/index-BbspQPC2.css +0 -1
  252. package/dist/public/assets/session-runtime-machine-DdLeDqQr.js +0 -17
  253. package/dist/public/assets/useRegisteredDebugTemplates-oFAQNIqh.js +0 -1
@@ -1,6 +0,0 @@
1
- import{b as l,t as n,j as e,A as Bn}from"./index-BZLcEHW3.js";import{u as Hi,e as Ri,f as wi,g as jn}from"./App-BZvapsi8.js";import{u as Ai,V as st,r as Cn,aY as Nn,w as Pi,aZ as Di,a_ as Li,aQ as _i,a$ as vn,b0 as Fi,b1 as Sn,b2 as Oi,aS as ki,b3 as Gi,aR as $i,b4 as Bi,b5 as Ui,aX as Vi,b6 as Tn,b as Wi,b7 as zi,b8 as Ki}from"./WorkbenchLayout-DGm8Tc5M.js";import{g as Ii}from"./default-session-permission-mode-DT4SGiwp.js";import{S as Xi,v as qi,w as Yi,e as Zi}from"./MobileSheet-Ckug8hTb.js";import{F as Qi,a as Ft,b as Ot}from"./file-tree-icon-Db5LXC8h.js";import{W as Oe}from"./WorkbenchModal-0tPIIhca.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-C5_Iay0I.js";const Rt=56,Mn=28,wt=72,at=8,En=960,Hn=60*1e3,Rn=20,wn=9,An=9,At=68,_=12,rt=8,kt=260,Ji=120,Pt=6e4,ot={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function Ms({className:a,workspaceId:i,panelActive:u=!0,externalWindowMode:g=!1,workbenchShellOverrides:m}){const C=Hi(),p=Ri(),y=Ai(),{subscribeGitSnapshot:b,requestGitRefresh:v,addGitSnapshotListener:M,requestNavigationRefresh:S,selectWorkspace:T,upsertNavigationSession:x}={...y,...m},[r,h]=l.useState(null),[j,H]=l.useState(null),[d,P]=l.useState([]),[R,ne]=l.useState(0),[K,ie]=l.useState(null),[he,ct]=l.useState(!1),[G,ge]=l.useState(null),[se,I]=l.useState(null),[fe,pe]=l.useState(""),[$e,$]=l.useState(!1),[N,w]=l.useState(!1),[Yn,Vt]=l.useState([]),[J,Wt]=l.useState(!0),[ee,V]=l.useState(!1),[F,Zn]=l.useState(()=>typeof window<"u"?window.innerWidth<=En:!1),[ut,B]=l.useState([]),[xe,W]=l.useState(null),[be,ae]=l.useState("unstaged"),[ye,X]=l.useState(null),[re,q]=l.useState(null),[Qn,dt]=l.useState(!1),[Jn,mt]=l.useState(null),[ei,Be]=l.useState(!1),[zt,Ue]=l.useState(null),[D,je]=l.useState(null),[Kt,Ce]=l.useState(null),[ti,Ne]=l.useState(!1),[ve,oe]=l.useState(null),[te,ht]=l.useState(!1),[ni,Se]=l.useState(!1),[ii,It]=l.useState([]),[fs,Xt]=l.useState(!1),[Ve,gt]=l.useState(new Set),[si,Te]=l.useState(new Map),[We,qt]=l.useState(null),[ai,Me]=l.useState(!1),[A,Y]=l.useState(ot),[Yt,ze]=l.useState("generic"),[Zt,Ke]=l.useState(null),[O,ft]=l.useState(null),[k,pt]=l.useState(null),[Qt,Jt]=l.useState(Rt),[xt,bt]=l.useState(!1),[en,Ee]=l.useState(null),[ri,He]=l.useState(null),tn=l.useRef(null),nn=l.useRef(null),sn=l.useRef(null),an=l.useRef(null),rn=l.useRef(null),on=l.useRef(null),yt=l.useRef(null),Re=l.useRef(new Map),Ie=l.useRef(new Map),we=l.useRef(0),ln=l.useRef(u),cn=l.useRef(u),Xe=l.useRef(null),{showToast:E}=wi(),un=p.isDesktop&&!F;l.useEffect(()=>{st("git_sidebar.props",{workspaceId:i,externalWindowMode:g})},[g,i]),l.useEffect(()=>{cn.current=u},[u]),l.useEffect(()=>{Vt([]),Wt(!0),ne(0),ie(null),ct(!1),I(null),pe(""),V(!1),B([]),W(null),ae("unstaged"),X(null),q(null),dt(!1),mt(null),Be(!1),Ue(null),je(null),Ce(null),Ne(!1),oe(null),ht(!1),Se(!1),It([]),gt(new Set),Te(new Map),qt(null),Me(!1),Y(ot),ze("generic"),Ke(null),ft(null),pt(null),bt(!1),Jt(Rt),Ee(null),He(null),Ie.current.clear(),Re.current.clear()},[i]),l.useEffect(()=>{function t(){Zn(window.innerWidth<=En)}return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),l.useEffect(()=>{if(!xt)return;const t=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function o(f){fn(f.clientY)}function c(){bt(!1)}return window.addEventListener("pointermove",o),window.addEventListener("pointerup",c),()=>{document.body.style.cursor=t,document.body.style.userSelect=s,window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",c)}},[xt]),l.useEffect(()=>{var c,f;if(!(i!=null&&i.trim())){Xe.current=null,h(null),H(null),P([]),ne(0),ie(null),ge(null),$(!1);return}const t=i.trim(),s=Cn(ke(t),Hn),o=Lt(s);if(st("git_sidebar.snapshot",{workspaceId:t,cached:o,cachedHistoryCount:((c=s==null?void 0:s.history)==null?void 0:c.length)??0,cachedChangedCount:((f=s==null?void 0:s.status)==null?void 0:f.changes.length)??0}),o&&s){jt(s,t),$(!1);return}Xe.current=null,Nn(ke(t)),h(null),H(null),P([]),ne(0),ie(null),ge(null),$(!0)},[i]),l.useEffect(()=>{if(i!=null&&i.trim())return M(t=>{var s,o,c;t.workspaceId===i.trim()&&(st("git_sidebar.snapshot_received",{workspaceId:t.workspaceId,changedCount:((s=t.status)==null?void 0:s.changes.length)??0,historyCount:t.history.length,branchCount:(((o=t.branches)==null?void 0:o.local.length)??0)+(((c=t.branches)==null?void 0:c.remote.length)??0)}),jt(t,t.workspaceId),$(!1))})},[M,i]),l.useEffect(()=>{if(!(i!=null&&i.trim()))return;const t=i.trim(),s=Cn(ke(t),Hn),o=Lt(s)?(s==null?void 0:s.revision)??null:null;b(t,{knownRevision:o}),cn.current&&z()},[v,b,i]),l.useEffect(()=>{const t=ln.current;ln.current=u,i!=null&&i.trim()&&!t&&u&&v(i.trim(),{knownRevision:j})},[u,v,j,i]),l.useEffect(()=>{const t=i==null?void 0:i.trim();if(!t||Xe.current!==t)return;const s={revision:j,status:r,history:d,historyTotalCount:R,historyNextCursor:K,branches:G};if(!Lt(s)){Nn(ke(t));return}Pi(ke(t),s)},[G,d,K,R,j,r,i]),l.useEffect(()=>{if(!r||!se)return;r.changes.find(s=>s.path===se)||I(null)},[se,r]),l.useEffect(()=>{rs(an.current)},[fe]),l.useEffect(()=>{F||(B([]),W(null),X(null),Ke(null))},[F]),l.useEffect(()=>{if(!r){B([]);return}const t=new Set(r.changes.map(s=>s.path));B(s=>s.filter(o=>t.has(o)))},[r]);function oi(){const t=sn.current;if(!t)return;t.querySelectorAll(".git-tree-shell").forEach(o=>{o.scrollTop=0})}function jt(t,s){Xe.current=(s==null?void 0:s.trim())??(i==null?void 0:i.trim())??null,H(typeof t.revision=="string"?t.revision:null),h(t.status),P(Array.isArray(t.history)?t.history:[]),ne(typeof t.historyTotalCount=="number"?t.historyTotalCount:0),ie(typeof t.historyNextCursor=="string"?t.historyNextCursor:null),ge(t.branches??null)}function z(t){i!=null&&i.trim()&&($(!0),st("git_sidebar.refresh_requested",{workspaceId:i.trim(),resetTreeScroll:!1}),v(i.trim(),{knownRevision:j}))}async function Ct(t){if(!(i!=null&&i.trim()))return;const s=i.trim();$(!0);try{const[o,c,f]=await Promise.all([_i(s),vn(s,Rn,null),Fi(s)]);jt({status:o,history:c.items,historyTotalCount:c.totalCount,historyNextCursor:c.nextCursor,branches:f}),v(s),t!=null&&t.resetTreeScroll&&requestAnimationFrame(()=>{oi()})}catch(o){E({title:L(o,n("git.panelLoadFailed")),tone:"error"})}finally{$(!1)}}async function qe(){if(!(!i||!K||he)){ct(!0);try{const t=await vn(i,Rn,K);P(s=>{const o=new Set(s.map(f=>f.commitHash)),c=t.items.filter(f=>!o.has(f.commitHash));return[...s,...c]}),ne(t.totalCount),ie(t.nextCursor)}catch(t){E({title:L(t,n("git.panelLoadFailed")),tone:"error"})}finally{ct(!1)}}}function li(t){if(!J||he||!K)return;const s=t.currentTarget;s.scrollHeight-s.scrollTop-s.clientHeight<=40&&qe()}async function ci(){if(i){w(!0);try{const t=await Li(i,"ai");pe(t.validation.normalizedDraft.subject||t.draft.subject)}catch(t){E({title:L(t,n("git.draftFailed")),tone:"error"})}finally{w(!1)}}}async function Ye(t,s){if(i&&t.length){w(!0);try{const o=s?await Gi(i,t):await $i(i,t);h(o),I(t[t.length-1]??null),B(c=>c.filter(f=>!t.includes(f))),W(null),z()}catch(o){$(!1),E({title:L(o,n("git.stageFailed")),tone:"error"})}finally{w(!1)}}}async function Nt(t){if(i&&t.length){w(!0);try{const s=await Ui(i,t);h(s),t.includes(se??"")&&I(null),B(o=>o.filter(c=>!t.includes(c))),W(null),z()}catch(s){$(!1),E({title:L(s,n("git.discardFailed")),tone:"error"})}finally{w(!1)}}}async function ui(){if(!(!i||!fe.trim())){w(!0);try{await Oi(i,is(fe)),E({title:n("git.commitSuccess"),tone:"success"}),pe(""),I(null),z()}catch(t){E({title:L(t,n("git.commitFailed")),tone:"error"})}finally{w(!1)}}}async function di(){if(i!=null&&i.trim()){w(!0),$(!0);try{const t=await Di(i.trim());h(t),P([]),ne(0),ie(null),ge(null),E({title:n("git.initSuccess"),tone:"success"}),z()}catch(t){E({title:L(t,n("git.initFailed")),tone:"error"})}finally{w(!1),$(!1)}}}function Ze(t){Y(us(We)),Me(!0),mi(t)}async function mi(t){const s=i==null?void 0:i.trim();if(!s){ze("generic");return}try{const o=await Sn(s);if((i==null?void 0:i.trim())!==s)return;ze(ms(o,t))}catch{if((i==null?void 0:i.trim())!==s)return;ze("generic")}}function hi(){const t=ds(A),s=Yt==="github"?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder");if(A.authMode==="basic"){if(!A.username.trim()){E({title:n("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!A.password){E({title:s,tone:"error"});return}}if(A.authMode==="token"&&!A.token){E({title:n("shell.cloneTokenPlaceholder"),tone:"error"});return}qt(t),Me(!1),E({title:t?n("git.remoteAuthSaved"):n("git.remoteAuthCleared"),description:t&&A.rememberOnHost?n("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function dn(){if(i){Xt(!0);try{const t=await Sn(i);if(t.length===0){E({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){mn([t[0].name]);return}It(t),gt(new Set),Te(new Map),Se(!0)}catch(t){E({title:L(t,n("git.remoteFailed")),tone:"error"})}finally{Xt(!1)}}}async function mn(t){if(!i||t.length===0)return;w(!0),Te(new Map);const s=new Map;let o=!1;try{for(const c of t)try{const f=await Tn(i,"push",c,We,A.rememberOnHost);s.set(c,{ok:!0,summary:f.summary})}catch(f){if(o=!0,s.set(c,{ok:!1,summary:L(f,n("git.remoteFailed"))}),Te(new Map(s)),Gn(f)){Ze(c);return}}Te(s),z(),o||(E({title:n("git.pushAllSuccess",{count:String(t.length)}),tone:"success"}),Se(!1))}finally{w(!1)}}async function vt(t){if(i){if(t==="push"){V(!1),dn();return}w(!0);try{const s=await Tn(i,t,void 0,We,A.rememberOnHost);E({title:s.summary,tone:"success"}),V(!1),z()}catch(s){if(Gn(s)){Ze();return}E({title:L(s,n("git.remoteFailed")),tone:"error"})}finally{w(!1)}}}async function le(){if(i){w(!0);try{const t=await Bi(i);pe(t.commitSubject??""),E({title:t.summary||n("git.undoLastCommitSuccess"),tone:"success"}),V(!1),z()}catch(t){E({title:L(t,n("git.undoLastCommitFailed")),tone:"error"})}finally{w(!1)}}}async function gi(t){if(i){w(!0);try{const s=await zi(i,t,!1);ge(s),V(!1),z()}catch(s){E({title:L(s,n("git.branchFailed")),tone:"error"})}finally{w(!1)}}}async function St(t){const s=i==null?void 0:i.trim();if(!s)throw new Error(n("git.panelLoadFailed"));const o=Ie.current.get(t);if(o)return o;const c=await Ki(s,t);return Ie.current.set(t,c),c}async function Ae(t){q(null),X(null),mt(t),Ue(null);const s=Ie.current.get(t)??null;if(je(s),Be(!s),s)return;const o=we.current+1;we.current=o;try{const c=await St(t);if(we.current!==o)return;je(c)}catch(c){if(we.current!==o)return;Ue(L(c,n("git.commitDetailLoadFailed"))),je(null)}finally{we.current===o&&Be(!1)}}function fi(){mt(null),Be(!1),Ue(null),je(null)}async function Pe(t){try{const s=await St(t);await U(s.versionLabel,n("git.copyCommitVersionSuccess"))}catch(s){E({title:L(s,n("git.commitDetailLoadFailed")),tone:"error"})}}function De(t){q(null),X(null),Ce(t),oe(null),Ne(!0)}function pi(t){var o;const s=((o=d[0])==null?void 0:o.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 U(t.commitHash,n("git.copyCommitHashSuccess"))},{id:`copy-message:${t.commitHash}`,label:n("git.copyCommitMessage"),onSelect:()=>void U(me(t),n("git.copyCommitMessageSuccess"))},{id:`copy-version:${t.commitHash}`,label:n("git.copyCommitVersion"),onSelect:()=>void Pe(t.commitHash)},{id:`explain:${t.commitHash}`,label:n("git.explainCommitAction"),onSelect:()=>De(t.commitHash)},...s?[{id:`undo:${t.commitHash}`,label:n("git.undoLastCommit"),disabled:N,onSelect:()=>void le()}]:[]]}async function hn(t){q(null),X(null),await Vi(pi(t))}async function xi(){var t,s;if(!(!i||!Kt||!ve||te)){ht(!0);try{const o=await St(Kt),c=await qi({workspaceId:i,provider:ve,content:as(o),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:Ii()}),f=c.session??await Yi(c.sessionId);x(f),S(),T(f.workspaceId),C(Wi(f.workspaceId,f.sessionId)),Ne(!1),Ce(null),oe(null),E({title:n("git.explainCommitStarted"),tone:"success"})}catch(o){E({title:L(o,n("git.explainCommitFailed")),tone:"error"})}finally{ht(!1)}}}function Qe(t){Vt(s=>s.includes(t)?s.filter(o=>o!==t):[...s,t])}const bi=450;function gn(t){const s=Date.now(),o=tn.current;return tn.current={filePath:t,timestamp:s},(o==null?void 0:o.filePath)===t&&s-o.timestamp<=bi}async function Je(t,s){if(s.binary){E({title:n("git.binaryDiff"),tone:"info"});return}if(s.status==="A"||s.status==="?")He(null),Ee(t);else if(i)try{const o=await ki(i,t,s.staged);He(o.content),Ee(t)}catch{He(null),Ee(t)}}function et(t){I(t),W(null),B(s=>s.includes(t)?s.filter(o=>o!==t):[...s,t])}function fn(t){const s=nn.current;if(!s||!Number.isFinite(t))return;const o=s.getBoundingClientRect(),c=o.height-at;if(!Number.isFinite(o.top)||!Number.isFinite(o.height)||c<=0)return;const f=(t-o.top-at/2)/c*100;if(!Number.isFinite(f))return;const Fe=Math.max(Mn,Math.min(wt,Math.round(f)));Jt(Fe)}function yi(t){t.preventDefault(),fn(t.clientY),bt(!0)}const Le=(r==null?void 0:r.changes)??[],Z=Le.filter(t=>Gt(t,"staged")),ce=Le.filter(t=>Gt(t,"unstaged")),pn=On(Z,"staged"),xn=On(ce,"unstaged"),tt=new Set(Yn),nt=new Set(ut),ue=kn(ut,Le,"staged"),de=kn(ut,Le,"unstaged"),Tt=Le.length===0&&((r==null?void 0:r.snapshot.ahead)??0)>0,ji=Z.length>0&&fe.trim().length>0,it=(G==null?void 0:G.currentBranch)??(r==null?void 0:r.snapshot.branch)??n("common.unknown"),Mt=We!==null,_e=Yt==="github",Ci=_e?n("git.remoteAuthDescriptionGithub"):n("git.remoteAuthDescription"),Ni=_e?n("git.remoteAuthGithubPatLabel"):n("shell.clonePasswordLabel"),vi=_e?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder"),Si=_e?n("git.remoteAuthGithubUsernamePlaceholder"):n("shell.cloneUsernamePlaceholder"),Et=Number.isFinite(Qt)?Qt:Rt,Ti=J?`minmax(120px, ${Et}fr) ${at}px minmax(140px, ${100-Et}fr)`:`minmax(120px, 1fr) ${at}px auto`,Mi=ls(r);l.useEffect(()=>{xe==="staged"&&ue.length===0&&W(null),xe==="unstaged"&&de.length===0&&W(null)},[xe,ue.length,de.length]),l.useEffect(()=>{if(!F)return;const t=ce.length>0?"unstaged":Z.length>0?"staged":"history";ae(s=>s==="unstaged"&&ce.length>0||s==="staged"&&Z.length>0?s:t)},[F,Z.length,ce.length]),l.useEffect(()=>{ye&&(d.some(t=>t.commitHash===ye)||X(null))},[d,ye]),l.useEffect(()=>{re&&(d.some(t=>t.commitHash===re)||q(null))},[re,d]),l.useEffect(()=>{F&&be!=="history"&&ee&&V(!1)},[F,ee,be]),l.useLayoutEffect(()=>{if(F||!ee){ft(null);return}function t(){const o=rn.current,c=on.current;!o||!c||typeof window>"u"||ft($n(o.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,G==null?void 0:G.local.length,it,F,ee,Mt]);const Q=ye??re;l.useLayoutEffect(()=>{if(!Q){pt(null);return}const t=Q;function s(){const c=Re.current.get(t)??null,f=yt.current;!c||!f||typeof window>"u"||pt($n(c.getBoundingClientRect(),{width:f.getBoundingClientRect().width||kt,height:f.getBoundingClientRect().height||f.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}s();const o=window.requestAnimationFrame(s);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.cancelAnimationFrame(o),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[Q,d.length]),l.useEffect(()=>{if(!Q||typeof document>"u")return;const t=Q;function s(o){const c=o.target;if(!(c instanceof Node))return;const f=Re.current.get(t)??null,Fe=yt.current;f!=null&&f.contains(c)||Fe!=null&&Fe.contains(c)||(X(null),q(null))}return document.addEventListener("pointerdown",s),()=>{document.removeEventListener("pointerdown",s)}},[Q]);async function U(t,s){var o;try{if(p.isDesktop&&(await p.bridge.writeClipboardText(t)).ok){E({title:s,tone:"success"});return}if(typeof navigator<"u"&&((o=navigator.clipboard)!=null&&o.writeText)){await navigator.clipboard.writeText(t),E({title:s,tone:"success"});return}if(ss(t)){E({title:s,tone:"success"});return}}catch{E({title:n("common.copyContentFailed"),tone:"error"})}}async function bn(t,s){typeof window<"u"&&!window.confirm(n("git.discardConfirm",{path:s}))||await Nt(t)}function yn(t){const s=(t==null?void 0:t.desktopFloating)===!0&&!F,o=s?{top:(O==null?void 0:O.top)??_,left:(O==null?void 0:O.left)??_,maxHeight:O==null?void 0:O.maxHeight,transformOrigin:(O==null?void 0:O.transformOrigin)??"top right"}:void 0,c=e.jsxs("div",{ref:s?on:void 0,className:"git-operations-menu","data-floating":s?"true":"false",style:o,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:it})]}),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:Mt?n("git.remoteAuthConfigured"):n("git.remoteAuthNotConfigured")}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>Ze(),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:G==null?void 0:G.local.map(f=>e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||f.current,onClick:()=>void gi(f.name),children:e.jsx("span",{children:f.current?`${n("git.switchBranch")} ${f.name}`:`${n("git.switchBranchTo")} ${f.name}`})},f.name))})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>{V(!1),dt(!0)},children:e.jsx("span",{children:n("git.viewAllVersions")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void vt("fetch"),children:e.jsx("span",{children:n("git.fetch")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void vt("pull"),children:e.jsx("span",{children:n("git.pull")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void vt("push"),children:e.jsx("span",{children:n("git.push")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void le(),children:e.jsx("span",{children:n("git.undoLastCommit")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||$e,onClick:()=>void Ct({resetTreeScroll:!0}),children:e.jsx("span",{children:n("git.refresh")})})]})]});return s?typeof document>"u"?null:jn.createPortal(c,document.body):c}function Ht(t,s){if(s){Re.current.set(t,s);return}Re.current.delete(t)}function Ei(){var o;if(!Q||typeof document>"u")return null;const t=d.find(c=>c.commitHash===Q);if(!t)return null;const s=((o=d[0])==null?void 0:o.commitHash)===t.commitHash&&t.commitKind==="local";return jn.createPortal(e.jsx("div",{ref:yt,className:"git-history-entry-menu","data-floating":"true",style:{top:(k==null?void 0:k.top)??_,left:(k==null?void 0:k.left)??_,maxHeight:k==null?void 0:k.maxHeight,transformOrigin:(k==null?void 0:k.transformOrigin)??"top right"},children:e.jsx(ts,{item:t,canUndo:s,actioning:N,onViewCommitChanges:c=>void Ae(c),onCopyCommitHash:c=>void U(c,n("git.copyCommitHashSuccess")),onCopyCommitMessage:c=>void U(me(c),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:c=>void Pe(c),onExplainCommitChange:c=>void De(c),onUndoLastCommit:()=>void le()})}),document.body)}return r&&!Mi?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 di(),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:an,rows:1,value:fe,onChange:t=>pe(Kn(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 ci(),disabled:N||$e,children:e.jsx(gs,{})})]}),e.jsxs("div",{className:"git-primary-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Ct({resetTreeScroll:!0}),disabled:N||$e||!i,children:n("git.refreshNow")}),e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Tt){dn();return}ui()},disabled:N||!Tt&&!ji,children:Tt?n("git.pushNow"):n("git.commitNow")})]})]}),F?e.jsxs("div",{className:"git-mobile-sections",children:[e.jsx(Dt,{title:n("git.stagedChangesTitle"),count:Z.length,expanded:be==="staged",onToggle:()=>ae("staged"),children:e.jsx(Dn,{title:n("git.stagedChangesTitle"),nodes:pn,collapsedTreePathSet:tt,onToggleTreePath:Qe,onToggleMobileSelection:et,selectedMobilePathSet:nt,selectedTargets:ue,actioning:N,variant:"staged",swipeRowState:Zt,onSwipeRowChange:Ke,onStageToggle:Ye,onDiscardWithConfirm:bn,onClearSelectedTargets:()=>B(t=>t.filter(s=>!ue.includes(s))),onPreviewFile:Je})}),e.jsx(Dt,{title:n("git.changesTitle"),count:ce.length,expanded:be==="unstaged",onToggle:()=>ae("unstaged"),children:e.jsx(Dn,{title:n("git.changesTitle"),nodes:xn,collapsedTreePathSet:tt,onToggleTreePath:Qe,onToggleMobileSelection:et,selectedMobilePathSet:nt,selectedTargets:de,actioning:N,variant:"unstaged",swipeRowState:Zt,onSwipeRowChange:Ke,onStageToggle:Ye,onDiscardWithConfirm:bn,onClearSelectedTargets:()=>B(t=>t.filter(s=>!de.includes(s))),onPreviewFile:Je})}),e.jsxs(Dt,{title:n("git.recentVersionsTitle"),count:R,expanded:be==="history",onToggle:()=>ae("history"),trailingContent:e.jsx("span",{className:"badge",children:it}),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":ee,onClick:()=>{ae("history"),V(t=>!t)},disabled:N,children:e.jsx(Ge,{})}),children:[ee?e.jsx("div",{className:"git-mobile-operations-shell",children:yn()}):null,e.jsx(es,{history:d,historyLoadingMore:he,hasMore:!!K,actioning:N,openCommitHash:ye,onMenuTriggerRef:Ht,onToggleMenu:t=>X(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void U(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void U(me(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void Pe(t),onExplainCommitChange:t=>void De(t),onUndoLastCommit:()=>void le(),onLoadMore:()=>void qe()})]})]}):e.jsxs("div",{ref:nn,className:"git-content-split",style:{gridTemplateRows:Ti},children:[e.jsx("section",{className:"git-card git-tree-panel",children:e.jsxs("div",{ref:sn,className:"git-tree-panel-body",children:[Z.length>0?e.jsx(Pn,{title:n("git.stagedChangesTitle"),count:Z.length,nodes:pn,selectedPath:se,collapsedTreePathSet:tt,onToggleTreePath:Qe,onSelectFile:I,onPreviewFile:(t,s)=>{gn(t)&&Je(t,s)},onToggleMobileSelection:et,onStageToggle:Ye,onDiscard:Nt,actioning:N,variant:"staged",isMobileViewport:F,selectedMobilePathSet:nt,selectedTargets:ue,mobileActionMenuOpen:xe==="staged",onToggleMobileActionMenu:()=>W(t=>t==="staged"?null:"staged"),onClearSelectedTargets:()=>B(t=>t.filter(s=>!ue.includes(s)))}):null,e.jsx(Pn,{title:n("git.changesTitle"),count:ce.length,nodes:xn,selectedPath:se,collapsedTreePathSet:tt,onToggleTreePath:Qe,onSelectFile:I,onPreviewFile:(t,s)=>{gn(t)&&Je(t,s)},onToggleMobileSelection:et,onStageToggle:Ye,onDiscard:Nt,actioning:N,variant:"unstaged",isMobileViewport:F,selectedMobilePathSet:nt,selectedTargets:de,mobileActionMenuOpen:xe==="unstaged",onToggleMobileActionMenu:()=>W(t=>t==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>B(t=>t.filter(s=>!de.includes(s)))})]})}),e.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":n("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Mn,"aria-valuemax":wt,"aria-valuenow":J?Et:wt,"data-dragging":xt,onPointerDown:yi,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":J,"aria-label":J?n("git.collapseRecentVersions"):n("git.expandRecentVersions"),onClick:()=>Wt(t=>!t),children:[e.jsxs("span",{className:"git-section-toggle-main",children:[e.jsx(lt,{expanded:J}),e.jsx("span",{children:n("git.recentVersionsTitle")})]}),e.jsx("span",{className:"workbench-section-counter",children:R})]}),e.jsxs("div",{className:"git-history-actions",children:[e.jsx("span",{className:"badge",children:it}),e.jsx("button",{className:"git-icon-button",type:"button",ref:rn,"aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:()=>V(t=>!t),disabled:N,children:e.jsx(Ge,{})}),ee?yn({desktopFloating:!0}):null]})]}),J?e.jsx(_n,{history:d,historyLoadingMore:he,hasMore:!!K,actioning:N,openCommitHash:re,useNativeContextMenu:un,onMenuTriggerRef:Ht,onScroll:li,onToggleMenu:t=>{if(un){const s=d.find(o=>o.commitHash===t);s&&hn(s);return}q(s=>s===t?null:t)},onOpenContextMenu:t=>void hn(t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void U(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void U(me(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void Pe(t),onExplainCommitChange:t=>void De(t),onUndoLastCommit:()=>void le(),onLoadMore:()=>void qe()}):null]})]}),e.jsxs(Oe,{open:ni,title:n("git.selectRemoteTitle"),description:n("git.selectRemoteDesc"),onClose:()=>{N||Se(!1)},children:[e.jsxs("div",{className:"git-remote-auth-banner",children:[e.jsxs("div",{className:"git-remote-auth-banner-copy",children:[e.jsx("strong",{children:n("git.remoteAuthStatusLabel")}),e.jsx("span",{children:Mt?n("git.remoteAuthConfigured"):n("git.remoteAuthNotConfigured")})]}),e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>Ze(),children:n("git.remoteAuthAction")})]}),e.jsx("div",{className:"git-remote-select-list",children:ii.map(t=>{const s=Ve.has(t.name),o=si.get(t.name);return e.jsxs("label",{className:"git-remote-item",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:N,onChange:()=>{gt(c=>{const f=new Set(c);return f.has(t.name)?f.delete(t.name):f.add(t.name),f})}}),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}),o&&e.jsx("span",{className:`git-remote-result ${o.ok?"ok":"err"}`,children:o.summary})]})]},t.name)})}),e.jsxs("div",{className:"git-remote-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>Se(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:N||Ve.size===0,onClick:()=>void mn(Array.from(Ve)),children:N?n("git.pushing"):n("git.pushSelected",{count:String(Ve.size)})})]})]}),e.jsxs(Oe,{open:ai,title:n("git.remoteAuthTitle"),description:Ci,onClose:()=>{N||Me(!1)},children:[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:A.authMode,disabled:N,onChange:t=>Y(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")})]})]}),A.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:A.username,placeholder:Si,autoComplete:"username",onChange:t=>Y(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:Ni}),e.jsx("input",{type:"password",value:A.password,placeholder:vi,autoComplete:"current-password",onChange:t=>Y(s=>({...s,password:t.target.value}))})]})]}):null,A.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:A.username,placeholder:n("shell.cloneTokenUsernamePlaceholder"),autoComplete:"username",onChange:t=>Y(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:A.token,placeholder:n("shell.cloneTokenPlaceholder"),autoComplete:"current-password",onChange:t=>Y(s=>({...s,token:t.target.value}))})]})]}):null,_e?e.jsx("p",{className:"git-remote-auth-hint",children:n("git.remoteAuthGithubPatHint")}):null,A.authMode!=="none"?e.jsxs("label",{className:"settings-checkbox git-remote-auth-remember-toggle",children:[e.jsx("input",{type:"checkbox",checked:A.rememberOnHost,onChange:t=>Y(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:()=>Me(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:N,onClick:hi,children:n("git.remoteAuthSave")})]})]}),e.jsx(Oe,{open:Qn,title:n("git.viewAllVersions"),description:n("git.viewAllVersionsDescription",{count:String(R)}),onClose:()=>dt(!1),children:e.jsx(_n,{history:d,historyLoadingMore:he,hasMore:!!K,actioning:N,openCommitHash:re,className:"git-history-modal-list",onMenuTriggerRef:Ht,onToggleMenu:t=>q(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void U(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void U(me(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void Pe(t),onExplainCommitChange:t=>void De(t),onUndoLastCommit:()=>void le(),onLoadMore:()=>void qe()})}),e.jsx(Oe,{open:Jn!==null,className:"git-commit-detail-modal",title:(D==null?void 0:D.subject)||n("git.commitDetailTitle"),description:D?n("git.commitDetailDescription",{hash:D.shortHash}):n("git.commitDetailLoading"),onClose:fi,children:ei?e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailLoading")})}):zt?e.jsx("div",{className:"git-commit-detail-state is-error",children:e.jsx("p",{children:zt})}):D?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:D.versionLabel})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitHashLabel")}),e.jsx("strong",{children:D.commitHash})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitAuthorLabel")}),e.jsx("strong",{children:D.authorName})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitTimeLabel")}),e.jsx("strong",{children:os(D.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:me(D)})]}),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:D.changedFiles.length})]}),e.jsx("div",{className:"git-commit-detail-file-list",children:D.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")}),D.diffTruncated?e.jsx("span",{className:"git-commit-detail-truncated",children:n("git.diffTruncated")}):null]}),e.jsx("pre",{className:"git-commit-detail-diff",children:D.diffContent||n("git.emptyDiff")})]})]}):e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailEmpty")})})}),e.jsx(Oe,{open:ti,className:"git-explain-provider-modal",title:n("git.explainCommitTitle"),description:n("git.explainCommitDescription"),onClose:()=>{te||(Ne(!1),Ce(null),oe(null))},children:e.jsxs("div",{className:"git-explain-provider-shell",children:[e.jsx(Xi,{workspaceId:i,selectedProvider:ve,pendingProvider:te?ve:null,disabled:te,onSelect:t=>oe(t)}),e.jsxs("div",{className:"git-explain-provider-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:te,onClick:()=>{Ne(!1),Ce(null),oe(null)},children:n("common.cancel")}),e.jsx("button",{type:"button",className:"primary-button",disabled:!ve||te,onClick:()=>void xi(),children:te?n("conversation.sendingState"):n("git.startExplainCommit")})]})]})}),e.jsx(Qi,{workspaceId:i,filePath:en,open:en!==null,onClose:()=>{Ee(null),He(null)},onSaved:async()=>{await Ct({resetTreeScroll:!0})},diffContent:ri}),Ei()]})}function Pn({title:a,count:i,nodes:u,selectedPath:g,collapsedTreePathSet:m,onToggleTreePath:C,onSelectFile:p,onPreviewFile:y,onToggleMobileSelection:b,onStageToggle:v,onDiscard:M,actioning:S,variant:T,isMobileViewport:x,selectedMobilePathSet:r,selectedTargets:h,mobileActionMenuOpen:j,onToggleMobileActionMenu:H,onClearSelectedTargets:d}){const P=Ut(u),R=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}),!x&&P.length>0?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":R,title:R,onClick:()=>void v(P,T==="staged"),disabled:S,children:e.jsx($t,{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 M(P),disabled:S,children:e.jsx(Bt,{})}):null]}):null,x&&h.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]}),x&&j?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:h.length})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void v(h,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 M(h),children:e.jsx("span",{children:n("git.discard")})}):null,e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:d,children:e.jsx("span",{children:n("git.clearSelection")})})]})]}):null]}),e.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":a,children:u.length?Vn({nodes:u,depth:0,collapsedTreePathSet:m,selectedPath:g,onToggleTreePath:C,onSelectFile:p,onPreviewFile:y,onToggleMobileSelection:b,onStageToggle:v,onDiscard:M,actioning:S,variant:T,isMobileViewport:x,selectedMobilePathSet:r}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Dt({title:a,count:i,expanded:u,onToggle:g,trailingContent:m,headerAction:C,children:p}){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:g,children:[e.jsxs("span",{className:"git-mobile-section-toggle-main",children:[e.jsx(lt,{expanded:u}),e.jsx("h3",{children:a})]}),e.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[m,e.jsx("span",{className:"workbench-section-counter",children:i})]})]}),C?e.jsx("div",{className:"git-mobile-section-header-action",children:C}):null]}),u?e.jsx("div",{className:"git-mobile-section-body",children:p}):null]})}function Dn({title:a,nodes:i,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,selectedTargets:p,actioning:y,variant:b,swipeRowState:v,onSwipeRowChange:M,onStageToggle:S,onDiscardWithConfirm:T,onClearSelectedTargets:x,onPreviewFile:r}){return e.jsxs("div",{className:"git-mobile-record-shell",children:[p.length>0?e.jsxs("div",{className:"git-mobile-selection-toolbar",children:[e.jsxs("span",{className:"git-mobile-selection-count",children:[n("git.selectedFiles")," ",p.length]}),e.jsxs("div",{className:"git-mobile-selection-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:y,onClick:()=>void S(p,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:y,onClick:()=>void T(p,`${p.length}`),children:n("git.discard")}):null,e.jsx("button",{type:"button",className:"secondary-button",disabled:y,onClick:x,children:n("git.clearSelection")})]})]}):null,e.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":a,children:i.length?Un({nodes:i,depth:0,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,actioning:y,variant:b,swipeRowState:v,onSwipeRowChange:M,onStageToggle:S,onDiscardWithConfirm:T,onPreviewFile:r}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Un({nodes:a,depth:i,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,actioning:p,variant:y,swipeRowState:b,onSwipeRowChange:v,onStageToggle:M,onDiscardWithConfirm:S,onPreviewFile:T}){return a.map(x=>{if(x.kind==="directory"){const j=!u.has(x.path),H=Ut(x.children),d=`directory:${x.path}`;return e.jsxs("div",{className:"git-mobile-record-branch",children:[e.jsx(Ln,{rowKey:d,openState:(b==null?void 0:b.path)===d?b.direction:null,onOpenStateChange:P=>v(P?{path:d,direction:P}:null),trailingActions:H.length>0?[{label:y==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void M(H,y==="staged")},...y==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S(H,x.path)}]:[]]:null,children:e.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${wn+i*An}px`},onClick:()=>g(x.path),children:[e.jsxs("span",{className:"git-mobile-record-leading",children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":j,children:e.jsx(lt,{expanded:j})}),e.jsx("span",{className:"git-mobile-record-title",children:x.name})]}),e.jsx("span",{className:"git-mobile-record-meta",children:H.length})]})}),j?e.jsx("div",{className:"git-mobile-record-children",role:"group",children:Un({nodes:x.children,depth:i+1,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,actioning:p,variant:y,swipeRowState:b,onSwipeRowChange:v,onStageToggle:M,onDiscardWithConfirm:S,onPreviewFile:T})}):null]},d)}const r=`file:${x.path}`,h=C.has(x.path);return e.jsx(Ln,{rowKey:r,openState:(b==null?void 0:b.path)===r?b.direction:null,onOpenStateChange:j=>v(j?{path:r,direction:j}:null),trailingActions:[{label:n("git.preview"),tone:"neutral",onPress:()=>T(x.change.path,x.change)},{label:y==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void M([x.change.path],y==="staged")},...y==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S([x.change.path],x.path)}]:[]],children:e.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":h,style:{paddingInlineStart:`${wn+i*An}px`},children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:h,"aria-label":`${n("git.selectFile")} ${x.name}`,onChange:()=>m(x.change.path)}),e.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>m(x.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":Ot(x.name),"aria-hidden":"true",children:Ft(x.name)}),e.jsxs("span",{className:"git-mobile-record-copy",children:[e.jsx("span",{className:"git-mobile-record-title",children:x.name}),e.jsx("span",{className:"git-mobile-record-path",children:x.path})]}),e.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})]})]})},r)})}function Ln({rowKey:a,openState:i,onOpenStateChange:u,trailingActions:g,children:m}){const C=Zi(),p=l.useRef(null),[y,b]=l.useState(0),v=((g==null?void 0:g.length)??0)*At;l.useEffect(()=>{i||b(0)},[i,a]);const M=y!==0?y:i==="trailing"?-v:0;function S(h){var j,H;h.button===0&&(p.current={pointerId:h.pointerId,startX:h.clientX},(H=(j=h.currentTarget).setPointerCapture)==null||H.call(j,h.pointerId))}function T(h){const j=p.current;if(!j||j.pointerId!==h.pointerId)return;const H=v>0?v+10:0,d=Math.max(-H,Math.min(0,h.clientX-j.startX));b(d)}function x(h){var H,d;const j=p.current;if(!(!j||j.pointerId!==h.pointerId)){if((d=(H=h.currentTarget).releasePointerCapture)==null||d.call(H,h.pointerId),p.current=null,y<=-44&&(g!=null&&g.length)){C.trigger("gesture"),u("trailing"),b(0);return}u(null),b(0)}}function r(h){var H,d;const j=p.current;!j||j.pointerId!==h.pointerId||((d=(H=h.currentTarget).releasePointerCapture)==null||d.call(H,h.pointerId),p.current=null,b(0))}return e.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":i??"closed","data-dragging":y!==0,children:[g==null?void 0:g.map((h,j)=>e.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":h.tone,style:{right:j*At,width:At},onClick:()=>{C.trigger(h.tone==="danger"?"warning":"action"),u(null),h.onPress()},children:h.label},`trailing-${j}`)),e.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${M}px)`},onPointerDown:S,onPointerMove:T,onPointerUp:x,onPointerCancel:r,children:m})]})}function es({history:a,historyLoadingMore:i,hasMore:u,actioning:g,openCommitHash:m,onMenuTriggerRef:C,onToggleMenu:p,onViewCommitChanges:y,onCopyCommitHash:b,onCopyCommitMessage:v,onCopyCommitVersion:M,onExplainCommitChange:S,onUndoLastCommit:T,onLoadMore:x}){return a.length?e.jsxs("div",{className:"git-mobile-history-list",children:[a.map(r=>e.jsx("article",{className:"git-mobile-history-entry","data-kind":r.commitKind,children:e.jsxs("div",{className:"git-mobile-history-entry-main",children:[e.jsx("span",{className:"git-history-marker","data-kind":r.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:r.subject,children:r.subject}),e.jsx("span",{className:"git-history-kind-badge","data-kind":r.commitKind,children:In(r.commitKind)})]}),r.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:r.refs.map(h=>e.jsx("span",{className:"git-history-ref-pill","data-kind":h.kind,"data-remote-index":String(Xn(h.remoteName)),children:h.name},`${r.commitHash}:${h.kind}:${h.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:r.commitHash.slice(0,8)}),e.jsx("span",{children:r.authorName}),e.jsx("time",{dateTime:r.authoredAt,children:qn(r.authoredAt)})]})]}),e.jsx("button",{type:"button",className:"git-icon-button",ref:h=>C(r.commitHash,h),"aria-label":n("git.historyItemMenu"),onClick:()=>p(r.commitHash),children:e.jsx(Ge,{})})]})},r.commitHash)),u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:x,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"git-tree-status",children:n("git.noHistory")})}function _n({history:a,historyLoadingMore:i,hasMore:u,actioning:g,openCommitHash:m,className:C,useNativeContextMenu:p=!1,onMenuTriggerRef:y,onScroll:b,onToggleMenu:v,onOpenContextMenu:M,onViewCommitChanges:S,onCopyCommitHash:T,onCopyCommitMessage:x,onCopyCommitVersion:r,onExplainCommitChange:h,onUndoLastCommit:j,onLoadMore:H}){return a.length?e.jsxs("div",{className:["git-history-list",C].filter(Boolean).join(" "),onScroll:b,children:[a.map(d=>{const P=m===d.commitHash;return e.jsxs("article",{className:"git-history-entry","data-kind":d.commitKind,"data-menu-open":P?"true":"false",onContextMenu:R=>{!p||!M||(R.preventDefault(),R.stopPropagation(),M(d))},children:[e.jsx("span",{className:"git-history-marker","data-kind":d.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:d.subject,children:d.subject}),e.jsxs("div",{className:"git-history-title-actions",children:[e.jsx("span",{className:"git-history-kind-badge","data-kind":d.commitKind,children:In(d.commitKind)}),p?null:e.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:R=>y(d.commitHash,R),"aria-label":n("git.historyItemMenu"),onClick:()=>{v(d.commitHash)},children:e.jsx(Ge,{})})]})]}),d.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:d.refs.map(R=>e.jsx("span",{className:"git-history-ref-pill","data-kind":R.kind,"data-remote-index":String(Xn(R.remoteName)),children:R.name},`${d.commitHash}:${R.kind}:${R.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:d.commitHash.slice(0,8)}),e.jsx("span",{children:d.authorName}),e.jsx("time",{dateTime:d.authoredAt,children:qn(d.authoredAt)})]})]})]},d.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 ts({item:a,canUndo:i,actioning:u,onViewCommitChanges:g,onCopyCommitHash:m,onCopyCommitMessage:C,onCopyCommitVersion:p,onExplainCommitChange:y,onUndoLastCommit:b}){return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>g(a.commitHash),children:e.jsx("span",{children:n("git.viewCommitChanges")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>m(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitHash")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>C(a),children:e.jsx("span",{children:n("git.copyCommitMessage")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>p(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitVersion")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>y(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 Vn({nodes:a,depth:i,collapsedTreePathSet:u,selectedPath:g,onToggleTreePath:m,onSelectFile:C,onPreviewFile:p,onToggleMobileSelection:y,onStageToggle:b,onDiscard:v,actioning:M,variant:S,isMobileViewport:T,selectedMobilePathSet:x}){return a.map(r=>{if(r.kind==="directory"){const H=!u.has(r.path),d=Ut(r.children),P=`${S==="staged"?n("git.unstage"):n("git.stage")} ${r.path}`,R=`${n("git.discard")} ${r.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:()=>m(r.path),children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":H,children:e.jsx(lt,{expanded:H})}),e.jsx("span",{className:"git-tree-label git-tree-label-directory",children:r.name})]}),!T&&d.length>0?e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":P,title:P,onClick:()=>void b(d,S==="staged"),disabled:M,children:e.jsx($t,{staged:S==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":R,title:R,onClick:()=>void v(d),disabled:M,children:e.jsx(Bt,{})}):null]}):null]}),H?e.jsx("div",{className:"git-tree-children",role:"group",children:Vn({nodes:r.children,depth:i+1,collapsedTreePathSet:u,selectedPath:g,onToggleTreePath:m,onSelectFile:C,onPreviewFile:p,onToggleMobileSelection:y,onStageToggle:b,onDiscard:v,actioning:M,variant:S,isMobileViewport:T,selectedMobilePathSet:x})}):null]},`directory:${r.path}`)}const h=x.has(r.path),j=T?h:g===r.path;return T?e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":j,"data-mobile":"true",children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:h,"aria-label":`${n("git.selectFile")} ${r.name}`,onChange:()=>y(r.change.path)}),e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":j,"data-mobile":"true",style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>y(r.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":Ot(r.name),"aria-hidden":"true",children:Ft(r.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:r.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":r.status,children:r.status})})]})]},`file:${r.path}`):e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":j,children:[e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":j,style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>{C(r.change.path),p&&p(r.change.path,r.change)},children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":Ot(r.name),"aria-hidden":"true",children:Ft(r.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:r.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":r.status,children:r.status})})]}),e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":r.variant==="staged"?n("git.unstage"):n("git.stage"),title:r.variant==="staged"?n("git.unstage"):n("git.stage"),onClick:()=>void b([r.change.path],r.variant==="staged"),disabled:M,children:e.jsx($t,{staged:r.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([r.change.path]),disabled:M,children:e.jsx(Bt,{})}):null]})]},`file:${r.path}`)})}function Fn(a,i){return{kind:"directory",name:a,path:i,children:new Map}}function On(a,i){const u=Fn("","");for(const g of a){const m=g.path.replace(/\\/g,"/"),C=m.split("/").filter(Boolean);let p=u;C.forEach((y,b)=>{const v=C.slice(0,b+1).join("/");if(b===C.length-1){p.children.set(`file:${v}`,{kind:"file",name:y,path:m,change:g,status:ns(g,i),variant:i});return}const M=`directory:${v}`,S=p.children.get(M);if(S&&S.kind==="directory"){p=S;return}const T=Fn(y,v);p.children.set(M,T),p=T})}return zn(Wn([...u.children.values()]))}function Wn(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:Wn([...i.children.values()])}:i)}function zn(a){return a.map(i=>{var p;if(i.kind!=="directory")return i;const u=zn(i.children);let g=i.name,m=i.path,C=u;for(;C.length===1&&((p=C[0])==null?void 0:p.kind)==="directory";){const y=C[0];g=`${g}/${y.name}`,m=y.path,C=y.children}return{kind:"directory",name:g,path:m,children:C}})}function kn(a,i,u){const g=new Set(a);return i.filter(m=>Gt(m,u)&&g.has(m.path)).map(m=>m.path)}function Ut(a){const i=[],u=new Set;function g(m){if(m.kind==="file"){u.has(m.path)||(u.add(m.path),i.push(m.path));return}m.children.forEach(g)}return a.forEach(g),i}function Gt(a,i){return i==="staged"?!!a.stagedStatus:!!a.worktreeStatus}function ns(a,i){return i==="staged"?a.stagedStatus??a.status:a.worktreeStatus??a.status}function is(a){return{subject:Kn(a).trim(),body:null,footer:null,source:"manual"}}function Kn(a){return a.replace(/[\r\n]+/g," ")}function ss(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 me(a){const i=a.subject.trim(),u=a.body.trim();return u?`${i}
2
-
3
- ${u}`:i}function as(a){const i=a.changedFiles.map(m=>`- [${m.status}] ${m.path}${m.oldPath?` (from ${m.oldPath})`:""}`).join(`
4
- `),u=a.diffContent.length>Pt?a.diffContent.slice(0,Pt):a.diffContent,g=a.diffContent.length>Pt||a.diffTruncated?`
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||"- 无",g,"","Diff:",u||"(empty diff)"].join(`
6
- `)}function rs(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 In(a){switch(a){case"local":return n("git.historyKindLocal");case"remote":return n("git.historyKindRemote");default:return n("git.historyKindShared")}}function Xn(a){if(!a)return 0;let i=0;for(const u of a)i=i*33+u.charCodeAt(0)>>>0;return i%6}function os(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 Bn?cs(a)??a.message:typeof a=="object"&&a&&"message"in a?a.message:i}function ke(a){return`git-sidebar.snapshot.${a}`}function Lt(a){return a?!!(a.status||a.branches||a.history.length>0||a.historyTotalCount>0||a.historyNextCursor||a.revision):!1}function ls(a){return a?a.snapshot.enabled!==!1:!0}function cs(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 Gn(a){return a instanceof Bn&&a.errorCode==="GIT_REMOTE_AUTH_FAILED"}function us(a){return!a||!a.mode||a.mode==="none"?ot:a.mode==="basic"?{authMode:"basic",username:a.username??"",password:a.password??"",token:"",rememberOnHost:!1}:a.mode==="token"?{authMode:"token",username:a.username??"",password:"",token:a.token??"",rememberOnHost:!1}:ot}function ds(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 ms(a,i){const u=a.find(m=>m.name===i)??a.find(m=>m.name==="origin")??a[0];if(!u)return"generic";const g=u.pushUrl||u.fetchUrl;return hs(g)?"github":"generic"}function hs(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 $n(a,i,u){const g=Math.max(0,u.width),m=Math.max(0,u.height),C=Math.max(0,m-_*2),p=Math.max(0,g-_*2),y=Math.min(Math.max(i.width||kt,0),p),b=Math.max(0,m-a.bottom-rt-_),v=Math.max(0,a.top-rt-_),M=b<i.height&&v>b,T=_t(Math.max(M?v:b,Ji),0,C),x=Math.min(Math.max(i.height,0),T),r=M?a.top-rt-x:a.bottom+rt,h=Math.max(_,m-_-x),j=Math.max(_,g-_-y);return{top:_t(r,_,h),left:_t(a.right-y,_,j),maxHeight:Math.max(0,T),transformOrigin:`${M?"bottom":"top"} right`}}function _t(a,i,u){return!Number.isFinite(a)||u<i?i:Math.min(Math.max(a,i),u)}function lt({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 $t({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 Bt(){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 gs(){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 qn(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{Ms as GitSidebar,$n as resolveGitOperationsMenuPosition};
@@ -1 +0,0 @@
1
- import{b as c,j as e,t as a}from"./index-BZLcEHW3.js";import{e as j,M as f,f as k,h as g,i as v,j as M,k as S,S as L}from"./MobileSheet-Ckug8hTb.js";function E({open:o,workspaces:l,workspaceOptions:t,initialWorkspaceId:d,onClose:b,onSelect:x}){const[n,p]=c.useState(""),[h,u]=c.useState(!1),m=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&&(p(N(i,d)),u(!1))},[d,o,w]),!o)return null;const r=i.find(s=>s.workspace.id===n)??i[0]??null;return e.jsxs(f,{open:o,title:a("shell.createSessionModalTitle"),description:a("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(k,{className:"mobile-create-session-section",tone:"accent",children:e.jsxs(g,{label:a("shell.createSessionWorkspaceLabel"),children:[e.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${a("shell.createSessionWorkspaceLabel")} ${(r==null?void 0:r.label)??""}`.trim(),"aria-expanded":h?"true":"false",disabled:i.length===0,onClick:()=>{m.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)??a("common.unknown")}),e.jsx("span",{children:(r==null?void 0:r.subtitle)??a("common.unknown")})]}),e.jsx(C,{expanded:h})]}),h?e.jsx(v,{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:i.map(s=>e.jsx(M,{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===n,trailing:e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:s.workspace.id===n?e.jsx(I,{}):e.jsx(y,{})}),style:{"--mobile-workspace-tree-depth":String(s.depth)},onClick:()=>{s.workspace.id!==n&&m.trigger("selection"),p(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(S,{className:"mobile-workspace-home-worktree-badge",children:a("shell.mobileWorktreeBadge")}):null,s.label]}),e.jsx("span",{children:s.subtitle})]})},s.workspace.id))}):null]})}),e.jsx(k,{className:"mobile-create-session-provider-block",heading:a("shell.createSessionProviderLabel"),description:a("shell.providerOptionHint"),children:e.jsx(L,{disabled:!n,workspaceId:n||null,onSelect:s=>{n&&x(n,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 +0,0 @@
1
- var V=Object.defineProperty;var Z=(e,n,s)=>n in e?V(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s;var R=(e,n,s)=>Z(e,typeof n!="symbol"?n+"":n,s);import{C as r,A as Y,b as w,j as i,t as g,f as X,Y as H,h as $}from"./index-BZLcEHW3.js";import{e as _,g as ee}from"./App-BZvapsi8.js";function ne(){return r.request("/api/workspaces")}async function Te(){try{return await r.request("/api/workbench")}catch(e){if(!(e instanceof Y)||e.status!==404)throw e;const n=await ne();return{items:await Promise.all(n.items.map(async t=>({workspace:t,sessions:(await se(t.id)).items})))}}}function Be(e){return r.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function Me(e){return r.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function je(e){return r.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function ke(e){return r.request("/api/debug-targets/analyze",{method:"POST",body:JSON.stringify(e)})}function Fe(e,n){return r.request(`/api/debug-targets/${encodeURIComponent(e)}/launch-plan`,{method:"POST",body:JSON.stringify({})})}function Je(){return r.request("/api/framework-compatibility-matrix")}function Ke(e){return r.request("/api/workspaces/reorder",{method:"PUT",body:JSON.stringify(e)})}function Qe(e,n){return r.request(`/api/workspaces/${encodeURIComponent(e)}/navigation-state`,{method:"PUT",body:JSON.stringify(n)})}function Ge(e){const n=new URLSearchParams;return e!=null&&e.trim()&&n.set("path",e.trim()),r.request(`/api/workspaces/browse${n.size>0?`?${n.toString()}`:""}`)}function We(e){return r.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function se(e){return r.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function ze(e){return r.request(`/api/sessions/${encodeURIComponent(e)}`)}function Ve(e){return r.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function Ze(e){return r.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function Ye(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:n})})}function Xe(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:n})})}function He(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:n})})}function $e(e){return r.request(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}function _e(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/parallel-groups`,{method:"POST",body:JSON.stringify(n)})}function en(e,n){return r.request(`/api/workspaces/${encodeURIComponent(e)}/parallel-groups`,{method:"POST",body:JSON.stringify(n)})}function nn(e){return r.request(`/api/parallel-groups/${encodeURIComponent(e)}`)}function sn(e,n){return r.request(`/api/parallel-groups/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(n)})}function tn(e){return r.request(`/api/session-isolated-workspaces/${encodeURIComponent(e)}/promote`,{method:"POST"})}function on(e){return r.request("/api/worktrees",{method:"POST",body:JSON.stringify(e)})}function rn(e){return r.request(`/api/worktrees/${encodeURIComponent(e)}/merge-preview`,{method:"POST"})}function an(e){return r.request(`/api/worktrees/${encodeURIComponent(e)}/merge-into-parent`,{method:"POST"})}function un(e,n){return r.request(`/api/worktrees/${encodeURIComponent(e)}/cleanup`,{method:"POST",body:JSON.stringify(n??{})})}function ln(e){return r.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function cn(e){return r.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function dn(){return r.request("/api/preferences/quick-phrases")}function fn(e){return r.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function te(e,n){const s=new URLSearchParams;return n!=null&&n.trim()&&s.set("workspaceId",n.trim()),r.request(`/api/providers/${encodeURIComponent(e)}/capabilities${s.size>0?`?${s.toString()}`:""}`)}async function oe(e,n){const s=await Promise.allSettled(e.map(async o=>[o,await te(o,n)])),t=[];for(const o of s){if(o.status!=="fulfilled")continue;const[a,l]=o.value;t.push([a,l])}return Object.fromEntries(t)}function pn(e,n,s,t="forward"){const o=new URLSearchParams;return n&&o.set("cursor",n),o.set("limit",String(s)),o.set("direction",t),r.request(`/api/sessions/${encodeURIComponent(e)}/messages?${o.toString()}`)}function mn(e,n){return r.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(n)}/content`)}function gn(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(n)})}function Sn(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/forks`,{method:"POST",body:JSON.stringify(n)})}function An(e){return r.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function hn(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(n)})}function yn(e){return r.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function vn(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(n)})}function Rn(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(n)}`,{method:"DELETE"})}function Cn(e,n){return r.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(n)}/steer`,{method:"POST"})}function wn(e){return r.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function Dn(e){return r.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function Pn(e,n,s){return r.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(n)}/reply`,{method:"POST",body:JSON.stringify(s)})}const I="codingns.workspace.session-display-sort-mode",b="codingns.file-panel.show-system-files",q="codingns.notification.preferences",C={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function D(){return typeof window<"u"&&typeof window.localStorage<"u"}function re(e){return e==="createdAt"||e==="updatedAt"||e==="title"}function B(){if(!D())return"createdAt";const e=window.localStorage.getItem(I);return re(e)?e:"createdAt"}function M(){return D()?window.localStorage.getItem(b)==="1":!1}function U(e){return typeof e=="boolean"}function j(){if(!D())return C;const e=window.localStorage.getItem(q);if(!e)return C;try{const n=JSON.parse(e);return{notifyOnPermissionRequest:U(n.notifyOnPermissionRequest)?n.notifyOnPermissionRequest:C.notifyOnPermissionRequest,notifyOnSessionCompleted:U(n.notifyOnSessionCompleted)?n.notifyOnSessionCompleted:C.notifyOnSessionCompleted,notifyOnSessionFailed:U(n.notifyOnSessionFailed)?n.notifyOnSessionFailed:C.notifyOnSessionFailed}}catch{return C}}function k(e,n){return e.notifyOnPermissionRequest===n.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===n.notifyOnSessionCompleted&&e.notifyOnSessionFailed===n.notifyOnSessionFailed}function ie(e){D()&&window.localStorage.setItem(q,JSON.stringify(e))}class ae{constructor(){R(this,"state",{sessionDisplaySortMode:B(),showSystemFiles:M(),notificationPreferences:j()});R(this,"listeners",new Set);R(this,"subscribe",n=>(this.listeners.add(n),()=>{this.listeners.delete(n)}));R(this,"getState",()=>this.state);R(this,"handleStorage",n=>{if(n.key!==null&&n.key!==I&&n.key!==b&&n.key!==q)return;const s=B(),t=M(),o=j(),a=this.state.sessionDisplaySortMode===s,l=this.state.showSystemFiles===t,c=k(this.state.notificationPreferences,o);a&&l&&c||(this.state={sessionDisplaySortMode:s,showSystemFiles:t,notificationPreferences:o},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setSessionDisplaySortMode(n){D()&&(n==="createdAt"?window.localStorage.removeItem(I):window.localStorage.setItem(I,n)),this.state.sessionDisplaySortMode!==n&&(this.state={...this.state,sessionDisplaySortMode:n},this.emit())}setShowSystemFiles(n){D()&&(n?window.localStorage.setItem(b,"1"):window.localStorage.removeItem(b)),this.state.showSystemFiles!==n&&(this.state={...this.state,showSystemFiles:n},this.emit())}setNotificationPreferences(n){const s={...this.state.notificationPreferences,...n};k(this.state.notificationPreferences,s)||(ie(s),this.state={...this.state,notificationPreferences:s},this.emit())}emit(){for(const n of this.listeners)n()}}const F=new ae;function On(e){return w.useSyncExternalStore(F.subscribe,()=>e(F.getState()))}function Nn({heading:e,description:n,actions:s,tone:t="default",className:o,children:a}){return i.jsxs("section",{className:y("modal-section",o),"data-tone":t,children:[e||n||s?i.jsxs("div",{className:"modal-section-header",children:[i.jsxs("div",{className:"modal-section-copy",children:[e?i.jsx("strong",{className:"modal-section-heading",children:e}):null,n?i.jsx("p",{className:"modal-section-description",children:n}):null]}),s?i.jsx("div",{className:"modal-section-actions",children:s}):null]}):null,a]})}function In({label:e,description:n,className:s,htmlFor:t,children:o}){return i.jsxs("div",{className:y("workbench-modal-field","modal-field",s),children:[i.jsxs("div",{className:"modal-field-copy",children:[t?i.jsx("label",{className:"modal-field-label",htmlFor:t,children:e}):i.jsx("span",{className:"modal-field-label",children:e}),n?i.jsx("span",{className:"modal-field-description",children:n}):null]}),o]})}function bn({align:e="end",stack:n=!1,className:s,children:t,...o}){return i.jsx("div",{className:y("workbench-modal-actions","modal-actions",s),"data-align":e,"data-stack":n?"true":void 0,...o,children:t})}function En({compact:e=!1,className:n,children:s,...t}){return i.jsx("div",{className:y("modal-list",n),"data-compact":e?"true":void 0,...t,children:s})}function Ln(e){const{as:n="div",label:s,description:t,leading:o,trailing:a,tone:l="default",selected:c=!1,className:P,children:O,...S}=e,f={className:y("modal-list-item",P),"data-tone":l!=="default"?l:void 0,"data-selected":c?"true":void 0,"data-interactive":n==="button"?"true":void 0},A=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"modal-list-item-main",children:[o?i.jsx("div",{className:"modal-list-item-leading",children:o}):null,i.jsxs("div",{className:"modal-list-item-copy",children:[s?i.jsx("span",{className:"modal-list-item-label",children:s}):null,t?i.jsx("span",{className:"modal-list-item-description",children:t}):null,O]})]}),a?i.jsx("div",{className:"modal-list-item-trailing",children:a}):null]});if(n==="button"){const u=S;return i.jsx("button",{type:u.type??"button",...u,...f,children:A})}return i.jsx("div",{...S,...f,children:A})}function Un({title:e,description:n,action:s,className:t,compact:o=!1}){return i.jsxs("div",{className:y("modal-empty-state",t),"data-compact":o?"true":void 0,children:[i.jsx("strong",{className:"modal-empty-state-title",children:e}),n?i.jsx("p",{className:"modal-empty-state-description",children:n}):null,s?i.jsx("div",{className:"modal-empty-state-action",children:s}):null]})}function qn({tone:e="default",className:n,children:s,...t}){return i.jsx("span",{className:y("modal-tag",n),"data-tone":e!=="default"?e:void 0,...t,children:s})}function y(...e){return e.filter(Boolean).join(" ")}function ue(){return _().haptics}const le="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAF+0lEQVRYha2XbXBUZxXHf+e5u4SkCZjg0NIWnQLJLgRF5UWnL75MP9gMjqPT2eyC0qlMiYxOUAR206LOyhiSTVscp52O0xamWgu7WTp0qLUz6kht6Qed1L7M5GUTsAoDTRSIJJos2b33+GFfWMJuNqmcT/c595z/+d3nOc+9zxXKWE9Li7tm0fjyqmT6H0t/Fp8sFz9XM+UCauouH8Rx+ifmWWdP7Q0sLRbT98g3lySC/mcSQd+GGwrQt2vzx1G2ZEa6KJ3S1mJxlpOKIDyEmEM3FGCk5vw5YCw3FmFbb9hXfV2gcm/26vINBfhS+LU0qgcKXB9xT1hbr6kdDhtgcYaDxHSNwVBg92Ao0DMY8n97zgAAZnK8U2AoX1D0++rzWfkC44k6wAVghP7C3EQo8Iiijyq61oEDiV2bPjojwKk234pEsPnh/lDgzpyv/olXrwi6qyDsjsQy2ZQXmJdefPWWvp0v3uZ/CLQ9NxZINpxJj84IYDvmOUT2G/T1DD0CUB/pflnhd1eT5Mcnwl90Adi23JzPl9TbAEN7fF9AeapQW5AOicftGQFEOJ+9tEDbB9v8x99r21wLYBlnJ5AGUKhfklz8QEbY3J71nVnZceziUPAbtzvGxAB3wdPH6yPRx6cXvw4gbbm/B5zIO5SvVKjdMxAMrKvviPcpHMyLqvyoN+ybh7AUwIi+M9TaVOGI/SJwc4Fsf6rS2SqgxQBkukPDYTM40RdCZB/Z5gKmEGmzjStq2alBoDqbvF2hEWgF9oEuAvlugdx/Deaz9ZEjvcWKFwXIWaLNv14cDqmwugDvFRVOi8qOrOMdhT6BzQhvoNxzjbjItxo6o8+VqjEjAMBQa1OFXbXwh4KGuLqmDleXToHzwG1FpLs9kah/uvf98IPz08nkSuZbp+vDL4zNCJAHaQt82lH9JfCJ2cQrTFjq8hiZGrfVtQGcDQhrFNYAywELuFw15SwRgN6dvrrahcnkreGXJ0pCtDZVOFULwsCerEBJExhVGAY8FH/Z2cBvPJHY1ySx13cbaXMaqACSwCVRLqlhVNBRVTOm4lxCOSdqPkB0FdA2m5kosGGEHpC3UP2z6uRJb9fx8SwsJEL+nwBNwEKgWqBSoXaORQqtH+VNhDdErJMNnYf/ViqwbBNO3lRbVZFSS9yyIG1jucRuVuGnM6TZZL4d/wS9KEgawIH/gF5EzAWBvzecto9KPG7PqgkBTu0NLHVs7VBlcxnwS8ALgtyp6Kco3S9/OF850lQWYCD41RpMZUiUH5BZmgkRDqmyVaCqeJYeS1dqwJq4UoG56S5w7hb4PMp6YH426LJR1+qSAOrzWYPLZCvIPuAWAIHXxGGXY3geWAV6DOTrJRR+r5q8P9dskNtJ1etBVl4R19FPdh4eLQowEPR5RKxfgebOeGMqGvLMX/V0YrK/W+B+4ATCYZRnEJ5E+Q5gFM4AFwQ+I8hbLks2Ltt/ZKTUg163Rwfamrcj5q/54spvLZes9nZ2/yIx0b8jW/wCLmeLOLoCAEdeAjmYnaWPGXga9Jiia1O28+bAbt8dswJQEFF5IrO2chGVBzxdsY0r2qNnBx5uvkuELkAFedDTHj+nIl4AIzJsjL2XTAOisB+XtqryKLBcLHNyKLSpsSyAgKrKJoRtbksaPV3R5yFz7BaHOOBGOdAQib6SRV4L4KQZqe+I/wvYmZWqE1ue8nbFggjbgDoH/VOxY3vZXdDT0uKuqR37I+jdIH9JV9r3NIbjU717fLe4jPkASDVEYhW5730i2PwqIvdlZkK3eCPdv06E/GuAbmCBJxJbUnIGill13b8fyxRnRG070BiOTwG4MeuyszBSeNiw3KZFYDTzdPLzU7u3LPZEYu+qTq5Tlev+K2YESAQD94rKjqzgl72Pxd/P3VNLsgAyXJizoj161kG3Z4d1aZP6HIC36/i4tyt6dE4AasQNDIhxNnoisXevvZndJcLw9DxvpLsb5XGE9yzD2ZlqzPpVPN0SIf854FaUZz1dsW0fVqdsD5Q05Qhgg7z+oTX+Xyv2pzNX+x+eTlGviPgh3AAAAABJRU5ErkJggg==",Q="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAbGSURBVHgBzZo/bBtVHMd/ZzuJA0gYCYlsOFO7xRFDy1R3olucqd0SJtiSjiCknBckpjZjBxRn7BR3owOqs5Wp7tZKoDgSQysh4UqUOCG2eZ/3/Oznv/fObqJ+pfPZd+/ufn++vz/vnQN5FwjbGZFGQSRYUb+yIu2c2tSxIOOMqpktqKpzz9X3ioSLNZkRgUwLhA4aW9KWvPqVl6mgldmVGZSJr0BX8Pb2gIVnRUltxbiKxFOgeLJzAYL3I5BQdhaL/sN9EJ5k1dADw+1LQU1tN328kYgaIMWzDSX4s0sUHmSVwZ5JeFqIGjhZgeKpokyzdKGUGQuyWOtA03YCxlNIC98K5X3AhLgYrYB2ndLeE5l0IFvXklK4mpRsxvyuvmqrrSX71aZUjlsyM4LkpuzM7w8dHhqoAxbO+9Fm63pSwhspLTSo1dt6n830bl1SStx9fK6/Z9LmWL3B1hZ/BHUl1+pgYI9S4Eh0EEVjJ5/SwiPI7m9Nuf+02SfUZi4pO+o8ynDcKmlRqRkPlZ43xQ+q8IXpVfdIsu88vJd2ZOSD/OcJKRXmtMW//PlMyi9a0jjvH5NZCDStEDydCjSlfvm9pa/hd24poc+zf/zH8PUjsCT57wOp/FjpqtQ9pakjR+KJo60Fbdnl3dMubSw4vrc2J/msSXLlF4ZCg+M4zzjGEzM39888aAWVFpYlZN+fRnfEE1iMh8JtVygsDWWefTOvhYMiCLX+8L8h4QHnVx+cas/klgLZvpb0eDrp9d/trjr609P6brbhgesPDXXA5kpS7t0ywYwVi4fERD8noJ1WfIDzBDYeRRw8GscL1gP5iCv0g7FsqAIX4UH9pHeegEb44uG5EuKsT3iuPbg9J08252VPxQ3CoowFGYlgRhEMEY2eFzp3CbbEQ3j28BnXjwI0CSvnXQu6lMJrnOd67qOV6fAf2HuuLPn2l4kbRgGT9yf2OU825o11lXDw+bgenb8LV5JdjwE8s/rAxMPXj0xMkGbxBkpWX8epCRp5WvuERNAHl9qADQ+j8xz0QuGDOz3rIizXW8/wHa7bzISSKAveNCQGGoVElPU3coaTcDQKhmoL3QxEkLMna2FplzKAOCFLGf6b4x+nJQbauURnHjsWWJQg8+1nsChCsZGh2LuUwTvb11J94zfVeVtPGOOej4CuNNlJI2xa9BUeQQaD3FKG83iAdItHClcSQ4rzLJvRohGsRCowqoexyCxKbNiUqVPrnf5MhBL0VKRTv6IWZCJnZJR4bujm7eprY+GD2/M6g/hZyypgKENGspThHha2fqxdjZ4sUg8iRz16aYLXBrN5SLPLa5tBMrGCT3T7wD0GgYcM1XwU0IWsXZ80wPY7WMpVguM2g0ABvMDmZhkXZox4w3dswvQV44FFSIe4vqT46rrbzSAEru1pXF6j1L2vTND6Us10p15Zr5Ywq2OTQRwUO0UMyiCM27PYDDKYLomRoy2VNq+n9HGfbGbvyzM9FWgd+4zMfWY4iaV1v6+assHCZNOl7XcKnUC0bUQ9osrq3qnTevgUTtZYUz4ecGEDDwtjaTYER8jsx0YAO5Gxc2EfyyP83lqq27b4Fc6gqhRolEXSe1FDrRBUZioslrYpkD3WthzHSyg0WNCIkVFeoNWw3S7UsQsAHqiobvQTgrgSNbL80gizdmU4EyEswsNzPMQxV3hqiO1oR3kDoyD87tOm57QStKusUNiUcigRXSlZQRchZW2qpc0Sdg5AbQDuw3XboDIQcwGAUm7uh3LWEPvPx88zRiNgWd5OaBr3o+oBrmeaCJhdDeZ7BB83kbETdjZ3bmzryii6eaDCR8c0PzUk/wOdTX7SFU//bEmg5EYoUiOCvv5H5NXbnuDffpHUGYoxLJN892uvarsgXXIPa/14SJTU+pBepXOWVf5W88yFI58VOWqBW9DAYNM3KQMRE0x4gO2JYmLZrtD1ItLTC3ooK2rKasdvzAIVwNp2PfTqpwmdWZY+CswMKzDeYZp579acNgDjodSLv+IK31JvcT4o218jlhYbM78LcJcUR8EG8xSWrynLL7sHZl7cnQQUoYKvLJn0eVwnHTenCVgxSSbwWNwF4cmm+owsbpeLxLqEC+WhoyPHhosl4Y3hewN4Pyw8mNzfhiehxFgzvRgg/IfhuLPRDXr4ljfwe5f/nkxz/m6HDWMR4zWrPBHPFx+zQ7/BX/d5zRrvRfeFU0pbfVcJHvpeMcVfDfAGby8TG/LO0BFc0vftiwtfzPBnD02rvFnZnrrwVUR3wvEFt5heARddZVDE/uXGjRdt4bru4UWODcfT5WmFdvE/Jeqz44iuBr4AAAAASUVORK5CYII=",ce="/assets/gemini-D4G1NbrE.png",de="/assets/kimi-BWNNSh7e.png",fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",pe=new Set(["low","medium","high","xhigh"]),me=["claude-code","codex","opencode","gemini","kimi"],ge=["codex","claude-code","opencode","gemini","kimi"],G={"claude-code":{displayNameKey:"conversation.providerClaude",fullDisplayNameKey:"shell.providerClaudeCode",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:le,defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!0,supportsRunSteeringByDefault:!0,supportsSessionDeleteByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:Q,defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!0,defaultReasoningLevel:null,supportsSlashMenuByDefault:!1,supportsRunSteeringByDefault:!0,supportsQueueWhileRunningByDefault:!0,supportsSessionDeleteByDefault:!0,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:fe,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!1,supportsSessionDeleteByDefault:!0,foldRulesMessagesByDefault:!1},gemini:{displayNameKey:"conversation.providerGemini",draftTitleKey:"conversation.draftTitleGemini",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:ce,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,supportsSessionDeleteByDefault:!0,foldRulesMessagesByDefault:!1},kimi:{displayNameKey:"conversation.providerKimi",draftTitleKey:"conversation.draftTitleKimi",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:de,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,supportsSessionDeleteByDefault:!0,foldRulesMessagesByDefault:!0}},Se=Array.from(new Set(Object.values(G).map(e=>e.icon)));let J=!1;function Ae(e){return me.includes(e)}function d(e){return!e||!Ae(e)?null:G[e]}function he(e){return[{id:"provider-default",name:g(e),usesProviderDefault:!0}]}function ye(e){const n=d(e);return he((n==null?void 0:n.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function xn(e){return!!(e&&d(e))}function Tn(e){const n=d(e);return g((n==null?void 0:n.draftTitleKey)??"conversation.draftTitleCodex")}function ve(e,n="compact"){const s=d(e);return s?n==="full"&&s.fullDisplayNameKey?g(s.fullDisplayNameKey):g(s.displayNameKey):(e==null?void 0:e.trim())||g("conversation.providerCodex")}function Re(e){const n=d(e);return(n==null?void 0:n.icon)??Q}function W(){J||typeof window>"u"||(J=!0,Se.forEach(e=>{const n=new window.Image;n.decoding="async",n.src=e,typeof n.decode=="function"&&n.decode().catch(()=>{})}))}function Bn(e){const n=d(e);return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:(n==null?void 0:n.defaultRunInputMode)??"none",supportsSubagents:!1,supportsInterrupt:(n==null?void 0:n.supportsInterrupt)??!1,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:(n==null?void 0:n.supportsAttachments)??!0,supportsPermissionPrompt:(n==null?void 0:n.supportsPermissionPrompt)??!0,supportsCheckpoint:!1,supportsSessionDelete:(n==null?void 0:n.supportsSessionDeleteByDefault)??!1,modelOptions:ye(e),defaultReasoningLevel:n==null?void 0:n.defaultReasoningLevel,supportsRunSteering:n==null?void 0:n.supportsRunSteeringByDefault,supportsQueueWhileRunning:n==null?void 0:n.supportsQueueWhileRunningByDefault,limitations:[]}}function Mn(e){return(e==null?void 0:e.provider)??"claude-code"}function jn(e){var s;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const n=(e==null?void 0:e.provider)??null;return((s=d(n))==null?void 0:s.supportsSlashMenuByDefault)??!1}function kn(e){var n;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((n=e==null?void 0:e.modelOptions)!=null&&n.some(s=>{var t;return((t=s.supportedReasoningEfforts)==null?void 0:t.some(o=>pe.has(o)))??!1}))}function Fn(e,n){var a;if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const s=(e==null?void 0:e.provider)??null,t=(a=d(s))==null?void 0:a.supportsQueueWhileRunningByDefault;if(t!==void 0)return t;const o=(e==null?void 0:e.inRunInputMode)??"none";return o==="queued_guidance"||o==="none"||o==="streaming_guidance"&&n===!1}function Jn(e){var s;if((e==null?void 0:e.supportsRunSteering)!==void 0)return e.supportsRunSteering;const n=(e==null?void 0:e.provider)??null;return((s=d(n))==null?void 0:s.supportsRunSteeringByDefault)??(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function Kn(e){const n=d(e);return(n==null?void 0:n.reasoningLevelPersists)??!1}function Qn(e,n){var t;return((t=d(n??null))==null?void 0:t.foldRulesMessagesByDefault)??!1}typeof window<"u"&&W();const x=new Map;function Gn(){x.clear()}function Wn({disabled:e=!1,workspaceId:n=null,pendingProvider:s=null,selectedProvider:t=null,providers:o=ge,className:a,disabledReasons:l,statusHintByProvider:c,onSelect:P}){const O=ue(),S=!!n,[v,f]=w.useState(()=>K(o,n)),A=o.map(u=>({provider:u}));return w.useEffect(()=>{W()},[]),w.useEffect(()=>{if(!n){f({});return}const u=K(o,n);f(u);const h=o.filter(m=>!u[m]);if(h.length===0)return;let p=!1;return oe(h,n).then(m=>{we(n,m),p||f(N=>({...N,...m}))}),()=>{p=!0}},[o,n]),i.jsx("div",{className:`session-provider-grid${a?` ${a}`:""}`,children:A.map(u=>{const h=ve(u.provider,"full"),p=s===u.provider,m=t===u.provider,N=!!v[u.provider],E=Ce(v[u.provider]??null),L=(l==null?void 0:l[u.provider])??E,T=p?g("shell.startingSession"):L||((c==null?void 0:c[u.provider])??(S&&!N&&!p?g("shell.providerChecking"):null));return i.jsxs("button",{type:"button",className:"session-provider-card","data-provider":u.provider,"data-pending":p?"true":"false","data-selected":m?"true":"false","aria-label":h,disabled:e||!!L,onClick:()=>{O.trigger("action"),P(u.provider)},children:[i.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:i.jsx("img",{src:Re(u.provider),alt:"",loading:"eager",decoding:"async"})}),i.jsxs("span",{className:"session-provider-card-copy",children:[i.jsx("strong",{children:h}),T?i.jsx("span",{className:"session-provider-card-status",children:T}):null]})]},u.provider)})})}function Ce(e){return!e||e.canStartSession!==!1?null:e.limitations[0]??g("conversation.capabilityDenied")}function K(e,n){const s=(n==null?void 0:n.trim())??"";if(!s)return{};const t=[];for(const o of e){const a=x.get(z(s,o));a&&t.push([o,a])}return Object.fromEntries(t)}function we(e,n){const s=e.trim();if(s)for(const[t,o]of Object.entries(n))o&&x.set(z(s,t),o)}function z(e,n){return`${e}::${n}`}function zn(){const e=X(s=>s),n=H(s=>s);return De(e,n)}function De(e,n){var l;const s=$(e);if(!s)return null;const t=!!((l=s.relayTunnel)!=null&&l.enabled),a=!(e.platform==="web"&&t)&&n.activeHostId===s.id&&n.candidateProbePhase==="ready"?Pe(n):null;if(a){const c=Oe(a.kind);return{kind:c,url:a.url,endpointId:a.endpointId,autoDirect:t&&c!=="relay",probeInProgress:!1}}return{kind:Ne(s),url:s.baseUrl,endpointId:null,autoDirect:!1,probeInProgress:t&&n.activeHostId===s.id&&n.candidateProbePhase==="probing"}}function Vn(e){switch(e){case"relay":return"common.connectionRouteRelay";case"lan":return"common.connectionRouteLan";case"loopback":return"common.connectionRouteLoopback";case"tailscale":return"common.connectionRouteTailscale";default:return"common.connectionRouteDirect"}}function Pe(e){const n=e.preferredDirectCandidateEndpointId??e.preferredCandidateEndpointId;return n?e.candidateEndpoints.find(s=>s.endpointId===n&&s.status==="verified")??null:null}function Oe(e){return e==="custom"?"direct":e}function Ne(e){var n;if((n=e.relayTunnel)!=null&&n.enabled&&Ie(e.baseUrl,e.relayTunnel.tunnelDomain))return"relay";try{const s=new URL(e.baseUrl).hostname.toLowerCase();if(be(s))return"loopback";if(Ee(s))return"tailscale";if(Le(s))return"lan"}catch{return"direct"}return e.kind==="local"?"loopback":e.kind==="lan"?"lan":"direct"}function Ie(e,n){try{return new URL(e).hostname.toLowerCase()===n.trim().toLowerCase()}catch{return!1}}function be(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="[::1]"}function Ee(e){if(e.endsWith(".ts.net"))return!0;const n=e.split(".").map(o=>Number(o));if(n.length!==4||n.some(o=>Number.isNaN(o)))return!1;const[s,t]=n;return s===100&&t>=64&&t<=127}function Le(e){const n=e.split(".").map(o=>Number(o));if(n.length!==4||n.some(o=>Number.isNaN(o)))return!1;const[s,t]=n;return s===10||s===192&&t===168||s===172&&t>=16&&t<=31}function Zn({open:e,title:n,description:s,height:t="auto",kind:o="form",dismissible:a=!0,closeOnBackdrop:l=!0,showHandle:c=!1,showCancelButton:P=!0,cancelLabel:O,className:S,cardClassName:v,bodyClassName:f,footer:A,onClose:u,children:h}){const p=w.useId(),m=w.useId(),N=a&&l;return!e||typeof document>"u"?null:ee.createPortal(i.jsx("div",{className:"ios-action-sheet-overlay mobile-sheet-overlay",role:"presentation",onClick:()=>{N&&u()},children:i.jsxs("div",{className:`mobile-workspace-home-sheet mobile-sheet${S?` ${S}`:""}`,"data-height":t,"data-kind":o,role:"dialog","aria-modal":"true","aria-labelledby":p,"aria-describedby":s?m:void 0,onClick:E=>E.stopPropagation(),children:[i.jsxs("div",{className:`mobile-workspace-home-sheet-card mobile-sheet-card${v?` ${v}`:""}`,children:[c?i.jsx("div",{className:"mobile-sheet-handle","aria-hidden":"true"}):null,i.jsx("div",{className:"mobile-workspace-home-sheet-header mobile-sheet-header",children:i.jsxs("div",{className:"mobile-sheet-title-wrap",children:[i.jsx("strong",{id:p,children:n}),s?i.jsx("p",{id:m,children:s}):null]})}),i.jsx("div",{className:f?`mobile-sheet-body ${f}`:"mobile-sheet-body",children:h}),A?i.jsx("div",{className:"mobile-sheet-footer",children:A}):null]}),P?i.jsx("button",{type:"button",className:"ios-action-sheet-cancel mobile-sheet-cancel",disabled:!a,onClick:()=>{a&&u()},children:O??g("common.cancel")}):null]})}),document.body)}export{mn as $,Cn as A,Dn as B,Pn as C,Ze as D,pn as E,wn as F,ln as G,cn as H,yn as I,gn as J,xn as K,nn as L,Zn as M,Jn as N,$e as O,tn as P,Tn as Q,Un as R,Wn as S,Mn as T,kn as U,jn as V,Fn as W,fn as X,Kn as Y,dn as Z,Qn as _,ve as a,Re as a0,Ge as a1,Me as a2,Be as a3,We as a4,sn as a5,_e as a6,en as a7,rn as a8,an as a9,un as aa,Xe as ab,Gn as ac,Qe as ad,Ke as ae,He as af,Ye as ag,on as ah,F as ai,Ve as aj,ke as b,Fe as c,Je as d,ue as e,Nn as f,Te as g,In as h,En as i,Ln as j,qn as k,zn as l,Vn as m,Bn as n,te as o,oe as p,ge as q,je as r,Sn as s,hn as t,On as u,An as v,ze as w,bn as x,vn as y,Rn as z};
@@ -1 +0,0 @@
1
- import{b as j,f as B,h as $,j as t,t as l}from"./index-BZLcEHW3.js";import{e as K,i as P,j as F,k as S,M as G}from"./MobileSheet-Ckug8hTb.js";import{aN as q,m as z,aO as D,aj as X,aP as J}from"./WorkbenchLayout-DGm8Tc5M.js";import{u as Q,f as V}from"./App-BZvapsi8.js";import{M as Y}from"./MobileTopHeaderFrame-Bwv8Ovm_.js";function Z(s){return s.flatMap(o=>[{workspace:o.workspace,label:o.workspace.name,subtitle:o.workspace.path,depth:0,kind:"workspace",meta:null},...v(o.childWorktrees??[])])}function we(s,o){const a=o==null?void 0:o.trim();if(!a)return null;for(const i of s){if(i.workspace.id===a)return{workspace:i.workspace,sessions:i.sessions,childWorktrees:i.childWorktrees??[],meta:null};const n=N(i.childWorktrees??[],a);if(n)return n}return null}function v(s){return s.flatMap(o=>[{workspace:o.workspace,label:o.meta.displayName||o.workspace.name,subtitle:o.workspace.path,depth:o.meta.depth,kind:"worktree",meta:o.meta},...v(o.children)])}function N(s,o){for(const a of s){if(a.workspace.id===o)return{workspace:a.workspace,sessions:a.sessions,childWorktrees:a.children,meta:a.meta};const i=N(a.children,o);if(i)return i}return null}const W=10080*60*1e3;function ee(s,o){return se(s.hosts,s.activeHostId).flatMap(a=>{const i=a.id===s.activeHostId?o:oe(a.id);return[{kind:"host",host:a,workspaceCount:i.length},...i.map(n=>({kind:"workspace",host:a,workspace:n.workspace,option:n}))]})}function se(s,o){return[...s].sort((a,i)=>{if(a.id===o)return-1;if(i.id===o)return 1;const n=a.lastConnectedAt??a.updatedAt??a.createdAt;return(i.lastConnectedAt??i.updatedAt??i.createdAt).localeCompare(n)})}function oe(s){const o=q(W,s);return o?Z(z(o)):[]}function ke({currentWorkspace:s,workspaces:o,workspaceOptions:a,onSelectWorkspace:i,className:n,containerRef:w,heading:H,content:C,sheetContent:k,triggerLabel:M,triggerAriaLabel:L,onTriggerClick:c,trailing:A,gestureHandlers:y}){const[u,d]=j.useState(!1),[m,f]=j.useState(null),b=K(),I=Q(),{showToast:T}=V(),r=B(e=>e),h=$(r),E=a??o.map(e=>({workspace:{...e,repoRoot:e.path},label:e.name,subtitle:e.path,depth:0,kind:"workspace",meta:null})),O=ee(r,E),p=(s==null?void 0:s.name)??(h==null?void 0:h.name)??null,x=(s==null?void 0:s.path)??(h==null?void 0:h.baseUrl)??null;if(!p)return null;async function R(e){const U=e.kind==="host"?`host:${e.host.id}`:`workspace:${e.host.id}:${e.workspace.id}`;if(!m){f(U);try{e.host.id!==r.activeHostId&&(b.trigger("selection"),await D.switchHost(e.host.id)),e.kind==="host"?I(X()):(e.workspace.id!==(s==null?void 0:s.id)||e.host.id!==r.activeHostId)&&await(i==null?void 0:i(e.workspace.id)),d(!1)}catch(_){T({title:te(_,e.host.name),tone:"error"})}finally{f(null)}}}return t.jsxs(t.Fragment,{children:[t.jsx(Y,{className:n,frameRef:w,...y,children:t.jsxs("section",{className:"mobile-workspace-home-header",children:[t.jsx("h1",{className:"mobile-workspace-switcher-heading",children:H??p}),t.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[t.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":L??l("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(c){c();return}b.trigger("selection"),d(!0)},children:[t.jsx("span",{className:"mobile-workspace-home-switcher-label",children:M??p}),t.jsx(ne,{})]}),t.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:A})]}),x?t.jsx("p",{className:"mobile-workspace-home-path",children:x}):null,C]})}),u&&!c?t.jsxs(ie,{open:u,title:l("shell.hostWorkspaceSwitcherTitle"),onClose:()=>d(!1),children:[t.jsx(P,{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:O.map(e=>t.jsx(F,{as:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row","data-host-entry-kind":e.kind,"data-host-active":e.host.id===r.activeHostId,"data-worktree-kind":e.kind==="workspace"?e.option.kind:void 0,"data-worktree-depth":e.kind==="workspace"?e.option.depth+1:0,disabled:m!==null,selected:e.kind==="host"&&e.host.id===r.activeHostId||e.kind==="workspace"&&e.workspace.id===(s==null?void 0:s.id)&&e.host.id===r.activeHostId,trailing:t.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.kind==="host"&&e.host.id===r.activeHostId?t.jsx(g,{}):e.kind==="workspace"&&e.workspace.id===(s==null?void 0:s.id)&&e.host.id===r.activeHostId?t.jsx(g,{}):t.jsx(re,{})}),style:{"--mobile-workspace-tree-depth":String(e.kind==="host"?0:e.option.depth+1)},onClick:()=>{R(e)},label:t.jsxs("span",{className:e.kind==="host"?"mobile-workspace-home-sheet-label mobile-host-workspace-switcher-host-label":"mobile-workspace-home-sheet-label",children:[e.kind==="host"?t.jsx(S,{className:"mobile-host-workspace-switcher-host-badge",children:l("shell.hostSwitcherNodeBadge")}):null,e.kind==="workspace"&&e.option.kind==="worktree"?t.jsx(S,{className:"mobile-workspace-home-worktree-badge",children:l("shell.mobileWorktreeBadge")}):null,t.jsx("span",{className:"mobile-workspace-home-sheet-label-text",children:e.kind==="host"?e.host.name:e.option.label})]}),description:t.jsx("span",{className:"mobile-workspace-home-sheet-description",children:e.kind==="host"?ae(e.host,e.workspaceCount):e.option.subtitle})},e.kind==="host"?`host-${e.host.id}`:`workspace-${e.host.id}-${e.workspace.id}`))}),k?k(()=>d(!1)):null]}):null]})}function te(s,o){return s instanceof J?s.code==="HOST_UNREACHABLE"?l("shell.hostSwitchUnreachable",{name:o}):l("shell.hostSwitchMissing"):l("shell.hostSwitchFailed")}function ae(s,o){return s?s.lastUsername?l("shell.hostSwitcherWorkspaceCountWithUser",{username:s.lastUsername,count:o}):o>0?l("shell.hostSwitcherWorkspaceCount",{count:o}):s.baseUrl:""}function ie({open:s,title:o,onClose:a,children:i}){return t.jsx(G,{open:s,title:o,kind:"picker",height:"three-quarter",className:"mobile-host-workspace-switcher-sheet",bodyClassName:"mobile-workspace-home-form",showHandle:!0,onClose:a,children:i})}function ne(){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function re(){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function g(){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.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{ke as M,we as a,Z as f};
@@ -1 +0,0 @@
1
- import{b as h,j as e,t as a}from"./index-BZLcEHW3.js";import{g as ve,u as ye}from"./App-BZvapsi8.js";import{e as je,a as be}from"./MobileSheet-Ckug8hTb.js";import{C as ue,D as Ne,E as ke,F as Me,G as Ee,H as xe,I as Ae,J as Ce,u as Pe,K as Ie,L as De,M as he,f as Le,N as ie,O as oe,P as Te,k as Re,b as Ge}from"./WorkbenchLayout-DGm8Tc5M.js";import{f as Oe,a as me,M as We}from"./MobileWorkspaceSwitcherHeader-RqWrBdn2.js";import{M as $e}from"./MobileCreateSessionSheet-BYfbvK8o.js";import{w as pe}from"./styles-DRVvx_kv.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-0tPIIhca.js";import"./relay-entry-C5_Iay0I.js";import"./MobileTopHeaderFrame-Bwv8Ovm_.js";const Be=420,Fe=156;function He({entry:n,isFavorite:t,isActive:r=!1,depth:d=0,variant:l="default",workspaceTone:N="root",hasSubsessions:m=!1,subsessionsExpanded:k=!1,showActions:z=!0,onActivate:J,onToggleSubsessions:$,onToggleFavorite:ae,onArchive:B,onUnarchive:re,onRename:u}){var C;const[g,L]=h.useState(!1),[T,R]=h.useState(null),[w,F]=h.useState(null),M=h.useRef(null),G=h.useRef(!1),O=h.useRef(null),H=je(),{session:c,workspace:le}=n,V=c.title??c.sessionId,Z=be(c.provider),_=[Z,Ve(c.lastMessageAt??c.updatedAt??null),ue(c)].filter(Boolean).join(" · "),K=Ke(c),U=K?Ue(K):null,W=l==="mobile"?null:ue(c),X=W?Ne("session-list-activity-badge",c):null,E=l!=="mobile",q=E?ke(c.parallelGroup):null,Q=E?Me(c.parallelGroup):null,ce=E?Ee(c.parallelGroup):void 0;h.useEffect(()=>()=>{A()},[]),h.useLayoutEffect(()=>{if(!g||!w||typeof window>"u"){R(null);return}const i=()=>{var P,I;const f=Ae(w,{width:((P=O.current)==null?void 0:P.offsetWidth)??0,height:((I=O.current)==null?void 0:I.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:Fe});R({position:"fixed",left:`${Math.round(f.left)}px`,top:`${Math.round(f.top)}px`,width:`${Math.round(f.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(f.maxHeight)}px`,transformOrigin:f.transformOrigin})},S=f=>{var I;const P=f.target;P&&!((I=O.current)!=null&&I.contains(P))&&y()},ne=f=>{f.key==="Escape"&&y()};return i(),window.addEventListener("pointerdown",S),window.addEventListener("keydown",ne),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",ne),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[w,g]);function Y(i){F(i),L(!0)}function y(){L(!1),F(null)}function A(){M.current!==null&&(window.clearTimeout(M.current),M.current=null)}function ee(i){if(!z||i.pointerType==="mouse")return;const S={x:i.clientX,y:i.clientY};A(),M.current=window.setTimeout(()=>{G.current=!0,H.trigger("gesture"),Y(S)},Be)}function s(){A()}function o(){if(G.current){G.current=!1;return}H.trigger("selection"),J(c.sessionId)}const p=async()=>{const i=window.prompt(a("shell.renameModalDescription"),V);i&&(await u(c.sessionId,i.trim()),y())},v=async()=>{if(c.isArchived){await re(c.sessionId),y();return}await B(c.sessionId),y()},j=()=>{ae(c.sessionId),y()},x=i=>{if(i.key!=="ContextMenu"&&!(i.shiftKey&&i.key==="F10"))return;i.preventDefault(),i.stopPropagation();const S=i.currentTarget.getBoundingClientRect();Y({x:S.right,y:S.bottom})},se=g&&typeof document<"u"?ve.createPortal(e.jsxs("div",{ref:O,className:"session-action-menu surface-card",role:"menu","aria-label":a("shell.sessionMoreAction"),style:T??{position:"fixed",top:0,left:0,visibility:"hidden"},onClick:i=>i.stopPropagation(),children:[e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:j,children:t?a("shell.unfavoriteAction"):a("shell.favoriteAction")}),e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void v(),children:c.isArchived?a("shell.unarchiveAction"):a("shell.archiveAction")}),e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void p(),children:a("shell.renameAction")})]}),document.body):null;return e.jsxs("article",{className:"session-list-item","data-depth":d,"data-active":r,"data-workspace-tone":N,"data-has-subsessions":m,"data-variant":l,"data-parallel-group":E&&c.parallelGroup?"true":void 0,"data-parallel-role":E?((C=c.parallelGroup)==null?void 0:C.role)??void 0:void 0,style:ce,onContextMenu:i=>{z&&(i.preventDefault(),i.stopPropagation(),Y({x:i.clientX,y:i.clientY}))},children:[m?e.jsx("button",{type:"button",className:"session-list-subsession-toggle","aria-label":k?a("shell.subagentCollapse"):a("shell.subagentExpand"),title:k?a("shell.subagentCollapse"):a("shell.subagentExpand"),"aria-expanded":k,onClick:i=>{i.stopPropagation(),H.trigger("selection"),$==null||$()},children:e.jsx("span",{className:fe(c,{isActive:r,hasSubsessions:m}),"aria-hidden":"true"})}):e.jsx("span",{className:fe(c,{isActive:r,hasSubsessions:m}),"aria-hidden":"true"}),e.jsx("button",{type:"button",className:"session-list-link",onClick:o,onPointerDown:ee,onPointerUp:s,onPointerCancel:s,onPointerLeave:s,onKeyDown:x,children:e.jsxs("div",{className:"session-list-copy",children:[e.jsxs("div",{className:"session-list-title-row",children:[e.jsx("div",{className:"session-list-title",children:V||a("shell.searchEntry")}),q?e.jsx("span",{className:"session-list-parallel-badge",children:q}):null,Q?e.jsx("span",{className:"session-list-parallel-role-badge",children:Q}):null]}),e.jsx("div",{className:"session-list-meta",children:l==="mobile"?e.jsx(e.Fragment,{children:e.jsx("span",{children:_})}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:le.name}),W&&X?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{className:X,children:W})]}):null,e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{children:Z})]})}),U?e.jsx("div",{className:"session-list-error",title:K??void 0,children:U}):null]})}),se]})}function fe(n,t){return Ce("session-list-indicator",n,{isActive:t.isActive,hasSubagents:t.hasSubsessions})}function Ve(n){return n?new Date(n).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):a("common.unknown")}function _e(n){return xe(n)||n.syncStatus==="error"}function Ke(n){var d,l;if(!_e(n))return null;const t=((d=n.lastErrorCode)==null?void 0:d.trim())??"",r=((l=n.lastErrorDetail)==null?void 0:l.replace(/\s+/g," ").trim())??"";return t&&r&&!r.includes(t)?`${t} · ${r}`:r||t||(n.syncStatus==="error"&&!xe(n)?a("conversation.syncStatusError"):a("conversation.runtimeErrorTitle"))}function Ue(n,t=96){return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}…`}const te=5;function us(){var ee;const n=ye(),{navigationGroups:t,favoriteSessionIds:r,currentWorkspaceId:d,currentSessionId:l,navigationLoading:N,selectWorkspace:m,toggleFavoriteSession:k,archiveSession:z,unarchiveSession:J,renameSession:$,startDraftSession:ae}=Pe(),B=Oe(t),re=h.useMemo(()=>Ie(t),[t]),u=me(t,d)??me(t,((ee=t[0])==null?void 0:ee.workspace.id)??null),g=B.find(s=>s.workspace.id===(u==null?void 0:u.workspace.id))??(u?{workspace:u.workspace,label:u.workspace.name,subtitle:u.workspace.path}:null),L=h.useMemo(()=>new Set(r),[r]),T=h.useMemo(()=>u?u.sessions.filter(s=>{if(s.isArchived)return!1;const o=De(s,{mode:"mobile"});if(!o)return!0;const p=u.sessions.find(v=>v.sessionId===o);return!p||!p.isArchived}).map(s=>({session:s,workspace:u.workspace})):[],[u]),R=h.useMemo(()=>T.filter(s=>L.has(s.session.sessionId)),[T,L]),w=h.useMemo(()=>he(T,{mode:"mobile"}),[T]),F=h.useMemo(()=>he(R,{mode:"mobile"}),[R]),M=h.useMemo(()=>u?u.sessions.filter(s=>s.isArchived===!0&&!Le(s)):[],[u]),G=(u==null?void 0:u.workspace.id)??"",O=!!G,[H,c]=h.useState([]),[le,V]=h.useState({}),[Z,_]=h.useState(!1),[K,U]=h.useState(!1),[W,X]=h.useState(null);h.useEffect(()=>{V(s=>{const o={};for(const p of w){const v=ie(oe(p));if(v.length===0)continue;const j=v.findIndex(x=>x.item.session.sessionId===l);o[p.item.session.sessionId]=Ze(v.length,te,s[p.item.session.sessionId],j)}return qe(s,o)?s:o})},[l,w]),h.useEffect(()=>{if(!l)return;const s=Te(w,l,o=>o.session.sessionId);s.length!==0&&c(o=>{const p=new Set(o);let v=!1;for(const j of s)p.has(j)||(p.add(j),v=!0);return v?Array.from(p):o})},[l,w]);function E(s){c(o=>o.includes(s)?o.filter(p=>p!==s):[...o,s])}function q(s){return le[s]??te}function Q(s){V(o=>({...o,[s]:(o[s]??te)+te}))}function ce(s,o){pe("immersive"),n(Ge(s,o))}function Y(s,o){_(!1),pe("immersive"),ae(s,o)}async function y(s){X(s);try{await J(s)}finally{X(o=>o===s?null:o)}}function A(s,o=!1,p=[],v=!1,j=!1){var de;const x=s.item.session.sessionId,se=s.children,C=s.depth===0&&se.length>0,i=o||C&&H.includes(x),S=i&&C,ne=S?Je(s,q(x)):s,f=i?ne.children:[],P=ie(se).length,I=ie(f).length,we=S&&I<P,Se=s.depth>0?[...p,v]:[...p];return e.jsxs("div",{className:"session-list-tree-node",children:[e.jsxs("div",{className:"session-list-tree-row",style:{"--session-tree-depth":s.depth},children:[s.depth>0?e.jsxs("div",{className:"session-tree-guides","aria-hidden":"true",style:{"--session-tree-depth":s.depth},children:[p.map((b,D)=>b?e.jsx("span",{className:"session-tree-guide-column",style:{"--session-tree-level":D+1}},`${x}:ancestor:${D}`):null),e.jsx("span",{className:"session-tree-guide-branch","data-continue":v,"data-first":j,style:{"--session-tree-level":s.depth},children:e.jsx("span",{className:"session-tree-guide-branch-horizontal"})})]}):null,e.jsx(He,{entry:s.item,isFavorite:L.has(x),isActive:l===x,depth:s.depth,variant:"mobile",workspaceTone:((de=re[s.item.workspace.id])==null?void 0:de.tone)??"root",hasSubsessions:C,subsessionsExpanded:i,onActivate:b=>ce(s.item.workspace.id,b),onToggleSubsessions:C?()=>E(x):void 0,onToggleFavorite:b=>{k(b)},onArchive:b=>z(b),onUnarchive:b=>J(b),onRename:(b,D)=>$(b,D)})]}),i&&f.length>0?e.jsx("div",{className:"session-list-children",children:f.map((b,D)=>A(b,!0,Se,D<f.length-1,D===0))}):null,we?e.jsx("div",{className:"session-list-children",children:e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Q(x),children:a("shell.subagentExpandMore")})}):null]},`${s.item.workspace.id}:${x}`)}return e.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[e.jsx(We,{currentWorkspace:g?{id:g.workspace.id,name:g.label,path:g.subtitle}:null,workspaces:t.map(s=>s.workspace),workspaceOptions:B,onSelectWorkspace:s=>{m(s),n(Re(s))},content:e.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:N||!O,onClick:()=>_(!0),children:a("shell.createSession")})}),e.jsxs("div",{className:"mobile-page-top-body",children:[e.jsx("div",{className:"session-index-archive-actions",children:e.jsxs("button",{type:"button",className:"primary-button mobile-session-index-create-button session-index-archive-button",disabled:N||!u,onClick:()=>U(!0),children:[e.jsx("span",{children:a("shell.archiveViewAction")}),e.jsx("span",{className:"session-index-archive-count",children:M.length})]})}),F.length>0?e.jsxs("section",{className:"session-section session-section-sheet",children:[e.jsxs("header",{className:"session-section-heading",children:[e.jsx("div",{children:e.jsx("h2",{children:a("shell.favoriteSectionTitle")})}),e.jsx("span",{className:"session-section-count",children:R.length})]}),e.jsx("div",{className:"session-current-workspace-list",children:F.map(s=>A(s))})]}):null,e.jsxs("section",{className:"session-section session-section-sheet",children:[e.jsxs("header",{className:"session-section-heading",children:[e.jsx("div",{children:e.jsx("h2",{children:a("shell.mobileConversationCurrentWorkspaceSection")})}),e.jsx("span",{className:"session-section-count",children:w.length})]}),w.length===0?e.jsx("p",{className:"session-section-empty",children:N?a("shell.searchSessionHint"):a("shell.emptyWorkspaceSessions")}):e.jsx("div",{className:"session-current-workspace-list",children:w.map(s=>A(s))})]})]}),e.jsx($e,{open:Z,workspaces:t.map(s=>s.workspace),workspaceOptions:B,initialWorkspaceId:d??G,onClose:()=>_(!1),onSelect:Y}),e.jsx(Xe,{open:K,workspaceName:(g==null?void 0:g.label)??(u==null?void 0:u.workspace.name)??null,sessions:M,restoringSessionId:W,onClose:()=>{W||U(!1)},onRestore:s=>void y(s)})]})}function Xe({open:n,workspaceName:t,sessions:r,restoringSessionId:d,onClose:l,onRestore:N}){return h.useEffect(()=>{if(!n)return;function m(k){k.key==="Escape"&&!d&&l()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[l,n,d]),!n||typeof document>"u"?null:ve.createPortal(e.jsxs("div",{className:"workbench-modal-layer",children:[e.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":a("common.close"),disabled:!!d,onClick:l}),e.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":a("shell.archiveModalTitle"),children:[e.jsx("div",{className:"workbench-modal-header",children:e.jsxs("div",{className:"workbench-modal-title-wrap",children:[e.jsx("h2",{children:a("shell.archiveModalTitle")}),e.jsx("p",{children:t?`${t} · ${a("shell.archiveModalDescription")}`:a("shell.archiveModalDescription")})]})}),e.jsx("div",{className:"workbench-modal-body",children:r.length>0?e.jsx("div",{className:"workbench-archive-list",children:r.map(m=>e.jsxs("article",{className:"workbench-archive-item",children:[e.jsxs("div",{className:"workbench-archive-item-main",children:[e.jsx("strong",{title:m.title??m.sessionId,children:m.title??m.sessionId}),e.jsx("p",{children:Ye(m)})]}),e.jsx("button",{type:"button",className:"secondary-button",disabled:d===m.sessionId,onClick:()=>{N(m.sessionId)},children:a("shell.unarchiveAction")})]},m.sessionId))}):e.jsx("p",{className:"workbench-section-empty",children:a("shell.archiveEmpty")})})]})]}),document.body)}function Ye(n){const t=be(n.provider),r=ze(n.lastMessageAt??n.updatedAt??null);return[t,r].filter(Boolean).join(" · ")}function ze(n){if(!n)return null;const t=Date.parse(n);return Number.isNaN(t)?null:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}function Je(n,t){const r=new Set(ie(oe(n)).sort((d,l)=>(l.item.session.lastMessageAt??l.item.session.updatedAt).localeCompare(d.item.session.lastMessageAt??d.item.session.updatedAt)).slice(0,t).map(d=>d.item.session.sessionId));return{...n,children:ge(oe(n),r)}}function ge(n,t){return n.flatMap(r=>{const d=ge(oe(r),t);return!t.has(r.item.session.sessionId)&&d.length===0?[]:[{...r,children:d}]})}function Ze(n,t,r,d=-1){if(n<=0)return 0;const l=d>=0?Math.max(t,d+1):t;return Math.min(n,Math.max(r??0,l))}function qe(n,t){const r=Object.keys(n),d=Object.keys(t);return r.length!==d.length?!1:r.every(l=>n[l]===t[l])}export{us as SessionIndexPage};