@jingyi0605/codingns 0.4.0 → 0.5.0

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 (267) 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-R-XZw7pd.js +3 -0
  4. package/dist/public/assets/App-DUAg5urj.css +1 -0
  5. package/dist/public/assets/App-DkvE5EyM.js +30 -0
  6. package/dist/public/assets/BootstrapPage-Vu5oEJ8z.js +1 -0
  7. package/dist/public/assets/ConversationPage-Cjpg6g0J.js +2 -0
  8. package/dist/public/assets/DesktopDetachPreviewPage-BgeEqbc5.js +1 -0
  9. package/dist/public/assets/DesktopWindowPage-1WelvxdH.js +2 -0
  10. package/dist/public/assets/FileContextPanel-D_ghXJuW.js +1 -0
  11. package/dist/public/assets/GitSidebar-D9f9Jxwr.js +6 -0
  12. package/dist/public/assets/MobileCreateSessionSheet-DLq5qPkx.js +1 -0
  13. package/dist/public/assets/MobileSheet-DLg-gX1t.js +1 -0
  14. package/dist/public/assets/MobileTopHeaderFrame-DArgZI7L.js +1 -0
  15. package/dist/public/assets/MobileWorkspaceSwitcherHeader-0ywJKfBQ.js +1 -0
  16. package/dist/public/assets/ServerSettingsModal-izoYMx9U.js +1 -0
  17. package/dist/public/assets/SessionIndexPage-C5aG8FIv.js +1 -0
  18. package/dist/public/assets/SettingsPage-HJIC-P-4.js +1 -0
  19. package/dist/public/assets/TerminalManagerPanel-DpyUTo9k.js +1 -0
  20. package/dist/public/assets/{TerminalPage-6jHZV9Mh.js → TerminalPage-CtKXIU0h.js} +19 -19
  21. package/dist/public/assets/TerminalRuntimeFallbackModal-CRhOQOsT.js +1 -0
  22. package/dist/public/assets/ToolFilesPage-DcYPsS-e.js +1 -0
  23. package/dist/public/assets/ToolGitPage-CsPl89ty.js +1 -0
  24. package/dist/public/assets/ToolProcessesPage-D0dvR8xK.js +1 -0
  25. package/dist/public/assets/ToolsHomePage-4fP-KRiv.js +1 -0
  26. package/dist/public/assets/WorkbenchLandingPage-kvlfyxRo.js +1 -0
  27. package/dist/public/assets/WorkbenchLayout-ByFw4eeu.js +3 -0
  28. package/dist/public/assets/WorkbenchModal-Ctob14VR.js +1 -0
  29. package/dist/public/assets/WorkbenchShellRoute-BUITtdAg.css +1 -0
  30. package/dist/public/assets/WorkbenchShellRoute-Kw7JEZI3.js +1 -0
  31. package/dist/public/assets/WorkspaceDebugDetailPage-Com5kEXJ.js +1 -0
  32. package/dist/public/assets/WorkspaceDetailPage-D0Lrx4Uz.js +1 -0
  33. package/dist/public/assets/WorkspaceHomePage-wR8d3aP9.js +1 -0
  34. package/dist/public/assets/butler-records-events-DgWCG364.js +1 -0
  35. package/dist/public/assets/default-session-permission-mode-CcGwR4Kk.js +1 -0
  36. package/dist/public/assets/event-DvH9tcej.js +1 -0
  37. package/dist/public/assets/file-tree-icon-UFVoVzhM.js +31 -0
  38. package/dist/public/assets/index-Byp9hJ0c.js +42 -0
  39. package/dist/public/assets/index-_52jxu4a.css +1 -0
  40. package/dist/public/assets/preferences-service-KIYeE2gk.js +1 -0
  41. package/dist/public/assets/session-runtime-machine-0KNSSPp5.js +17 -0
  42. package/dist/public/assets/styles-BWPBZvze.css +1 -0
  43. package/dist/public/assets/styles-CSUx5LGe.js +1 -0
  44. package/dist/public/assets/terminal-runtime-meta-AWXJpN4r.js +1 -0
  45. package/dist/public/assets/useRegisteredDebugTemplates-DBDRdptr.js +1 -0
  46. package/dist/public/assets/window-BWqRixxq.js +1 -0
  47. package/dist/public/index.html +2 -2
  48. package/dist/server/middlewares/auth-guard.d.ts +4 -0
  49. package/dist/server/middlewares/auth-guard.js +42 -4
  50. package/dist/server/middlewares/auth-guard.js.map +1 -1
  51. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +62 -1
  52. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +58 -0
  53. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  54. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +66 -3
  55. package/dist/server/modules/assistant-capability/assistant-capability-service.js +173 -1
  56. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  57. package/dist/server/modules/auth/auth-controller.d.ts +11 -1
  58. package/dist/server/modules/auth/auth-controller.js +61 -2
  59. package/dist/server/modules/auth/auth-controller.js.map +1 -1
  60. package/dist/server/modules/auth/auth-device-display-name.d.ts +10 -0
  61. package/dist/server/modules/auth/auth-device-display-name.js +190 -0
  62. package/dist/server/modules/auth/auth-device-display-name.js.map +1 -0
  63. package/dist/server/modules/auth/auth-service.d.ts +80 -5
  64. package/dist/server/modules/auth/auth-service.js +333 -23
  65. package/dist/server/modules/auth/auth-service.js.map +1 -1
  66. package/dist/server/modules/butler/assistant-automation-service.d.ts +2 -0
  67. package/dist/server/modules/butler/assistant-automation-service.js +46 -0
  68. package/dist/server/modules/butler/assistant-automation-service.js.map +1 -1
  69. package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.d.ts +32 -0
  70. package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js +93 -0
  71. package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js.map +1 -0
  72. package/dist/server/modules/butler/assistant-sandbox-service.d.ts +16 -2
  73. package/dist/server/modules/butler/assistant-sandbox-service.js +137 -4
  74. package/dist/server/modules/butler/assistant-sandbox-service.js.map +1 -1
  75. package/dist/server/modules/butler/butler-auth-service.js +7 -2
  76. package/dist/server/modules/butler/butler-auth-service.js.map +1 -1
  77. package/dist/server/modules/butler/butler-control-session-service.d.ts +4 -1
  78. package/dist/server/modules/butler/butler-control-session-service.js +20 -1
  79. package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
  80. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.d.ts +2 -1
  81. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js +27 -25
  82. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js.map +1 -1
  83. package/dist/server/modules/butler/butler-follow-up-service.d.ts +32 -4
  84. package/dist/server/modules/butler/butler-follow-up-service.js +436 -331
  85. package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
  86. package/dist/server/modules/butler/butler-inbox-analysis-service.d.ts +1 -1
  87. package/dist/server/modules/butler/butler-inbox-analysis-service.js.map +1 -1
  88. package/dist/server/modules/butler/butler-inbox-service.js +1 -0
  89. package/dist/server/modules/butler/butler-inbox-service.js.map +1 -1
  90. package/dist/server/modules/butler/butler-session-service.d.ts +3 -1
  91. package/dist/server/modules/butler/butler-session-service.js +15 -1
  92. package/dist/server/modules/butler/butler-session-service.js.map +1 -1
  93. package/dist/server/modules/butler/butler-workspace-context.d.ts +1 -1
  94. package/dist/server/modules/butler/butler-workspace-context.js +54 -28
  95. package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
  96. package/dist/server/modules/provider/provider-controller.d.ts +1 -1
  97. package/dist/server/modules/provider/provider-controller.js.map +1 -1
  98. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.d.ts +10 -0
  99. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js +48 -0
  100. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js.map +1 -0
  101. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.d.ts +48 -0
  102. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js +11 -0
  103. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js.map +1 -0
  104. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.d.ts +74 -0
  105. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js +302 -0
  106. package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js.map +1 -0
  107. package/dist/server/modules/relay-tunnel/relay-tunnel-controller.d.ts +33 -0
  108. package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js +57 -0
  109. package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js.map +1 -0
  110. package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.d.ts +9 -0
  111. package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js +25 -0
  112. package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js.map +1 -0
  113. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.d.ts +18 -0
  114. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js +230 -0
  115. package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js.map +1 -0
  116. package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.d.ts +41 -0
  117. package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js +443 -0
  118. package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js.map +1 -0
  119. package/dist/server/modules/relay-tunnel/relay-tunnel-service.d.ts +111 -0
  120. package/dist/server/modules/relay-tunnel/relay-tunnel-service.js +771 -0
  121. package/dist/server/modules/relay-tunnel/relay-tunnel-service.js.map +1 -0
  122. package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +2 -1
  123. package/dist/server/modules/sessions/codex-app-server-helper-client.js +78 -0
  124. package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -1
  125. package/dist/server/modules/sessions/codex-app-server-helper-process.js +84 -2
  126. package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
  127. package/dist/server/modules/sessions/provider-session-delete-cli.d.ts +15 -0
  128. package/dist/server/modules/sessions/provider-session-delete-cli.js +148 -0
  129. package/dist/server/modules/sessions/provider-session-delete-cli.js.map +1 -0
  130. package/dist/server/modules/sessions/session-controller.d.ts +4 -1
  131. package/dist/server/modules/sessions/session-controller.js +4 -0
  132. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  133. package/dist/server/modules/sessions/session-history-service.d.ts +17 -0
  134. package/dist/server/modules/sessions/session-history-service.js +150 -1
  135. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  136. package/dist/server/modules/sessions/session-live-runtime-router-service.d.ts +25 -0
  137. package/dist/server/modules/sessions/session-live-runtime-router-service.js +42 -0
  138. package/dist/server/modules/sessions/session-live-runtime-router-service.js.map +1 -0
  139. package/dist/server/modules/sessions/session-live-runtime-service.js +34 -18
  140. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  141. package/dist/server/modules/sessions/session-message-attachment-service.d.ts +1 -0
  142. package/dist/server/modules/sessions/session-message-attachment-service.js +22 -0
  143. package/dist/server/modules/sessions/session-message-attachment-service.js.map +1 -1
  144. package/dist/server/modules/sessions/session-permission-request-service.d.ts +1 -0
  145. package/dist/server/modules/sessions/session-permission-request-service.js +200 -5
  146. package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
  147. package/dist/server/modules/sessions/session-provider-error-mapper.js +32 -0
  148. package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
  149. package/dist/server/modules/sessions/session-provider-usage-guard-service.d.ts +37 -0
  150. package/dist/server/modules/sessions/session-provider-usage-guard-service.js +179 -0
  151. package/dist/server/modules/sessions/session-provider-usage-guard-service.js.map +1 -0
  152. package/dist/server/modules/sessions/session-provider-usage-limit.d.ts +17 -0
  153. package/dist/server/modules/sessions/session-provider-usage-limit.js +465 -0
  154. package/dist/server/modules/sessions/session-provider-usage-limit.js.map +1 -0
  155. package/dist/server/modules/skills/assistant-runtime-skill-catalog.d.ts +8 -0
  156. package/dist/server/modules/skills/assistant-runtime-skill-catalog.js +26 -0
  157. package/dist/server/modules/skills/assistant-runtime-skill-catalog.js.map +1 -0
  158. package/dist/server/modules/skills/assistant-runtime-skill-cleanup.d.ts +9 -0
  159. package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js +55 -0
  160. package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js.map +1 -0
  161. package/dist/server/modules/skills/builtin-skill-service.js +1 -6
  162. package/dist/server/modules/skills/builtin-skill-service.js.map +1 -1
  163. package/dist/server/modules/skills/skill-controller.d.ts +2 -2
  164. package/dist/server/modules/skills/skill-controller.js +9 -1
  165. package/dist/server/modules/skills/skill-controller.js.map +1 -1
  166. package/dist/server/modules/skills/skill-manager-service.d.ts +26 -1
  167. package/dist/server/modules/skills/skill-manager-service.js +346 -90
  168. package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
  169. package/dist/server/modules/skills/skill-name-policy.d.ts +2 -0
  170. package/dist/server/modules/skills/skill-name-policy.js +10 -0
  171. package/dist/server/modules/skills/skill-name-policy.js.map +1 -0
  172. package/dist/server/modules/tailscale/tailscale-service.d.ts +2 -0
  173. package/dist/server/modules/tailscale/tailscale-service.js +21 -8
  174. package/dist/server/modules/tailscale/tailscale-service.js.map +1 -1
  175. package/dist/server/modules/tasks/task-types.d.ts +3 -0
  176. package/dist/server/modules/tasks/task-types.js +3 -0
  177. package/dist/server/modules/tasks/task-types.js.map +1 -1
  178. package/dist/server/modules/terminal/template-reverse-proxy-service.js +71 -3
  179. package/dist/server/modules/terminal/template-reverse-proxy-service.js.map +1 -1
  180. package/dist/server/routes/assistant.js +30 -0
  181. package/dist/server/routes/assistant.js.map +1 -1
  182. package/dist/server/routes/auth.js +4 -0
  183. package/dist/server/routes/auth.js.map +1 -1
  184. package/dist/server/routes/sessions.js +1 -0
  185. package/dist/server/routes/sessions.js.map +1 -1
  186. package/dist/server/routes/system.d.ts +2 -1
  187. package/dist/server/routes/system.js +13 -1
  188. package/dist/server/routes/system.js.map +1 -1
  189. package/dist/server/server/create-server.d.ts +10 -0
  190. package/dist/server/server/create-server.js +82 -12
  191. package/dist/server/server/create-server.js.map +1 -1
  192. package/dist/server/shared/utils/tokens.d.ts +3 -1
  193. package/dist/server/shared/utils/tokens.js +9 -2
  194. package/dist/server/shared/utils/tokens.js.map +1 -1
  195. package/dist/server/storage/repositories/assistant-automation-task-repository.d.ts +2 -0
  196. package/dist/server/storage/repositories/assistant-automation-task-repository.js +8 -2
  197. package/dist/server/storage/repositories/assistant-automation-task-repository.js.map +1 -1
  198. package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.d.ts +1 -0
  199. package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js +27 -0
  200. package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js.map +1 -1
  201. package/dist/server/storage/repositories/auth-device-repository.d.ts +22 -0
  202. package/dist/server/storage/repositories/auth-device-repository.js +97 -0
  203. package/dist/server/storage/repositories/auth-device-repository.js.map +1 -0
  204. package/dist/server/storage/repositories/auth-device-session-repository.d.ts +17 -0
  205. package/dist/server/storage/repositories/auth-device-session-repository.js +82 -0
  206. package/dist/server/storage/repositories/auth-device-session-repository.js.map +1 -0
  207. package/dist/server/storage/repositories/auth-login-event-repository.d.ts +9 -0
  208. package/dist/server/storage/repositories/auth-login-event-repository.js +53 -0
  209. package/dist/server/storage/repositories/auth-login-event-repository.js.map +1 -0
  210. package/dist/server/storage/repositories/auth-token-repository.d.ts +4 -0
  211. package/dist/server/storage/repositories/auth-token-repository.js +58 -5
  212. package/dist/server/storage/repositories/auth-token-repository.js.map +1 -1
  213. package/dist/server/storage/repositories/butler-follow-up-task-repository.js +21 -3
  214. package/dist/server/storage/repositories/butler-follow-up-task-repository.js.map +1 -1
  215. package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.d.ts +8 -0
  216. package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js +52 -0
  217. package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js.map +1 -0
  218. package/dist/server/storage/repositories/instance-relay-tunnel-repository.d.ts +10 -0
  219. package/dist/server/storage/repositories/instance-relay-tunnel-repository.js +153 -0
  220. package/dist/server/storage/repositories/instance-relay-tunnel-repository.js.map +1 -0
  221. package/dist/server/storage/repositories/instance-tailscale-repository.js +6 -3
  222. package/dist/server/storage/repositories/instance-tailscale-repository.js.map +1 -1
  223. package/dist/server/storage/repositories/managed-skill-repository.d.ts +2 -1
  224. package/dist/server/storage/repositories/managed-skill-repository.js +14 -4
  225. package/dist/server/storage/repositories/managed-skill-repository.js.map +1 -1
  226. package/dist/server/storage/repositories/session-message-attachment-repository.d.ts +2 -0
  227. package/dist/server/storage/repositories/session-message-attachment-repository.js +24 -0
  228. package/dist/server/storage/repositories/session-message-attachment-repository.js.map +1 -1
  229. package/dist/server/storage/sqlite/client.js +297 -2
  230. package/dist/server/storage/sqlite/client.js.map +1 -1
  231. package/dist/server/storage/sqlite/schema.sql +122 -4
  232. package/dist/server/types/domain.d.ts +82 -1
  233. package/dist/server/ws/workbench-ws-hub.js +99 -75
  234. package/dist/server/ws/workbench-ws-hub.js.map +1 -1
  235. package/dist/server/ws/ws-auth-guard.js +1 -4
  236. package/dist/server/ws/ws-auth-guard.js.map +1 -1
  237. package/dist/server/ws/ws-server.d.ts +1 -1
  238. package/dist/server/ws/ws-server.js.map +1 -1
  239. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
  240. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
  241. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
  242. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +1 -0
  243. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +11 -1
  244. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
  245. package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +11 -0
  246. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +132 -21
  247. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  248. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +2 -0
  249. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +53 -1
  250. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -1
  251. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +1 -0
  252. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +10 -1
  253. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -1
  254. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +1 -0
  255. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +30 -0
  256. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
  257. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +5 -1
  258. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +145 -58
  259. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  260. package/node_modules/@codingns/session-sync-core/dist/services.d.ts +1 -0
  261. package/node_modules/@codingns/session-sync-core/dist/services.js +7 -0
  262. package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -1
  263. package/node_modules/@codingns/session-sync-core/dist/types.d.ts +2 -0
  264. package/package.json +1 -1
  265. package/scripts/postinstall.mjs +0 -33
  266. package/dist/public/assets/index-CSVhg7I8.js +0 -123
  267. 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 _n}from"./index-Byp9hJ0c.js";import{u as ji,d as Ci,e as Ni,f as fn}from"./App-DkvE5EyM.js";import{u as vi,X as Qe,r as pn,w as Si,aC as Ti,au as Mi,aD as xn,aE as Ei,aF as bn,aG as Hi,aw as wi,aH as Ai,av as Pi,aI as Ri,aJ as Li,aB as Di,aK as yn,b as _i,aL as Fi,aM as Oi}from"./WorkbenchLayout-ByFw4eeu.js";import{g as ki}from"./default-session-permission-mode-CcGwR4Kk.js";import{S as Gi,q as $i,t as Bi,e as Ui}from"./MobileSheet-DLg-gX1t.js";import{F as Wi,a as Rt,b as Lt}from"./file-tree-icon-UFVoVzhM.js";import{W as De}from"./WorkbenchModal-Ctob14VR.js";import"./window-BWqRixxq.js";import"./event-DvH9tcej.js";const Tt=56,jn=28,Mt=72,et=8,Cn=960,Nn=60*1e3,vn=20,Sn=9,Tn=9,Et=68,_=12,tt=8,Dt=260,Vi=120,Ht=6e4,nt={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function gs({className:a,workspaceId:i,panelActive:u=!0,externalWindowMode:h=!1,workbenchShellOverrides:d}){const C=ji(),b=Ci(),j=vi(),{subscribeGitSnapshot:y,requestGitRefresh:N,addGitSnapshotListener:M,requestNavigationRefresh:S,selectWorkspace:T,upsertNavigationSession:f}={...j,...d},[r,m]=l.useState(null),[g,E]=l.useState([]),[p,P]=l.useState(0),[H,ue]=l.useState(null),[de,st]=l.useState(!1),[G,Fe]=l.useState(null),[te,I]=l.useState(null),[me,he]=l.useState(""),[at,U]=l.useState(!1),[v,R]=l.useState(!1),[Vn,Gt]=l.useState([]),[J,$t]=l.useState(!0),[Q,W]=l.useState(!1),[F,In]=l.useState(()=>typeof window<"u"?window.innerWidth<=Cn:!1),[rt,$]=l.useState([]),[ge,V]=l.useState(null),[fe,ne]=l.useState("unstaged"),[pe,z]=l.useState(null),[ie,K]=l.useState(null),[zn,ot]=l.useState(!1),[Kn,lt]=l.useState(null),[Xn,Oe]=l.useState(!1),[Bt,ke]=l.useState(null),[L,xe]=l.useState(null),[Ut,be]=l.useState(null),[qn,ye]=l.useState(!1),[je,se]=l.useState(null),[ee,ct]=l.useState(!1),[Yn,Ce]=l.useState(!1),[Zn,Wt]=l.useState([]),[ss,Vt]=l.useState(!1),[Ge,ut]=l.useState(new Set),[Jn,Ne]=l.useState(new Map),[$e,It]=l.useState(null),[Qn,ve]=l.useState(!1),[A,X]=l.useState(nt),[zt,Be]=l.useState("generic"),[Kt,Ue]=l.useState(null),[O,dt]=l.useState(null),[k,mt]=l.useState(null),[Xt,qt]=l.useState(Tt),[ht,gt]=l.useState(!1),[Yt,Se]=l.useState(null),[ei,Te]=l.useState(null),Zt=l.useRef(null),Jt=l.useRef(null),Qt=l.useRef(null),en=l.useRef(null),tn=l.useRef(null),nn=l.useRef(null),ft=l.useRef(null),Me=l.useRef(new Map),We=l.useRef(new Map),Ee=l.useRef(0),sn=l.useRef(u),{showToast:w}=Ni(),an=b.isDesktop&&!F;l.useEffect(()=>{Qe("git_sidebar.props",{workspaceId:i,externalWindowMode:h})},[h,i]),l.useEffect(()=>{Gt([]),$t(!0),P(0),ue(null),st(!1),I(null),he(""),W(!1),$([]),V(null),ne("unstaged"),z(null),K(null),ot(!1),lt(null),Oe(!1),ke(null),xe(null),be(null),ye(!1),se(null),ct(!1),Ce(!1),Wt([]),ut(new Set),Ne(new Map),It(null),ve(!1),X(nt),Be("generic"),Ue(null),dt(null),mt(null),gt(!1),qt(Tt),Se(null),Te(null),We.current.clear(),Me.current.clear()},[i]),l.useEffect(()=>{function t(){In(window.innerWidth<=Cn)}return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),l.useEffect(()=>{if(!ht)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(x){un(x.clientY)}function c(){gt(!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)}},[ht]),l.useEffect(()=>{var o,c;if(!(i!=null&&i.trim())){m(null),E([]),P(0),ue(null),Fe(null),U(!1);return}const t=i.trim(),s=pn(At(t),Nn);if(Qe("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){pt(s),U(!1);return}m(null),E([]),P(0),ue(null),Fe(null),U(!0)},[i]),l.useEffect(()=>{if(i!=null&&i.trim())return M(t=>{var s,o,c;t.workspaceId===i.trim()&&(Qe("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)}),pt(t),U(!1))})},[M,i]),l.useEffect(()=>{if(!(i!=null&&i.trim()))return;const t=i.trim(),s=pn(At(t),Nn)!==null;if(y(t),s){N(t);return}q()},[N,y,i]),l.useEffect(()=>{const t=sn.current;sn.current=u,i!=null&&i.trim()&&!t&&u&&N(i.trim())},[u,N,i]),l.useEffect(()=>{i&&Si(At(i),{status:r,history:g,historyTotalCount:p,historyNextCursor:H,branches:G})},[G,g,H,p,r,i]),l.useEffect(()=>{if(!r||!te)return;r.changes.find(s=>s.path===te)||I(null)},[te,r]),l.useEffect(()=>{Yi(en.current)},[me]),l.useEffect(()=>{F||($([]),V(null),z(null),Ue(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 ti(){const t=Qt.current;if(!t)return;t.querySelectorAll(".git-tree-shell").forEach(o=>{o.scrollTop=0})}function pt(t){m(t.status),E(Array.isArray(t.history)?t.history:[]),P(typeof t.historyTotalCount=="number"?t.historyTotalCount:0),ue(typeof t.historyNextCursor=="string"?t.historyNextCursor:null),Fe(t.branches??null)}function q(t){i!=null&&i.trim()&&(U(!0),Qe("git_sidebar.refresh_requested",{workspaceId:i.trim(),resetTreeScroll:!1}),N(i.trim()))}async function xt(t){if(!(i!=null&&i.trim()))return;const s=i.trim();U(!0);try{const[o,c,x]=await Promise.all([Mi(s),xn(s,vn,null),Ei(s)]);pt({status:o,history:c.items,historyTotalCount:c.totalCount,historyNextCursor:c.nextCursor,branches:x}),N(s),t!=null&&t.resetTreeScroll&&requestAnimationFrame(()=>{ti()})}catch(o){w({title:D(o,n("git.panelLoadFailed")),tone:"error"})}finally{U(!1)}}async function Ve(){if(!(!i||!H||de)){st(!0);try{const t=await xn(i,vn,H);E(s=>{const o=new Set(s.map(x=>x.commitHash)),c=t.items.filter(x=>!o.has(x.commitHash));return[...s,...c]}),P(t.totalCount),ue(t.nextCursor)}catch(t){w({title:D(t,n("git.panelLoadFailed")),tone:"error"})}finally{st(!1)}}}function ni(t){if(!J||de||!H)return;const s=t.currentTarget;s.scrollHeight-s.scrollTop-s.clientHeight<=40&&Ve()}async function ii(){if(i){R(!0);try{const t=await Ti(i,"ai");he(t.validation.normalizedDraft.subject||t.draft.subject)}catch(t){w({title:D(t,n("git.draftFailed")),tone:"error"})}finally{R(!1)}}}async function Ie(t,s){if(i&&t.length){R(!0);try{const o=s?await Ai(i,t):await Pi(i,t);m(o),I(t[t.length-1]??null),$(c=>c.filter(x=>!t.includes(x))),V(null),q()}catch(o){U(!1),w({title:D(o,n("git.stageFailed")),tone:"error"})}finally{R(!1)}}}async function bt(t){if(i&&t.length){R(!0);try{const s=await Li(i,t);m(s),t.includes(te??"")&&I(null),$(o=>o.filter(c=>!t.includes(c))),V(null),q()}catch(s){U(!1),w({title:D(s,n("git.discardFailed")),tone:"error"})}finally{R(!1)}}}async function si(){if(!(!i||!me.trim())){R(!0);try{await Hi(i,Xi(me)),w({title:n("git.commitSuccess"),tone:"success"}),he(""),I(null),q()}catch(t){w({title:D(t,n("git.commitFailed")),tone:"error"})}finally{R(!1)}}}function ze(t){X(Qi($e)),ve(!0),ai(t)}async function ai(t){const s=i==null?void 0:i.trim();if(!s){Be("generic");return}try{const o=await bn(s);if((i==null?void 0:i.trim())!==s)return;Be(ts(o,t))}catch{if((i==null?void 0:i.trim())!==s)return;Be("generic")}}function ri(){const t=es(A),s=zt==="github"?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder");if(A.authMode==="basic"){if(!A.username.trim()){w({title:n("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!A.password){w({title:s,tone:"error"});return}}if(A.authMode==="token"&&!A.token){w({title:n("shell.cloneTokenPlaceholder"),tone:"error"});return}It(t),ve(!1),w({title:t?n("git.remoteAuthSaved"):n("git.remoteAuthCleared"),description:t&&A.rememberOnHost?n("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function rn(){if(i){Vt(!0);try{const t=await bn(i);if(t.length===0){w({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){on([t[0].name]);return}Wt(t),ut(new Set),Ne(new Map),Ce(!0)}catch(t){w({title:D(t,n("git.remoteFailed")),tone:"error"})}finally{Vt(!1)}}}async function on(t){if(!i||t.length===0)return;R(!0),Ne(new Map);const s=new Map;let o=!1;try{for(const c of t)try{const x=await yn(i,"push",c,$e,A.rememberOnHost);s.set(c,{ok:!0,summary:x.summary})}catch(x){if(o=!0,s.set(c,{ok:!1,summary:D(x,n("git.remoteFailed"))}),Ne(new Map(s)),Ln(x)){ze(c);return}}Ne(s),q(),o||(w({title:n("git.pushAllSuccess",{count:String(t.length)}),tone:"success"}),Ce(!1))}finally{R(!1)}}async function yt(t){if(i){if(t==="push"){W(!1),rn();return}R(!0);try{const s=await yn(i,t,void 0,$e,A.rememberOnHost);w({title:s.summary,tone:"success"}),W(!1),q()}catch(s){if(Ln(s)){ze();return}w({title:D(s,n("git.remoteFailed")),tone:"error"})}finally{R(!1)}}}async function ae(){if(i){R(!0);try{const t=await Ri(i);he(t.commitSubject??""),w({title:t.summary||n("git.undoLastCommitSuccess"),tone:"success"}),W(!1),q()}catch(t){w({title:D(t,n("git.undoLastCommitFailed")),tone:"error"})}finally{R(!1)}}}async function oi(t){if(i){R(!0);try{const s=await Fi(i,t,!1);Fe(s),W(!1),q()}catch(s){w({title:D(s,n("git.branchFailed")),tone:"error"})}finally{R(!1)}}}async function jt(t){const s=i==null?void 0:i.trim();if(!s)throw new Error(n("git.panelLoadFailed"));const o=We.current.get(t);if(o)return o;const c=await Oi(s,t);return We.current.set(t,c),c}async function He(t){K(null),z(null),lt(t),ke(null);const s=We.current.get(t)??null;if(xe(s),Oe(!s),s)return;const o=Ee.current+1;Ee.current=o;try{const c=await jt(t);if(Ee.current!==o)return;xe(c)}catch(c){if(Ee.current!==o)return;ke(D(c,n("git.commitDetailLoadFailed"))),xe(null)}finally{Ee.current===o&&Oe(!1)}}function li(){lt(null),Oe(!1),ke(null),xe(null)}async function we(t){try{const s=await jt(t);await B(s.versionLabel,n("git.copyCommitVersionSuccess"))}catch(s){w({title:D(s,n("git.commitDetailLoadFailed")),tone:"error"})}}function Ae(t){K(null),z(null),be(t),se(null),ye(!0)}function ci(t){var o;const s=((o=g[0])==null?void 0:o.commitHash)===t.commitHash&&t.commitKind==="local";return[{id:`view-changes:${t.commitHash}`,label:n("git.viewCommitChanges"),onSelect:()=>void He(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(ce(t),n("git.copyCommitMessageSuccess"))},{id:`copy-version:${t.commitHash}`,label:n("git.copyCommitVersion"),onSelect:()=>void we(t.commitHash)},{id:`explain:${t.commitHash}`,label:n("git.explainCommitAction"),onSelect:()=>Ae(t.commitHash)},...s?[{id:`undo:${t.commitHash}`,label:n("git.undoLastCommit"),disabled:v,onSelect:()=>void ae()}]:[]]}async function ln(t){K(null),z(null),await Di(ci(t))}async function ui(){var t,s;if(!(!i||!Ut||!je||ee)){ct(!0);try{const o=await jt(Ut),c=await $i({workspaceId:i,provider:je,content:qi(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:ki()}),x=c.session??await Bi(c.sessionId);f(x),S(),T(x.workspaceId),C(_i(x.workspaceId,x.sessionId)),ye(!1),be(null),se(null),w({title:n("git.explainCommitStarted"),tone:"success"})}catch(o){w({title:D(o,n("git.explainCommitFailed")),tone:"error"})}finally{ct(!1)}}}function Ke(t){Gt(s=>s.includes(t)?s.filter(o=>o!==t):[...s,t])}const di=450;function cn(t){const s=Date.now(),o=Zt.current;return Zt.current={filePath:t,timestamp:s},(o==null?void 0:o.filePath)===t&&s-o.timestamp<=di}async function Xe(t,s){if(s.binary){w({title:n("git.binaryDiff"),tone:"info"});return}if(s.status==="A"||s.status==="?")Te(null),Se(t);else if(i)try{const o=await wi(i,t,s.staged);Te(o.content),Se(t)}catch{Te(null),Se(t)}}function qe(t){I(t),V(null),$(s=>s.includes(t)?s.filter(o=>o!==t):[...s,t])}function un(t){const s=Jt.current;if(!s||!Number.isFinite(t))return;const o=s.getBoundingClientRect(),c=o.height-et;if(!Number.isFinite(o.top)||!Number.isFinite(o.height)||c<=0)return;const x=(t-o.top-et/2)/c*100;if(!Number.isFinite(x))return;const Le=Math.max(jn,Math.min(Mt,Math.round(x)));qt(Le)}function mi(t){t.preventDefault(),un(t.clientY),gt(!0)}const Pe=(r==null?void 0:r.changes)??[],Y=Pe.filter(t=>_t(t,"staged")),re=Pe.filter(t=>_t(t,"unstaged")),dn=Pn(Y,"staged"),mn=Pn(re,"unstaged"),Ye=new Set(Vn),Ze=new Set(rt),oe=Rn(rt,Pe,"staged"),le=Rn(rt,Pe,"unstaged"),Ct=Pe.length===0&&((r==null?void 0:r.snapshot.ahead)??0)>0,hi=Y.length>0&&me.trim().length>0,Je=(G==null?void 0:G.currentBranch)??(r==null?void 0:r.snapshot.branch)??n("common.unknown"),Nt=$e!==null,Re=zt==="github",gi=Re?n("git.remoteAuthDescriptionGithub"):n("git.remoteAuthDescription"),fi=Re?n("git.remoteAuthGithubPatLabel"):n("shell.clonePasswordLabel"),pi=Re?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder"),xi=Re?n("git.remoteAuthGithubUsernamePlaceholder"):n("shell.cloneUsernamePlaceholder"),vt=Number.isFinite(Xt)?Xt:Tt,bi=J?`minmax(120px, ${vt}fr) ${et}px minmax(140px, ${100-vt}fr)`:`minmax(120px, 1fr) ${et}px auto`;l.useEffect(()=>{ge==="staged"&&oe.length===0&&V(null),ge==="unstaged"&&le.length===0&&V(null)},[ge,oe.length,le.length]),l.useEffect(()=>{if(!F)return;const t=re.length>0?"unstaged":Y.length>0?"staged":"history";ne(s=>s==="unstaged"&&re.length>0||s==="staged"&&Y.length>0?s:t)},[F,Y.length,re.length]),l.useEffect(()=>{pe&&(g.some(t=>t.commitHash===pe)||z(null))},[g,pe]),l.useEffect(()=>{ie&&(g.some(t=>t.commitHash===ie)||K(null))},[ie,g]),l.useEffect(()=>{F&&fe!=="history"&&Q&&W(!1)},[F,Q,fe]),l.useLayoutEffect(()=>{if(F||!Q){dt(null);return}function t(){const o=tn.current,c=nn.current;!o||!c||typeof window>"u"||dt(Dn(o.getBoundingClientRect(),{width:c.getBoundingClientRect().width||Dt,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,Je,F,Q,Nt]);const Z=pe??ie;l.useLayoutEffect(()=>{if(!Z){mt(null);return}const t=Z;function s(){const c=Me.current.get(t)??null,x=ft.current;!c||!x||typeof window>"u"||mt(Dn(c.getBoundingClientRect(),{width:x.getBoundingClientRect().width||Dt,height:x.getBoundingClientRect().height||x.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)}},[Z,g.length]),l.useEffect(()=>{if(!Z||typeof document>"u")return;const t=Z;function s(o){const c=o.target;if(!(c instanceof Node))return;const x=Me.current.get(t)??null,Le=ft.current;x!=null&&x.contains(c)||Le!=null&&Le.contains(c)||(z(null),K(null))}return document.addEventListener("pointerdown",s),()=>{document.removeEventListener("pointerdown",s)}},[Z]);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),w({title:s,tone:"success"})}catch{w({title:n("common.copyContentFailed"),tone:"error"})}}async function hn(t,s){typeof window<"u"&&!window.confirm(n("git.discardConfirm",{path:s}))||await bt(t)}function gn(t){const s=(t==null?void 0:t.desktopFloating)===!0&&!F,o=s?{top:(O==null?void 0:O.top)??_,left:(O==null?void 0:O.left)??_,maxHeight:O==null?void 0:O.maxHeight,transformOrigin:(O==null?void 0:O.transformOrigin)??"top right"}:void 0,c=e.jsxs("div",{ref:s?nn: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:Je})]}),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:Nt?n("git.remoteAuthConfigured"):n("git.remoteAuthNotConfigured")}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>ze(),children:e.jsx("span",{children:n("git.remoteAuthAction")})})]})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.branchTitle")}),e.jsx("div",{className:"git-menu-branch-list",children:G==null?void 0:G.local.map(x=>e.jsx("button",{className:"git-menu-item",type:"button",disabled:v||x.current,onClick:()=>void oi(x.name),children:e.jsx("span",{children:x.current?`${n("git.switchBranch")} ${x.name}`:`${n("git.switchBranchTo")} ${x.name}`})},x.name))})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>{W(!1),ot(!0)},children:e.jsx("span",{children:n("git.viewAllVersions")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void yt("fetch"),children:e.jsx("span",{children:n("git.fetch")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void yt("pull"),children:e.jsx("span",{children:n("git.pull")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void yt("push"),children:e.jsx("span",{children:n("git.push")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v,onClick:()=>void ae(),children:e.jsx("span",{children:n("git.undoLastCommit")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:v||at,onClick:()=>void xt({resetTreeScroll:!0}),children:e.jsx("span",{children:n("git.refresh")})})]})]});return s?typeof document>"u"?null:fn.createPortal(c,document.body):c}function St(t,s){if(s){Me.current.set(t,s);return}Me.current.delete(t)}function yi(){var o;if(!Z||typeof document>"u")return null;const t=g.find(c=>c.commitHash===Z);if(!t)return null;const s=((o=g[0])==null?void 0:o.commitHash)===t.commitHash&&t.commitKind==="local";return fn.createPortal(e.jsx("div",{ref:ft,className:"git-history-entry-menu","data-floating":"true",style:{top:(k==null?void 0:k.top)??_,left:(k==null?void 0:k.left)??_,maxHeight:k==null?void 0:k.maxHeight,transformOrigin:(k==null?void 0:k.transformOrigin)??"top right"},children:e.jsx(zi,{item:t,canUndo:s,actioning:v,onViewCommitChanges:c=>void He(c),onCopyCommitHash:c=>void B(c,n("git.copyCommitHashSuccess")),onCopyCommitMessage:c=>void B(ce(c),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:c=>void we(c),onExplainCommitChange:c=>void Ae(c),onUndoLastCommit:()=>void ae()})}),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:en,rows:1,value:me,onChange:t=>he($n(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 ii(),disabled:v||at,children:e.jsx(is,{})})]}),e.jsxs("div",{className:"git-primary-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void xt({resetTreeScroll:!0}),disabled:v||at||!i,children:n("git.refreshNow")}),e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Ct){rn();return}si()},disabled:v||!Ct&&!hi,children:Ct?n("git.pushNow"):n("git.commitNow")})]})]}),F?e.jsxs("div",{className:"git-mobile-sections",children:[e.jsx(wt,{title:n("git.stagedChangesTitle"),count:Y.length,expanded:fe==="staged",onToggle:()=>ne("staged"),children:e.jsx(En,{title:n("git.stagedChangesTitle"),nodes:dn,collapsedTreePathSet:Ye,onToggleTreePath:Ke,onToggleMobileSelection:qe,selectedMobilePathSet:Ze,selectedTargets:oe,actioning:v,variant:"staged",swipeRowState:Kt,onSwipeRowChange:Ue,onStageToggle:Ie,onDiscardWithConfirm:hn,onClearSelectedTargets:()=>$(t=>t.filter(s=>!oe.includes(s))),onPreviewFile:Xe})}),e.jsx(wt,{title:n("git.changesTitle"),count:re.length,expanded:fe==="unstaged",onToggle:()=>ne("unstaged"),children:e.jsx(En,{title:n("git.changesTitle"),nodes:mn,collapsedTreePathSet:Ye,onToggleTreePath:Ke,onToggleMobileSelection:qe,selectedMobilePathSet:Ze,selectedTargets:le,actioning:v,variant:"unstaged",swipeRowState:Kt,onSwipeRowChange:Ue,onStageToggle:Ie,onDiscardWithConfirm:hn,onClearSelectedTargets:()=>$(t=>t.filter(s=>!le.includes(s))),onPreviewFile:Xe})}),e.jsxs(wt,{title:n("git.recentVersionsTitle"),count:p,expanded:fe==="history",onToggle:()=>ne("history"),trailingContent:e.jsx("span",{className:"badge",children:Je}),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":Q,onClick:()=>{ne("history"),W(t=>!t)},disabled:v,children:e.jsx(_e,{})}),children:[Q?e.jsx("div",{className:"git-mobile-operations-shell",children:gn()}):null,e.jsx(Ii,{history:g,historyLoadingMore:de,hasMore:!!H,actioning:v,openCommitHash:pe,onMenuTriggerRef:St,onToggleMenu:t=>z(s=>s===t?null:t),onViewCommitChanges:t=>void He(t),onCopyCommitHash:t=>void B(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void B(ce(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void we(t),onExplainCommitChange:t=>void Ae(t),onUndoLastCommit:()=>void ae(),onLoadMore:()=>void Ve()})]})]}):e.jsxs("div",{ref:Jt,className:"git-content-split",style:{gridTemplateRows:bi},children:[e.jsx("section",{className:"git-card git-tree-panel",children:e.jsxs("div",{ref:Qt,className:"git-tree-panel-body",children:[Y.length>0?e.jsx(Mn,{title:n("git.stagedChangesTitle"),count:Y.length,nodes:dn,selectedPath:te,collapsedTreePathSet:Ye,onToggleTreePath:Ke,onSelectFile:I,onPreviewFile:(t,s)=>{cn(t)&&Xe(t,s)},onToggleMobileSelection:qe,onStageToggle:Ie,onDiscard:bt,actioning:v,variant:"staged",isMobileViewport:F,selectedMobilePathSet:Ze,selectedTargets:oe,mobileActionMenuOpen:ge==="staged",onToggleMobileActionMenu:()=>V(t=>t==="staged"?null:"staged"),onClearSelectedTargets:()=>$(t=>t.filter(s=>!oe.includes(s)))}):null,e.jsx(Mn,{title:n("git.changesTitle"),count:re.length,nodes:mn,selectedPath:te,collapsedTreePathSet:Ye,onToggleTreePath:Ke,onSelectFile:I,onPreviewFile:(t,s)=>{cn(t)&&Xe(t,s)},onToggleMobileSelection:qe,onStageToggle:Ie,onDiscard:bt,actioning:v,variant:"unstaged",isMobileViewport:F,selectedMobilePathSet:Ze,selectedTargets:le,mobileActionMenuOpen:ge==="unstaged",onToggleMobileActionMenu:()=>V(t=>t==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>$(t=>t.filter(s=>!le.includes(s)))})]})}),e.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":n("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":jn,"aria-valuemax":Mt,"aria-valuenow":J?vt:Mt,"data-dragging":ht,onPointerDown:mi,children:e.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),e.jsxs("section",{className:"git-card git-history-section",children:[e.jsxs("div",{className:"git-history-topbar",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":J,"aria-label":J?n("git.collapseRecentVersions"):n("git.expandRecentVersions"),onClick:()=>$t(t=>!t),children:[e.jsxs("span",{className:"git-section-toggle-main",children:[e.jsx(it,{expanded:J}),e.jsx("span",{children:n("git.recentVersionsTitle")})]}),e.jsx("span",{className:"workbench-section-counter",children:p})]}),e.jsxs("div",{className:"git-history-actions",children:[e.jsx("span",{className:"badge",children:Je}),e.jsx("button",{className:"git-icon-button",type:"button",ref:tn,"aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:()=>W(t=>!t),disabled:v,children:e.jsx(_e,{})}),Q?gn({desktopFloating:!0}):null]})]}),J?e.jsx(wn,{history:g,historyLoadingMore:de,hasMore:!!H,actioning:v,openCommitHash:ie,useNativeContextMenu:an,onMenuTriggerRef:St,onScroll:ni,onToggleMenu:t=>{if(an){const s=g.find(o=>o.commitHash===t);s&&ln(s);return}K(s=>s===t?null:t)},onOpenContextMenu:t=>void ln(t),onViewCommitChanges:t=>void He(t),onCopyCommitHash:t=>void B(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void B(ce(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void we(t),onExplainCommitChange:t=>void Ae(t),onUndoLastCommit:()=>void ae(),onLoadMore:()=>void Ve()}):null]})]}),e.jsxs(De,{open:Yn,title:n("git.selectRemoteTitle"),description:n("git.selectRemoteDesc"),onClose:()=>{v||Ce(!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:Nt?n("git.remoteAuthConfigured"):n("git.remoteAuthNotConfigured")})]}),e.jsx("button",{className:"secondary-button",type:"button",disabled:v,onClick:()=>ze(),children:n("git.remoteAuthAction")})]}),e.jsx("div",{className:"git-remote-select-list",children:Zn.map(t=>{const s=Ge.has(t.name),o=Jn.get(t.name);return e.jsxs("label",{className:"git-remote-item",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:v,onChange:()=>{ut(c=>{const x=new Set(c);return x.has(t.name)?x.delete(t.name):x.add(t.name),x})}}),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:()=>Ce(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:v||Ge.size===0,onClick:()=>void on(Array.from(Ge)),children:v?n("git.pushing"):n("git.pushSelected",{count:String(Ge.size)})})]})]}),e.jsxs(De,{open:Qn,title:n("git.remoteAuthTitle"),description:gi,onClose:()=>{v||ve(!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=>X(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:xi,autoComplete:"username",onChange:t=>X(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:fi}),e.jsx("input",{type:"password",value:A.password,placeholder:pi,autoComplete:"current-password",onChange:t=>X(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=>X(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=>X(s=>({...s,token:t.target.value}))})]})]}):null,Re?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=>X(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:()=>ve(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:v,onClick:ri,children:n("git.remoteAuthSave")})]})]}),e.jsx(De,{open:zn,title:n("git.viewAllVersions"),description:n("git.viewAllVersionsDescription",{count:String(p)}),onClose:()=>ot(!1),children:e.jsx(wn,{history:g,historyLoadingMore:de,hasMore:!!H,actioning:v,openCommitHash:ie,className:"git-history-modal-list",onMenuTriggerRef:St,onToggleMenu:t=>K(s=>s===t?null:t),onViewCommitChanges:t=>void He(t),onCopyCommitHash:t=>void B(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void B(ce(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void we(t),onExplainCommitChange:t=>void Ae(t),onUndoLastCommit:()=>void ae(),onLoadMore:()=>void Ve()})}),e.jsx(De,{open:Kn!==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:li,children:Xn?e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailLoading")})}):Bt?e.jsx("div",{className:"git-commit-detail-state is-error",children:e.jsx("p",{children:Bt})}):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:Zi(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:ce(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(De,{open:qn,className:"git-explain-provider-modal",title:n("git.explainCommitTitle"),description:n("git.explainCommitDescription"),onClose:()=>{ee||(ye(!1),be(null),se(null))},children:e.jsxs("div",{className:"git-explain-provider-shell",children:[e.jsx(Gi,{workspaceId:i,selectedProvider:je,pendingProvider:ee?je:null,disabled:ee,onSelect:t=>se(t)}),e.jsxs("div",{className:"git-explain-provider-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:ee,onClick:()=>{ye(!1),be(null),se(null)},children:n("common.cancel")}),e.jsx("button",{type:"button",className:"primary-button",disabled:!je||ee,onClick:()=>void ui(),children:ee?n("conversation.sendingState"):n("git.startExplainCommit")})]})]})}),e.jsx(Wi,{workspaceId:i,filePath:Yt,open:Yt!==null,onClose:()=>{Se(null),Te(null)},onSaved:async()=>{await xt({resetTreeScroll:!0})},diffContent:ei}),yi()]})}function Mn({title:a,count:i,nodes:u,selectedPath:h,collapsedTreePathSet:d,onToggleTreePath:C,onSelectFile:b,onPreviewFile:j,onToggleMobileSelection:y,onStageToggle:N,onDiscard:M,actioning:S,variant:T,isMobileViewport:f,selectedMobilePathSet:r,selectedTargets:m,mobileActionMenuOpen:g,onToggleMobileActionMenu:E,onClearSelectedTargets:p}){const P=kt(u),H=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&&P.length>0?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":H,title:H,onClick:()=>void N(P,T==="staged"),disabled:S,children:e.jsx(Ft,{staged:T==="staged"})}),T==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":n("git.discardAll"),title:n("git.discardAll"),onClick:()=>void M(P),disabled:S,children:e.jsx(Ot,{})}):null]}):null,f&&m.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(_e,{})}):null]}),f&&g?e.jsxs("div",{className:"git-selection-menu",children:[e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.selectedFiles")}),e.jsx("strong",{className:"git-menu-branch",children:m.length})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void N(m,T==="staged"),children:e.jsx("span",{children:T==="staged"?n("git.unstage"):n("git.stage")})}),T==="unstaged"?e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void M(m),children:e.jsx("span",{children:n("git.discard")})}):null,e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:p,children:e.jsx("span",{children:n("git.clearSelection")})})]})]}):null]}),e.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":a,children:u.length?On({nodes:u,depth:0,collapsedTreePathSet:d,selectedPath:h,onToggleTreePath:C,onSelectFile:b,onPreviewFile:j,onToggleMobileSelection:y,onStageToggle:N,onDiscard:M,actioning:S,variant:T,isMobileViewport:f,selectedMobilePathSet:r}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function wt({title:a,count:i,expanded:u,onToggle:h,trailingContent:d,headerAction:C,children:b}){return e.jsxs("section",{className:"git-mobile-section","data-expanded":u,children:[e.jsxs("div",{className:"git-mobile-section-header",children:[e.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":u,onClick:h,children:[e.jsxs("span",{className:"git-mobile-section-toggle-main",children:[e.jsx(it,{expanded:u}),e.jsx("h3",{children:a})]}),e.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[d,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:b}):null]})}function En({title:a,nodes:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:d,selectedMobilePathSet:C,selectedTargets:b,actioning:j,variant:y,swipeRowState:N,onSwipeRowChange:M,onStageToggle:S,onDiscardWithConfirm:T,onClearSelectedTargets:f,onPreviewFile:r}){return e.jsxs("div",{className:"git-mobile-record-shell",children:[b.length>0?e.jsxs("div",{className:"git-mobile-selection-toolbar",children:[e.jsxs("span",{className:"git-mobile-selection-count",children:[n("git.selectedFiles")," ",b.length]}),e.jsxs("div",{className:"git-mobile-selection-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:j,onClick:()=>void S(b,y==="staged"),children:y==="staged"?n("git.unstage"):n("git.stage")}),y==="unstaged"?e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:j,onClick:()=>void T(b,`${b.length}`),children:n("git.discard")}):null,e.jsx("button",{type:"button",className:"secondary-button",disabled:j,onClick:f,children:n("git.clearSelection")})]})]}):null,e.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":a,children:i.length?Fn({nodes:i,depth:0,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:d,selectedMobilePathSet:C,actioning:j,variant:y,swipeRowState:N,onSwipeRowChange:M,onStageToggle:S,onDiscardWithConfirm:T,onPreviewFile:r}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Fn({nodes:a,depth:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:d,selectedMobilePathSet:C,actioning:b,variant:j,swipeRowState:y,onSwipeRowChange:N,onStageToggle:M,onDiscardWithConfirm:S,onPreviewFile:T}){return a.map(f=>{if(f.kind==="directory"){const g=!u.has(f.path),E=kt(f.children),p=`directory:${f.path}`;return e.jsxs("div",{className:"git-mobile-record-branch",children:[e.jsx(Hn,{rowKey:p,openState:(y==null?void 0:y.path)===p?y.direction:null,onOpenStateChange:P=>N(P?{path:p,direction:P}:null),trailingActions:E.length>0?[{label:j==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void M(E,j==="staged")},...j==="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:`${Sn+i*Tn}px`},onClick:()=>h(f.path),children:[e.jsxs("span",{className:"git-mobile-record-leading",children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":g,children:e.jsx(it,{expanded:g})}),e.jsx("span",{className:"git-mobile-record-title",children:f.name})]}),e.jsx("span",{className:"git-mobile-record-meta",children:E.length})]})}),g?e.jsx("div",{className:"git-mobile-record-children",role:"group",children:Fn({nodes:f.children,depth:i+1,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:d,selectedMobilePathSet:C,actioning:b,variant:j,swipeRowState:y,onSwipeRowChange:N,onStageToggle:M,onDiscardWithConfirm:S,onPreviewFile:T})}):null]},p)}const r=`file:${f.path}`,m=C.has(f.path);return e.jsx(Hn,{rowKey:r,openState:(y==null?void 0:y.path)===r?y.direction:null,onOpenStateChange:g=>N(g?{path:r,direction:g}:null),trailingActions:[{label:n("git.preview"),tone:"neutral",onPress:()=>T(f.change.path,f.change)},{label:j==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void M([f.change.path],j==="staged")},...j==="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":m,style:{paddingInlineStart:`${Sn+i*Tn}px`},children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${f.name}`,onChange:()=>d(f.change.path)}),e.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>d(f.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":Lt(f.name),"aria-hidden":"true",children:Rt(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 Hn({rowKey:a,openState:i,onOpenStateChange:u,trailingActions:h,children:d}){const C=Ui(),b=l.useRef(null),[j,y]=l.useState(0),N=((h==null?void 0:h.length)??0)*Et;l.useEffect(()=>{i||y(0)},[i,a]);const M=j!==0?j:i==="trailing"?-N:0;function S(m){var g,E;m.button===0&&(b.current={pointerId:m.pointerId,startX:m.clientX},(E=(g=m.currentTarget).setPointerCapture)==null||E.call(g,m.pointerId))}function T(m){const g=b.current;if(!g||g.pointerId!==m.pointerId)return;const E=N>0?N+10:0,p=Math.max(-E,Math.min(0,m.clientX-g.startX));y(p)}function f(m){var E,p;const g=b.current;if(!(!g||g.pointerId!==m.pointerId)){if((p=(E=m.currentTarget).releasePointerCapture)==null||p.call(E,m.pointerId),b.current=null,j<=-44&&(h!=null&&h.length)){C.trigger("gesture"),u("trailing"),y(0);return}u(null),y(0)}}function r(m){var E,p;const g=b.current;!g||g.pointerId!==m.pointerId||((p=(E=m.currentTarget).releasePointerCapture)==null||p.call(E,m.pointerId),b.current=null,y(0))}return e.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":i??"closed","data-dragging":j!==0,children:[h==null?void 0:h.map((m,g)=>e.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":m.tone,style:{right:g*Et,width:Et},onClick:()=>{C.trigger(m.tone==="danger"?"warning":"action"),u(null),m.onPress()},children:m.label},`trailing-${g}`)),e.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${M}px)`},onPointerDown:S,onPointerMove:T,onPointerUp:f,onPointerCancel:r,children:d})]})}function Ii({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:d,onMenuTriggerRef:C,onToggleMenu:b,onViewCommitChanges:j,onCopyCommitHash:y,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:Bn(r.commitKind)})]}),r.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:r.refs.map(m=>e.jsx("span",{className:"git-history-ref-pill","data-kind":m.kind,"data-remote-index":String(Un(m.remoteName)),children:m.name},`${r.commitHash}:${m.kind}:${m.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:Wn(r.authoredAt)})]})]}),e.jsx("button",{type:"button",className:"git-icon-button",ref:m=>C(r.commitHash,m),"aria-label":n("git.historyItemMenu"),onClick:()=>b(r.commitHash),children:e.jsx(_e,{})})]})},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 wn({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:d,className:C,useNativeContextMenu:b=!1,onMenuTriggerRef:j,onScroll:y,onToggleMenu:N,onOpenContextMenu:M,onViewCommitChanges:S,onCopyCommitHash:T,onCopyCommitMessage:f,onCopyCommitVersion:r,onExplainCommitChange:m,onUndoLastCommit:g,onLoadMore:E}){return a.length?e.jsxs("div",{className:["git-history-list",C].filter(Boolean).join(" "),onScroll:y,children:[a.map(p=>{const P=d===p.commitHash;return e.jsxs("article",{className:"git-history-entry","data-kind":p.commitKind,"data-menu-open":P?"true":"false",onContextMenu:H=>{!b||!M||(H.preventDefault(),H.stopPropagation(),M(p))},children:[e.jsx("span",{className:"git-history-marker","data-kind":p.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:p.subject,children:p.subject}),e.jsxs("div",{className:"git-history-title-actions",children:[e.jsx("span",{className:"git-history-kind-badge","data-kind":p.commitKind,children:Bn(p.commitKind)}),b?null:e.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:H=>j(p.commitHash,H),"aria-label":n("git.historyItemMenu"),onClick:()=>{N(p.commitHash)},children:e.jsx(_e,{})})]})]}),p.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:p.refs.map(H=>e.jsx("span",{className:"git-history-ref-pill","data-kind":H.kind,"data-remote-index":String(Un(H.remoteName)),children:H.name},`${p.commitHash}:${H.kind}:${H.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:p.commitHash.slice(0,8)}),e.jsx("span",{children:p.authorName}),e.jsx("time",{dateTime:p.authoredAt,children:Wn(p.authoredAt)})]})]})]},p.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 zi({item:a,canUndo:i,actioning:u,onViewCommitChanges:h,onCopyCommitHash:d,onCopyCommitMessage:C,onCopyCommitVersion:b,onExplainCommitChange:j,onUndoLastCommit:y}){return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>h(a.commitHash),children:e.jsx("span",{children:n("git.viewCommitChanges")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>d(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:()=>b(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitVersion")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>j(a.commitHash),children:e.jsx("span",{children:n("git.explainCommitAction")})}),i?e.jsx("button",{type:"button",className:"git-menu-item",disabled:u,onClick:y,children:e.jsx("span",{children:n("git.undoLastCommit")})}):null]})}function On({nodes:a,depth:i,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:d,onSelectFile:C,onPreviewFile:b,onToggleMobileSelection:j,onStageToggle:y,onDiscard:N,actioning:M,variant:S,isMobileViewport:T,selectedMobilePathSet:f}){return a.map(r=>{if(r.kind==="directory"){const E=!u.has(r.path),p=kt(r.children),P=`${S==="staged"?n("git.unstage"):n("git.stage")} ${r.path}`,H=`${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:()=>d(r.path),children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":E,children:e.jsx(it,{expanded:E})}),e.jsx("span",{className:"git-tree-label git-tree-label-directory",children:r.name})]}),!T&&p.length>0?e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":P,title:P,onClick:()=>void y(p,S==="staged"),disabled:M,children:e.jsx(Ft,{staged:S==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":H,title:H,onClick:()=>void N(p),disabled:M,children:e.jsx(Ot,{})}):null]}):null]}),E?e.jsx("div",{className:"git-tree-children",role:"group",children:On({nodes:r.children,depth:i+1,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:d,onSelectFile:C,onPreviewFile:b,onToggleMobileSelection:j,onStageToggle:y,onDiscard:N,actioning:M,variant:S,isMobileViewport:T,selectedMobilePathSet:f})}):null]},`directory:${r.path}`)}const m=f.has(r.path),g=T?m:h===r.path;return T?e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":g,"data-mobile":"true",children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${r.name}`,onChange:()=>j(r.change.path)}),e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":g,"data-mobile":"true",style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>j(r.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":Lt(r.name),"aria-hidden":"true",children:Rt(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":g,children:[e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":g,style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>{C(r.change.path),b&&b(r.change.path,r.change)},children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":Lt(r.name),"aria-hidden":"true",children:Rt(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 y([r.change.path],r.variant==="staged"),disabled:M,children:e.jsx(Ft,{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(Ot,{})}):null]})]},`file:${r.path}`)})}function An(a,i){return{kind:"directory",name:a,path:i,children:new Map}}function Pn(a,i){const u=An("","");for(const h of a){const d=h.path.replace(/\\/g,"/"),C=d.split("/").filter(Boolean);let b=u;C.forEach((j,y)=>{const N=C.slice(0,y+1).join("/");if(y===C.length-1){b.children.set(`file:${N}`,{kind:"file",name:j,path:d,change:h,status:Ki(h,i),variant:i});return}const M=`directory:${N}`,S=b.children.get(M);if(S&&S.kind==="directory"){b=S;return}const T=An(j,N);b.children.set(M,T),b=T})}return Gn(kn([...u.children.values()]))}function kn(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:kn([...i.children.values()])}:i)}function Gn(a){return a.map(i=>{var b;if(i.kind!=="directory")return i;const u=Gn(i.children);let h=i.name,d=i.path,C=u;for(;C.length===1&&((b=C[0])==null?void 0:b.kind)==="directory";){const j=C[0];h=`${h}/${j.name}`,d=j.path,C=j.children}return{kind:"directory",name:h,path:d,children:C}})}function Rn(a,i,u){const h=new Set(a);return i.filter(d=>_t(d,u)&&h.has(d.path)).map(d=>d.path)}function kt(a){const i=[],u=new Set;function h(d){if(d.kind==="file"){u.has(d.path)||(u.add(d.path),i.push(d.path));return}d.children.forEach(h)}return a.forEach(h),i}function _t(a,i){return i==="staged"?!!a.stagedStatus:!!a.worktreeStatus}function Ki(a,i){return i==="staged"?a.stagedStatus??a.status:a.worktreeStatus??a.status}function Xi(a){return{subject:$n(a).trim(),body:null,footer:null,source:"manual"}}function $n(a){return a.replace(/[\r\n]+/g," ")}function ce(a){const i=a.subject.trim(),u=a.body.trim();return u?`${i}
2
+
3
+ ${u}`:i}function qi(a){const i=a.changedFiles.map(d=>`- [${d.status}] ${d.path}${d.oldPath?` (from ${d.oldPath})`:""}`).join(`
4
+ `),u=a.diffContent.length>Ht?a.diffContent.slice(0,Ht):a.diffContent,h=a.diffContent.length>Ht||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||"- 无",h,"","Diff:",u||"(empty diff)"].join(`
6
+ `)}function Yi(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 Bn(a){switch(a){case"local":return n("git.historyKindLocal");case"remote":return n("git.historyKindRemote");default:return n("git.historyKindShared")}}function Un(a){if(!a)return 0;let i=0;for(const u of a)i=i*33+u.charCodeAt(0)>>>0;return i%6}function Zi(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 _n?Ji(a)??a.message:typeof a=="object"&&a&&"message"in a?a.message:i}function At(a){return`git-sidebar.snapshot.${a}`}function Ji(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 Ln(a){return a instanceof _n&&a.errorCode==="GIT_REMOTE_AUTH_FAILED"}function Qi(a){return!a||!a.mode||a.mode==="none"?nt: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}:nt}function es(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 ts(a,i){const u=a.find(d=>d.name===i)??a.find(d=>d.name==="origin")??a[0];if(!u)return"generic";const h=u.pushUrl||u.fetchUrl;return ns(h)?"github":"generic"}function ns(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 Dn(a,i,u){const h=Math.max(0,u.width),d=Math.max(0,u.height),C=Math.max(0,d-_*2),b=Math.max(0,h-_*2),j=Math.min(Math.max(i.width||Dt,0),b),y=Math.max(0,d-a.bottom-tt-_),N=Math.max(0,a.top-tt-_),M=y<i.height&&N>y,T=Pt(Math.max(M?N:y,Vi),0,C),f=Math.min(Math.max(i.height,0),T),r=M?a.top-tt-f:a.bottom+tt,m=Math.max(_,d-_-f),g=Math.max(_,h-_-j);return{top:Pt(r,_,m),left:Pt(a.right-j,_,g),maxHeight:Math.max(0,T),transformOrigin:`${M?"bottom":"top"} right`}}function Pt(a,i,u){return!Number.isFinite(a)||u<i?i:Math.min(Math.max(a,i),u)}function it({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 Ft({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 Ot(){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 is(){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 _e(){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 Wn(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{gs as GitSidebar,Dn as resolveGitOperationsMenuPosition};
@@ -0,0 +1 @@
1
+ import{b as c,j as e,t as a}from"./index-Byp9hJ0c.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-DLg-gX1t.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,s,n)=>s in e?V(e,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[s]=n;var R=(e,s,n)=>Z(e,typeof s!="symbol"?s+"":s,n);import{z as i,A as Y,b as w,t as g,j as t}from"./index-Byp9hJ0c.js";import{d as X,f as H}from"./App-DkvE5EyM.js";function $(){return i.request("/api/workspaces")}async function De(){try{return await i.request("/api/workbench")}catch(e){if(!(e instanceof Y)||e.status!==404)throw e;const s=await $();return{items:await Promise.all(s.items.map(async o=>({workspace:o,sessions:(await _(o.id)).items})))}}}function Pe(e){return i.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function Oe(e){return i.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function Ne(e){return i.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function Ie(e){return i.request("/api/debug-targets/analyze",{method:"POST",body:JSON.stringify(e)})}function Ee(e,s){return i.request(`/api/debug-targets/${encodeURIComponent(e)}/launch-plan`,{method:"POST",body:JSON.stringify({})})}function qe(){return i.request("/api/framework-compatibility-matrix")}function xe(e){return i.request("/api/workspaces/reorder",{method:"PUT",body:JSON.stringify(e)})}function be(e,s){return i.request(`/api/workspaces/${encodeURIComponent(e)}/navigation-state`,{method:"PUT",body:JSON.stringify(s)})}function Le(e){const s=new URLSearchParams;return e!=null&&e.trim()&&s.set("path",e.trim()),i.request(`/api/workspaces/browse${s.size>0?`?${s.toString()}`:""}`)}function Ue(e){return i.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function _(e){return i.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function Be(e){return i.request(`/api/sessions/${encodeURIComponent(e)}`)}function Te(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function Me(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function je(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:s})})}function Fe(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:s})})}function ke(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:s})})}function Je(e){return i.request(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}function Ke(e){return i.request("/api/worktrees",{method:"POST",body:JSON.stringify(e)})}function Qe(e){return i.request(`/api/worktrees/${encodeURIComponent(e)}/merge-preview`,{method:"POST"})}function Ge(e){return i.request(`/api/worktrees/${encodeURIComponent(e)}/merge-into-parent`,{method:"POST"})}function ze(e,s){return i.request(`/api/worktrees/${encodeURIComponent(e)}/cleanup`,{method:"POST",body:JSON.stringify(s??{})})}function We(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function Ve(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function Ze(){return i.request("/api/preferences/quick-phrases")}function Ye(e){return i.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function ee(e,s){const n=new URLSearchParams;return s!=null&&s.trim()&&n.set("workspaceId",s.trim()),i.request(`/api/providers/${encodeURIComponent(e)}/capabilities${n.size>0?`?${n.toString()}`:""}`)}async function se(e,s){const n=await Promise.allSettled(e.map(async r=>[r,await ee(r,s)])),o=[];for(const r of n){if(r.status!=="fulfilled")continue;const[u,l]=r.value;o.push([u,l])}return Object.fromEntries(o)}function Xe(e,s,n,o="forward"){const r=new URLSearchParams;return s&&r.set("cursor",s),r.set("limit",String(n)),r.set("direction",o),i.request(`/api/sessions/${encodeURIComponent(e)}/messages?${r.toString()}`)}function He(e,s){return i.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(s)}/content`)}function $e(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(s)})}function _e(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/forks`,{method:"POST",body:JSON.stringify(s)})}function es(e){return i.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function ss(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(s)})}function ns(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function ts(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(s)})}function os(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(s)}`,{method:"DELETE"})}function rs(e,s){return i.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(s)}/steer`,{method:"POST"})}function is(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function as(e){return i.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function us(e,s,n){return i.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(s)}/reply`,{method:"POST",body:JSON.stringify(n)})}const I="codingns.workspace.session-display-sort-mode",E="codingns.file-panel.show-system-files",L="codingns.notification.preferences",C={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function D(){return typeof window<"u"&&typeof window.localStorage<"u"}function ne(e){return e==="createdAt"||e==="updatedAt"||e==="title"}function T(){if(!D())return"createdAt";const e=window.localStorage.getItem(I);return ne(e)?e:"createdAt"}function M(){return D()?window.localStorage.getItem(E)==="1":!1}function b(e){return typeof e=="boolean"}function j(){if(!D())return C;const e=window.localStorage.getItem(L);if(!e)return C;try{const s=JSON.parse(e);return{notifyOnPermissionRequest:b(s.notifyOnPermissionRequest)?s.notifyOnPermissionRequest:C.notifyOnPermissionRequest,notifyOnSessionCompleted:b(s.notifyOnSessionCompleted)?s.notifyOnSessionCompleted:C.notifyOnSessionCompleted,notifyOnSessionFailed:b(s.notifyOnSessionFailed)?s.notifyOnSessionFailed:C.notifyOnSessionFailed}}catch{return C}}function F(e,s){return e.notifyOnPermissionRequest===s.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===s.notifyOnSessionCompleted&&e.notifyOnSessionFailed===s.notifyOnSessionFailed}function te(e){D()&&window.localStorage.setItem(L,JSON.stringify(e))}class oe{constructor(){R(this,"state",{sessionDisplaySortMode:T(),showSystemFiles:M(),notificationPreferences:j()});R(this,"listeners",new Set);R(this,"subscribe",s=>(this.listeners.add(s),()=>{this.listeners.delete(s)}));R(this,"getState",()=>this.state);R(this,"handleStorage",s=>{if(s.key!==null&&s.key!==I&&s.key!==E&&s.key!==L)return;const n=T(),o=M(),r=j(),u=this.state.sessionDisplaySortMode===n,l=this.state.showSystemFiles===o,d=F(this.state.notificationPreferences,r);u&&l&&d||(this.state={sessionDisplaySortMode:n,showSystemFiles:o,notificationPreferences:r},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setSessionDisplaySortMode(s){D()&&(s==="createdAt"?window.localStorage.removeItem(I):window.localStorage.setItem(I,s)),this.state.sessionDisplaySortMode!==s&&(this.state={...this.state,sessionDisplaySortMode:s},this.emit())}setShowSystemFiles(s){D()&&(s?window.localStorage.setItem(E,"1"):window.localStorage.removeItem(E)),this.state.showSystemFiles!==s&&(this.state={...this.state,showSystemFiles:s},this.emit())}setNotificationPreferences(s){const n={...this.state.notificationPreferences,...s};F(this.state.notificationPreferences,n)||(te(n),this.state={...this.state,notificationPreferences:n},this.emit())}emit(){for(const s of this.listeners)s()}}const k=new oe;function ls(e){return w.useSyncExternalStore(k.subscribe,()=>e(k.getState()))}function re(){return X().haptics}const ie="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=",ae="/assets/gemini-D4G1NbrE.png",ue="/assets/kimi-BWNNSh7e.png",le="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",ce=new Set(["low","medium","high","xhigh"]),de=["claude-code","codex","opencode","gemini","kimi"],fe=["codex","claude-code","opencode","gemini","kimi"],G={"claude-code":{displayNameKey:"conversation.providerClaude",fullDisplayNameKey:"shell.providerClaudeCode",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:ie,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:le,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!1,supportsSessionDeleteByDefault:!0,foldRulesMessagesByDefault:!1},gemini:{displayNameKey:"conversation.providerGemini",draftTitleKey:"conversation.draftTitleGemini",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:ae,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:ue,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,supportsSessionDeleteByDefault:!0,foldRulesMessagesByDefault:!0}},pe=Array.from(new Set(Object.values(G).map(e=>e.icon)));let J=!1;function me(e){return de.includes(e)}function c(e){return!e||!me(e)?null:G[e]}function ge(e){return[{id:"provider-default",name:g(e),usesProviderDefault:!0}]}function Se(e){const s=c(e);return ge((s==null?void 0:s.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function cs(e){return!!(e&&c(e))}function ds(e){const s=c(e);return g((s==null?void 0:s.draftTitleKey)??"conversation.draftTitleCodex")}function Ae(e,s="compact"){const n=c(e);return n?s==="full"&&n.fullDisplayNameKey?g(n.fullDisplayNameKey):g(n.displayNameKey):(e==null?void 0:e.trim())||g("conversation.providerCodex")}function he(e){const s=c(e);return(s==null?void 0:s.icon)??Q}function z(){J||typeof window>"u"||(J=!0,pe.forEach(e=>{const s=new window.Image;s.decoding="async",s.src=e,typeof s.decode=="function"&&s.decode().catch(()=>{})}))}function fs(e){const s=c(e);return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:(s==null?void 0:s.defaultRunInputMode)??"none",supportsSubagents:!1,supportsInterrupt:(s==null?void 0:s.supportsInterrupt)??!1,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:(s==null?void 0:s.supportsAttachments)??!0,supportsPermissionPrompt:(s==null?void 0:s.supportsPermissionPrompt)??!0,supportsCheckpoint:!1,supportsSessionDelete:(s==null?void 0:s.supportsSessionDeleteByDefault)??!1,modelOptions:Se(e),defaultReasoningLevel:s==null?void 0:s.defaultReasoningLevel,supportsRunSteering:s==null?void 0:s.supportsRunSteeringByDefault,supportsQueueWhileRunning:s==null?void 0:s.supportsQueueWhileRunningByDefault,limitations:[]}}function ps(e){return(e==null?void 0:e.provider)??"claude-code"}function ms(e){var n;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const s=(e==null?void 0:e.provider)??null;return((n=c(s))==null?void 0:n.supportsSlashMenuByDefault)??!1}function gs(e){var s;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((s=e==null?void 0:e.modelOptions)!=null&&s.some(n=>{var o;return((o=n.supportedReasoningEfforts)==null?void 0:o.some(r=>ce.has(r)))??!1}))}function Ss(e,s){var u;if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const n=(e==null?void 0:e.provider)??null,o=(u=c(n))==null?void 0:u.supportsQueueWhileRunningByDefault;if(o!==void 0)return o;const r=(e==null?void 0:e.inRunInputMode)??"none";return r==="queued_guidance"||r==="none"||r==="streaming_guidance"&&s===!1}function As(e){var n;if((e==null?void 0:e.supportsRunSteering)!==void 0)return e.supportsRunSteering;const s=(e==null?void 0:e.provider)??null;return((n=c(s))==null?void 0:n.supportsRunSteeringByDefault)??(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function hs(e){const s=c(e);return(s==null?void 0:s.reasoningLevelPersists)??!1}function ys(e,s){var o;return((o=c(s??null))==null?void 0:o.foldRulesMessagesByDefault)??!1}typeof window<"u"&&z();const U=new Map;function vs(){U.clear()}function Rs({disabled:e=!1,workspaceId:s=null,pendingProvider:n=null,selectedProvider:o=null,providers:r=fe,className:u,disabledReasons:l,statusHintByProvider:d,onSelect:P}){const O=re(),S=!!s,[v,f]=w.useState(()=>K(r,s)),A=r.map(a=>({provider:a}));return w.useEffect(()=>{z()},[]),w.useEffect(()=>{if(!s){f({});return}const a=K(r,s);f(a);const h=r.filter(m=>!a[m]);if(h.length===0)return;let p=!1;return se(h,s).then(m=>{ve(s,m),p||f(N=>({...N,...m}))}),()=>{p=!0}},[r,s]),t.jsx("div",{className:`session-provider-grid${u?` ${u}`:""}`,children:A.map(a=>{const h=Ae(a.provider,"full"),p=n===a.provider,m=o===a.provider,N=!!v[a.provider],q=ye(v[a.provider]??null),x=(l==null?void 0:l[a.provider])??q,B=p?g("shell.startingSession"):x||((d==null?void 0:d[a.provider])??(S&&!N&&!p?g("shell.providerChecking"):null));return t.jsxs("button",{type:"button",className:"session-provider-card","data-provider":a.provider,"data-pending":p?"true":"false","data-selected":m?"true":"false","aria-label":h,disabled:e||!!x,onClick:()=>{O.trigger("action"),P(a.provider)},children:[t.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:t.jsx("img",{src:he(a.provider),alt:"",loading:"eager",decoding:"async"})}),t.jsxs("span",{className:"session-provider-card-copy",children:[t.jsx("strong",{children:h}),B?t.jsx("span",{className:"session-provider-card-status",children:B}):null]})]},a.provider)})})}function ye(e){return!e||e.canStartSession!==!1?null:e.limitations[0]??g("conversation.capabilityDenied")}function K(e,s){const n=(s==null?void 0:s.trim())??"";if(!n)return{};const o=[];for(const r of e){const u=U.get(W(n,r));u&&o.push([r,u])}return Object.fromEntries(o)}function ve(e,s){const n=e.trim();if(n)for(const[o,r]of Object.entries(s))r&&U.set(W(n,o),r)}function W(e,s){return`${e}::${s}`}function Cs({heading:e,description:s,actions:n,tone:o="default",className:r,children:u}){return t.jsxs("section",{className:y("modal-section",r),"data-tone":o,children:[e||s||n?t.jsxs("div",{className:"modal-section-header",children:[t.jsxs("div",{className:"modal-section-copy",children:[e?t.jsx("strong",{className:"modal-section-heading",children:e}):null,s?t.jsx("p",{className:"modal-section-description",children:s}):null]}),n?t.jsx("div",{className:"modal-section-actions",children:n}):null]}):null,u]})}function ws({label:e,description:s,className:n,htmlFor:o,children:r}){return t.jsxs("div",{className:y("workbench-modal-field","modal-field",n),children:[t.jsxs("div",{className:"modal-field-copy",children:[o?t.jsx("label",{className:"modal-field-label",htmlFor:o,children:e}):t.jsx("span",{className:"modal-field-label",children:e}),s?t.jsx("span",{className:"modal-field-description",children:s}):null]}),r]})}function Ds({align:e="end",stack:s=!1,className:n,children:o,...r}){return t.jsx("div",{className:y("workbench-modal-actions","modal-actions",n),"data-align":e,"data-stack":s?"true":void 0,...r,children:o})}function Ps({compact:e=!1,className:s,children:n,...o}){return t.jsx("div",{className:y("modal-list",s),"data-compact":e?"true":void 0,...o,children:n})}function Os(e){const{as:s="div",label:n,description:o,leading:r,trailing:u,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":s==="button"?"true":void 0},A=t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"modal-list-item-main",children:[r?t.jsx("span",{className:"modal-list-item-leading",children:r}):null,t.jsxs("span",{className:"modal-list-item-copy",children:[n?t.jsx("span",{className:"modal-list-item-label",children:n}):null,o?t.jsx("span",{className:"modal-list-item-description",children:o}):null,O]})]}),u?t.jsx("span",{className:"modal-list-item-trailing",children:u}):null]});if(s==="button"){const a=S;return t.jsx("button",{type:a.type??"button",...a,...f,children:A})}return t.jsx("div",{...S,...f,children:A})}function Ns({title:e,description:s,action:n,className:o,compact:r=!1}){return t.jsxs("div",{className:y("modal-empty-state",o),"data-compact":r?"true":void 0,children:[t.jsx("strong",{className:"modal-empty-state-title",children:e}),s?t.jsx("p",{className:"modal-empty-state-description",children:s}):null,n?t.jsx("div",{className:"modal-empty-state-action",children:n}):null]})}function Is({tone:e="default",className:s,children:n,...o}){return t.jsx("span",{className:y("modal-tag",s),"data-tone":e!=="default"?e:void 0,...o,children:n})}function y(...e){return e.filter(Boolean).join(" ")}function Es({open:e,title:s,description:n,height:o="auto",kind:r="form",dismissible:u=!0,closeOnBackdrop:l=!0,showHandle:d=!1,showCancelButton:P=!0,cancelLabel:O,className:S,cardClassName:v,bodyClassName:f,footer:A,onClose:a,children:h}){const p=w.useId(),m=w.useId(),N=u&&l;return!e||typeof document>"u"?null:H.createPortal(t.jsx("div",{className:"ios-action-sheet-overlay mobile-sheet-overlay",role:"presentation",onClick:()=>{N&&a()},children:t.jsxs("div",{className:`mobile-workspace-home-sheet mobile-sheet${S?` ${S}`:""}`,"data-height":o,"data-kind":r,role:"dialog","aria-modal":"true","aria-labelledby":p,"aria-describedby":n?m:void 0,onClick:q=>q.stopPropagation(),children:[t.jsxs("div",{className:`mobile-workspace-home-sheet-card mobile-sheet-card${v?` ${v}`:""}`,children:[d?t.jsx("div",{className:"mobile-sheet-handle","aria-hidden":"true"}):null,t.jsx("div",{className:"mobile-workspace-home-sheet-header mobile-sheet-header",children:t.jsxs("div",{className:"mobile-sheet-title-wrap",children:[t.jsx("strong",{id:p,children:s}),n?t.jsx("p",{id:m,children:n}):null]})}),t.jsx("div",{className:f?`mobile-sheet-body ${f}`:"mobile-sheet-body",children:h}),A?t.jsx("div",{className:"mobile-sheet-footer",children:A}):null]}),P?t.jsx("button",{type:"button",className:"ios-action-sheet-cancel mobile-sheet-cancel",disabled:!u,onClick:()=>{u&&a()},children:O??g("common.cancel")}):null]})}),document.body)}export{Pe as $,as as A,us as B,Me as C,is as D,We as E,Ve as F,ns as G,$e as H,cs as I,As as J,ds as K,Ns as L,Es as M,Je as N,ps as O,gs as P,ms as Q,Ss as R,Rs as S,Ye as T,hs as U,Ze as V,ys as W,He as X,he as Y,Le as Z,Oe as _,Ae as a,Ue as a0,Qe as a1,Ge as a2,ze as a3,Fe as a4,vs as a5,be as a6,xe as a7,ke as a8,je as a9,Ke as aa,k as ab,Te as ac,Ie as b,Ee as c,qe as d,re as e,Cs as f,De as g,ws as h,Ps as i,Os as j,Is as k,fs as l,ee as m,se as n,fe as o,_e as p,es as q,Ne as r,ss as s,Be as t,ls as u,Ds as v,Xe as w,ts as x,os as y,rs as z};
@@ -0,0 +1 @@
1
+ import{j as i}from"./index-Byp9hJ0c.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 $,i as B,j as t,t as l}from"./index-Byp9hJ0c.js";import{e as K,i as F,j as P,k as S,M as G}from"./MobileSheet-DLg-gX1t.js";import{ar as q,m as z,as as D,$ as X,at as J}from"./WorkbenchLayout-ByFw4eeu.js";import{u as Q,e as V}from"./App-DkvE5EyM.js";import{M as Y}from"./MobileTopHeaderFrame-DArgZI7L.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-Byp9hJ0c.js";import{a as v,q as k,s as I,t as O}from"./App-DkvE5EyM.js";import{W as y}from"./WorkbenchModal-Ctob14VR.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-Byp9hJ0c.js";import{f as me,u as ye}from"./App-DkvE5EyM.js";import{e as je,a as pe}from"./MobileSheet-DLg-gX1t.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-ByFw4eeu.js";import{f as Te,a as de,M as Le}from"./MobileWorkspaceSwitcherHeader-0ywJKfBQ.js";import{M as Re}from"./MobileCreateSessionSheet-DLq5qPkx.js";import{w as ue}from"./styles-CSUx5LGe.js";import"./window-BWqRixxq.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-Ctob14VR.js";import"./MobileTopHeaderFrame-DArgZI7L.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};