@jingyi0605/codingns 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/bin/codingns.mjs +425 -1
  2. package/dist/public/assets/AdaptiveButlerPage-B153lk5H.css +1 -0
  3. package/dist/public/assets/AdaptiveButlerPage-SffCV4Vb.js +3 -0
  4. package/dist/public/assets/App-DUAg5urj.css +1 -0
  5. package/dist/public/assets/App-WOLwMld_.js +30 -0
  6. package/dist/public/assets/BootstrapPage--zExdgfM.js +1 -0
  7. package/dist/public/assets/ConversationPage-D9pzRmOg.js +2 -0
  8. package/dist/public/assets/DesktopDetachPreviewPage-DvI9CIKi.js +1 -0
  9. package/dist/public/assets/DesktopWindowPage-D8FpOSLE.js +2 -0
  10. package/dist/public/assets/FileContextPanel-C8T7oqRN.js +1 -0
  11. package/dist/public/assets/GitSidebar-Bze7DNnc.js +6 -0
  12. package/dist/public/assets/MobileCreateSessionSheet-CXSKMnYn.js +1 -0
  13. package/dist/public/assets/MobileSheet-Gzc14EpR.js +1 -0
  14. package/dist/public/assets/MobileTopHeaderFrame-BWorAJ1C.js +1 -0
  15. package/dist/public/assets/MobileWorkspaceSwitcherHeader-DOr4pTUq.js +1 -0
  16. package/dist/public/assets/ServerSettingsModal-BYB0GvTl.js +1 -0
  17. package/dist/public/assets/SessionIndexPage-CR3IARXX.js +1 -0
  18. package/dist/public/assets/SettingsPage-B_BQtnwE.js +1 -0
  19. package/dist/public/assets/TerminalManagerPanel-PQ-EM64j.js +1 -0
  20. package/dist/public/assets/{TerminalPage-6jHZV9Mh.js → TerminalPage-CvnHXBhw.js} +19 -19
  21. package/dist/public/assets/TerminalRuntimeFallbackModal-D7Aq186N.js +1 -0
  22. package/dist/public/assets/ToolFilesPage-Qzkc6K2I.js +1 -0
  23. package/dist/public/assets/ToolGitPage-BdNDN-cV.js +1 -0
  24. package/dist/public/assets/ToolProcessesPage-EXJ9DHWI.js +1 -0
  25. package/dist/public/assets/ToolsHomePage-CjF3CWzR.js +1 -0
  26. package/dist/public/assets/WorkbenchLandingPage-DZPk4SmX.js +1 -0
  27. package/dist/public/assets/WorkbenchLayout-rwQib5In.js +3 -0
  28. package/dist/public/assets/WorkbenchModal-B09hC9b5.js +1 -0
  29. package/dist/public/assets/WorkbenchShellRoute-Cerk5uK7.js +1 -0
  30. package/dist/public/assets/WorkbenchShellRoute-DsW4mBTX.css +1 -0
  31. package/dist/public/assets/WorkspaceDebugDetailPage-Bcq8s-Ma.js +1 -0
  32. package/dist/public/assets/WorkspaceDetailPage-DNAa8pKr.js +1 -0
  33. package/dist/public/assets/WorkspaceHomePage-BoiLuACV.js +1 -0
  34. package/dist/public/assets/butler-records-events-DgWCG364.js +1 -0
  35. package/dist/public/assets/client-runtime-manager-CRQ-F5d2.js +1 -0
  36. package/dist/public/assets/default-session-permission-mode-D0wZ9Jek.js +1 -0
  37. package/dist/public/assets/event-DvH9tcej.js +1 -0
  38. package/dist/public/assets/file-tree-icon-Dp_xhVfD.js +31 -0
  39. package/dist/public/assets/index-C2G8Gmf1.js +42 -0
  40. package/dist/public/assets/index-CpPTUeA3.css +1 -0
  41. package/dist/public/assets/preferences-service-gOt2ZjKZ.js +1 -0
  42. package/dist/public/assets/session-runtime-machine-Dq3pW-UF.js +17 -0
  43. package/dist/public/assets/styles-BWPBZvze.css +1 -0
  44. package/dist/public/assets/styles-CSUx5LGe.js +1 -0
  45. package/dist/public/assets/terminal-runtime-meta-BMT-rSEe.js +1 -0
  46. package/dist/public/assets/useRegisteredDebugTemplates-zMcEOGca.js +1 -0
  47. package/dist/public/assets/window-BWqRixxq.js +1 -0
  48. package/dist/public/index.html +2 -2
  49. package/dist/server/middlewares/auth-guard.d.ts +4 -0
  50. package/dist/server/middlewares/auth-guard.js +42 -4
  51. package/dist/server/middlewares/auth-guard.js.map +1 -1
  52. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +62 -1
  53. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +58 -0
  54. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  55. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +66 -3
  56. package/dist/server/modules/assistant-capability/assistant-capability-service.js +173 -1
  57. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  58. package/dist/server/modules/auth/auth-controller.d.ts +11 -1
  59. package/dist/server/modules/auth/auth-controller.js +61 -2
  60. package/dist/server/modules/auth/auth-controller.js.map +1 -1
  61. package/dist/server/modules/auth/auth-device-display-name.d.ts +10 -0
  62. package/dist/server/modules/auth/auth-device-display-name.js +190 -0
  63. package/dist/server/modules/auth/auth-device-display-name.js.map +1 -0
  64. package/dist/server/modules/auth/auth-service.d.ts +80 -5
  65. package/dist/server/modules/auth/auth-service.js +333 -23
  66. package/dist/server/modules/auth/auth-service.js.map +1 -1
  67. package/dist/server/modules/butler/assistant-automation-service.d.ts +2 -0
  68. package/dist/server/modules/butler/assistant-automation-service.js +46 -0
  69. package/dist/server/modules/butler/assistant-automation-service.js.map +1 -1
  70. package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.d.ts +32 -0
  71. package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js +93 -0
  72. package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js.map +1 -0
  73. package/dist/server/modules/butler/assistant-sandbox-service.d.ts +16 -2
  74. package/dist/server/modules/butler/assistant-sandbox-service.js +137 -4
  75. package/dist/server/modules/butler/assistant-sandbox-service.js.map +1 -1
  76. package/dist/server/modules/butler/butler-auth-service.js +7 -2
  77. package/dist/server/modules/butler/butler-auth-service.js.map +1 -1
  78. package/dist/server/modules/butler/butler-control-session-service.d.ts +4 -1
  79. package/dist/server/modules/butler/butler-control-session-service.js +20 -1
  80. package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
  81. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.d.ts +2 -1
  82. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js +27 -25
  83. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js.map +1 -1
  84. package/dist/server/modules/butler/butler-follow-up-service.d.ts +32 -4
  85. package/dist/server/modules/butler/butler-follow-up-service.js +436 -331
  86. package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
  87. package/dist/server/modules/butler/butler-inbox-analysis-service.d.ts +1 -1
  88. package/dist/server/modules/butler/butler-inbox-analysis-service.js.map +1 -1
  89. package/dist/server/modules/butler/butler-inbox-service.js +1 -0
  90. package/dist/server/modules/butler/butler-inbox-service.js.map +1 -1
  91. package/dist/server/modules/butler/butler-session-service.d.ts +3 -1
  92. package/dist/server/modules/butler/butler-session-service.js +15 -1
  93. package/dist/server/modules/butler/butler-session-service.js.map +1 -1
  94. package/dist/server/modules/butler/butler-workspace-context.d.ts +1 -1
  95. package/dist/server/modules/butler/butler-workspace-context.js +54 -28
  96. package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
  97. package/dist/server/modules/client/client-controller.js +1 -1
  98. package/dist/server/modules/client/client-controller.js.map +1 -1
  99. package/dist/server/modules/client/client-service.d.ts +16 -2
  100. package/dist/server/modules/client/client-service.js +21 -3
  101. package/dist/server/modules/client/client-service.js.map +1 -1
  102. package/dist/server/modules/provider/provider-controller.d.ts +1 -1
  103. package/dist/server/modules/provider/provider-controller.js.map +1 -1
  104. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.d.ts +10 -0
  105. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js +48 -0
  106. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js.map +1 -0
  107. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.d.ts +48 -0
  108. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js +11 -0
  109. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js.map +1 -0
  110. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.d.ts +74 -0
  111. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js +302 -0
  112. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js.map +1 -0
  113. package/dist/server/modules/relay-tunnel/relay-tunnel-controller.d.ts +33 -0
  114. package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js +57 -0
  115. package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js.map +1 -0
  116. package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.d.ts +9 -0
  117. package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js +25 -0
  118. package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js.map +1 -0
  119. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.d.ts +18 -0
  120. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js +230 -0
  121. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js.map +1 -0
  122. package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.d.ts +41 -0
  123. package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js +443 -0
  124. package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js.map +1 -0
  125. package/dist/server/modules/relay-tunnel/relay-tunnel-service.d.ts +112 -0
  126. package/dist/server/modules/relay-tunnel/relay-tunnel-service.js +966 -0
  127. package/dist/server/modules/relay-tunnel/relay-tunnel-service.js.map +1 -0
  128. package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +2 -1
  129. package/dist/server/modules/sessions/codex-app-server-helper-client.js +78 -0
  130. package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -1
  131. package/dist/server/modules/sessions/codex-app-server-helper-process.js +84 -2
  132. package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
  133. package/dist/server/modules/sessions/provider-session-delete-cli.d.ts +15 -0
  134. package/dist/server/modules/sessions/provider-session-delete-cli.js +148 -0
  135. package/dist/server/modules/sessions/provider-session-delete-cli.js.map +1 -0
  136. package/dist/server/modules/sessions/session-controller.d.ts +4 -1
  137. package/dist/server/modules/sessions/session-controller.js +4 -0
  138. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  139. package/dist/server/modules/sessions/session-history-service.d.ts +17 -0
  140. package/dist/server/modules/sessions/session-history-service.js +150 -1
  141. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  142. package/dist/server/modules/sessions/session-live-runtime-router-service.d.ts +25 -0
  143. package/dist/server/modules/sessions/session-live-runtime-router-service.js +42 -0
  144. package/dist/server/modules/sessions/session-live-runtime-router-service.js.map +1 -0
  145. package/dist/server/modules/sessions/session-live-runtime-service.js +34 -18
  146. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  147. package/dist/server/modules/sessions/session-message-attachment-service.d.ts +1 -0
  148. package/dist/server/modules/sessions/session-message-attachment-service.js +22 -0
  149. package/dist/server/modules/sessions/session-message-attachment-service.js.map +1 -1
  150. package/dist/server/modules/sessions/session-permission-request-service.d.ts +1 -0
  151. package/dist/server/modules/sessions/session-permission-request-service.js +200 -5
  152. package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
  153. package/dist/server/modules/sessions/session-provider-error-mapper.js +32 -0
  154. package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
  155. package/dist/server/modules/sessions/session-provider-usage-guard-service.d.ts +37 -0
  156. package/dist/server/modules/sessions/session-provider-usage-guard-service.js +179 -0
  157. package/dist/server/modules/sessions/session-provider-usage-guard-service.js.map +1 -0
  158. package/dist/server/modules/sessions/session-provider-usage-limit.d.ts +17 -0
  159. package/dist/server/modules/sessions/session-provider-usage-limit.js +465 -0
  160. package/dist/server/modules/sessions/session-provider-usage-limit.js.map +1 -0
  161. package/dist/server/modules/skills/assistant-runtime-skill-catalog.d.ts +8 -0
  162. package/dist/server/modules/skills/assistant-runtime-skill-catalog.js +26 -0
  163. package/dist/server/modules/skills/assistant-runtime-skill-catalog.js.map +1 -0
  164. package/dist/server/modules/skills/assistant-runtime-skill-cleanup.d.ts +9 -0
  165. package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js +55 -0
  166. package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js.map +1 -0
  167. package/dist/server/modules/skills/builtin-skill-service.js +1 -6
  168. package/dist/server/modules/skills/builtin-skill-service.js.map +1 -1
  169. package/dist/server/modules/skills/skill-controller.d.ts +2 -2
  170. package/dist/server/modules/skills/skill-controller.js +9 -1
  171. package/dist/server/modules/skills/skill-controller.js.map +1 -1
  172. package/dist/server/modules/skills/skill-manager-service.d.ts +26 -1
  173. package/dist/server/modules/skills/skill-manager-service.js +346 -90
  174. package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
  175. package/dist/server/modules/skills/skill-name-policy.d.ts +2 -0
  176. package/dist/server/modules/skills/skill-name-policy.js +10 -0
  177. package/dist/server/modules/skills/skill-name-policy.js.map +1 -0
  178. package/dist/server/modules/tailscale/tailscale-service.d.ts +2 -0
  179. package/dist/server/modules/tailscale/tailscale-service.js +21 -8
  180. package/dist/server/modules/tailscale/tailscale-service.js.map +1 -1
  181. package/dist/server/modules/tasks/task-types.d.ts +3 -0
  182. package/dist/server/modules/tasks/task-types.js +3 -0
  183. package/dist/server/modules/tasks/task-types.js.map +1 -1
  184. package/dist/server/modules/terminal/template-reverse-proxy-service.js +71 -3
  185. package/dist/server/modules/terminal/template-reverse-proxy-service.js.map +1 -1
  186. package/dist/server/modules/workbench/snapshot-revision.d.ts +4 -0
  187. package/dist/server/modules/workbench/snapshot-revision.js +13 -0
  188. package/dist/server/modules/workbench/snapshot-revision.js.map +1 -0
  189. package/dist/server/modules/workbench/workbench-service.d.ts +1 -0
  190. package/dist/server/modules/workbench/workbench-service.js +3 -2
  191. package/dist/server/modules/workbench/workbench-service.js.map +1 -1
  192. package/dist/server/modules/workbench/workspace-panel-snapshot-service.d.ts +6 -1
  193. package/dist/server/modules/workbench/workspace-panel-snapshot-service.js +10 -8
  194. package/dist/server/modules/workbench/workspace-panel-snapshot-service.js.map +1 -1
  195. package/dist/server/routes/assistant.js +30 -0
  196. package/dist/server/routes/assistant.js.map +1 -1
  197. package/dist/server/routes/auth.js +4 -0
  198. package/dist/server/routes/auth.js.map +1 -1
  199. package/dist/server/routes/sessions.js +1 -0
  200. package/dist/server/routes/sessions.js.map +1 -1
  201. package/dist/server/routes/system.d.ts +2 -1
  202. package/dist/server/routes/system.js +13 -1
  203. package/dist/server/routes/system.js.map +1 -1
  204. package/dist/server/server/create-server.d.ts +10 -0
  205. package/dist/server/server/create-server.js +83 -13
  206. package/dist/server/server/create-server.js.map +1 -1
  207. package/dist/server/shared/utils/tokens.d.ts +3 -1
  208. package/dist/server/shared/utils/tokens.js +9 -2
  209. package/dist/server/shared/utils/tokens.js.map +1 -1
  210. package/dist/server/storage/repositories/assistant-automation-task-repository.d.ts +2 -0
  211. package/dist/server/storage/repositories/assistant-automation-task-repository.js +8 -2
  212. package/dist/server/storage/repositories/assistant-automation-task-repository.js.map +1 -1
  213. package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.d.ts +1 -0
  214. package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js +27 -0
  215. package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js.map +1 -1
  216. package/dist/server/storage/repositories/auth-device-repository.d.ts +22 -0
  217. package/dist/server/storage/repositories/auth-device-repository.js +97 -0
  218. package/dist/server/storage/repositories/auth-device-repository.js.map +1 -0
  219. package/dist/server/storage/repositories/auth-device-session-repository.d.ts +17 -0
  220. package/dist/server/storage/repositories/auth-device-session-repository.js +82 -0
  221. package/dist/server/storage/repositories/auth-device-session-repository.js.map +1 -0
  222. package/dist/server/storage/repositories/auth-login-event-repository.d.ts +9 -0
  223. package/dist/server/storage/repositories/auth-login-event-repository.js +53 -0
  224. package/dist/server/storage/repositories/auth-login-event-repository.js.map +1 -0
  225. package/dist/server/storage/repositories/auth-token-repository.d.ts +4 -0
  226. package/dist/server/storage/repositories/auth-token-repository.js +58 -5
  227. package/dist/server/storage/repositories/auth-token-repository.js.map +1 -1
  228. package/dist/server/storage/repositories/butler-follow-up-task-repository.js +21 -3
  229. package/dist/server/storage/repositories/butler-follow-up-task-repository.js.map +1 -1
  230. package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.d.ts +8 -0
  231. package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js +52 -0
  232. package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js.map +1 -0
  233. package/dist/server/storage/repositories/instance-relay-tunnel-repository.d.ts +10 -0
  234. package/dist/server/storage/repositories/instance-relay-tunnel-repository.js +153 -0
  235. package/dist/server/storage/repositories/instance-relay-tunnel-repository.js.map +1 -0
  236. package/dist/server/storage/repositories/instance-tailscale-repository.js +6 -3
  237. package/dist/server/storage/repositories/instance-tailscale-repository.js.map +1 -1
  238. package/dist/server/storage/repositories/managed-skill-repository.d.ts +2 -1
  239. package/dist/server/storage/repositories/managed-skill-repository.js +14 -4
  240. package/dist/server/storage/repositories/managed-skill-repository.js.map +1 -1
  241. package/dist/server/storage/repositories/session-message-attachment-repository.d.ts +2 -0
  242. package/dist/server/storage/repositories/session-message-attachment-repository.js +24 -0
  243. package/dist/server/storage/repositories/session-message-attachment-repository.js.map +1 -1
  244. package/dist/server/storage/sqlite/client.js +297 -2
  245. package/dist/server/storage/sqlite/client.js.map +1 -1
  246. package/dist/server/storage/sqlite/schema.sql +122 -4
  247. package/dist/server/types/domain.d.ts +91 -1
  248. package/dist/server/ws/workbench-ws-hub.js +225 -99
  249. package/dist/server/ws/workbench-ws-hub.js.map +1 -1
  250. package/dist/server/ws/ws-auth-guard.js +1 -4
  251. package/dist/server/ws/ws-auth-guard.js.map +1 -1
  252. package/dist/server/ws/ws-server.d.ts +1 -1
  253. package/dist/server/ws/ws-server.js.map +1 -1
  254. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
  255. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
  256. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
  257. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +1 -0
  258. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +11 -1
  259. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
  260. package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +11 -0
  261. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +132 -21
  262. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  263. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +2 -0
  264. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +53 -1
  265. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -1
  266. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +1 -0
  267. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +10 -1
  268. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -1
  269. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +1 -0
  270. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +30 -0
  271. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
  272. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +5 -1
  273. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +145 -58
  274. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  275. package/node_modules/@codingns/session-sync-core/dist/services.d.ts +1 -0
  276. package/node_modules/@codingns/session-sync-core/dist/services.js +7 -0
  277. package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -1
  278. package/node_modules/@codingns/session-sync-core/dist/types.d.ts +2 -0
  279. package/package.json +1 -1
  280. package/scripts/postinstall.mjs +0 -33
  281. package/dist/public/assets/index-CSVhg7I8.js +0 -123
  282. package/dist/public/assets/index-Ce1VX19m.css +0 -1
@@ -0,0 +1,6 @@
1
+ import{b as l,t as n,j as e,A as kn}from"./index-C2G8Gmf1.js";import{u as Ni,d as vi,e as Si,f as xn}from"./App-WOLwMld_.js";import{u as Ti,X as tt,r as bn,w as Mi,aD as Ei,av as Hi,aE as yn,aF as wi,aG as jn,aH as Ai,ax as Ri,aI as Pi,aw as Li,aJ as Di,aK as _i,aC as Fi,aL as Cn,b as ki,aM as Oi,aN as Gi}from"./WorkbenchLayout-rwQib5In.js";import{g as $i}from"./default-session-permission-mode-D0wZ9Jek.js";import{S as Bi,v as Ui,w as Wi,e as Vi}from"./MobileSheet-Gzc14EpR.js";import{F as Ii,a as Dt,b as _t}from"./file-tree-icon-Dp_xhVfD.js";import{W as Fe}from"./WorkbenchModal-B09hC9b5.js";import"./window-BWqRixxq.js";import"./event-DvH9tcej.js";const Et=56,Nn=28,Ht=72,nt=8,vn=960,Sn=60*1e3,Tn=20,Mn=9,En=9,wt=68,_=12,it=8,Ft=260,zi=120,At=6e4,st={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function ps({className:a,workspaceId:i,panelActive:u=!0,externalWindowMode:g=!1,workbenchShellOverrides:m}){const C=Ni(),x=vi(),y=Ti(),{subscribeGitSnapshot:b,requestGitRefresh:N,addGitSnapshotListener:M,requestNavigationRefresh:S,selectWorkspace:T,upsertNavigationSession:f}={...y,...m},[r,h]=l.useState(null),[j,E]=l.useState(null),[d,R]=l.useState([]),[w,de]=l.useState(0),[I,me]=l.useState(null),[he,rt]=l.useState(!1),[G,Oe]=l.useState(null),[ne,z]=l.useState(null),[ge,fe]=l.useState(""),[ot,U]=l.useState(!1),[v,P]=l.useState(!1),[zn,Bt]=l.useState([]),[Q,Ut]=l.useState(!0),[ee,W]=l.useState(!1),[F,Kn]=l.useState(()=>typeof window<"u"?window.innerWidth<=vn:!1),[lt,$]=l.useState([]),[pe,V]=l.useState(null),[xe,ie]=l.useState("unstaged"),[be,K]=l.useState(null),[se,X]=l.useState(null),[Xn,ct]=l.useState(!1),[qn,ut]=l.useState(null),[Yn,Ge]=l.useState(!1),[Wt,$e]=l.useState(null),[L,ye]=l.useState(null),[Vt,je]=l.useState(null),[Zn,Ce]=l.useState(!1),[Ne,ae]=l.useState(null),[te,dt]=l.useState(!1),[Jn,ve]=l.useState(!1),[Qn,It]=l.useState([]),[rs,zt]=l.useState(!1),[Be,mt]=l.useState(new Set),[ei,Se]=l.useState(new Map),[Ue,Kt]=l.useState(null),[ti,Te]=l.useState(!1),[A,q]=l.useState(st),[Xt,We]=l.useState("generic"),[qt,Ve]=l.useState(null),[k,ht]=l.useState(null),[O,gt]=l.useState(null),[Yt,Zt]=l.useState(Et),[ft,pt]=l.useState(!1),[Jt,Me]=l.useState(null),[ni,Ee]=l.useState(null),Qt=l.useRef(null),en=l.useRef(null),tn=l.useRef(null),nn=l.useRef(null),sn=l.useRef(null),an=l.useRef(null),xt=l.useRef(null),He=l.useRef(new Map),Ie=l.useRef(new Map),we=l.useRef(0),rn=l.useRef(u),{showToast:H}=Si(),on=x.isDesktop&&!F;l.useEffect(()=>{tt("git_sidebar.props",{workspaceId:i,externalWindowMode:g})},[g,i]),l.useEffect(()=>{Bt([]),Ut(!0),de(0),me(null),rt(!1),z(null),fe(""),W(!1),$([]),V(null),ie("unstaged"),K(null),X(null),ct(!1),ut(null),Ge(!1),$e(null),ye(null),je(null),Ce(!1),ae(null),dt(!1),ve(!1),It([]),mt(new Set),Se(new Map),Kt(null),Te(!1),q(st),We("generic"),Ve(null),ht(null),gt(null),pt(!1),Zt(Et),Me(null),Ee(null),Ie.current.clear(),He.current.clear()},[i]),l.useEffect(()=>{function t(){Kn(window.innerWidth<=vn)}return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),l.useEffect(()=>{if(!ft)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(p){mn(p.clientY)}function c(){pt(!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)}},[ft]),l.useEffect(()=>{var o,c;if(!(i!=null&&i.trim())){h(null),E(null),R([]),de(0),me(null),Oe(null),U(!1);return}const t=i.trim(),s=bn(Pt(t),Sn);if(tt("git_sidebar.snapshot",{workspaceId:t,cached:!!s,cachedHistoryCount:((o=s==null?void 0:s.history)==null?void 0:o.length)??0,cachedChangedCount:((c=s==null?void 0:s.status)==null?void 0:c.changes.length)??0}),s){bt(s),U(!1);return}h(null),E(null),R([]),de(0),me(null),Oe(null),U(!0)},[i]),l.useEffect(()=>{if(i!=null&&i.trim())return M(t=>{var s,o,c;t.workspaceId===i.trim()&&(tt("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)}),bt(t),U(!1))})},[M,i]),l.useEffect(()=>{if(!(i!=null&&i.trim()))return;const t=i.trim(),s=bn(Pt(t),Sn);b(t,{knownRevision:(s==null?void 0:s.revision)??null}),s||Y()},[N,b,i]),l.useEffect(()=>{const t=rn.current;rn.current=u,i!=null&&i.trim()&&!t&&u&&N(i.trim(),{knownRevision:j})},[u,N,j,i]),l.useEffect(()=>{i&&Mi(Pt(i),{revision:j,status:r,history:d,historyTotalCount:w,historyNextCursor:I,branches:G})},[G,d,I,w,j,r,i]),l.useEffect(()=>{if(!r||!ne)return;r.changes.find(s=>s.path===ne)||z(null)},[ne,r]),l.useEffect(()=>{Ji(nn.current)},[ge]),l.useEffect(()=>{F||($([]),V(null),K(null),Ve(null))},[F]),l.useEffect(()=>{if(!r){$([]);return}const t=new Set(r.changes.map(s=>s.path));$(s=>s.filter(o=>t.has(o)))},[r]);function ii(){const t=tn.current;if(!t)return;t.querySelectorAll(".git-tree-shell").forEach(o=>{o.scrollTop=0})}function bt(t){E(typeof t.revision=="string"?t.revision:null),h(t.status),R(Array.isArray(t.history)?t.history:[]),de(typeof t.historyTotalCount=="number"?t.historyTotalCount:0),me(typeof t.historyNextCursor=="string"?t.historyNextCursor:null),Oe(t.branches??null)}function Y(t){i!=null&&i.trim()&&(U(!0),tt("git_sidebar.refresh_requested",{workspaceId:i.trim(),resetTreeScroll:!1}),N(i.trim(),{knownRevision:j}))}async function yt(t){if(!(i!=null&&i.trim()))return;const s=i.trim();U(!0);try{const[o,c,p]=await Promise.all([Hi(s),yn(s,Tn,null),wi(s)]);bt({status:o,history:c.items,historyTotalCount:c.totalCount,historyNextCursor:c.nextCursor,branches:p}),N(s),t!=null&&t.resetTreeScroll&&requestAnimationFrame(()=>{ii()})}catch(o){H({title:D(o,n("git.panelLoadFailed")),tone:"error"})}finally{U(!1)}}async function ze(){if(!(!i||!I||he)){rt(!0);try{const t=await yn(i,Tn,I);R(s=>{const o=new Set(s.map(p=>p.commitHash)),c=t.items.filter(p=>!o.has(p.commitHash));return[...s,...c]}),de(t.totalCount),me(t.nextCursor)}catch(t){H({title:D(t,n("git.panelLoadFailed")),tone:"error"})}finally{rt(!1)}}}function si(t){if(!Q||he||!I)return;const s=t.currentTarget;s.scrollHeight-s.scrollTop-s.clientHeight<=40&&ze()}async function ai(){if(i){P(!0);try{const t=await Ei(i,"ai");fe(t.validation.normalizedDraft.subject||t.draft.subject)}catch(t){H({title:D(t,n("git.draftFailed")),tone:"error"})}finally{P(!1)}}}async function Ke(t,s){if(i&&t.length){P(!0);try{const o=s?await Pi(i,t):await Li(i,t);h(o),z(t[t.length-1]??null),$(c=>c.filter(p=>!t.includes(p))),V(null),Y()}catch(o){U(!1),H({title:D(o,n("git.stageFailed")),tone:"error"})}finally{P(!1)}}}async function jt(t){if(i&&t.length){P(!0);try{const s=await _i(i,t);h(s),t.includes(ne??"")&&z(null),$(o=>o.filter(c=>!t.includes(c))),V(null),Y()}catch(s){U(!1),H({title:D(s,n("git.discardFailed")),tone:"error"})}finally{P(!1)}}}async function ri(){if(!(!i||!ge.trim())){P(!0);try{await Ai(i,Yi(ge)),H({title:n("git.commitSuccess"),tone:"success"}),fe(""),z(null),Y()}catch(t){H({title:D(t,n("git.commitFailed")),tone:"error"})}finally{P(!1)}}}function Xe(t){q(ts(Ue)),Te(!0),oi(t)}async function oi(t){const s=i==null?void 0:i.trim();if(!s){We("generic");return}try{const o=await jn(s);if((i==null?void 0:i.trim())!==s)return;We(is(o,t))}catch{if((i==null?void 0:i.trim())!==s)return;We("generic")}}function li(){const t=ns(A),s=Xt==="github"?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder");if(A.authMode==="basic"){if(!A.username.trim()){H({title:n("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!A.password){H({title:s,tone:"error"});return}}if(A.authMode==="token"&&!A.token){H({title:n("shell.cloneTokenPlaceholder"),tone:"error"});return}Kt(t),Te(!1),H({title:t?n("git.remoteAuthSaved"):n("git.remoteAuthCleared"),description:t&&A.rememberOnHost?n("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function ln(){if(i){zt(!0);try{const t=await jn(i);if(t.length===0){H({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){cn([t[0].name]);return}It(t),mt(new Set),Se(new Map),ve(!0)}catch(t){H({title:D(t,n("git.remoteFailed")),tone:"error"})}finally{zt(!1)}}}async function cn(t){if(!i||t.length===0)return;P(!0),Se(new Map);const s=new Map;let o=!1;try{for(const c of t)try{const p=await Cn(i,"push",c,Ue,A.rememberOnHost);s.set(c,{ok:!0,summary:p.summary})}catch(p){if(o=!0,s.set(c,{ok:!1,summary:D(p,n("git.remoteFailed"))}),Se(new Map(s)),_n(p)){Xe(c);return}}Se(s),Y(),o||(H({title:n("git.pushAllSuccess",{count:String(t.length)}),tone:"success"}),ve(!1))}finally{P(!1)}}async function Ct(t){if(i){if(t==="push"){W(!1),ln();return}P(!0);try{const s=await Cn(i,t,void 0,Ue,A.rememberOnHost);H({title:s.summary,tone:"success"}),W(!1),Y()}catch(s){if(_n(s)){Xe();return}H({title:D(s,n("git.remoteFailed")),tone:"error"})}finally{P(!1)}}}async function re(){if(i){P(!0);try{const t=await Di(i);fe(t.commitSubject??""),H({title:t.summary||n("git.undoLastCommitSuccess"),tone:"success"}),W(!1),Y()}catch(t){H({title:D(t,n("git.undoLastCommitFailed")),tone:"error"})}finally{P(!1)}}}async function ci(t){if(i){P(!0);try{const s=await Oi(i,t,!1);Oe(s),W(!1),Y()}catch(s){H({title:D(s,n("git.branchFailed")),tone:"error"})}finally{P(!1)}}}async function Nt(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 Gi(s,t);return Ie.current.set(t,c),c}async function Ae(t){X(null),K(null),ut(t),$e(null);const s=Ie.current.get(t)??null;if(ye(s),Ge(!s),s)return;const o=we.current+1;we.current=o;try{const c=await Nt(t);if(we.current!==o)return;ye(c)}catch(c){if(we.current!==o)return;$e(D(c,n("git.commitDetailLoadFailed"))),ye(null)}finally{we.current===o&&Ge(!1)}}function ui(){ut(null),Ge(!1),$e(null),ye(null)}async function Re(t){try{const s=await Nt(t);await B(s.versionLabel,n("git.copyCommitVersionSuccess"))}catch(s){H({title:D(s,n("git.commitDetailLoadFailed")),tone:"error"})}}function Pe(t){X(null),K(null),je(t),ae(null),Ce(!0)}function di(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 B(t.commitHash,n("git.copyCommitHashSuccess"))},{id:`copy-message:${t.commitHash}`,label:n("git.copyCommitMessage"),onSelect:()=>void B(ue(t),n("git.copyCommitMessageSuccess"))},{id:`copy-version:${t.commitHash}`,label:n("git.copyCommitVersion"),onSelect:()=>void Re(t.commitHash)},{id:`explain:${t.commitHash}`,label:n("git.explainCommitAction"),onSelect:()=>Pe(t.commitHash)},...s?[{id:`undo:${t.commitHash}`,label:n("git.undoLastCommit"),disabled:v,onSelect:()=>void re()}]:[]]}async function un(t){X(null),K(null),await Fi(di(t))}async function mi(){var t,s;if(!(!i||!Vt||!Ne||te)){dt(!0);try{const o=await Nt(Vt),c=await Ui({workspaceId:i,provider:Ne,content:Zi(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:$i()}),p=c.session??await Wi(c.sessionId);f(p),S(),T(p.workspaceId),C(ki(p.workspaceId,p.sessionId)),Ce(!1),je(null),ae(null),H({title:n("git.explainCommitStarted"),tone:"success"})}catch(o){H({title:D(o,n("git.explainCommitFailed")),tone:"error"})}finally{dt(!1)}}}function qe(t){Bt(s=>s.includes(t)?s.filter(o=>o!==t):[...s,t])}const hi=450;function dn(t){const s=Date.now(),o=Qt.current;return Qt.current={filePath:t,timestamp:s},(o==null?void 0:o.filePath)===t&&s-o.timestamp<=hi}async function Ye(t,s){if(s.binary){H({title:n("git.binaryDiff"),tone:"info"});return}if(s.status==="A"||s.status==="?")Ee(null),Me(t);else if(i)try{const o=await Ri(i,t,s.staged);Ee(o.content),Me(t)}catch{Ee(null),Me(t)}}function Ze(t){z(t),V(null),$(s=>s.includes(t)?s.filter(o=>o!==t):[...s,t])}function mn(t){const s=en.current;if(!s||!Number.isFinite(t))return;const o=s.getBoundingClientRect(),c=o.height-nt;if(!Number.isFinite(o.top)||!Number.isFinite(o.height)||c<=0)return;const p=(t-o.top-nt/2)/c*100;if(!Number.isFinite(p))return;const _e=Math.max(Nn,Math.min(Ht,Math.round(p)));Zt(_e)}function gi(t){t.preventDefault(),mn(t.clientY),pt(!0)}const Le=(r==null?void 0:r.changes)??[],Z=Le.filter(t=>kt(t,"staged")),oe=Le.filter(t=>kt(t,"unstaged")),hn=Ln(Z,"staged"),gn=Ln(oe,"unstaged"),Je=new Set(zn),Qe=new Set(lt),le=Dn(lt,Le,"staged"),ce=Dn(lt,Le,"unstaged"),vt=Le.length===0&&((r==null?void 0:r.snapshot.ahead)??0)>0,fi=Z.length>0&&ge.trim().length>0,et=(G==null?void 0:G.currentBranch)??(r==null?void 0:r.snapshot.branch)??n("common.unknown"),St=Ue!==null,De=Xt==="github",pi=De?n("git.remoteAuthDescriptionGithub"):n("git.remoteAuthDescription"),xi=De?n("git.remoteAuthGithubPatLabel"):n("shell.clonePasswordLabel"),bi=De?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder"),yi=De?n("git.remoteAuthGithubUsernamePlaceholder"):n("shell.cloneUsernamePlaceholder"),Tt=Number.isFinite(Yt)?Yt:Et,ji=Q?`minmax(120px, ${Tt}fr) ${nt}px minmax(140px, ${100-Tt}fr)`:`minmax(120px, 1fr) ${nt}px auto`;l.useEffect(()=>{pe==="staged"&&le.length===0&&V(null),pe==="unstaged"&&ce.length===0&&V(null)},[pe,le.length,ce.length]),l.useEffect(()=>{if(!F)return;const t=oe.length>0?"unstaged":Z.length>0?"staged":"history";ie(s=>s==="unstaged"&&oe.length>0||s==="staged"&&Z.length>0?s:t)},[F,Z.length,oe.length]),l.useEffect(()=>{be&&(d.some(t=>t.commitHash===be)||K(null))},[d,be]),l.useEffect(()=>{se&&(d.some(t=>t.commitHash===se)||X(null))},[se,d]),l.useEffect(()=>{F&&xe!=="history"&&ee&&W(!1)},[F,ee,xe]),l.useLayoutEffect(()=>{if(F||!ee){ht(null);return}function t(){const o=sn.current,c=an.current;!o||!c||typeof window>"u"||ht(Fn(o.getBoundingClientRect(),{width:c.getBoundingClientRect().width||Ft,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)}},[v,G==null?void 0:G.local.length,et,F,ee,St]);const J=be??se;l.useLayoutEffect(()=>{if(!J){gt(null);return}const t=J;function s(){const c=He.current.get(t)??null,p=xt.current;!c||!p||typeof window>"u"||gt(Fn(c.getBoundingClientRect(),{width:p.getBoundingClientRect().width||Ft,height:p.getBoundingClientRect().height||p.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)}},[J,d.length]),l.useEffect(()=>{if(!J||typeof document>"u")return;const t=J;function s(o){const c=o.target;if(!(c instanceof Node))return;const p=He.current.get(t)??null,_e=xt.current;p!=null&&p.contains(c)||_e!=null&&_e.contains(c)||(K(null),X(null))}return document.addEventListener("pointerdown",s),()=>{document.removeEventListener("pointerdown",s)}},[J]);async function B(t,s){var o;try{if(typeof navigator>"u"||!((o=navigator.clipboard)!=null&&o.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(t),H({title:s,tone:"success"})}catch{H({title:n("common.copyContentFailed"),tone:"error"})}}async function fn(t,s){typeof window<"u"&&!window.confirm(n("git.discardConfirm",{path:s}))||await jt(t)}function pn(t){const s=(t==null?void 0:t.desktopFloating)===!0&&!F,o=s?{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"}:void 0,c=e.jsxs("div",{ref:s?an: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:et})]}),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:St?n("git.remoteAuthConfigured"):n("git.remoteAuthNotConfigured")}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>Xe(),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(p=>e.jsx("button",{className:"git-menu-item",type:"button",disabled:v||p.current,onClick:()=>void ci(p.name),children:e.jsx("span",{children:p.current?`${n("git.switchBranch")} ${p.name}`:`${n("git.switchBranchTo")} ${p.name}`})},p.name))})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>{W(!1),ct(!0)},children:e.jsx("span",{children:n("git.viewAllVersions")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void Ct("fetch"),children:e.jsx("span",{children:n("git.fetch")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void Ct("pull"),children:e.jsx("span",{children:n("git.pull")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void Ct("push"),children:e.jsx("span",{children:n("git.push")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void re(),children:e.jsx("span",{children:n("git.undoLastCommit")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v||ot,onClick:()=>void yt({resetTreeScroll:!0}),children:e.jsx("span",{children:n("git.refresh")})})]})]});return s?typeof document>"u"?null:xn.createPortal(c,document.body):c}function Mt(t,s){if(s){He.current.set(t,s);return}He.current.delete(t)}function Ci(){var o;if(!J||typeof document>"u")return null;const t=d.find(c=>c.commitHash===J);if(!t)return null;const s=((o=d[0])==null?void 0:o.commitHash)===t.commitHash&&t.commitKind==="local";return xn.createPortal(e.jsx("div",{ref:xt,className:"git-history-entry-menu","data-floating":"true",style:{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"},children:e.jsx(Xi,{item:t,canUndo:s,actioning:v,onViewCommitChanges:c=>void Ae(c),onCopyCommitHash:c=>void B(c,n("git.copyCommitHashSuccess")),onCopyCommitMessage:c=>void B(ue(c),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:c=>void Re(c),onExplainCommitChange:c=>void Pe(c),onUndoLastCommit:()=>void re()})}),document.body)}return 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:nn,rows:1,value:ge,onChange:t=>fe(Un(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 ai(),disabled:v||ot,children:e.jsx(as,{})})]}),e.jsxs("div",{className:"git-primary-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void yt({resetTreeScroll:!0}),disabled:v||ot||!i,children:n("git.refreshNow")}),e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(vt){ln();return}ri()},disabled:v||!vt&&!fi,children:vt?n("git.pushNow"):n("git.commitNow")})]})]}),F?e.jsxs("div",{className:"git-mobile-sections",children:[e.jsx(Rt,{title:n("git.stagedChangesTitle"),count:Z.length,expanded:xe==="staged",onToggle:()=>ie("staged"),children:e.jsx(wn,{title:n("git.stagedChangesTitle"),nodes:hn,collapsedTreePathSet:Je,onToggleTreePath:qe,onToggleMobileSelection:Ze,selectedMobilePathSet:Qe,selectedTargets:le,actioning:v,variant:"staged",swipeRowState:qt,onSwipeRowChange:Ve,onStageToggle:Ke,onDiscardWithConfirm:fn,onClearSelectedTargets:()=>$(t=>t.filter(s=>!le.includes(s))),onPreviewFile:Ye})}),e.jsx(Rt,{title:n("git.changesTitle"),count:oe.length,expanded:xe==="unstaged",onToggle:()=>ie("unstaged"),children:e.jsx(wn,{title:n("git.changesTitle"),nodes:gn,collapsedTreePathSet:Je,onToggleTreePath:qe,onToggleMobileSelection:Ze,selectedMobilePathSet:Qe,selectedTargets:ce,actioning:v,variant:"unstaged",swipeRowState:qt,onSwipeRowChange:Ve,onStageToggle:Ke,onDiscardWithConfirm:fn,onClearSelectedTargets:()=>$(t=>t.filter(s=>!ce.includes(s))),onPreviewFile:Ye})}),e.jsxs(Rt,{title:n("git.recentVersionsTitle"),count:w,expanded:xe==="history",onToggle:()=>ie("history"),trailingContent:e.jsx("span",{className:"badge",children:et}),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:()=>{ie("history"),W(t=>!t)},disabled:v,children:e.jsx(ke,{})}),children:[ee?e.jsx("div",{className:"git-mobile-operations-shell",children:pn()}):null,e.jsx(Ki,{history:d,historyLoadingMore:he,hasMore:!!I,actioning:v,openCommitHash:be,onMenuTriggerRef:Mt,onToggleMenu:t=>K(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void B(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void B(ue(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void Re(t),onExplainCommitChange:t=>void Pe(t),onUndoLastCommit:()=>void re(),onLoadMore:()=>void ze()})]})]}):e.jsxs("div",{ref:en,className:"git-content-split",style:{gridTemplateRows:ji},children:[e.jsx("section",{className:"git-card git-tree-panel",children:e.jsxs("div",{ref:tn,className:"git-tree-panel-body",children:[Z.length>0?e.jsx(Hn,{title:n("git.stagedChangesTitle"),count:Z.length,nodes:hn,selectedPath:ne,collapsedTreePathSet:Je,onToggleTreePath:qe,onSelectFile:z,onPreviewFile:(t,s)=>{dn(t)&&Ye(t,s)},onToggleMobileSelection:Ze,onStageToggle:Ke,onDiscard:jt,actioning:v,variant:"staged",isMobileViewport:F,selectedMobilePathSet:Qe,selectedTargets:le,mobileActionMenuOpen:pe==="staged",onToggleMobileActionMenu:()=>V(t=>t==="staged"?null:"staged"),onClearSelectedTargets:()=>$(t=>t.filter(s=>!le.includes(s)))}):null,e.jsx(Hn,{title:n("git.changesTitle"),count:oe.length,nodes:gn,selectedPath:ne,collapsedTreePathSet:Je,onToggleTreePath:qe,onSelectFile:z,onPreviewFile:(t,s)=>{dn(t)&&Ye(t,s)},onToggleMobileSelection:Ze,onStageToggle:Ke,onDiscard:jt,actioning:v,variant:"unstaged",isMobileViewport:F,selectedMobilePathSet:Qe,selectedTargets:ce,mobileActionMenuOpen:pe==="unstaged",onToggleMobileActionMenu:()=>V(t=>t==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>$(t=>t.filter(s=>!ce.includes(s)))})]})}),e.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":n("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Nn,"aria-valuemax":Ht,"aria-valuenow":Q?Tt:Ht,"data-dragging":ft,onPointerDown:gi,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":Q,"aria-label":Q?n("git.collapseRecentVersions"):n("git.expandRecentVersions"),onClick:()=>Ut(t=>!t),children:[e.jsxs("span",{className:"git-section-toggle-main",children:[e.jsx(at,{expanded:Q}),e.jsx("span",{children:n("git.recentVersionsTitle")})]}),e.jsx("span",{className:"workbench-section-counter",children:w})]}),e.jsxs("div",{className:"git-history-actions",children:[e.jsx("span",{className:"badge",children:et}),e.jsx("button",{className:"git-icon-button",type:"button",ref:sn,"aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:()=>W(t=>!t),disabled:v,children:e.jsx(ke,{})}),ee?pn({desktopFloating:!0}):null]})]}),Q?e.jsx(Rn,{history:d,historyLoadingMore:he,hasMore:!!I,actioning:v,openCommitHash:se,useNativeContextMenu:on,onMenuTriggerRef:Mt,onScroll:si,onToggleMenu:t=>{if(on){const s=d.find(o=>o.commitHash===t);s&&un(s);return}X(s=>s===t?null:t)},onOpenContextMenu:t=>void un(t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void B(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void B(ue(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void Re(t),onExplainCommitChange:t=>void Pe(t),onUndoLastCommit:()=>void re(),onLoadMore:()=>void ze()}):null]})]}),e.jsxs(Fe,{open:Jn,title:n("git.selectRemoteTitle"),description:n("git.selectRemoteDesc"),onClose:()=>{v||ve(!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:St?n("git.remoteAuthConfigured"):n("git.remoteAuthNotConfigured")})]}),e.jsx("button",{className:"secondary-button",type:"button",disabled:v,onClick:()=>Xe(),children:n("git.remoteAuthAction")})]}),e.jsx("div",{className:"git-remote-select-list",children:Qn.map(t=>{const s=Be.has(t.name),o=ei.get(t.name);return e.jsxs("label",{className:"git-remote-item",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:v,onChange:()=>{mt(c=>{const p=new Set(c);return p.has(t.name)?p.delete(t.name):p.add(t.name),p})}}),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:v,onClick:()=>ve(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:v||Be.size===0,onClick:()=>void cn(Array.from(Be)),children:v?n("git.pushing"):n("git.pushSelected",{count:String(Be.size)})})]})]}),e.jsxs(Fe,{open:ti,title:n("git.remoteAuthTitle"),description:pi,onClose:()=>{v||Te(!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:v,onChange:t=>q(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:yi,autoComplete:"username",onChange:t=>q(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:xi}),e.jsx("input",{type:"password",value:A.password,placeholder:bi,autoComplete:"current-password",onChange:t=>q(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=>q(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=>q(s=>({...s,token:t.target.value}))})]})]}):null,De?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=>q(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:v,onClick:()=>Te(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:v,onClick:li,children:n("git.remoteAuthSave")})]})]}),e.jsx(Fe,{open:Xn,title:n("git.viewAllVersions"),description:n("git.viewAllVersionsDescription",{count:String(w)}),onClose:()=>ct(!1),children:e.jsx(Rn,{history:d,historyLoadingMore:he,hasMore:!!I,actioning:v,openCommitHash:se,className:"git-history-modal-list",onMenuTriggerRef:Mt,onToggleMenu:t=>X(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void B(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void B(ue(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void Re(t),onExplainCommitChange:t=>void Pe(t),onUndoLastCommit:()=>void re(),onLoadMore:()=>void ze()})}),e.jsx(Fe,{open:qn!==null,className:"git-commit-detail-modal",title:(L==null?void 0:L.subject)||n("git.commitDetailTitle"),description:L?n("git.commitDetailDescription",{hash:L.shortHash}):n("git.commitDetailLoading"),onClose:ui,children:Yn?e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailLoading")})}):Wt?e.jsx("div",{className:"git-commit-detail-state is-error",children:e.jsx("p",{children:Wt})}):L?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:L.versionLabel})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitHashLabel")}),e.jsx("strong",{children:L.commitHash})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitAuthorLabel")}),e.jsx("strong",{children:L.authorName})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitTimeLabel")}),e.jsx("strong",{children:Qi(L.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:ue(L)})]}),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:L.changedFiles.length})]}),e.jsx("div",{className:"git-commit-detail-file-list",children:L.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")}),L.diffTruncated?e.jsx("span",{className:"git-commit-detail-truncated",children:n("git.diffTruncated")}):null]}),e.jsx("pre",{className:"git-commit-detail-diff",children:L.diffContent||n("git.emptyDiff")})]})]}):e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailEmpty")})})}),e.jsx(Fe,{open:Zn,className:"git-explain-provider-modal",title:n("git.explainCommitTitle"),description:n("git.explainCommitDescription"),onClose:()=>{te||(Ce(!1),je(null),ae(null))},children:e.jsxs("div",{className:"git-explain-provider-shell",children:[e.jsx(Bi,{workspaceId:i,selectedProvider:Ne,pendingProvider:te?Ne:null,disabled:te,onSelect:t=>ae(t)}),e.jsxs("div",{className:"git-explain-provider-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:te,onClick:()=>{Ce(!1),je(null),ae(null)},children:n("common.cancel")}),e.jsx("button",{type:"button",className:"primary-button",disabled:!Ne||te,onClick:()=>void mi(),children:te?n("conversation.sendingState"):n("git.startExplainCommit")})]})]})}),e.jsx(Ii,{workspaceId:i,filePath:Jt,open:Jt!==null,onClose:()=>{Me(null),Ee(null)},onSaved:async()=>{await yt({resetTreeScroll:!0})},diffContent:ni}),Ci()]})}function Hn({title:a,count:i,nodes:u,selectedPath:g,collapsedTreePathSet:m,onToggleTreePath:C,onSelectFile:x,onPreviewFile:y,onToggleMobileSelection:b,onStageToggle:N,onDiscard:M,actioning:S,variant:T,isMobileViewport:f,selectedMobilePathSet:r,selectedTargets:h,mobileActionMenuOpen:j,onToggleMobileActionMenu:E,onClearSelectedTargets:d}){const R=$t(u),w=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}),!f&&R.length>0?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":w,title:w,onClick:()=>void N(R,T==="staged"),disabled:S,children:e.jsx(Ot,{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(R),disabled:S,children:e.jsx(Gt,{})}):null]}):null,f&&h.length>0?e.jsx("button",{className:"git-icon-button",type:"button","aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:E,disabled:S,children:e.jsx(ke,{})}):null]}),f&&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 N(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?Gn({nodes:u,depth:0,collapsedTreePathSet:m,selectedPath:g,onToggleTreePath:C,onSelectFile:x,onPreviewFile:y,onToggleMobileSelection:b,onStageToggle:N,onDiscard:M,actioning:S,variant:T,isMobileViewport:f,selectedMobilePathSet:r}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Rt({title:a,count:i,expanded:u,onToggle:g,trailingContent:m,headerAction:C,children:x}){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(at,{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:x}):null]})}function wn({title:a,nodes:i,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,selectedTargets:x,actioning:y,variant:b,swipeRowState:N,onSwipeRowChange:M,onStageToggle:S,onDiscardWithConfirm:T,onClearSelectedTargets:f,onPreviewFile:r}){return e.jsxs("div",{className:"git-mobile-record-shell",children:[x.length>0?e.jsxs("div",{className:"git-mobile-selection-toolbar",children:[e.jsxs("span",{className:"git-mobile-selection-count",children:[n("git.selectedFiles")," ",x.length]}),e.jsxs("div",{className:"git-mobile-selection-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:y,onClick:()=>void S(x,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(x,`${x.length}`),children:n("git.discard")}):null,e.jsx("button",{type:"button",className:"secondary-button",disabled:y,onClick:f,children:n("git.clearSelection")})]})]}):null,e.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":a,children:i.length?On({nodes:i,depth:0,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,actioning:y,variant:b,swipeRowState:N,onSwipeRowChange:M,onStageToggle:S,onDiscardWithConfirm:T,onPreviewFile:r}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function On({nodes:a,depth:i,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,actioning:x,variant:y,swipeRowState:b,onSwipeRowChange:N,onStageToggle:M,onDiscardWithConfirm:S,onPreviewFile:T}){return a.map(f=>{if(f.kind==="directory"){const j=!u.has(f.path),E=$t(f.children),d=`directory:${f.path}`;return e.jsxs("div",{className:"git-mobile-record-branch",children:[e.jsx(An,{rowKey:d,openState:(b==null?void 0:b.path)===d?b.direction:null,onOpenStateChange:R=>N(R?{path:d,direction:R}:null),trailingActions:E.length>0?[{label:y==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void M(E,y==="staged")},...y==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S(E,f.path)}]:[]]:null,children:e.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${Mn+i*En}px`},onClick:()=>g(f.path),children:[e.jsxs("span",{className:"git-mobile-record-leading",children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":j,children:e.jsx(at,{expanded:j})}),e.jsx("span",{className:"git-mobile-record-title",children:f.name})]}),e.jsx("span",{className:"git-mobile-record-meta",children:E.length})]})}),j?e.jsx("div",{className:"git-mobile-record-children",role:"group",children:On({nodes:f.children,depth:i+1,collapsedTreePathSet:u,onToggleTreePath:g,onToggleMobileSelection:m,selectedMobilePathSet:C,actioning:x,variant:y,swipeRowState:b,onSwipeRowChange:N,onStageToggle:M,onDiscardWithConfirm:S,onPreviewFile:T})}):null]},d)}const r=`file:${f.path}`,h=C.has(f.path);return e.jsx(An,{rowKey:r,openState:(b==null?void 0:b.path)===r?b.direction:null,onOpenStateChange:j=>N(j?{path:r,direction:j}:null),trailingActions:[{label:n("git.preview"),tone:"neutral",onPress:()=>T(f.change.path,f.change)},{label:y==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void M([f.change.path],y==="staged")},...y==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S([f.change.path],f.path)}]:[]],children:e.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":h,style:{paddingInlineStart:`${Mn+i*En}px`},children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:h,"aria-label":`${n("git.selectFile")} ${f.name}`,onChange:()=>m(f.change.path)}),e.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>m(f.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":_t(f.name),"aria-hidden":"true",children:Dt(f.name)}),e.jsxs("span",{className:"git-mobile-record-copy",children:[e.jsx("span",{className:"git-mobile-record-title",children:f.name}),e.jsx("span",{className:"git-mobile-record-path",children:f.path})]}),e.jsx("span",{className:"git-status-badge","data-status":f.status,children:f.status})]})]})},r)})}function An({rowKey:a,openState:i,onOpenStateChange:u,trailingActions:g,children:m}){const C=Vi(),x=l.useRef(null),[y,b]=l.useState(0),N=((g==null?void 0:g.length)??0)*wt;l.useEffect(()=>{i||b(0)},[i,a]);const M=y!==0?y:i==="trailing"?-N:0;function S(h){var j,E;h.button===0&&(x.current={pointerId:h.pointerId,startX:h.clientX},(E=(j=h.currentTarget).setPointerCapture)==null||E.call(j,h.pointerId))}function T(h){const j=x.current;if(!j||j.pointerId!==h.pointerId)return;const E=N>0?N+10:0,d=Math.max(-E,Math.min(0,h.clientX-j.startX));b(d)}function f(h){var E,d;const j=x.current;if(!(!j||j.pointerId!==h.pointerId)){if((d=(E=h.currentTarget).releasePointerCapture)==null||d.call(E,h.pointerId),x.current=null,y<=-44&&(g!=null&&g.length)){C.trigger("gesture"),u("trailing"),b(0);return}u(null),b(0)}}function r(h){var E,d;const j=x.current;!j||j.pointerId!==h.pointerId||((d=(E=h.currentTarget).releasePointerCapture)==null||d.call(E,h.pointerId),x.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*wt,width:wt},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:f,onPointerCancel:r,children:m})]})}function Ki({history:a,historyLoadingMore:i,hasMore:u,actioning:g,openCommitHash:m,onMenuTriggerRef:C,onToggleMenu:x,onViewCommitChanges:y,onCopyCommitHash:b,onCopyCommitMessage:N,onCopyCommitVersion:M,onExplainCommitChange:S,onUndoLastCommit:T,onLoadMore:f}){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:Wn(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(Vn(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:In(r.authoredAt)})]})]}),e.jsx("button",{type:"button",className:"git-icon-button",ref:h=>C(r.commitHash,h),"aria-label":n("git.historyItemMenu"),onClick:()=>x(r.commitHash),children:e.jsx(ke,{})})]})},r.commitHash)),u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:f,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"git-tree-status",children:n("git.noHistory")})}function Rn({history:a,historyLoadingMore:i,hasMore:u,actioning:g,openCommitHash:m,className:C,useNativeContextMenu:x=!1,onMenuTriggerRef:y,onScroll:b,onToggleMenu:N,onOpenContextMenu:M,onViewCommitChanges:S,onCopyCommitHash:T,onCopyCommitMessage:f,onCopyCommitVersion:r,onExplainCommitChange:h,onUndoLastCommit:j,onLoadMore:E}){return a.length?e.jsxs("div",{className:["git-history-list",C].filter(Boolean).join(" "),onScroll:b,children:[a.map(d=>{const R=m===d.commitHash;return e.jsxs("article",{className:"git-history-entry","data-kind":d.commitKind,"data-menu-open":R?"true":"false",onContextMenu:w=>{!x||!M||(w.preventDefault(),w.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:Wn(d.commitKind)}),x?null:e.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:w=>y(d.commitHash,w),"aria-label":n("git.historyItemMenu"),onClick:()=>{N(d.commitHash)},children:e.jsx(ke,{})})]})]}),d.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:d.refs.map(w=>e.jsx("span",{className:"git-history-ref-pill","data-kind":w.kind,"data-remote-index":String(Vn(w.remoteName)),children:w.name},`${d.commitHash}:${w.kind}:${w.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:In(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:E,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"status-text",children:n("git.noHistory")})}function Xi({item:a,canUndo:i,actioning:u,onViewCommitChanges:g,onCopyCommitHash:m,onCopyCommitMessage:C,onCopyCommitVersion:x,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:()=>x(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 Gn({nodes:a,depth:i,collapsedTreePathSet:u,selectedPath:g,onToggleTreePath:m,onSelectFile:C,onPreviewFile:x,onToggleMobileSelection:y,onStageToggle:b,onDiscard:N,actioning:M,variant:S,isMobileViewport:T,selectedMobilePathSet:f}){return a.map(r=>{if(r.kind==="directory"){const E=!u.has(r.path),d=$t(r.children),R=`${S==="staged"?n("git.unstage"):n("git.stage")} ${r.path}`,w=`${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":E,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":E,children:e.jsx(at,{expanded:E})}),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":R,title:R,onClick:()=>void b(d,S==="staged"),disabled:M,children:e.jsx(Ot,{staged:S==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":w,title:w,onClick:()=>void N(d),disabled:M,children:e.jsx(Gt,{})}):null]}):null]}),E?e.jsx("div",{className:"git-tree-children",role:"group",children:Gn({nodes:r.children,depth:i+1,collapsedTreePathSet:u,selectedPath:g,onToggleTreePath:m,onSelectFile:C,onPreviewFile:x,onToggleMobileSelection:y,onStageToggle:b,onDiscard:N,actioning:M,variant:S,isMobileViewport:T,selectedMobilePathSet:f})}):null]},`directory:${r.path}`)}const h=f.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":_t(r.name),"aria-hidden":"true",children:Dt(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),x&&x(r.change.path,r.change)},children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":_t(r.name),"aria-hidden":"true",children:Dt(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(Ot,{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 N([r.change.path]),disabled:M,children:e.jsx(Gt,{})}):null]})]},`file:${r.path}`)})}function Pn(a,i){return{kind:"directory",name:a,path:i,children:new Map}}function Ln(a,i){const u=Pn("","");for(const g of a){const m=g.path.replace(/\\/g,"/"),C=m.split("/").filter(Boolean);let x=u;C.forEach((y,b)=>{const N=C.slice(0,b+1).join("/");if(b===C.length-1){x.children.set(`file:${N}`,{kind:"file",name:y,path:m,change:g,status:qi(g,i),variant:i});return}const M=`directory:${N}`,S=x.children.get(M);if(S&&S.kind==="directory"){x=S;return}const T=Pn(y,N);x.children.set(M,T),x=T})}return Bn($n([...u.children.values()]))}function $n(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:$n([...i.children.values()])}:i)}function Bn(a){return a.map(i=>{var x;if(i.kind!=="directory")return i;const u=Bn(i.children);let g=i.name,m=i.path,C=u;for(;C.length===1&&((x=C[0])==null?void 0:x.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 Dn(a,i,u){const g=new Set(a);return i.filter(m=>kt(m,u)&&g.has(m.path)).map(m=>m.path)}function $t(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 kt(a,i){return i==="staged"?!!a.stagedStatus:!!a.worktreeStatus}function qi(a,i){return i==="staged"?a.stagedStatus??a.status:a.worktreeStatus??a.status}function Yi(a){return{subject:Un(a).trim(),body:null,footer:null,source:"manual"}}function Un(a){return a.replace(/[\r\n]+/g," ")}function ue(a){const i=a.subject.trim(),u=a.body.trim();return u?`${i}
2
+
3
+ ${u}`:i}function Zi(a){const i=a.changedFiles.map(m=>`- [${m.status}] ${m.path}${m.oldPath?` (from ${m.oldPath})`:""}`).join(`
4
+ `),u=a.diffContent.length>At?a.diffContent.slice(0,At):a.diffContent,g=a.diffContent.length>At||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 Ji(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 Wn(a){switch(a){case"local":return n("git.historyKindLocal");case"remote":return n("git.historyKindRemote");default:return n("git.historyKindShared")}}function Vn(a){if(!a)return 0;let i=0;for(const u of a)i=i*33+u.charCodeAt(0)>>>0;return i%6}function Qi(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 D(a,i){return a instanceof kn?es(a)??a.message:typeof a=="object"&&a&&"message"in a?a.message:i}function Pt(a){return`git-sidebar.snapshot.${a}`}function es(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_DISCARD_FAILED":return n("git.discardFailed");case"GIT_UNDO_FAILED":return n("git.undoLastCommitFailed");default:return null}}function _n(a){return a instanceof kn&&a.errorCode==="GIT_REMOTE_AUTH_FAILED"}function ts(a){return!a||!a.mode||a.mode==="none"?st: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}:st}function ns(a){return a.authMode==="none"?null:a.authMode==="basic"?{mode:"basic",username:a.username.trim(),password:a.password}:{mode:"token",username:a.username.trim()||void 0,token:a.token}}function is(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 ss(g)?"github":"generic"}function ss(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 Fn(a,i,u){const g=Math.max(0,u.width),m=Math.max(0,u.height),C=Math.max(0,m-_*2),x=Math.max(0,g-_*2),y=Math.min(Math.max(i.width||Ft,0),x),b=Math.max(0,m-a.bottom-it-_),N=Math.max(0,a.top-it-_),M=b<i.height&&N>b,T=Lt(Math.max(M?N:b,zi),0,C),f=Math.min(Math.max(i.height,0),T),r=M?a.top-it-f:a.bottom+it,h=Math.max(_,m-_-f),j=Math.max(_,g-_-y);return{top:Lt(r,_,h),left:Lt(a.right-y,_,j),maxHeight:Math.max(0,T),transformOrigin:`${M?"bottom":"top"} right`}}function Lt(a,i,u){return!Number.isFinite(a)||u<i?i:Math.min(Math.max(a,i),u)}function at({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 Ot({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 Gt(){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 as(){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 ke(){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 In(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{ps as GitSidebar,Fn as resolveGitOperationsMenuPosition};
@@ -0,0 +1 @@
1
+ import{b as c,j as e,t as a}from"./index-C2G8Gmf1.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-Gzc14EpR.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};
@@ -0,0 +1 @@
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{B as i,A as Y,b as w,t as g,j as r,f as X,Q as H,h as $}from"./index-C2G8Gmf1.js";import{d as _,f as ee}from"./App-WOLwMld_.js";function ne(){return i.request("/api/workspaces")}async function Te(){try{return await i.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 o=>({workspace:o,sessions:(await se(o.id)).items})))}}}function Be(e){return i.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function Me(e){return i.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function je(e){return i.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function ke(e){return i.request("/api/debug-targets/analyze",{method:"POST",body:JSON.stringify(e)})}function Ke(e,n){return i.request(`/api/debug-targets/${encodeURIComponent(e)}/launch-plan`,{method:"POST",body:JSON.stringify({})})}function Fe(){return i.request("/api/framework-compatibility-matrix")}function Je(e){return i.request("/api/workspaces/reorder",{method:"PUT",body:JSON.stringify(e)})}function Qe(e,n){return i.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()),i.request(`/api/workspaces/browse${n.size>0?`?${n.toString()}`:""}`)}function We(e){return i.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function se(e){return i.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function ze(e){return i.request(`/api/sessions/${encodeURIComponent(e)}`)}function Ve(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function Ze(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function Ye(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:n})})}function Xe(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:n})})}function He(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:n})})}function $e(e){return i.request(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}function _e(e){return i.request("/api/worktrees",{method:"POST",body:JSON.stringify(e)})}function en(e){return i.request(`/api/worktrees/${encodeURIComponent(e)}/merge-preview`,{method:"POST"})}function nn(e){return i.request(`/api/worktrees/${encodeURIComponent(e)}/merge-into-parent`,{method:"POST"})}function sn(e,n){return i.request(`/api/worktrees/${encodeURIComponent(e)}/cleanup`,{method:"POST",body:JSON.stringify(n??{})})}function tn(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function on(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function rn(){return i.request("/api/preferences/quick-phrases")}function an(e){return i.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()),i.request(`/api/providers/${encodeURIComponent(e)}/capabilities${s.size>0?`?${s.toString()}`:""}`)}async function oe(e,n){const s=await Promise.allSettled(e.map(async t=>[t,await te(t,n)])),o=[];for(const t of s){if(t.status!=="fulfilled")continue;const[a,l]=t.value;o.push([a,l])}return Object.fromEntries(o)}function un(e,n,s,o="forward"){const t=new URLSearchParams;return n&&t.set("cursor",n),t.set("limit",String(s)),t.set("direction",o),i.request(`/api/sessions/${encodeURIComponent(e)}/messages?${t.toString()}`)}function ln(e,n){return i.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(n)}/content`)}function cn(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(n)})}function dn(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/forks`,{method:"POST",body:JSON.stringify(n)})}function fn(e){return i.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function pn(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(n)})}function mn(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function gn(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(n)})}function Sn(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(n)}`,{method:"DELETE"})}function An(e,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(n)}/steer`,{method:"POST"})}function hn(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function yn(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function vn(e,n,s){return i.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(),o=M(),t=j(),a=this.state.sessionDisplaySortMode===s,l=this.state.showSystemFiles===o,d=k(this.state.notificationPreferences,t);a&&l&&d||(this.state={sessionDisplaySortMode:s,showSystemFiles:o,notificationPreferences:t},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 K=new ae;function Rn(e){return w.useSyncExternalStore(K.subscribe,()=>e(K.getState()))}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 F=!1;function Ae(e){return me.includes(e)}function c(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=c(e);return he((n==null?void 0:n.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function Cn(e){return!!(e&&c(e))}function wn(e){const n=c(e);return g((n==null?void 0:n.draftTitleKey)??"conversation.draftTitleCodex")}function ve(e,n="compact"){const s=c(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=c(e);return(n==null?void 0:n.icon)??Q}function W(){F||typeof window>"u"||(F=!0,Se.forEach(e=>{const n=new window.Image;n.decoding="async",n.src=e,typeof n.decode=="function"&&n.decode().catch(()=>{})}))}function Dn(e){const n=c(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 Pn(e){return(e==null?void 0:e.provider)??"claude-code"}function On(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=c(n))==null?void 0:s.supportsSlashMenuByDefault)??!1}function Nn(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 o;return((o=s.supportedReasoningEfforts)==null?void 0:o.some(t=>pe.has(t)))??!1}))}function In(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,o=(a=c(s))==null?void 0:a.supportsQueueWhileRunningByDefault;if(o!==void 0)return o;const t=(e==null?void 0:e.inRunInputMode)??"none";return t==="queued_guidance"||t==="none"||t==="streaming_guidance"&&n===!1}function bn(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=c(n))==null?void 0:s.supportsRunSteeringByDefault)??(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function En(e){const n=c(e);return(n==null?void 0:n.reasoningLevelPersists)??!1}function Ln(e,n){var o;return((o=c(n??null))==null?void 0:o.foldRulesMessagesByDefault)??!1}typeof window<"u"&&W();const x=new Map;function Un(){x.clear()}function qn({disabled:e=!1,workspaceId:n=null,pendingProvider:s=null,selectedProvider:o=null,providers:t=ge,className:a,disabledReasons:l,statusHintByProvider:d,onSelect:P}){const O=ue(),S=!!n,[v,f]=w.useState(()=>J(t,n)),A=t.map(u=>({provider:u}));return w.useEffect(()=>{W()},[]),w.useEffect(()=>{if(!n){f({});return}const u=J(t,n);f(u);const h=t.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}},[t,n]),r.jsx("div",{className:`session-provider-grid${a?` ${a}`:""}`,children:A.map(u=>{const h=ve(u.provider,"full"),p=s===u.provider,m=o===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||((d==null?void 0:d[u.provider])??(S&&!N&&!p?g("shell.providerChecking"):null));return r.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:[r.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:r.jsx("img",{src:Re(u.provider),alt:"",loading:"eager",decoding:"async"})}),r.jsxs("span",{className:"session-provider-card-copy",children:[r.jsx("strong",{children:h}),T?r.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 J(e,n){const s=(n==null?void 0:n.trim())??"";if(!s)return{};const o=[];for(const t of e){const a=x.get(z(s,t));a&&o.push([t,a])}return Object.fromEntries(o)}function we(e,n){const s=e.trim();if(s)for(const[o,t]of Object.entries(n))t&&x.set(z(s,o),t)}function z(e,n){return`${e}::${n}`}function xn(){const e=X(s=>s),n=H(s=>s);return De(e,n)}function De(e,n){var a;const s=$(e);if(!s)return null;const o=!!((a=s.relayTunnel)!=null&&a.enabled),t=n.activeHostId===s.id&&n.candidateProbePhase==="ready"?Pe(n):null;if(t){const l=Oe(t.kind);return{kind:l,url:t.url,endpointId:t.endpointId,autoDirect:o&&l!=="relay",probeInProgress:!1}}return{kind:Ne(s),url:s.baseUrl,endpointId:null,autoDirect:!1,probeInProgress:o&&n.activeHostId===s.id&&n.candidateProbePhase==="probing"}}function Tn(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(t=>Number(t));if(n.length!==4||n.some(t=>Number.isNaN(t)))return!1;const[s,o]=n;return s===100&&o>=64&&o<=127}function Le(e){const n=e.split(".").map(t=>Number(t));if(n.length!==4||n.some(t=>Number.isNaN(t)))return!1;const[s,o]=n;return s===10||s===192&&o===168||s===172&&o>=16&&o<=31}function Bn({heading:e,description:n,actions:s,tone:o="default",className:t,children:a}){return r.jsxs("section",{className:y("modal-section",t),"data-tone":o,children:[e||n||s?r.jsxs("div",{className:"modal-section-header",children:[r.jsxs("div",{className:"modal-section-copy",children:[e?r.jsx("strong",{className:"modal-section-heading",children:e}):null,n?r.jsx("p",{className:"modal-section-description",children:n}):null]}),s?r.jsx("div",{className:"modal-section-actions",children:s}):null]}):null,a]})}function Mn({label:e,description:n,className:s,htmlFor:o,children:t}){return r.jsxs("div",{className:y("workbench-modal-field","modal-field",s),children:[r.jsxs("div",{className:"modal-field-copy",children:[o?r.jsx("label",{className:"modal-field-label",htmlFor:o,children:e}):r.jsx("span",{className:"modal-field-label",children:e}),n?r.jsx("span",{className:"modal-field-description",children:n}):null]}),t]})}function jn({align:e="end",stack:n=!1,className:s,children:o,...t}){return r.jsx("div",{className:y("workbench-modal-actions","modal-actions",s),"data-align":e,"data-stack":n?"true":void 0,...t,children:o})}function kn({compact:e=!1,className:n,children:s,...o}){return r.jsx("div",{className:y("modal-list",n),"data-compact":e?"true":void 0,...o,children:s})}function Kn(e){const{as:n="div",label:s,description:o,leading:t,trailing:a,tone:l="default",selected:d=!1,className:P,children:O,...S}=e,f={className:y("modal-list-item",P),"data-tone":l!=="default"?l:void 0,"data-selected":d?"true":void 0,"data-interactive":n==="button"?"true":void 0},A=r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"modal-list-item-main",children:[t?r.jsx("span",{className:"modal-list-item-leading",children:t}):null,r.jsxs("span",{className:"modal-list-item-copy",children:[s?r.jsx("span",{className:"modal-list-item-label",children:s}):null,o?r.jsx("span",{className:"modal-list-item-description",children:o}):null,O]})]}),a?r.jsx("span",{className:"modal-list-item-trailing",children:a}):null]});if(n==="button"){const u=S;return r.jsx("button",{type:u.type??"button",...u,...f,children:A})}return r.jsx("div",{...S,...f,children:A})}function Fn({title:e,description:n,action:s,className:o,compact:t=!1}){return r.jsxs("div",{className:y("modal-empty-state",o),"data-compact":t?"true":void 0,children:[r.jsx("strong",{className:"modal-empty-state-title",children:e}),n?r.jsx("p",{className:"modal-empty-state-description",children:n}):null,s?r.jsx("div",{className:"modal-empty-state-action",children:s}):null]})}function Jn({tone:e="default",className:n,children:s,...o}){return r.jsx("span",{className:y("modal-tag",n),"data-tone":e!=="default"?e:void 0,...o,children:s})}function y(...e){return e.filter(Boolean).join(" ")}function Qn({open:e,title:n,description:s,height:o="auto",kind:t="form",dismissible:a=!0,closeOnBackdrop:l=!0,showHandle:d=!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(r.jsx("div",{className:"ios-action-sheet-overlay mobile-sheet-overlay",role:"presentation",onClick:()=>{N&&u()},children:r.jsxs("div",{className:`mobile-workspace-home-sheet mobile-sheet${S?` ${S}`:""}`,"data-height":o,"data-kind":t,role:"dialog","aria-modal":"true","aria-labelledby":p,"aria-describedby":s?m:void 0,onClick:E=>E.stopPropagation(),children:[r.jsxs("div",{className:`mobile-workspace-home-sheet-card mobile-sheet-card${v?` ${v}`:""}`,children:[d?r.jsx("div",{className:"mobile-sheet-handle","aria-hidden":"true"}):null,r.jsx("div",{className:"mobile-workspace-home-sheet-header mobile-sheet-header",children:r.jsxs("div",{className:"mobile-sheet-title-wrap",children:[r.jsx("strong",{id:p,children:n}),s?r.jsx("p",{id:m,children:s}):null]})}),r.jsx("div",{className:f?`mobile-sheet-body ${f}`:"mobile-sheet-body",children:h}),A?r.jsx("div",{className:"mobile-sheet-footer",children:A}):null]}),P?r.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{Ge as $,Sn as A,An as B,yn as C,vn as D,Ze as E,hn as F,tn as G,on as H,mn as I,cn as J,Cn as K,bn as L,Qn as M,wn as N,Fn as O,$e as P,Pn as Q,Nn as R,qn as S,On as T,In as U,an as V,En as W,rn as X,Ln as Y,ln as Z,Re as _,ve as a,Me as a0,Be as a1,We as a2,en as a3,nn as a4,sn as a5,Xe as a6,Un as a7,Qe as a8,Je as a9,He as aa,Ye as ab,_e as ac,K as ad,Ve as ae,ke as b,Ke as c,Fe as d,ue as e,Bn as f,Te as g,Mn as h,kn as i,Kn as j,Jn as k,xn as l,Tn as m,Dn as n,te as o,oe as p,ge as q,je as r,dn as s,pn as t,Rn as u,fn as v,ze as w,jn as x,un as y,gn as z};
@@ -0,0 +1 @@
1
+ import{j as i}from"./index-C2G8Gmf1.js";function m({children:e,className:o,frameRef:r,...a}){return i.jsx("div",{ref:r,className:["mobile-top-header-frame",o].filter(Boolean).join(" "),...a,children:e})}export{m as M};
@@ -0,0 +1 @@
1
+ import{b as j,f as $,h as B,j as t,t as l}from"./index-C2G8Gmf1.js";import{e as K,i as F,j as P,k as S,M as G}from"./MobileSheet-Gzc14EpR.js";import{as as q,m as z,at as D,$ as X,au as J}from"./WorkbenchLayout-rwQib5In.js";import{u as Q,e as V}from"./App-WOLwMld_.js";import{M as Y}from"./MobileTopHeaderFrame-BWorAJ1C.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=H(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 H(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=H(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:N,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=$(e=>e),h=B(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:N??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(F,{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:O.map(e=>t.jsx(P,{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)},children:t.jsxs("div",{className:e.kind==="host"?"mobile-workspace-home-session-main mobile-host-workspace-switcher-host-main":"mobile-workspace-home-session-main",children:[t.jsxs("span",{className:"mobile-workspace-home-session-title",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,e.kind==="host"?e.host.name:e.option.label]}),t.jsx("span",{className:"mobile-workspace-home-session-meta",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};
@@ -0,0 +1 @@
1
+ import{b as i,n as U,j as r,t as s}from"./index-C2G8Gmf1.js";import{a as v,q as k,s as I,t as O}from"./App-WOLwMld_.js";import{W as y}from"./WorkbenchModal-B09hC9b5.js";function w({isOpen:t,onClose:u,onSave:c,theme:P="dark"}){const d=v(e=>e.baseUrl),b=v(e=>e.options),m=v(e=>e.presetOptions),h=I(),[l,n]=i.useState(d),[p,o]=i.useState(null),a=i.useMemo(()=>{try{return U(l)}catch{return null}},[l]),f=k(a??l,b),x=m.find(e=>e.value===f)??null,g="server-settings-preset",S="server-settings-address";if(i.useEffect(()=>{t&&(n(d),o(null))},[t,d]),!t)return null;function N(){if(!a){o(s("auth.serverInvalid"));return}O.setBaseUrl(a),c==null||c(a),u()}function B(){a&&n(a)}return r.jsx(y,{open:t,title:s("auth.serverSettingsTitle"),description:s("auth.serverHint"),className:"server-settings-modal-card",onClose:u,children:r.jsxs("form",{className:"server-settings-modal-form",onSubmit:e=>{e.preventDefault(),N()},children:[r.jsxs("label",{className:"workbench-modal-field",htmlFor:g,children:[r.jsx("span",{children:s("auth.serverPreset")}),r.jsxs("select",{id:g,"aria-label":s("auth.serverPreset"),value:f,onChange:e=>{const j=e.target.value;j!==h&&(n(j),o(null))},children:[m.map(e=>r.jsx("option",{value:e.value,children:C(e)},`${e.source}:${e.value}`)),r.jsx("option",{value:h,children:s("auth.serverCustomOption")})]})]}),x?r.jsx("div",{className:"server-settings-modal-tags","aria-live":"polite",children:x.source==="discovered"?r.jsx("span",{className:"server-settings-modal-tag","data-tone":"discovered",children:s("auth.serverDiscoveredTag")}):null}):null,r.jsxs("label",{className:"workbench-modal-field",htmlFor:S,children:[r.jsx("span",{children:s("auth.serverAddress")}),r.jsx("input",{id:S,"aria-label":s("auth.serverAddress"),value:l,placeholder:s("auth.serverPlaceholder"),onBlur:B,onChange:e=>{n(e.target.value),o(null)}})]}),p?r.jsx("p",{className:"server-settings-modal-status","data-tone":"error",children:p}):r.jsx("p",{className:"server-settings-modal-hint",children:s("auth.serverHint")}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",onClick:u,children:s("common.cancel")}),r.jsx("button",{type:"submit",className:"primary-button",children:s("auth.saveServerSettings")})]})]})})}function C(t){return t.source==="discovered"?`${t.value} · ${s("auth.serverDiscoveredTag")}`:t.value}export{w as ServerSettingsModal};
@@ -0,0 +1 @@
1
+ import{b as u,j as e,t as r}from"./index-C2G8Gmf1.js";import{f as me,u as ye}from"./App-WOLwMld_.js";import{e as je,a as pe}from"./MobileSheet-Gzc14EpR.js";import{A as le,C as ke,D as fe,E as Ne,F as Me,u as Ee,G as Ae,H as ce,i as Ce,I as Q,J as ee,K as Ie,j as Pe,b as De}from"./WorkbenchLayout-rwQib5In.js";import{f as Te,a as de,M as Le}from"./MobileWorkspaceSwitcherHeader-DOr4pTUq.js";import{M as Re}from"./MobileCreateSessionSheet-CXSKMnYn.js";import{w as ue}from"./styles-CSUx5LGe.js";import"./window-BWqRixxq.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-B09hC9b5.js";import"./MobileTopHeaderFrame-BWorAJ1C.js";const Oe=420,We=156;function $e({entry:n,isFavorite:i,isActive:a=!1,depth:l=0,variant:c="default",workspaceTone:k="root",hasSubsessions:m=!1,subsessionsExpanded:N=!1,showActions:X=!0,onActivate:Y,onToggleSubsessions:L,onToggleFavorite:se,onArchive:R,onUnarchive:ne,onRename:d}){const[g,A]=u.useState(!1),[C,I]=u.useState(null),[w,O]=u.useState(null),M=u.useRef(null),P=u.useRef(!1),D=u.useRef(null),W=je(),{session:h,workspace:te}=n,$=h.title??h.sessionId,z=pe(h.provider),B=[z,Be(h.lastMessageAt??h.updatedAt??null),le(h)].filter(Boolean).join(" · "),H=Ve(h),V=H?Fe(H):null,T=c==="mobile"?null:le(h),F=T?ke("session-list-activity-badge",h):null;u.useEffect(()=>()=>{K()},[]),u.useLayoutEffect(()=>{if(!g||!w||typeof window>"u"){I(null);return}const t=()=>{var S,y;const x=Ne(w,{width:((S=D.current)==null?void 0:S.offsetWidth)??0,height:((y=D.current)==null?void 0:y.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:We});I({position:"fixed",left:`${Math.round(x.left)}px`,top:`${Math.round(x.top)}px`,width:`${Math.round(x.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(x.maxHeight)}px`,transformOrigin:x.transformOrigin})},f=x=>{var y;const S=x.target;S&&!((y=D.current)!=null&&y.contains(S))&&j()},v=x=>{x.key==="Escape"&&j()};return t(),window.addEventListener("pointerdown",f),window.addEventListener("keydown",v),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("pointerdown",f),window.removeEventListener("keydown",v),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[w,g]);function _(t){O(t),A(!0)}function j(){A(!1),O(null)}function K(){M.current!==null&&(window.clearTimeout(M.current),M.current=null)}function ie(t){if(!X||t.pointerType==="mouse")return;const f={x:t.clientX,y:t.clientY};K(),M.current=window.setTimeout(()=>{P.current=!0,W.trigger("gesture"),_(f)},Oe)}function G(){K()}function oe(){if(P.current){P.current=!1;return}W.trigger("selection"),Y(h.sessionId)}const U=async()=>{const t=window.prompt(r("shell.renameModalDescription"),$);t&&(await d(h.sessionId,t.trim()),j())},J=async()=>{if(h.isArchived){await ne(h.sessionId),j();return}await R(h.sessionId),j()},s=()=>{se(h.sessionId),j()},o=t=>{if(t.key!=="ContextMenu"&&!(t.shiftKey&&t.key==="F10"))return;t.preventDefault(),t.stopPropagation();const f=t.currentTarget.getBoundingClientRect();_({x:f.right,y:f.bottom})},p=g&&typeof document<"u"?me.createPortal(e.jsxs("div",{ref:D,className:"session-action-menu surface-card",role:"menu","aria-label":r("shell.sessionMoreAction"),style:C??{position:"fixed",top:0,left:0,visibility:"hidden"},onClick:t=>t.stopPropagation(),children:[e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:s,children:i?r("shell.unfavoriteAction"):r("shell.favoriteAction")}),e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void J(),children:h.isArchived?r("shell.unarchiveAction"):r("shell.archiveAction")}),e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void U(),children:r("shell.renameAction")})]}),document.body):null;return e.jsxs("article",{className:"session-list-item","data-depth":l,"data-active":a,"data-workspace-tone":k,"data-has-subsessions":m,"data-variant":c,onContextMenu:t=>{X&&(t.preventDefault(),t.stopPropagation(),_({x:t.clientX,y:t.clientY}))},children:[m?e.jsx("button",{type:"button",className:"session-list-subsession-toggle","aria-label":N?r("shell.subagentCollapse"):r("shell.subagentExpand"),title:N?r("shell.subagentCollapse"):r("shell.subagentExpand"),"aria-expanded":N,onClick:t=>{t.stopPropagation(),W.trigger("selection"),L==null||L()},children:e.jsx("span",{className:he(h,{isActive:a,hasSubsessions:m}),"aria-hidden":"true"})}):e.jsx("span",{className:he(h,{isActive:a,hasSubsessions:m}),"aria-hidden":"true"}),e.jsx("button",{type:"button",className:"session-list-link",onClick:oe,onPointerDown:ie,onPointerUp:G,onPointerCancel:G,onPointerLeave:G,onKeyDown:o,children:e.jsxs("div",{className:"session-list-copy",children:[e.jsx("div",{className:"session-list-title",children:$||r("shell.searchEntry")}),e.jsx("div",{className:"session-list-meta",children:c==="mobile"?e.jsx("span",{children:B}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:te.name}),T&&F?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{className:F,children:T})]}):null,e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{children:z})]})}),V?e.jsx("div",{className:"session-list-error",title:H??void 0,children:V}):null]})}),p]})}function he(n,i){return Me("session-list-indicator",n,{isActive:i.isActive,hasSubagents:i.hasSubsessions})}function Be(n){return n?new Date(n).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):r("common.unknown")}function He(n){return fe(n)||n.syncStatus==="error"}function Ve(n){var l,c;if(!He(n))return null;const i=((l=n.lastErrorCode)==null?void 0:l.trim())??"",a=((c=n.lastErrorDetail)==null?void 0:c.replace(/\s+/g," ").trim())??"";return i&&a&&!a.includes(i)?`${i} · ${a}`:a||i||(n.syncStatus==="error"&&!fe(n)?r("conversation.syncStatusError"):r("conversation.runtimeErrorTitle"))}function Fe(n,i=96){return n.length<=i?n:`${n.slice(0,Math.max(0,i-1)).trimEnd()}…`}const q=5;function rs(){var J;const n=ye(),{navigationGroups:i,favoriteSessionIds:a,currentWorkspaceId:l,currentSessionId:c,navigationLoading:k,selectWorkspace:m,toggleFavoriteSession:N,archiveSession:X,unarchiveSession:Y,renameSession:L,startDraftSession:se}=Ee(),R=Te(i),ne=u.useMemo(()=>Ae(i),[i]),d=de(i,l)??de(i,((J=i[0])==null?void 0:J.workspace.id)??null),g=R.find(s=>s.workspace.id===(d==null?void 0:d.workspace.id))??(d?{workspace:d.workspace,label:d.workspace.name,subtitle:d.workspace.path}:null),A=u.useMemo(()=>new Set(a),[a]),C=u.useMemo(()=>d?d.sessions.filter(s=>{var t;if(s.isArchived)return!1;const o=((t=s.parentSessionId)==null?void 0:t.trim())||null;if(!o)return!0;const p=d.sessions.find(f=>f.sessionId===o);return!p||!p.isArchived}).map(s=>({session:s,workspace:d.workspace})):[],[d]),I=u.useMemo(()=>C.filter(s=>A.has(s.session.sessionId)),[C,A]),w=u.useMemo(()=>ce(C),[C]),O=u.useMemo(()=>ce(I),[I]),M=u.useMemo(()=>d?d.sessions.filter(s=>s.isArchived===!0&&!Ce(s)):[],[d]),P=(d==null?void 0:d.workspace.id)??"",D=!!P,[W,h]=u.useState([]),[te,$]=u.useState({}),[z,B]=u.useState(!1),[H,V]=u.useState(!1),[T,F]=u.useState(null);u.useEffect(()=>{$(s=>{const o={};for(const p of w){const t=Q(ee(p));if(t.length===0)continue;const f=t.findIndex(v=>v.item.session.sessionId===c);o[p.item.session.sessionId]=Xe(t.length,q,s[p.item.session.sessionId],f)}return Ye(s,o)?s:o})},[c,w]),u.useEffect(()=>{if(!c)return;const s=Ie(w,c,o=>o.session.sessionId);s.length!==0&&h(o=>{const p=new Set(o);let t=!1;for(const f of s)p.has(f)||(p.add(f),t=!0);return t?Array.from(p):o})},[c,w]);function _(s){h(o=>o.includes(s)?o.filter(p=>p!==s):[...o,s])}function j(s){return te[s]??q}function K(s){$(o=>({...o,[s]:(o[s]??q)+q}))}function ie(s,o){ue("immersive"),n(De(s,o))}function G(s,o){B(!1),ue("immersive"),se(s,o)}async function oe(s){F(s);try{await Y(s)}finally{F(o=>o===s?null:o)}}function U(s,o=!1,p=[],t=!1,f=!1){var ae;const v=s.item.session.sessionId,x=s.children,S=s.depth===0&&x.length>0,y=o||S&&W.includes(v),re=y&&S,be=re?Ue(s,j(v)):s,Z=y?be.children:[],xe=Q(x).length,ge=Q(Z).length,we=re&&ge<xe,Se=s.depth>0?[...p,t]:[...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,E)=>b?e.jsx("span",{className:"session-tree-guide-column",style:{"--session-tree-level":E+1}},`${v}:ancestor:${E}`):null),e.jsx("span",{className:"session-tree-guide-branch","data-continue":t,"data-first":f,style:{"--session-tree-level":s.depth},children:e.jsx("span",{className:"session-tree-guide-branch-horizontal"})})]}):null,e.jsx($e,{entry:s.item,isFavorite:A.has(v),isActive:c===v,depth:s.depth,variant:"mobile",workspaceTone:((ae=ne[s.item.workspace.id])==null?void 0:ae.tone)??"root",hasSubsessions:S,subsessionsExpanded:y,onActivate:b=>ie(s.item.workspace.id,b),onToggleSubsessions:S?()=>_(v):void 0,onToggleFavorite:b=>{N(b)},onArchive:b=>X(b),onUnarchive:b=>Y(b),onRename:(b,E)=>L(b,E)})]}),y&&Z.length>0?e.jsx("div",{className:"session-list-children",children:Z.map((b,E)=>U(b,!0,Se,E<Z.length-1,E===0))}):null,we?e.jsx("div",{className:"session-list-children",children:e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>K(v),children:r("shell.subagentExpandMore")})}):null]},`${s.item.workspace.id}:${v}`)}return e.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[e.jsx(Le,{currentWorkspace:g?{id:g.workspace.id,name:g.label,path:g.subtitle}:null,workspaces:i.map(s=>s.workspace),workspaceOptions:R,onSelectWorkspace:s=>{m(s),n(Pe(s))},content:e.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:k||!D,onClick:()=>B(!0),children:r("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:k||!d,onClick:()=>V(!0),children:[e.jsx("span",{children:r("shell.archiveViewAction")}),e.jsx("span",{className:"session-index-archive-count",children:M.length})]})}),O.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:r("shell.favoriteSectionTitle")})}),e.jsx("span",{className:"session-section-count",children:I.length})]}),e.jsx("div",{className:"session-current-workspace-list",children:O.map(s=>U(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:r("shell.mobileConversationCurrentWorkspaceSection")})}),e.jsx("span",{className:"session-section-count",children:w.length})]}),w.length===0?e.jsx("p",{className:"session-section-empty",children:k?r("shell.searchSessionHint"):r("shell.emptyWorkspaceSessions")}):e.jsx("div",{className:"session-current-workspace-list",children:w.map(s=>U(s))})]})]}),e.jsx(Re,{open:z,workspaces:i.map(s=>s.workspace),workspaceOptions:R,initialWorkspaceId:l??P,onClose:()=>B(!1),onSelect:G}),e.jsx(_e,{open:H,workspaceName:(g==null?void 0:g.label)??(d==null?void 0:d.workspace.name)??null,sessions:M,restoringSessionId:T,onClose:()=>{T||V(!1)},onRestore:s=>void oe(s)})]})}function _e({open:n,workspaceName:i,sessions:a,restoringSessionId:l,onClose:c,onRestore:k}){return u.useEffect(()=>{if(!n)return;function m(N){N.key==="Escape"&&!l&&c()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[c,n,l]),!n||typeof document>"u"?null:me.createPortal(e.jsxs("div",{className:"workbench-modal-layer",children:[e.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":r("common.close"),disabled:!!l,onClick:c}),e.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":r("shell.archiveModalTitle"),children:[e.jsx("div",{className:"workbench-modal-header",children:e.jsxs("div",{className:"workbench-modal-title-wrap",children:[e.jsx("h2",{children:r("shell.archiveModalTitle")}),e.jsx("p",{children:i?`${i} · ${r("shell.archiveModalDescription")}`:r("shell.archiveModalDescription")})]})}),e.jsx("div",{className:"workbench-modal-body",children:a.length>0?e.jsx("div",{className:"workbench-archive-list",children:a.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:Ke(m)})]}),e.jsx("button",{type:"button",className:"secondary-button",disabled:l===m.sessionId,onClick:()=>{k(m.sessionId)},children:r("shell.unarchiveAction")})]},m.sessionId))}):e.jsx("p",{className:"workbench-section-empty",children:r("shell.archiveEmpty")})})]})]}),document.body)}function Ke(n){const i=pe(n.provider),a=Ge(n.lastMessageAt??n.updatedAt??null);return[i,a].filter(Boolean).join(" · ")}function Ge(n){if(!n)return null;const i=Date.parse(n);return Number.isNaN(i)?null:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(i)}function Ue(n,i){const a=new Set(Q(ee(n)).sort((l,c)=>(c.item.session.lastMessageAt??c.item.session.updatedAt).localeCompare(l.item.session.lastMessageAt??l.item.session.updatedAt)).slice(0,i).map(l=>l.item.session.sessionId));return{...n,children:ve(ee(n),a)}}function ve(n,i){return n.flatMap(a=>{const l=ve(ee(a),i);return!i.has(a.item.session.sessionId)&&l.length===0?[]:[{...a,children:l}]})}function Xe(n,i,a,l=-1){if(n<=0)return 0;const c=l>=0?Math.max(i,l+1):i;return Math.min(n,Math.max(a??0,c))}function Ye(n,i){const a=Object.keys(n),l=Object.keys(i);return a.length!==l.length?!1:a.every(c=>n[c]===i[c])}export{rs as SessionIndexPage};